diff --git a/Assets/WX-WASM-SDK/CHANGELOG.md b/Assets/WX-WASM-SDK/CHANGELOG.md
old mode 100755
new mode 100644
index f65d96b1..9abd4ae9
--- a/Assets/WX-WASM-SDK/CHANGELOG.md
+++ b/Assets/WX-WASM-SDK/CHANGELOG.md
@@ -1,435 +1,445 @@
-
-## 2022-7-14
-### Fixed
-* 转换面板的最大内存提示与指引优化
-* WebGL导出失败时不进行小游戏转换
-* 非playing状态调用WX接口的告警提示
-## 2022-7-1
-### Fixed
-* 开发阶段没显示耗时弹框
-* 21.3unity服务器错误且无跨域头导致报错
-## 2022-6-30
-### Fixed
-* 压缩纹理工具逻辑异常,增加进度条
-* 完善限帧率接口SetPreferredFramesPerSecond
-
-## 2022-6-28
-### Feature
-* 导出插件的brotli压缩不依赖python环境
-### Fixed
-* 压缩纹理工具独立命名,避免有NuGet产生dll冲突
-
-## 2022-6-18
-### Fixed
-* 小游戏模板错误
-## 2022-6-16
-### Added
-* 支持自定义可缓存文件及可清理文件
-* 优化缓存目录统计
-
-### Fixed
-* 21.3unity在iOS上网络报错
-## 2022-6-13
-### Fixed
-* `RemoveFile`参数转字符串
-* 8.0.16安卓worker写文件报错
-## 2022-6-8
-### Added
-* 提供Loader启动数据
-
-### Fixed
-* 修复是否需要下载代码包上报
-* 21.3版本Unity webrequest设置请求头;注册进度事件
-## 2022-6-7
-### Added
-* 增加MemoryProfiler,开发阶段分析内存
-
-## 2022-6-1
-### Added
-* 使用worker做文件写入临时绕过安卓文件写入多时造成卡顿
-## 2022-5-31
-### Added
-* 暴露插件进度事件
-## 2022-5-30
-### Fixed
-* pc小游戏首包资源通过分包加载时读取失败
-## 2022-5-26
-### Changed
-* 默认关闭纹理缓存,影响安卓帧率
-
-### Fixed
-* 修复21.3替换规则
-## 2022-5-24
-### Added
-* 增加对21.3版本unity支持
-* MiniGameConfig.asset增加不常用配置入口
-## 2022-4-29
-### Fixed
-* 通过分包加载资源时读取bug
-
-## 2022-4-26
-### Fixed
-* 带`dataFileSubPrefix`时iOS首包资源下载bug
-
-### Added
-* 游戏异常时增加重启游戏按钮
-* 检查是否32位微信导致无法进入游戏
-* 修正URL中非法路径
-## 2022-4-24
-### Fixed
-更新独立域插件版本`1.0.60`
-* 达缓存上限时未正常清理旧缓存
-* 1.0.58版本插件iOS报错
-## 2022-4-22
-
-### Fixed
-更新独立域插件版本`1.0.58`
-* 预下载问题路径bug
-* 不支持webgl2时提示
-### Added
-* 增加清理指定文件接口`RemoveFile`
-* 是否缓存纹理开关
-
-## 2022-4-18
-### Added
-* 修改文件删除接口使用方法`CleanFileCache`,`CleanAllFileCache`
-## 2022-4-14
-### Added
-* 增加清除文件缓存接口`CleanFileCache`
-
-## 2022-4-11
-### Changed
-* 2021版本调整为需要手动分离symbols,由于Unity自身产生的symbols存在缺失问题
-* 增加CleaStreamingAssets选项,控制是否清理webgl/StreamingAssets
-
-## 2022-3-29
-### Changed
-* 更新插件版本为1.0.53
-* `streamingUrlSubPath`支持传自定义拼接到streamingcdn后面的路径
-* iOS不支持webgl2时提示
-
-## 2022-3-22
-### Changed
-* 更新压缩纹理工具使用方式
-
-## 2022-3-7
-### Changed
-* 更新独立域插件版本为1.0.51
-* 预载列表按照填写顺序生成
-* Unity2021不再提示分离symbols,2021.2.11以后版本已支持
-* Pointer_stringify导致的浏览器告警
-
-## 2022-3-7
-### Changed
-* 更新独立域插件版本为1.0.50
-
-## 2022-2-17
-### Changed
-* 更新独立域插件版本
-* 增加日志输出
-* 限帧时禁用后台执行Loop
-
-## 2022-2-15
-### Fixed
-* UnityAudio循环播放修复
-* 2021版本修改为默认使用External Symbols(需升级Unity到2021.2.11以上)
-* PlayerSettings默认去除"Run In Background"
-
-## 2022-2-14
-### Added
-* 支持PC端DXT5压缩纹理
-
-## 2022-2-11
-### Added
-* 调整部分API
-* 支持webgl2.0的压缩纹理
-
-## 2022-1-26
-### Added
-* 新增API
-* 修复API中不确定类型的数据可能导致类型转换失败的问题
-
-## 2022-1-25
-### Fixed
-* 修复Login方法,默认不传timeout,默认超时为1000ms,容易失败的问题
-
-## 2022-1-24
-### Added
-* 兼容浏览器环境,修复部分API问题
-
-## 2022-1-21
-### Added
-* 新增WXCleanAllFileCache接口,用于清理所有文件缓存
-
-### Changed
-* 独立域插件版本更新到1.0.46,包含以下修改
-1. 自动清理存量旧文件
-2. 达到缓存上限时清理更多空间,具体值可通过minigame/unity-namespace.js中releaseMemorySize修改
-3. 上报unity版本和转换插件版本
-4. 支持以文件名全匹配的方式忽略缓存
-5. 插件错误报实时日志
-6. pc小游戏兼容
-
-## 2022-1-20
-
-### Added
-* 新增API,旧API批量重命名,用法保持不变
-
-## 2022-1-17
-### Fixed
-* 同名文件缓存未清理
-
-### Changed
-* 版本限制条件更新
-
-## 2022-1-13
-### Fixed
-
-* Unity Audio能力适配, 不支持设备兼容处理; 退后台暂停播放音频; 性能提升
-
-## 2022-1-7
-### Fixed
-
-* Unity Audio能力适配
-* Unity Input Touch能力适配
-
-## 2021-12-31
-### Fixed
-
-* 调整为默认不打开性能面板,单独提供WX.OpenProfileStats
-
-## 2021-12-30
-
-### Fixed
-* 修复引擎初始化失败后依然回调calledMainCb导致统计问题
-* 修复2021版本abort时执行WXUncaughtException
-* 补充小程序框架异常时上报实时日志
-
-## 2021-12-20
-
-### Fixed
-* 2021 dev 运行报错(randomDevices替换)
-* 跳转小游戏接口错误
-* 缓存大小为0,AssetBundle重试失败问题
-
-## 2021-12-16
-
-### Added
-* 开发、体验版本增加性能面板
-
-## 2021-12-10
-
-### Fixed
-* 修复独立域插件未编译子包bug
-
-## 2021-12-06
-
-### Added
-* WebGL2.0 增加适配,该特性处于测试阶段
-* 2021增加embedded symbols分离
-* 增加error日志回调
-
-### Fixed
-* 2021 dev 运行报错
-
-## 2021-12-02
-
-### Fixed
-* dev build报错
-* 设备方向无法选中"LandscapeLeft", "LandscapeRight"
-
-## 2021-11-30
-
-### Changed
-* 导出配置调整:统一资源CDN路径配置;配置顺序调整。
-
-### Fixed
-* 低版本C#导致markdownviewer报错'interpolated strings' cannot be used.
-
-## 2021-11-19
-
-### Fixed
-* 更新小游戏模板
-
-## 2021-11-18
-### Added
-增加bundle相关导出配置
-
-* 自定义bundle名中hash长度:用于缓存控制,默认32
-* 自定义需缓存的路径标识符:下载路径命中标识符时会自动缓存本次下载文件。
-* 忽略路径下指定类型文件:路径命中标识符时,过滤不需缓存的文件类型。
-
-### Fixed
-* markdownviewer可能出现guiskin引用丢失
-
-### Changed
-* 更新小游戏模板
-
-## 2021-10-26
-### Added
-* 增加部分文件操作API
-* 压缩纹理替换优化,提升转换速度
-
-## 2021-10-09
-### Added
-* 增加Unity2020、2021版本支持
-
-
-## 2021-09-23
-### Fixed
-* 程序crash时触发用户反馈入口
-
-
-## 2021-09-22
-
-### Added
-* 支持短音频的播放API(WX.ShortAudioPlayer),更接近Unity的API调用方式
-
-### Added
-* 当禁用异常时,程序即将crash之前弹出用户反馈入口,并自动提交用户反馈日志、JS Error与实时日志
-
-### Added
-* 编译选项增加"Profiling Funcs", 仅调试问题时勾选此选项时,编译代码将含有函数名,代码体积变大
-
-## 2021-09-14
-
-### Added
-* 支持PlayerPrefs优化,支持配置key
-### Fixed
-* 修复排行榜内存增长问题
-
-## 2021-09-06
-
-### Added
-* 支持导出时配置封面图
-
-## 2021-8-20
-
-### Added
-* 支持创建视频
-
-## 2021-8-12
-
-### Added
-* 修复IOS下音频被系统打断后的恢复问题
-* 支持客服消息
-
-## 2021-8-10
-
-### Changed
-* 小游戏项目模板更新
-* 独立域插件更新为1.0.27。优化文件删除;修复资源预载bug
-
-## 2021-08-05
-
-### Added
-* 音频支持获取播放状态
-* 非POT图也支持延迟加载
-
-## 2021-08-04
-
-### Fixed
-* 独立域插件版本更新为1.0.24,修复若干问题
-
-## 2021-08-02
-
-### Fixed
-* 独立域插件更新1.0.20,修复首包资源下载异常
-* 更新小游戏项目模板
-
-## 2021-08-01
-
-### Changed
-* 小游戏项目模板更新
-
-## 2021-07-31
-
-### Added
-* 增加预下载并发数控制接口WX.SetConcurrent
-
-### Changed
-* 小游戏项目模板变更
-
-## 2021-07-26
-### Added
-* 增加预下载猎豹配置,自动从导出目录webgl/StreamingAssets查找资源并填充到game.js的Preload列表
-
-## 2021-07-26
-### Added
-* 支持文件二进制读写(同步和异步)
-* 压缩纹理替换速度优化
-
-## 2021-07-20
-### Fixed
-* 独立域插件版本升级为1.0.16,修复初始上报时机
-
-## 2021-07-19
-
-### Changed
-* 优化插件更新提示
-
-## 2021-07-13
-
-### Fixed
-* 独立域插件版本升级为1.0.14,修复了一些bug
-
-### Changed
-* 导出插件只提示更新,不自动下载
-
-## 2021-07-09
-
-### Fixed
-* 独立域插件版本升级为1.0.13,修复了一些bug
-
-## 2021-07-02
-
-### Fixed
-* 微信版本或基础库版本过低时`WXWebAssembly`未定义,未弹框提示更新客户端
-
-## 2021-06-30
-
-### Fixed
-
-* 压缩纹理兼容flare
-
-### Added
-
-* 支持游戏恢复到前台后自动播放,默认开启分享
-
-## 2021-06-29
-
-### Fixed
-
-* 云测试设置UI框架导致editor运行错误
-
-### Added
-
-* 引入[UnityMarkdownViewer](https://github.com/gwaredd/UnityMarkdownViewer)在inspector面板预览changelog
-
-### Removed
-
-* 移除转换小游戏面板中`游戏内存大小`字段: 从Unity 2019开始已不支持设置`PlayerSettings.WebGL.memorySize`
-
-### Changed
-
-* 资源优化工具代码添加namespace, 避免与游戏代码冲突
-
-### Others
-
-独立域插件更新为(1.0.11)
-
-* `.untiy3d`拓展名文件视为bundle文件,可做缓存。
-* 根据是否调试模式控制日志输出,规则为: 若为开发版, enableDebugLog=false且为调试模式时输出详细日志;其他版本, 开启调试模式则输出详细日志
-
-## 2021-06-10
-
-### Fixed
-
-* 独立域插件更新(1.0.10): 修复安卓分片读取包内资源内存越界
+
+## 2022-7-28
+### Feature
+* 增加UDP接口能力
+## 2022-7-20
+### Feature
+* 增加重启小游戏的API支持
+### Fixed
+* 纹理压缩并行下载完成未正常显示
+### Added
+* 设置启动时是否自动检查小游戏版本更新
+## 2022-7-14
+### Fixed
+* 转换面板的最大内存提示与指引优化
+* WebGL导出失败时不进行小游戏转换
+* 非playing状态调用WX接口的告警提示
+## 2022-7-1
+### Fixed
+* 开发阶段没显示耗时弹框
+* 21.3unity服务器错误且无跨域头导致报错
+## 2022-6-30
+### Fixed
+* 压缩纹理工具逻辑异常,增加进度条
+* 完善限帧率接口SetPreferredFramesPerSecond
+
+## 2022-6-28
+### Feature
+* 导出插件的brotli压缩不依赖python环境
+### Fixed
+* 压缩纹理工具独立命名,避免有NuGet产生dll冲突
+
+## 2022-6-18
+### Fixed
+* 小游戏模板错误
+## 2022-6-16
+### Added
+* 支持自定义可缓存文件及可清理文件
+* 优化缓存目录统计
+
+### Fixed
+* 21.3unity在iOS上网络报错
+## 2022-6-13
+### Fixed
+* `RemoveFile`参数转字符串
+* 8.0.16安卓worker写文件报错
+## 2022-6-8
+### Added
+* 提供Loader启动数据
+
+### Fixed
+* 修复是否需要下载代码包上报
+* 21.3版本Unity webrequest设置请求头;注册进度事件
+## 2022-6-7
+### Added
+* 增加MemoryProfiler,开发阶段分析内存
+
+## 2022-6-1
+### Added
+* 使用worker做文件写入临时绕过安卓文件写入多时造成卡顿
+## 2022-5-31
+### Added
+* 暴露插件进度事件
+## 2022-5-30
+### Fixed
+* pc小游戏首包资源通过分包加载时读取失败
+## 2022-5-26
+### Changed
+* 默认关闭纹理缓存,影响安卓帧率
+
+### Fixed
+* 修复21.3替换规则
+## 2022-5-24
+### Added
+* 增加对21.3版本unity支持
+* MiniGameConfig.asset增加不常用配置入口
+## 2022-4-29
+### Fixed
+* 通过分包加载资源时读取bug
+
+## 2022-4-26
+### Fixed
+* 带`dataFileSubPrefix`时iOS首包资源下载bug
+
+### Added
+* 游戏异常时增加重启游戏按钮
+* 检查是否32位微信导致无法进入游戏
+* 修正URL中非法路径
+## 2022-4-24
+### Fixed
+更新独立域插件版本`1.0.60`
+* 达缓存上限时未正常清理旧缓存
+* 1.0.58版本插件iOS报错
+## 2022-4-22
+
+### Fixed
+更新独立域插件版本`1.0.58`
+* 预下载问题路径bug
+* 不支持webgl2时提示
+### Added
+* 增加清理指定文件接口`RemoveFile`
+* 是否缓存纹理开关
+
+## 2022-4-18
+### Added
+* 修改文件删除接口使用方法`CleanFileCache`,`CleanAllFileCache`
+## 2022-4-14
+### Added
+* 增加清除文件缓存接口`CleanFileCache`
+
+## 2022-4-11
+### Changed
+* 2021版本调整为需要手动分离symbols,由于Unity自身产生的symbols存在缺失问题
+* 增加CleaStreamingAssets选项,控制是否清理webgl/StreamingAssets
+
+## 2022-3-29
+### Changed
+* 更新插件版本为1.0.53
+* `streamingUrlSubPath`支持传自定义拼接到streamingcdn后面的路径
+* iOS不支持webgl2时提示
+
+## 2022-3-22
+### Changed
+* 更新压缩纹理工具使用方式
+
+## 2022-3-7
+### Changed
+* 更新独立域插件版本为1.0.51
+* 预载列表按照填写顺序生成
+* Unity2021不再提示分离symbols,2021.2.11以后版本已支持
+* Pointer_stringify导致的浏览器告警
+
+## 2022-3-7
+### Changed
+* 更新独立域插件版本为1.0.50
+
+## 2022-2-17
+### Changed
+* 更新独立域插件版本
+* 增加日志输出
+* 限帧时禁用后台执行Loop
+
+## 2022-2-15
+### Fixed
+* UnityAudio循环播放修复
+* 2021版本修改为默认使用External Symbols(需升级Unity到2021.2.11以上)
+* PlayerSettings默认去除"Run In Background"
+
+## 2022-2-14
+### Added
+* 支持PC端DXT5压缩纹理
+
+## 2022-2-11
+### Added
+* 调整部分API
+* 支持webgl2.0的压缩纹理
+
+## 2022-1-26
+### Added
+* 新增API
+* 修复API中不确定类型的数据可能导致类型转换失败的问题
+
+## 2022-1-25
+### Fixed
+* 修复Login方法,默认不传timeout,默认超时为1000ms,容易失败的问题
+
+## 2022-1-24
+### Added
+* 兼容浏览器环境,修复部分API问题
+
+## 2022-1-21
+### Added
+* 新增WXCleanAllFileCache接口,用于清理所有文件缓存
+
+### Changed
+* 独立域插件版本更新到1.0.46,包含以下修改
+1. 自动清理存量旧文件
+2. 达到缓存上限时清理更多空间,具体值可通过minigame/unity-namespace.js中releaseMemorySize修改
+3. 上报unity版本和转换插件版本
+4. 支持以文件名全匹配的方式忽略缓存
+5. 插件错误报实时日志
+6. pc小游戏兼容
+
+## 2022-1-20
+
+### Added
+* 新增API,旧API批量重命名,用法保持不变
+
+## 2022-1-17
+### Fixed
+* 同名文件缓存未清理
+
+### Changed
+* 版本限制条件更新
+
+## 2022-1-13
+### Fixed
+
+* Unity Audio能力适配, 不支持设备兼容处理; 退后台暂停播放音频; 性能提升
+
+## 2022-1-7
+### Fixed
+
+* Unity Audio能力适配
+* Unity Input Touch能力适配
+
+## 2021-12-31
+### Fixed
+
+* 调整为默认不打开性能面板,单独提供WX.OpenProfileStats
+
+## 2021-12-30
+
+### Fixed
+* 修复引擎初始化失败后依然回调calledMainCb导致统计问题
+* 修复2021版本abort时执行WXUncaughtException
+* 补充小程序框架异常时上报实时日志
+
+## 2021-12-20
+
+### Fixed
+* 2021 dev 运行报错(randomDevices替换)
+* 跳转小游戏接口错误
+* 缓存大小为0,AssetBundle重试失败问题
+
+## 2021-12-16
+
+### Added
+* 开发、体验版本增加性能面板
+
+## 2021-12-10
+
+### Fixed
+* 修复独立域插件未编译子包bug
+
+## 2021-12-06
+
+### Added
+* WebGL2.0 增加适配,该特性处于测试阶段
+* 2021增加embedded symbols分离
+* 增加error日志回调
+
+### Fixed
+* 2021 dev 运行报错
+
+## 2021-12-02
+
+### Fixed
+* dev build报错
+* 设备方向无法选中"LandscapeLeft", "LandscapeRight"
+
+## 2021-11-30
+
+### Changed
+* 导出配置调整:统一资源CDN路径配置;配置顺序调整。
+
+### Fixed
+* 低版本C#导致markdownviewer报错'interpolated strings' cannot be used.
+
+## 2021-11-19
+
+### Fixed
+* 更新小游戏模板
+
+## 2021-11-18
+### Added
+增加bundle相关导出配置
+
+* 自定义bundle名中hash长度:用于缓存控制,默认32
+* 自定义需缓存的路径标识符:下载路径命中标识符时会自动缓存本次下载文件。
+* 忽略路径下指定类型文件:路径命中标识符时,过滤不需缓存的文件类型。
+
+### Fixed
+* markdownviewer可能出现guiskin引用丢失
+
+### Changed
+* 更新小游戏模板
+
+## 2021-10-26
+### Added
+* 增加部分文件操作API
+* 压缩纹理替换优化,提升转换速度
+
+## 2021-10-09
+### Added
+* 增加Unity2020、2021版本支持
+
+
+## 2021-09-23
+### Fixed
+* 程序crash时触发用户反馈入口
+
+
+## 2021-09-22
+
+### Added
+* 支持短音频的播放API(WX.ShortAudioPlayer),更接近Unity的API调用方式
+
+### Added
+* 当禁用异常时,程序即将crash之前弹出用户反馈入口,并自动提交用户反馈日志、JS Error与实时日志
+
+### Added
+* 编译选项增加"Profiling Funcs", 仅调试问题时勾选此选项时,编译代码将含有函数名,代码体积变大
+
+## 2021-09-14
+
+### Added
+* 支持PlayerPrefs优化,支持配置key
+### Fixed
+* 修复排行榜内存增长问题
+
+## 2021-09-06
+
+### Added
+* 支持导出时配置封面图
+
+## 2021-8-20
+
+### Added
+* 支持创建视频
+
+## 2021-8-12
+
+### Added
+* 修复IOS下音频被系统打断后的恢复问题
+* 支持客服消息
+
+## 2021-8-10
+
+### Changed
+* 小游戏项目模板更新
+* 独立域插件更新为1.0.27。优化文件删除;修复资源预载bug
+
+## 2021-08-05
+
+### Added
+* 音频支持获取播放状态
+* 非POT图也支持延迟加载
+
+## 2021-08-04
+
+### Fixed
+* 独立域插件版本更新为1.0.24,修复若干问题
+
+## 2021-08-02
+
+### Fixed
+* 独立域插件更新1.0.20,修复首包资源下载异常
+* 更新小游戏项目模板
+
+## 2021-08-01
+
+### Changed
+* 小游戏项目模板更新
+
+## 2021-07-31
+
+### Added
+* 增加预下载并发数控制接口WX.SetConcurrent
+
+### Changed
+* 小游戏项目模板变更
+
+## 2021-07-26
+### Added
+* 增加预下载猎豹配置,自动从导出目录webgl/StreamingAssets查找资源并填充到game.js的Preload列表
+
+## 2021-07-26
+### Added
+* 支持文件二进制读写(同步和异步)
+* 压缩纹理替换速度优化
+
+## 2021-07-20
+### Fixed
+* 独立域插件版本升级为1.0.16,修复初始上报时机
+
+## 2021-07-19
+
+### Changed
+* 优化插件更新提示
+
+## 2021-07-13
+
+### Fixed
+* 独立域插件版本升级为1.0.14,修复了一些bug
+
+### Changed
+* 导出插件只提示更新,不自动下载
+
+## 2021-07-09
+
+### Fixed
+* 独立域插件版本升级为1.0.13,修复了一些bug
+
+## 2021-07-02
+
+### Fixed
+* 微信版本或基础库版本过低时`WXWebAssembly`未定义,未弹框提示更新客户端
+
+## 2021-06-30
+
+### Fixed
+
+* 压缩纹理兼容flare
+
+### Added
+
+* 支持游戏恢复到前台后自动播放,默认开启分享
+
+## 2021-06-29
+
+### Fixed
+
+* 云测试设置UI框架导致editor运行错误
+
+### Added
+
+* 引入[UnityMarkdownViewer](https://github.com/gwaredd/UnityMarkdownViewer)在inspector面板预览changelog
+
+### Removed
+
+* 移除转换小游戏面板中`游戏内存大小`字段: 从Unity 2019开始已不支持设置`PlayerSettings.WebGL.memorySize`
+
+### Changed
+
+* 资源优化工具代码添加namespace, 避免与游戏代码冲突
+
+### Others
+
+独立域插件更新为(1.0.11)
+
+* `.untiy3d`拓展名文件视为bundle文件,可做缓存。
+* 根据是否调试模式控制日志输出,规则为: 若为开发版, enableDebugLog=false且为调试模式时输出详细日志;其他版本, 开启调试模式则输出详细日志
+
+## 2021-06-10
+
+### Fixed
+
+* 独立域插件更新(1.0.10): 修复安卓分片读取包内资源内存越界
diff --git a/Assets/WX-WASM-SDK/CHANGELOG.md.meta b/Assets/WX-WASM-SDK/CHANGELOG.md.meta
old mode 100755
new mode 100644
index 8ec7eb41..3ea750e0
--- a/Assets/WX-WASM-SDK/CHANGELOG.md.meta
+++ b/Assets/WX-WASM-SDK/CHANGELOG.md.meta
@@ -1,7 +1,7 @@
-fileFormatVersion: 2
-guid: 28f40a500a3f8441ab9cd7f003194f69
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 28f40a500a3f8441ab9cd7f003194f69
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Cloud.cs b/Assets/WX-WASM-SDK/Cloud.cs
old mode 100755
new mode 100644
index db26794f..8917f099
--- a/Assets/WX-WASM-SDK/Cloud.cs
+++ b/Assets/WX-WASM-SDK/Cloud.cs
@@ -1,88 +1,88 @@
-using UnityEngine;
-using System.Collections;
-using System.Runtime.InteropServices;
-
-namespace WeChatWASM
-{
- ///
- /// 云函数,调用前必须先Init初始化
- ///
- public class Cloud
- {
- #region C#调用JS桥接方法
-#if UNITY_WEBGL
- [DllImport("__Internal")]
-#endif
-
- private static extern void WXCallFunction(string name, string data, string conf, string s, string f, string c);
-#if UNITY_WEBGL
- [DllImport("__Internal")]
-#endif
- private static extern void WXCallFunctionInit(string conf);
-#if UNITY_WEBGL
- [DllImport("__Internal")]
-#endif
- private static extern string WXCloudID(string cloudID);
- #endregion
-
- ///
- /// 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html
- ///
- ///
- public void Init(CallFunctionInitParam param)
- {
- WXCallFunctionInit(JsonUtility.ToJson(param));
- }
-
- ///
- /// 调用云函数,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html
- ///
- ///
- ///
- //WX.cloud.Init(new CallFunctionInitParam()
- //{
- // env = "product",
- // traceUser = false
- // });
-
- // var p = new C()
- // {
- // content = "haha"
- // };
- //WX.cloud.CallFunction(new CallFunctionParam()
- //{
- // name = "msgSecCheck",
- // data = JsonUtility.ToJson(p),
- // success = (res) => {
- // Debug.Log("success");
- // Debug.Log(res.result);
- // },
- // fail = (res) => {
- // Debug.Log("fail");
- // Debug.Log(res.errMsg);
- // },
- // complete = (res) => {
- // Debug.Log("complete");
- // Debug.Log(res.result);
- // }
- // });
- ///
- public void CallFunction(CallFunctionParam param)
- {
- WXCallFunction(param.name, param.data,
- param.config == null ? "" : JsonUtility.ToJson(param.config),
- WXCallBackHandler.Add(param.success), WXCallBackHandler.Add(param.fail), WXCallBackHandler.Add(param.complete));
- }
- ///
- /// 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html
- ///
- /// 通过开放能力在小程序端 / web 端获取得到的 CloudID
- /// 返回字符串,原样传回云函数调用就好
- public string CloudID(string cloudID)
- {
- return WXCloudID(cloudID);
- }
-
-
- }
-}
+using UnityEngine;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace WeChatWASM
+{
+ ///
+ /// 云函数,调用前必须先Init初始化
+ ///
+ public class Cloud
+ {
+ #region C#调用JS桥接方法
+#if UNITY_WEBGL
+ [DllImport("__Internal")]
+#endif
+
+ private static extern void WXCallFunction(string name, string data, string conf, string s, string f, string c);
+#if UNITY_WEBGL
+ [DllImport("__Internal")]
+#endif
+ private static extern void WXCallFunctionInit(string conf);
+#if UNITY_WEBGL
+ [DllImport("__Internal")]
+#endif
+ private static extern string WXCloudID(string cloudID);
+ #endregion
+
+ ///
+ /// 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html
+ ///
+ ///
+ public void Init(CallFunctionInitParam param)
+ {
+ WXCallFunctionInit(JsonUtility.ToJson(param));
+ }
+
+ ///
+ /// 调用云函数,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html
+ ///
+ ///
+ ///
+ //WX.cloud.Init(new CallFunctionInitParam()
+ //{
+ // env = "product",
+ // traceUser = false
+ // });
+
+ // var p = new C()
+ // {
+ // content = "haha"
+ // };
+ //WX.cloud.CallFunction(new CallFunctionParam()
+ //{
+ // name = "msgSecCheck",
+ // data = JsonUtility.ToJson(p),
+ // success = (res) => {
+ // Debug.Log("success");
+ // Debug.Log(res.result);
+ // },
+ // fail = (res) => {
+ // Debug.Log("fail");
+ // Debug.Log(res.errMsg);
+ // },
+ // complete = (res) => {
+ // Debug.Log("complete");
+ // Debug.Log(res.result);
+ // }
+ // });
+ ///
+ public void CallFunction(CallFunctionParam param)
+ {
+ WXCallFunction(param.name, param.data,
+ param.config == null ? "" : JsonUtility.ToJson(param.config),
+ WXCallBackHandler.Add(param.success), WXCallBackHandler.Add(param.fail), WXCallBackHandler.Add(param.complete));
+ }
+ ///
+ /// 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html
+ ///
+ /// 通过开放能力在小程序端 / web 端获取得到的 CloudID
+ /// 返回字符串,原样传回云函数调用就好
+ public string CloudID(string cloudID)
+ {
+ return WXCloudID(cloudID);
+ }
+
+
+ }
+}
diff --git a/Assets/WX-WASM-SDK/Cloud.cs.meta b/Assets/WX-WASM-SDK/Cloud.cs.meta
old mode 100755
new mode 100644
index 5f0184c4..43a5eba1
--- a/Assets/WX-WASM-SDK/Cloud.cs.meta
+++ b/Assets/WX-WASM-SDK/Cloud.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 7dc67f38c6b669248935f7a81515cc15
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 7dc67f38c6b669248935f7a81515cc15
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt b/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt
index 49550fc2..33b7cdd2 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt
@@ -1,19 +1,19 @@
-Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt.meta b/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt.meta
index fa307eb0..eed20d82 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/LICENSE.txt.meta
@@ -1,7 +1,7 @@
-fileFormatVersion: 2
-guid: 094d36fd8b54c4c3d98d21b57d92ae26
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 094d36fd8b54c4c3d98d21b57d92ae26
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt b/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt
index 0225acca..c5516b97 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt
@@ -1,2 +1,2 @@
-https://github.com/Unity-Technologies/brotli
-359ceef04a4eae97cb8a161c4b768fd639eef98b
+https://github.com/Unity-Technologies/brotli
+359ceef04a4eae97cb8a161c4b768fd639eef98b
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt.meta b/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt.meta
index 2f76c426..092373de 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/commits.txt.meta
@@ -1,7 +1,7 @@
-fileFormatVersion: 2
-guid: 5aaeb4910866f4388a86efc2ac5bde76
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 5aaeb4910866f4388a86efc2ac5bde76
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/linux_x86_64/brotli.meta b/Assets/WX-WASM-SDK/Editor/Brotli/linux_x86_64/brotli.meta
index 547916fc..cf3a6561 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/linux_x86_64/brotli.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/linux_x86_64/brotli.meta
@@ -1,7 +1,7 @@
-fileFormatVersion: 2
-guid: c7d34b53fefa24bf5b0ce2914fc60ad8
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: c7d34b53fefa24bf5b0ce2914fc60ad8
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/macos/brotli.meta b/Assets/WX-WASM-SDK/Editor/Brotli/macos/brotli.meta
index 76370157..0bb9b715 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/macos/brotli.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/macos/brotli.meta
@@ -1,7 +1,7 @@
-fileFormatVersion: 2
-guid: 74b4e5c821cda4b7d8f401d7935a892e
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 74b4e5c821cda4b7d8f401d7935a892e
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/brotli.exe.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/brotli.exe.meta
new file mode 100755
index 00000000..2a15356b
--- /dev/null
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/brotli.exe.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 14077bb4dfcdf487aa222261b4719a0e
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140.dll.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140.dll.meta
index 77837279..75145c32 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140.dll.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140.dll.meta
@@ -1,27 +1,27 @@
-fileFormatVersion: 2
-guid: 482c84c1110074e5295b51734fa3053b
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 0
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 1
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 482c84c1110074e5295b51734fa3053b
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ DefaultValueInitialized: true
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_1.dll.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_1.dll.meta
index f8c14d76..4b98f466 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_1.dll.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_1.dll.meta
@@ -1,27 +1,27 @@
-fileFormatVersion: 2
-guid: 713e2b6c25b3540e595a5036bacaedbd
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 0
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 1
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 713e2b6c25b3540e595a5036bacaedbd
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ DefaultValueInitialized: true
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_2.dll.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_2.dll.meta
index 4dd7f1f2..3e932bcc 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_2.dll.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/msvcp140_2.dll.meta
@@ -1,27 +1,27 @@
-fileFormatVersion: 2
-guid: 250ffb10dd8854b5d8b5d31a7f9afd14
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 0
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 1
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 250ffb10dd8854b5d8b5d31a7f9afd14
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ DefaultValueInitialized: true
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140.dll.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140.dll.meta
index 9d76daae..77fdacc5 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140.dll.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140.dll.meta
@@ -1,27 +1,27 @@
-fileFormatVersion: 2
-guid: e23a7460c65914b4995b078d7edfcd55
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 0
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 1
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: e23a7460c65914b4995b078d7edfcd55
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ DefaultValueInitialized: true
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140_1.dll.meta b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140_1.dll.meta
index f2f28e82..236b7c97 100755
--- a/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140_1.dll.meta
+++ b/Assets/WX-WASM-SDK/Editor/Brotli/win_x86_64/vcruntime140_1.dll.meta
@@ -1,27 +1,27 @@
-fileFormatVersion: 2
-guid: 466c0abf5fe5847879df912061e09f9e
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 0
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 1
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 466c0abf5fe5847879df912061e09f9e
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ DefaultValueInitialized: true
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs
old mode 100755
new mode 100644
index 31f41876..1b3cdb89
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs
@@ -1,12 +1,12 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEditor;
-
-namespace WeChatWASM.Analysis
-{
- public class Analysis : ScriptableObject
- {
-
- }
-}
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+namespace WeChatWASM.Analysis
+{
+ public class Analysis : ScriptableObject
+ {
+
+ }
+}
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs.meta
old mode 100755
new mode 100644
index 10832bdf..20ad2a2f
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/Analysis.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 2aab4fbbf46a75b408a8a38ff77fbbb9
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 2aab4fbbf46a75b408a8a38ff77fbbb9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs
old mode 100755
new mode 100644
index 58c741c7..0553019a
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs
@@ -1,75 +1,75 @@
-using UnityEngine;
-using UnityEditor;
-using System;
-
-namespace WeChatWASM.Analysis
-{
- public class AnalysisWindow : EditorWindow
- {
- public int AssetsTypeSelected;
- public string[] AssetsTypeOptions = new string[] { "Texture", "Font", "Audio", "Prefab" };
-
- public TextureWindow TextureWindow;
- public FontWindow FontWindow;
- public AudioWindow AudioWindow;
- public PrefabWindow PrefabWindow;
-
- static private EditorWindow win;
-
- [MenuItem("微信小游戏 / 资源优化工具")]
- static void ShowTextureWindow()
- {
- //EditorUtility.DisplayDialog("MyTool", "Do It in C# !", "OK", "");
- win = AnalysisWindow.GetCurrentWindow();
- win.minSize = new Vector2(1600, 800);
- win.Show();
- }
-
- public static EditorWindow GetCurrentWindow()
- {
- return GetWindow(typeof(AnalysisWindow), false, "Optimize", true);
- }
-
- private void OnEnable()
- {
- this.TextureWindow = TextureWindow.GetInstance();
- this.FontWindow = FontWindow.GetInstance();
- this.AudioWindow = AudioWindow.GetInstance();
- this.PrefabWindow = PrefabWindow.GetInstance();
- }
-
- private void OnDisable()
- {
- this.TextureWindow = null;
- this.FontWindow = null;
- }
-
- private void OnGUI()
- {
- GUILayout.BeginHorizontal(Array.Empty());
- GUILayout.FlexibleSpace();
- GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(25f) };
- this.AssetsTypeSelected = GUILayout.Toolbar(this.AssetsTypeSelected, this.AssetsTypeOptions, "LargeButton", GUI.ToolbarButtonSize.FitToContents, options);
- GUILayout.FlexibleSpace();
- GUILayout.EndHorizontal();
-
- switch (this.AssetsTypeSelected)
- {
- case 0:
- this.TextureWindow.Show();
- break;
- case 1:
- this.FontWindow.Show();
- break;
- case 2:
- this.AudioWindow.Show();
- break;
- case 3:
- this.PrefabWindow.Show();
- break;
- default:
- break;
- }
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System;
+
+namespace WeChatWASM.Analysis
+{
+ public class AnalysisWindow : EditorWindow
+ {
+ public int AssetsTypeSelected;
+ public string[] AssetsTypeOptions = new string[] { "Texture", "Font", "Audio", "Prefab" };
+
+ public TextureWindow TextureWindow;
+ public FontWindow FontWindow;
+ public AudioWindow AudioWindow;
+ public PrefabWindow PrefabWindow;
+
+ static private EditorWindow win;
+
+ [MenuItem("微信小游戏 / 资源优化工具")]
+ static void ShowTextureWindow()
+ {
+ //EditorUtility.DisplayDialog("MyTool", "Do It in C# !", "OK", "");
+ win = AnalysisWindow.GetCurrentWindow();
+ win.minSize = new Vector2(1600, 800);
+ win.Show();
+ }
+
+ public static EditorWindow GetCurrentWindow()
+ {
+ return GetWindow(typeof(AnalysisWindow), false, "Optimize", true);
+ }
+
+ private void OnEnable()
+ {
+ this.TextureWindow = TextureWindow.GetInstance();
+ this.FontWindow = FontWindow.GetInstance();
+ this.AudioWindow = AudioWindow.GetInstance();
+ this.PrefabWindow = PrefabWindow.GetInstance();
+ }
+
+ private void OnDisable()
+ {
+ this.TextureWindow = null;
+ this.FontWindow = null;
+ }
+
+ private void OnGUI()
+ {
+ GUILayout.BeginHorizontal(Array.Empty());
+ GUILayout.FlexibleSpace();
+ GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(25f) };
+ this.AssetsTypeSelected = GUILayout.Toolbar(this.AssetsTypeSelected, this.AssetsTypeOptions, "LargeButton", GUI.ToolbarButtonSize.FitToContents, options);
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+
+ switch (this.AssetsTypeSelected)
+ {
+ case 0:
+ this.TextureWindow.Show();
+ break;
+ case 1:
+ this.FontWindow.Show();
+ break;
+ case 2:
+ this.AudioWindow.Show();
+ break;
+ case 3:
+ this.PrefabWindow.Show();
+ break;
+ default:
+ break;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs.meta
old mode 100755
new mode 100644
index 4ce471cc..3f8c0c75
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AnalysisWindow.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 7d06d74ece63a234b9cf5994c689e33e
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 7d06d74ece63a234b9cf5994c689e33e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs
old mode 100755
new mode 100644
index 063c5a54..88335073
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs
@@ -1,164 +1,164 @@
-using UnityEngine;
-using UnityEditor;
-using UnityEditor.IMGUI.Controls;
-
-namespace WeChatWASM.Analysis
-{
- //带数据的TreeViewItem
- public class AssetViewItem : TreeViewItem
- {
- public ReferenceFinderData.AssetDescription data;
- }
-
- //资源引用树
- public class AssetTreeView : TreeView
- {
- //图标宽度
- const float kIconWidth = 18f;
- //列表高度
- const float kRowHeights = 20f;
- public AssetViewItem assetRoot;
-
- private GUIStyle stateGUIStyle = new GUIStyle { richText = true, alignment = TextAnchor.MiddleCenter };
-
- //列信息
- enum MyColumns
- {
- Name,
- Path,
- State,
- }
-
- public AssetTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader) : base(state, multicolumnHeader)
- {
- useScrollView = false;
- rowHeight = kRowHeights;
- columnIndexForTreeFoldouts = 0;
- showAlternatingRowBackgrounds = true;
- showBorder = false;
- customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI
- extraSpaceBeforeIconAndLabel = kIconWidth;
- }
- //响应双击事件
- protected override void DoubleClickedItem(int id)
- {
- var item = (AssetViewItem)FindItem(id, rootItem);
- //在ProjectWindow中高亮双击资源
- if (item != null)
- {
- var assetObject = AssetDatabase.LoadAssetAtPath(item.data.path, typeof(UnityEngine.Object));
- EditorUtility.FocusProjectWindow();
- Selection.activeObject = assetObject;
- EditorGUIUtility.PingObject(assetObject);
- }
- }
-
- //生成ColumnHeader
- public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(float treeViewWidth)
- {
- var columns = new[]
- {
- //图标+名称
- new MultiColumnHeaderState.Column
- {
- headerContent = new GUIContent("Name"),
- headerTextAlignment = TextAlignment.Center,
- sortedAscending = false,
- width = 200,
- minWidth = 60,
- autoResize = false,
- allowToggleVisibility = false,
- canSort = false
- },
- //路径
- new MultiColumnHeaderState.Column
- {
- headerContent = new GUIContent("Path"),
- headerTextAlignment = TextAlignment.Center,
- sortedAscending = false,
- width = 360,
- minWidth = 60,
- autoResize = false,
- allowToggleVisibility = false,
- canSort = false
- },
- ////状态
- //new MultiColumnHeaderState.Column
- //{
- // headerContent = new GUIContent("State"),
- // headerTextAlignment = TextAlignment.Center,
- // sortedAscending = false,
- // width = 60,
- // minWidth = 60,
- // autoResize = false,
- // allowToggleVisibility = true,
- // canSort = false
- //},
- };
- var state = new MultiColumnHeaderState(columns);
- return state;
- }
-
- protected override TreeViewItem BuildRoot()
- {
- return assetRoot;
- }
-
- protected override void RowGUI(RowGUIArgs args)
- {
- var item = (AssetViewItem)args.item;
- for (int i = 0; i < args.GetNumVisibleColumns(); ++i)
- {
- CellGUI(args.GetCellRect(i), item, (MyColumns)args.GetColumn(i), ref args);
- }
- }
-
- //绘制列表中的每项内容
- void CellGUI(Rect cellRect, AssetViewItem item, MyColumns column, ref RowGUIArgs args)
- {
- CenterRectUsingSingleLineHeight(ref cellRect);
- switch (column)
- {
- case MyColumns.Name:
- {
- var iconRect = cellRect;
- iconRect.x += GetContentIndent(item);
- iconRect.width = kIconWidth;
- if (iconRect.x < cellRect.xMax)
- {
- var icon = GetIcon(item.data.path);
- if (icon != null)
- GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit);
- }
- args.rowRect = cellRect;
- base.RowGUI(args);
- }
- break;
- case MyColumns.Path:
- {
- GUI.Label(cellRect, item.data.path);
- }
- break;
- case MyColumns.State:
- {
- GUI.Label(cellRect, ReferenceFinderData.GetInfoByState(item.data.state), stateGUIStyle);
- }
- break;
- }
- }
-
- //根据资源信息获取资源图标
- private Texture2D GetIcon(string path)
- {
- Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
- if (obj != null)
- {
- Texture2D icon = AssetPreview.GetMiniThumbnail(obj);
- if (icon == null)
- icon = AssetPreview.GetMiniTypeThumbnail(obj.GetType());
- return icon;
- }
- return null;
- }
- }
+using UnityEngine;
+using UnityEditor;
+using UnityEditor.IMGUI.Controls;
+
+namespace WeChatWASM.Analysis
+{
+ //带数据的TreeViewItem
+ public class AssetViewItem : TreeViewItem
+ {
+ public ReferenceFinderData.AssetDescription data;
+ }
+
+ //资源引用树
+ public class AssetTreeView : TreeView
+ {
+ //图标宽度
+ const float kIconWidth = 18f;
+ //列表高度
+ const float kRowHeights = 20f;
+ public AssetViewItem assetRoot;
+
+ private GUIStyle stateGUIStyle = new GUIStyle { richText = true, alignment = TextAnchor.MiddleCenter };
+
+ //列信息
+ enum MyColumns
+ {
+ Name,
+ Path,
+ State,
+ }
+
+ public AssetTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader) : base(state, multicolumnHeader)
+ {
+ useScrollView = false;
+ rowHeight = kRowHeights;
+ columnIndexForTreeFoldouts = 0;
+ showAlternatingRowBackgrounds = true;
+ showBorder = false;
+ customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI
+ extraSpaceBeforeIconAndLabel = kIconWidth;
+ }
+ //响应双击事件
+ protected override void DoubleClickedItem(int id)
+ {
+ var item = (AssetViewItem)FindItem(id, rootItem);
+ //在ProjectWindow中高亮双击资源
+ if (item != null)
+ {
+ var assetObject = AssetDatabase.LoadAssetAtPath(item.data.path, typeof(UnityEngine.Object));
+ EditorUtility.FocusProjectWindow();
+ Selection.activeObject = assetObject;
+ EditorGUIUtility.PingObject(assetObject);
+ }
+ }
+
+ //生成ColumnHeader
+ public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(float treeViewWidth)
+ {
+ var columns = new[]
+ {
+ //图标+名称
+ new MultiColumnHeaderState.Column
+ {
+ headerContent = new GUIContent("Name"),
+ headerTextAlignment = TextAlignment.Center,
+ sortedAscending = false,
+ width = 200,
+ minWidth = 60,
+ autoResize = false,
+ allowToggleVisibility = false,
+ canSort = false
+ },
+ //路径
+ new MultiColumnHeaderState.Column
+ {
+ headerContent = new GUIContent("Path"),
+ headerTextAlignment = TextAlignment.Center,
+ sortedAscending = false,
+ width = 360,
+ minWidth = 60,
+ autoResize = false,
+ allowToggleVisibility = false,
+ canSort = false
+ },
+ ////状态
+ //new MultiColumnHeaderState.Column
+ //{
+ // headerContent = new GUIContent("State"),
+ // headerTextAlignment = TextAlignment.Center,
+ // sortedAscending = false,
+ // width = 60,
+ // minWidth = 60,
+ // autoResize = false,
+ // allowToggleVisibility = true,
+ // canSort = false
+ //},
+ };
+ var state = new MultiColumnHeaderState(columns);
+ return state;
+ }
+
+ protected override TreeViewItem BuildRoot()
+ {
+ return assetRoot;
+ }
+
+ protected override void RowGUI(RowGUIArgs args)
+ {
+ var item = (AssetViewItem)args.item;
+ for (int i = 0; i < args.GetNumVisibleColumns(); ++i)
+ {
+ CellGUI(args.GetCellRect(i), item, (MyColumns)args.GetColumn(i), ref args);
+ }
+ }
+
+ //绘制列表中的每项内容
+ void CellGUI(Rect cellRect, AssetViewItem item, MyColumns column, ref RowGUIArgs args)
+ {
+ CenterRectUsingSingleLineHeight(ref cellRect);
+ switch (column)
+ {
+ case MyColumns.Name:
+ {
+ var iconRect = cellRect;
+ iconRect.x += GetContentIndent(item);
+ iconRect.width = kIconWidth;
+ if (iconRect.x < cellRect.xMax)
+ {
+ var icon = GetIcon(item.data.path);
+ if (icon != null)
+ GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit);
+ }
+ args.rowRect = cellRect;
+ base.RowGUI(args);
+ }
+ break;
+ case MyColumns.Path:
+ {
+ GUI.Label(cellRect, item.data.path);
+ }
+ break;
+ case MyColumns.State:
+ {
+ GUI.Label(cellRect, ReferenceFinderData.GetInfoByState(item.data.state), stateGUIStyle);
+ }
+ break;
+ }
+ }
+
+ //根据资源信息获取资源图标
+ private Texture2D GetIcon(string path)
+ {
+ Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
+ if (obj != null)
+ {
+ Texture2D icon = AssetPreview.GetMiniThumbnail(obj);
+ if (icon == null)
+ icon = AssetPreview.GetMiniTypeThumbnail(obj.GetType());
+ return icon;
+ }
+ return null;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs.meta
old mode 100755
new mode 100644
index a6faa8a8..e5bf20b6
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AssetTreeView.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 913d7b4e37be64446863ebfd1b6b3294
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 913d7b4e37be64446863ebfd1b6b3294
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs
old mode 100755
new mode 100644
index 5151689c..4f2cbdfd
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs
@@ -1,148 +1,148 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
-using System.Linq;
-using System;
-
-namespace WeChatWASM.Analysis
-{
- public class AudioWindow : BaseWindow
- {
- private AssetDataTable m_table;
- private List selectedObjects;
- private List originalInfos;
- private List renderInfos;
-
- public class AssetDataTable : CommonTable
- {
- public AssetDataTable(List datas,
- CommonTableColumn[] cs,
- FilterMethod onfilter,
- SelectMethod onselect = null)
- : base(datas, cs, onfilter, onselect)
- {
- }
- }
-
- public AudioWindow() : base()
- {
- if (m_table == null)
- {
- var datas = new List();
- var cols = GetViewColumn();
- m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
- }
- }
-
- public CommonTableColumn[] GetViewColumn()
- {
- var cols = new CommonTableColumn[]
- {
- new CommonTableColumn
- {
- headerContent = new GUIContent("name"),
- canSort = true,
- minWidth = 170,
- width = 170,
- Compare = (a,b) => -a.name.CompareTo(b.name),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
- },
- new CommonTableColumn
- {
- headerContent = new GUIContent("path"),
- canSort = true,
- minWidth = 350,
- width = 350,
- Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
- }
- };
-
- return cols;
- }
-
- public void OnRowSelect(List datas)
- {
- currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
- selectedObjects = new List(datas);
- var list = new List();
- foreach (var data in datas)
- {
- var info = data._info;
- list.Add(info);
- }
- Selection.objects = list.ToArray();
- }
-
- private bool OnFilter(AudioInfo data, string std)
- {
- string name = std;
- if (name.Length == 0)
- {
- return true;
- }
- return data.name.ToLower().IndexOf(name.ToLower()) > -1;
- }
-
- public override void RefreshTable()
- {
- if (needUpdateMainContent)
- {
- needUpdateMainContent = false;
- var cols = GetViewColumn();
- m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
- }
- m_table.OnGUI();
- }
-
- public override void DrawOptionArea()
- {
- GUILayout.Space(40);
- if (GUILayout.Button("搜索音频文件", GUILayout.Width(160), GUILayout.Height(40)))
- {
- CollectAssets();
- }
- }
-
- public void CollectAssets(Boolean needRefreshCurrentFolder = true)
- {
- if (needRefreshCurrentFolder)
- {
- this.currentFolder = GetCurrentFolder();
- }
- originalInfos = new List();
- var guids = AssetDatabase.FindAssets("t:audioclip", new[] { this.currentFolder });
- var count = guids.Length;
- var current = 0;
- foreach (string guid in guids)
- {
- current++;
- EditorUtility.DisplayCancelableProgressBar("search Audio", "searching " + current, (float)current / count);
- var obj = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
- var filePath = AssetDatabase.GetAssetPath(obj);
- originalInfos.Add(new AudioInfo(obj, filePath));
- }
-
- EditorUtility.ClearProgressBar();
-
- renderInfos = new List(originalInfos);
-
- needUpdateMainContent = true;
- Selection.objects = null;
- }
- }
-
- public class AudioInfo
- {
- public string assetPath;
- public string name;
- public AudioClip _info;
-
- public AudioInfo(AudioClip info, string assetPath)
- {
- this._info = info;
- this.assetPath = assetPath;
- this.name = info.name;
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System.Collections.Generic;
+using System.Linq;
+using System;
+
+namespace WeChatWASM.Analysis
+{
+ public class AudioWindow : BaseWindow
+ {
+ private AssetDataTable m_table;
+ private List selectedObjects;
+ private List originalInfos;
+ private List renderInfos;
+
+ public class AssetDataTable : CommonTable
+ {
+ public AssetDataTable(List datas,
+ CommonTableColumn[] cs,
+ FilterMethod onfilter,
+ SelectMethod onselect = null)
+ : base(datas, cs, onfilter, onselect)
+ {
+ }
+ }
+
+ public AudioWindow() : base()
+ {
+ if (m_table == null)
+ {
+ var datas = new List();
+ var cols = GetViewColumn();
+ m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
+ }
+ }
+
+ public CommonTableColumn[] GetViewColumn()
+ {
+ var cols = new CommonTableColumn[]
+ {
+ new CommonTableColumn
+ {
+ headerContent = new GUIContent("name"),
+ canSort = true,
+ minWidth = 170,
+ width = 170,
+ Compare = (a,b) => -a.name.CompareTo(b.name),
+ DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
+ },
+ new CommonTableColumn
+ {
+ headerContent = new GUIContent("path"),
+ canSort = true,
+ minWidth = 350,
+ width = 350,
+ Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
+ DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
+ }
+ };
+
+ return cols;
+ }
+
+ public void OnRowSelect(List datas)
+ {
+ currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
+ selectedObjects = new List(datas);
+ var list = new List();
+ foreach (var data in datas)
+ {
+ var info = data._info;
+ list.Add(info);
+ }
+ Selection.objects = list.ToArray();
+ }
+
+ private bool OnFilter(AudioInfo data, string std)
+ {
+ string name = std;
+ if (name.Length == 0)
+ {
+ return true;
+ }
+ return data.name.ToLower().IndexOf(name.ToLower()) > -1;
+ }
+
+ public override void RefreshTable()
+ {
+ if (needUpdateMainContent)
+ {
+ needUpdateMainContent = false;
+ var cols = GetViewColumn();
+ m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
+ }
+ m_table.OnGUI();
+ }
+
+ public override void DrawOptionArea()
+ {
+ GUILayout.Space(40);
+ if (GUILayout.Button("搜索音频文件", GUILayout.Width(160), GUILayout.Height(40)))
+ {
+ CollectAssets();
+ }
+ }
+
+ public void CollectAssets(Boolean needRefreshCurrentFolder = true)
+ {
+ if (needRefreshCurrentFolder)
+ {
+ this.currentFolder = GetCurrentFolder();
+ }
+ originalInfos = new List();
+ var guids = AssetDatabase.FindAssets("t:audioclip", new[] { this.currentFolder });
+ var count = guids.Length;
+ var current = 0;
+ foreach (string guid in guids)
+ {
+ current++;
+ EditorUtility.DisplayCancelableProgressBar("search Audio", "searching " + current, (float)current / count);
+ var obj = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
+ var filePath = AssetDatabase.GetAssetPath(obj);
+ originalInfos.Add(new AudioInfo(obj, filePath));
+ }
+
+ EditorUtility.ClearProgressBar();
+
+ renderInfos = new List(originalInfos);
+
+ needUpdateMainContent = true;
+ Selection.objects = null;
+ }
+ }
+
+ public class AudioInfo
+ {
+ public string assetPath;
+ public string name;
+ public AudioClip _info;
+
+ public AudioInfo(AudioClip info, string assetPath)
+ {
+ this._info = info;
+ this.assetPath = assetPath;
+ this.name = info.name;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs.meta
old mode 100755
new mode 100644
index 3694490c..1c5cd47b
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/AudioWindow.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: e222bfdf52432fb429ffe36b48050b51
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: e222bfdf52432fb429ffe36b48050b51
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs
old mode 100755
new mode 100644
index 7b333611..054e8fbf
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs
@@ -1,254 +1,254 @@
-using UnityEngine;
-using UnityEditor;
-using System;
-using UnityEditor.IMGUI.Controls;
-using System.Collections.Generic;
-using System.IO;
-
-//public abstract class BaseWindow
-//{
-
-//}
-namespace WeChatWASM.Analysis
-{
- public class BaseWindow where T : class, new()
- {
- //private AssetDataTable m_table;
- Vector2 assetListScrollPosition = Vector2.zero;
-
- float splitterPos = 1000;
- Rect splitterRect;
- float splitterWidth = 5;
- bool dragging;
-
- Vector2 refrenceListScrollPostion = Vector2.zero;
-
- public EditorWindow win;
-
- public string currentFolder;
- public Boolean needRefreshCurrentFolder;
-
- public string[] currentAssetPathList;
- public AssetTreeView assetTreeView;
- public List selectedAssetGuid = new List();
- public static ReferenceFinderData assetRefrenceDatas = new ReferenceFinderData();
- public Boolean initializedRefrenceData = false;
-
- public TreeViewState treeViewState;
-
- // 是否需要刷新扫描结果
- public Boolean needUpdateMainContent = false;
- // 是否更新资源引用结果
- public Boolean needUpdateAssetTree = false;
-
- // 单例
- public static T instance;
- public static readonly object locker = new object();
-
- public BaseWindow()
- {
- win = AnalysisWindow.GetCurrentWindow();
-
- if (!initializedRefrenceData)
- {
- if (!assetRefrenceDatas.ReadFromCache())
- {
- assetRefrenceDatas.CollectDependenciesInfo();
- }
- initializedRefrenceData = true;
- }
- }
-
- public static T GetInstance()
- {
- lock (locker)
- {
- if (instance == null)
- {
- instance = new T();
- }
- }
- return instance;
- }
-
- public void Show()
- {
- GUILayout.BeginHorizontal();
-
- DrawOptionBtn();
- DrawMainContent();
- DrawSplitter();
- DrawReferenceLayout();
-
- GUILayout.EndHorizontal();
- }
-
- public void DrawOptionBtn()
- {
- GUILayout.BeginVertical();
-
- DrawOptionArea();
-
- GUILayout.EndVertical();
- }
-
- public virtual void DrawOptionArea()
- {
-
- }
-
- public string GetCurrentFolder()
- {
- string path = "Assets";
-
- foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
- {
- path = AssetDatabase.GetAssetPath(obj);
- if (!string.IsNullOrEmpty(path) && File.Exists(path))
- {
- path = Path.GetDirectoryName(path);
- break;
- }
- }
- return path;
- }
-
- public void DrawMainContent()
- {
- assetListScrollPosition = GUILayout.BeginScrollView(assetListScrollPosition, GUILayout.Width(splitterPos), GUILayout.MinWidth(splitterPos), GUILayout.MaxWidth(splitterPos));
- RefreshTable();
- GUILayout.EndScrollView();
- }
-
- public virtual void RefreshTable()
- {
- }
-
- public void DrawSplitter()
- {
- // splitter
- GUILayout.Box("",
- GUILayout.Width(splitterWidth),
- GUILayout.MaxWidth(splitterWidth),
- GUILayout.MinWidth(splitterWidth),
- GUILayout.ExpandHeight(true));
- splitterRect = GUILayoutUtility.GetLastRect();
-
- if (Event.current != null)
- {
- switch (Event.current.rawType)
- {
- case EventType.MouseDown:
- if (splitterRect.Contains(Event.current.mousePosition))
- {
- dragging = true;
- }
- break;
- case EventType.MouseDrag:
- if (dragging)
- {
- splitterPos += Event.current.delta.x;
- win.Repaint();
- }
- break;
- case EventType.MouseUp:
- if (dragging)
- {
- dragging = false;
- }
- break;
- }
- }
- }
-
- public void DrawReferenceLayout()
- {
- GUILayout.BeginVertical();
- if (GUILayout.Button("检查依赖", GUILayout.Width(160), GUILayout.Height(40)))
- {
- if (currentAssetPathList.Length > 0)
- {
- selectedAssetGuid.Clear();
- selectedAssetGuid.Add(AssetDatabase.AssetPathToGUID(currentAssetPathList[0]));
- needUpdateAssetTree = true;
- }
- }
- var btnRect = GUILayoutUtility.GetLastRect();
-
- // asset reference
- var scrollViewWidth = win.position.width - splitterRect.xMax;
- var scrollViewY = btnRect.yMax + 5;
-
- refrenceListScrollPostion = GUILayout.BeginScrollView(refrenceListScrollPostion, GUILayout.Width(scrollViewWidth), GUILayout.MinWidth(scrollViewWidth), GUILayout.MaxWidth(scrollViewWidth), GUILayout.ExpandHeight(true));
- UpdateAssetTree();
- if (assetTreeView != null)
- {
- var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
- if (Event.current.type != EventType.Layout)
- {
- assetTreeView.OnGUI(rect);
- }
- }
- GUILayout.EndScrollView();
-
- GUILayout.EndVertical();
- }
-
- public void UpdateAssetTree()
- {
- if (needUpdateAssetTree && selectedAssetGuid.Count != 0)
- {
- var root = SelectedAssetGuidToRootItem(selectedAssetGuid);
- if (assetTreeView == null)
- {
- if (treeViewState == null)
- {
- treeViewState = new TreeViewState();
- }
- var headerState = AssetTreeView.CreateDefaultMultiColumnHeaderState(win.position.width - splitterRect.x);
- var multiColumnHeader = new MultiColumnHeader(headerState);
- assetTreeView = new AssetTreeView(treeViewState, multiColumnHeader);
- }
- assetTreeView.assetRoot = root;
- assetTreeView.CollapseAll();
- assetTreeView.Reload();
- needUpdateAssetTree = false;
- }
- }
-
- //生成root相关
- private HashSet updatedAssetSet = new HashSet();
- //通过选择资源列表生成TreeView的根节点
- private AssetViewItem SelectedAssetGuidToRootItem(List selectedAssetGuid)
- {
- updatedAssetSet.Clear();
- int elementCount = 0;
- var root = new AssetViewItem { id = elementCount, depth = -1, displayName = "Root", data = null };
- int depth = 0;
- foreach (var childGuid in selectedAssetGuid)
- {
- root.AddChild(CreateTree(childGuid, ref elementCount, depth));
- }
- updatedAssetSet.Clear();
- return root;
- }
- //通过每个节点的数据生成子节点
- private AssetViewItem CreateTree(string guid, ref int elementCount, int _depth)
- {
- if (!updatedAssetSet.Contains(guid))
- {
- assetRefrenceDatas.UpdateAssetState(guid);
- updatedAssetSet.Add(guid);
- }
- ++elementCount;
- var referenceData = assetRefrenceDatas.assetDict[guid];
- var root = new AssetViewItem { id = elementCount, displayName = referenceData.name, data = referenceData, depth = _depth };
- var childGuids = referenceData.references;
- foreach (var childGuid in childGuids)
- {
- root.AddChild(CreateTree(childGuid, ref elementCount, _depth + 1));
- }
- return root;
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System;
+using UnityEditor.IMGUI.Controls;
+using System.Collections.Generic;
+using System.IO;
+
+//public abstract class BaseWindow
+//{
+
+//}
+namespace WeChatWASM.Analysis
+{
+ public class BaseWindow where T : class, new()
+ {
+ //private AssetDataTable m_table;
+ Vector2 assetListScrollPosition = Vector2.zero;
+
+ float splitterPos = 1000;
+ Rect splitterRect;
+ float splitterWidth = 5;
+ bool dragging;
+
+ Vector2 refrenceListScrollPostion = Vector2.zero;
+
+ public EditorWindow win;
+
+ public string currentFolder;
+ public Boolean needRefreshCurrentFolder;
+
+ public string[] currentAssetPathList;
+ public AssetTreeView assetTreeView;
+ public List selectedAssetGuid = new List();
+ public static ReferenceFinderData assetRefrenceDatas = new ReferenceFinderData();
+ public Boolean initializedRefrenceData = false;
+
+ public TreeViewState treeViewState;
+
+ // 是否需要刷新扫描结果
+ public Boolean needUpdateMainContent = false;
+ // 是否更新资源引用结果
+ public Boolean needUpdateAssetTree = false;
+
+ // 单例
+ public static T instance;
+ public static readonly object locker = new object();
+
+ public BaseWindow()
+ {
+ win = AnalysisWindow.GetCurrentWindow();
+
+ if (!initializedRefrenceData)
+ {
+ if (!assetRefrenceDatas.ReadFromCache())
+ {
+ assetRefrenceDatas.CollectDependenciesInfo();
+ }
+ initializedRefrenceData = true;
+ }
+ }
+
+ public static T GetInstance()
+ {
+ lock (locker)
+ {
+ if (instance == null)
+ {
+ instance = new T();
+ }
+ }
+ return instance;
+ }
+
+ public void Show()
+ {
+ GUILayout.BeginHorizontal();
+
+ DrawOptionBtn();
+ DrawMainContent();
+ DrawSplitter();
+ DrawReferenceLayout();
+
+ GUILayout.EndHorizontal();
+ }
+
+ public void DrawOptionBtn()
+ {
+ GUILayout.BeginVertical();
+
+ DrawOptionArea();
+
+ GUILayout.EndVertical();
+ }
+
+ public virtual void DrawOptionArea()
+ {
+
+ }
+
+ public string GetCurrentFolder()
+ {
+ string path = "Assets";
+
+ foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
+ {
+ path = AssetDatabase.GetAssetPath(obj);
+ if (!string.IsNullOrEmpty(path) && File.Exists(path))
+ {
+ path = Path.GetDirectoryName(path);
+ break;
+ }
+ }
+ return path;
+ }
+
+ public void DrawMainContent()
+ {
+ assetListScrollPosition = GUILayout.BeginScrollView(assetListScrollPosition, GUILayout.Width(splitterPos), GUILayout.MinWidth(splitterPos), GUILayout.MaxWidth(splitterPos));
+ RefreshTable();
+ GUILayout.EndScrollView();
+ }
+
+ public virtual void RefreshTable()
+ {
+ }
+
+ public void DrawSplitter()
+ {
+ // splitter
+ GUILayout.Box("",
+ GUILayout.Width(splitterWidth),
+ GUILayout.MaxWidth(splitterWidth),
+ GUILayout.MinWidth(splitterWidth),
+ GUILayout.ExpandHeight(true));
+ splitterRect = GUILayoutUtility.GetLastRect();
+
+ if (Event.current != null)
+ {
+ switch (Event.current.rawType)
+ {
+ case EventType.MouseDown:
+ if (splitterRect.Contains(Event.current.mousePosition))
+ {
+ dragging = true;
+ }
+ break;
+ case EventType.MouseDrag:
+ if (dragging)
+ {
+ splitterPos += Event.current.delta.x;
+ win.Repaint();
+ }
+ break;
+ case EventType.MouseUp:
+ if (dragging)
+ {
+ dragging = false;
+ }
+ break;
+ }
+ }
+ }
+
+ public void DrawReferenceLayout()
+ {
+ GUILayout.BeginVertical();
+ if (GUILayout.Button("检查依赖", GUILayout.Width(160), GUILayout.Height(40)))
+ {
+ if (currentAssetPathList.Length > 0)
+ {
+ selectedAssetGuid.Clear();
+ selectedAssetGuid.Add(AssetDatabase.AssetPathToGUID(currentAssetPathList[0]));
+ needUpdateAssetTree = true;
+ }
+ }
+ var btnRect = GUILayoutUtility.GetLastRect();
+
+ // asset reference
+ var scrollViewWidth = win.position.width - splitterRect.xMax;
+ var scrollViewY = btnRect.yMax + 5;
+
+ refrenceListScrollPostion = GUILayout.BeginScrollView(refrenceListScrollPostion, GUILayout.Width(scrollViewWidth), GUILayout.MinWidth(scrollViewWidth), GUILayout.MaxWidth(scrollViewWidth), GUILayout.ExpandHeight(true));
+ UpdateAssetTree();
+ if (assetTreeView != null)
+ {
+ var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
+ if (Event.current.type != EventType.Layout)
+ {
+ assetTreeView.OnGUI(rect);
+ }
+ }
+ GUILayout.EndScrollView();
+
+ GUILayout.EndVertical();
+ }
+
+ public void UpdateAssetTree()
+ {
+ if (needUpdateAssetTree && selectedAssetGuid.Count != 0)
+ {
+ var root = SelectedAssetGuidToRootItem(selectedAssetGuid);
+ if (assetTreeView == null)
+ {
+ if (treeViewState == null)
+ {
+ treeViewState = new TreeViewState();
+ }
+ var headerState = AssetTreeView.CreateDefaultMultiColumnHeaderState(win.position.width - splitterRect.x);
+ var multiColumnHeader = new MultiColumnHeader(headerState);
+ assetTreeView = new AssetTreeView(treeViewState, multiColumnHeader);
+ }
+ assetTreeView.assetRoot = root;
+ assetTreeView.CollapseAll();
+ assetTreeView.Reload();
+ needUpdateAssetTree = false;
+ }
+ }
+
+ //生成root相关
+ private HashSet updatedAssetSet = new HashSet();
+ //通过选择资源列表生成TreeView的根节点
+ private AssetViewItem SelectedAssetGuidToRootItem(List selectedAssetGuid)
+ {
+ updatedAssetSet.Clear();
+ int elementCount = 0;
+ var root = new AssetViewItem { id = elementCount, depth = -1, displayName = "Root", data = null };
+ int depth = 0;
+ foreach (var childGuid in selectedAssetGuid)
+ {
+ root.AddChild(CreateTree(childGuid, ref elementCount, depth));
+ }
+ updatedAssetSet.Clear();
+ return root;
+ }
+ //通过每个节点的数据生成子节点
+ private AssetViewItem CreateTree(string guid, ref int elementCount, int _depth)
+ {
+ if (!updatedAssetSet.Contains(guid))
+ {
+ assetRefrenceDatas.UpdateAssetState(guid);
+ updatedAssetSet.Add(guid);
+ }
+ ++elementCount;
+ var referenceData = assetRefrenceDatas.assetDict[guid];
+ var root = new AssetViewItem { id = elementCount, displayName = referenceData.name, data = referenceData, depth = _depth };
+ var childGuids = referenceData.references;
+ foreach (var childGuid in childGuids)
+ {
+ root.AddChild(CreateTree(childGuid, ref elementCount, _depth + 1));
+ }
+ return root;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs.meta
old mode 100755
new mode 100644
index 64b03e10..9550787b
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/BaseWindow.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: ea47c9c594c266a4f94dff634585161e
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: ea47c9c594c266a4f94dff634585161e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs
old mode 100755
new mode 100644
index e1f087c9..9c4cccef
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs
@@ -1,122 +1,122 @@
-using System;
-using System.Collections.Generic;
-using UnityEditor.IMGUI.Controls;
-using UnityEngine;
-
-namespace WeChatWASM.Analysis
-{
- public abstract class CommonTable
- {
- public abstract void OnGUI();
- }
-
- public class CommonTable : CommonTable where T : class
- {
- private const float DragHeight = 20f;
-
- private const float DragWidth = 5f;
-
- private readonly float m_FilterHeight = 20f;
-
- private bool m_initialized;
-
- private CommonTreeView m_treeView;
-
- private TreeViewState m_treeViewState;
-
- private readonly List m_datas;
- private readonly FilterMethod m_filter;
- private readonly SelectMethod m_select;
- private readonly Action m_toggleSelectAll;
-
- protected MultiColumnHeaderState MultiColumnHeaderState { get; private set; }
-
- public CommonTable(List datas, CommonTableColumn[] cs, FilterMethod onfilter, SelectMethod onselect = null, Action toggleSelectAll = null)
- {
- var state = new MultiColumnHeaderState(cs);
- MultiColumnHeaderState = state;
- m_filter = onfilter;
- m_datas = datas;
- m_select = onselect;
- m_toggleSelectAll = toggleSelectAll;
- }
-
- private void InitIfNeeded()
- {
- if (!m_initialized)
- {
- if (m_treeViewState == null)
- m_treeViewState = new TreeViewState();
- var multiColumnHeader = new MultiColumnHeader(MultiColumnHeaderState);
- m_treeView = new CommonTreeView(m_treeViewState, multiColumnHeader, m_datas, m_filter, m_select, m_toggleSelectAll);
- m_treeView.Reload();
- m_initialized = true;
- }
- }
-
- public void SelectAll()
- {
- if (m_treeView != null)
- {
- m_treeView.SelectAllRows();
- }
- }
-
- public override void OnGUI()
- {
-
- InitIfNeeded();
-
- var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
- if (Event.current.type == EventType.Layout)
- return;
- rect.x += DragWidth;
- rect.width -= DragWidth;
-
- rect.y += DragHeight;
-
- var r = rect;
- rect.y += m_FilterHeight;
- rect.height = rect.height - m_FilterHeight - DragHeight * 2;
-
- var rect2 = rect;
- m_treeView.OnCheckAllGUI();
- m_treeView.OnGUI(rect2);
- //DrawExportButton(r);
- m_treeView.OnFilterGUI(r);
- //if (m_treeView.IsFilteredDirty())
- // m_treeView.Reload();
- }
-
- //private void DrawExportButton(Rect rect)
- //{
- // var br = rect;
- // br.height = 20;
- // br.width = 50;
- // if (GUI.Button(br, "Export"))
- // {
- // var path = EditorUtility.SaveFilePanel("file", Application.dataPath, "data", "xml");
- // if (!string.IsNullOrEmpty(path))
- // Serializer.SaveAsXml(m_datas, path);
- // }
- //}
- }
-
- public delegate void DrawCellMethod(Rect cellRect, T item);
-
- public delegate bool FilterMethod(T data, string std);
-
- public delegate int CompareMethod(T data1, T data2);
-
- public delegate void SelectMethod(List datas);
-
- public class StringFilter
- {
- public static bool Contains(string req, string std)
- {
- if (req == null || std == null)
- return false;
- return req.IndexOf(std, 0, StringComparison.OrdinalIgnoreCase) >= 0;
- }
- }
+using System;
+using System.Collections.Generic;
+using UnityEditor.IMGUI.Controls;
+using UnityEngine;
+
+namespace WeChatWASM.Analysis
+{
+ public abstract class CommonTable
+ {
+ public abstract void OnGUI();
+ }
+
+ public class CommonTable : CommonTable where T : class
+ {
+ private const float DragHeight = 20f;
+
+ private const float DragWidth = 5f;
+
+ private readonly float m_FilterHeight = 20f;
+
+ private bool m_initialized;
+
+ private CommonTreeView m_treeView;
+
+ private TreeViewState m_treeViewState;
+
+ private readonly List m_datas;
+ private readonly FilterMethod m_filter;
+ private readonly SelectMethod m_select;
+ private readonly Action m_toggleSelectAll;
+
+ protected MultiColumnHeaderState MultiColumnHeaderState { get; private set; }
+
+ public CommonTable(List datas, CommonTableColumn[] cs, FilterMethod onfilter, SelectMethod onselect = null, Action toggleSelectAll = null)
+ {
+ var state = new MultiColumnHeaderState(cs);
+ MultiColumnHeaderState = state;
+ m_filter = onfilter;
+ m_datas = datas;
+ m_select = onselect;
+ m_toggleSelectAll = toggleSelectAll;
+ }
+
+ private void InitIfNeeded()
+ {
+ if (!m_initialized)
+ {
+ if (m_treeViewState == null)
+ m_treeViewState = new TreeViewState();
+ var multiColumnHeader = new MultiColumnHeader(MultiColumnHeaderState);
+ m_treeView = new CommonTreeView(m_treeViewState, multiColumnHeader, m_datas, m_filter, m_select, m_toggleSelectAll);
+ m_treeView.Reload();
+ m_initialized = true;
+ }
+ }
+
+ public void SelectAll()
+ {
+ if (m_treeView != null)
+ {
+ m_treeView.SelectAllRows();
+ }
+ }
+
+ public override void OnGUI()
+ {
+
+ InitIfNeeded();
+
+ var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
+ if (Event.current.type == EventType.Layout)
+ return;
+ rect.x += DragWidth;
+ rect.width -= DragWidth;
+
+ rect.y += DragHeight;
+
+ var r = rect;
+ rect.y += m_FilterHeight;
+ rect.height = rect.height - m_FilterHeight - DragHeight * 2;
+
+ var rect2 = rect;
+ m_treeView.OnCheckAllGUI();
+ m_treeView.OnGUI(rect2);
+ //DrawExportButton(r);
+ m_treeView.OnFilterGUI(r);
+ //if (m_treeView.IsFilteredDirty())
+ // m_treeView.Reload();
+ }
+
+ //private void DrawExportButton(Rect rect)
+ //{
+ // var br = rect;
+ // br.height = 20;
+ // br.width = 50;
+ // if (GUI.Button(br, "Export"))
+ // {
+ // var path = EditorUtility.SaveFilePanel("file", Application.dataPath, "data", "xml");
+ // if (!string.IsNullOrEmpty(path))
+ // Serializer.SaveAsXml(m_datas, path);
+ // }
+ //}
+ }
+
+ public delegate void DrawCellMethod(Rect cellRect, T item);
+
+ public delegate bool FilterMethod(T data, string std);
+
+ public delegate int CompareMethod(T data1, T data2);
+
+ public delegate void SelectMethod(List datas);
+
+ public class StringFilter
+ {
+ public static bool Contains(string req, string std)
+ {
+ if (req == null || std == null)
+ return false;
+ return req.IndexOf(std, 0, StringComparison.OrdinalIgnoreCase) >= 0;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs.meta
old mode 100755
new mode 100644
index 6b3ac103..d0759813
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTable.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 3141a5220cd78d9468884a5aaa571bd1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 3141a5220cd78d9468884a5aaa571bd1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs
old mode 100755
new mode 100644
index 6ea506c1..a5a53ecc
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs
@@ -1,275 +1,275 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using JetBrains.Annotations;
-using UnityEditor;
-using UnityEditor.IMGUI.Controls;
-using UnityEngine;
-
-namespace WeChatWASM.Analysis
-{
- public class CommonTreeView : TreeView where T : class
- {
- private List> m_items;
- private Boolean isAllCheck;
- private Action m_toggleSelectAll;
-
- private readonly List m_datas;
- public CommonTreeView(
- TreeViewState state,
- MultiColumnHeader multiColumnHeader,
- List datas,
- FilterMethod filter,
- SelectMethod select = null,
- Action toggleSelectAll = null)
- : base(state, multiColumnHeader)
- {
- m_datas = datas;
-
- m_filter = filter;
- m_select = select;
- m_toggleSelectAll = toggleSelectAll;
-
- multiColumnHeader.sortingChanged += OnSortingChanged;
- multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged;
-
- showAlternatingRowBackgrounds = true;
- showBorder = true;
- rowHeight = EditorGUIUtility.singleLineHeight;
- }
-
- private void OnVisibleColumnChanged(MultiColumnHeader multicolumnheader)
- {
- Reload();
- }
-
- private void OnSortingChanged(MultiColumnHeader multicolumnheader)
- {
- var rows = GetRows();
- Sort(rows, multiColumnHeader.sortedColumnIndex);
- }
-
- protected override TreeViewItem BuildRoot()
- {
- return new CommonTreeViewItem(-1, -1, null);
- }
-
- protected override IList BuildRows(TreeViewItem root)
- {
- if (m_items == null)
- {
- m_items = new List>();
- for (var i = 0; i < m_datas.Count; i++)
- {
- var data = m_datas[i];
- m_items.Add(new CommonTreeViewItem(i, 0, data));
- }
- }
- var items = m_items;
- if (!string.IsNullOrEmpty(m_text))
- items = Filter(items);
-
- var list = new List();
- foreach (var item in items)
- {
- list.Add(item);
- }
- if (multiColumnHeader.sortedColumnIndex >= 0)
- Sort(list, multiColumnHeader.sortedColumnIndex);
- return items.Cast().ToList();
- }
-
- private readonly FilterMethod m_filter;
-
- [CanBeNull]
- private readonly SelectMethod m_select;
-
- private List> Filter(IEnumerable> rows)
- {
- var enumerable = rows;
- var i = 0;
- if (IsColumnVisible(i) && m_filter != null)
- {
- enumerable = from item in enumerable
- where m_filter(item.Data, m_text)
- select item;
- }
- return enumerable.ToList();
- }
- private CommonTableColumn Col(int idx)
- {
- return (CommonTableColumn)multiColumnHeader.state.columns[idx];
- }
-
- private void Sort(IList rows, int sortIdx)
- {
- var flag = multiColumnHeader.IsSortedAscending(sortIdx);
- var comp = Col(sortIdx).Compare;
- var list = (List)rows;
- if (comp != null)
- {
- Comparison comparison = (lhs, rhs) =>
- {
- var x1 = (CommonTreeViewItem)lhs;
- var x2 = (CommonTreeViewItem)rhs;
- return comp(x1.Data, x2.Data);
- };
- Comparison comparison2 = (lhs, rhs) =>
- {
- var x1 = (CommonTreeViewItem)lhs;
- var x2 = (CommonTreeViewItem)rhs;
- return -comp(x1.Data, x2.Data);
- };
- list.Sort(!flag ? comparison2 : comparison);
- }
- }
-
- protected override void RowGUI(RowGUIArgs args)
- {
- var item = (CommonTreeViewItem)args.item;
- for (var i = 0; i < args.GetNumVisibleColumns(); i++)
- {
- CellGUI(args.GetCellRect(i), item.Data, args.GetColumn(i));
- }
- }
-
- private void CellGUI(Rect cellRect, T item, int columnIndex)
- {
- CenterRectUsingSingleLineHeight(ref cellRect);
- var column = (CommonTableColumn)multiColumnHeader.GetColumn(columnIndex);
- if (column.DrawCell != null)
- column.DrawCell(cellRect, item);
- }
-
- public void OnCheckAllGUI()
- {
- var selectedList = this.GetSelection();
- if (selectedList.Count != m_datas.Count)
- {
- isAllCheck = false;
- }
- var newState = GUI.Toggle(new Rect(5, 20, 50, 20), isAllCheck, "全选");
- if (newState != isAllCheck)
- {
- isAllCheck = newState;
- if (isAllCheck)
- {
- if (m_datas.Count != 0)
- {
- this.SelectAllRows();
- }
- } else
- {
- this.SetSelection(new List());
- }
- if (m_toggleSelectAll != null)
- {
- m_toggleSelectAll(isAllCheck);
- }
- }
- }
-
- public void OnFilterGUI(Rect r)
- {
- EditorGUI.BeginChangeCheck();
- var width = r.width;
- var num = 16f;
- r.width = num;
- r.x += num;
- r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x;
-
- //EditorGUI.LabelField(r, Styles.filterSelection);
- r.width = Mathf.Min(width - (r.x + r.width), 300f);
- r.x = width - r.width + 25;
- FilterGUI(r);
- if (EditorGUI.EndChangeCheck())
- {
- Reload();
- }
- }
-
- private string m_text;
- private void FilterGUI(Rect r)
- {
- r.width -= 15f;
- //GUI.SetNextControlName("InputText");
- m_text = EditorGUI.DelayedTextField(r, GUIContent.none, m_text, Styles.searchField);
- //EditorGUI.FocusTextInControl("InputText");
- r.x += r.width;
- r.width = 15f;
- bool flag = m_text != "";
- if (GUI.Button(r, GUIContent.none, (!flag) ? Styles.searchFieldCancelButtonEmpty : Styles.searchFieldCancelButton) && flag)
- {
- m_text = "";
- GUIUtility.keyboardControl = 0;
- }
- }
-
- private bool IsColumnVisible(int idx)
- {
- return multiColumnHeader.state.visibleColumns.Any(t => t == idx);
- }
-
- protected override void KeyEvent()
- {
- if (Event.current.type == EventType.KeyDown)
- {
- if (Event.current.character == '\t')
- {
- GUI.FocusControl(Styles.focusHelper);
- Event.current.Use();
- }
- }
- }
-
- protected override void SelectionChanged(IList selectedIds)
- {
- var datas = new List();
- foreach (var id in selectedIds)
- {
- if (id < 0 || id > m_datas.Count)
- {
- Debug.Log(id + "out of range");
- continue;
- }
- var data = m_datas[id];
- datas.Add(data);
- }
- if (m_select != null)
- m_select(datas);
- }
- }
-
- public class CommonTableColumn : MultiColumnHeaderState.Column
- {
- public DrawCellMethod DrawCell;
-
- //public IFilter Filter;
- public CompareMethod Compare { get; set; }
- }
-
- //public interface IFilter
- //{
- // void OnGUI(Rect r);
- //}
-
- //public interface IFilter : IFilter
- //{
- // bool Filter(T prop);
- //}
-
- //public class StringFilter
- //{
- // [SerializeField]
- // protected string m_Text = "";
- // public void OnGUI(Rect r)
- // {
-
- // }
-
- // public bool Filter(string prop)
- // {
- // return prop.IndexOf(m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0;
- // }
- //}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using JetBrains.Annotations;
+using UnityEditor;
+using UnityEditor.IMGUI.Controls;
+using UnityEngine;
+
+namespace WeChatWASM.Analysis
+{
+ public class CommonTreeView : TreeView where T : class
+ {
+ private List> m_items;
+ private Boolean isAllCheck;
+ private Action m_toggleSelectAll;
+
+ private readonly List m_datas;
+ public CommonTreeView(
+ TreeViewState state,
+ MultiColumnHeader multiColumnHeader,
+ List datas,
+ FilterMethod filter,
+ SelectMethod select = null,
+ Action toggleSelectAll = null)
+ : base(state, multiColumnHeader)
+ {
+ m_datas = datas;
+
+ m_filter = filter;
+ m_select = select;
+ m_toggleSelectAll = toggleSelectAll;
+
+ multiColumnHeader.sortingChanged += OnSortingChanged;
+ multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged;
+
+ showAlternatingRowBackgrounds = true;
+ showBorder = true;
+ rowHeight = EditorGUIUtility.singleLineHeight;
+ }
+
+ private void OnVisibleColumnChanged(MultiColumnHeader multicolumnheader)
+ {
+ Reload();
+ }
+
+ private void OnSortingChanged(MultiColumnHeader multicolumnheader)
+ {
+ var rows = GetRows();
+ Sort(rows, multiColumnHeader.sortedColumnIndex);
+ }
+
+ protected override TreeViewItem BuildRoot()
+ {
+ return new CommonTreeViewItem(-1, -1, null);
+ }
+
+ protected override IList BuildRows(TreeViewItem root)
+ {
+ if (m_items == null)
+ {
+ m_items = new List>();
+ for (var i = 0; i < m_datas.Count; i++)
+ {
+ var data = m_datas[i];
+ m_items.Add(new CommonTreeViewItem(i, 0, data));
+ }
+ }
+ var items = m_items;
+ if (!string.IsNullOrEmpty(m_text))
+ items = Filter(items);
+
+ var list = new List();
+ foreach (var item in items)
+ {
+ list.Add(item);
+ }
+ if (multiColumnHeader.sortedColumnIndex >= 0)
+ Sort(list, multiColumnHeader.sortedColumnIndex);
+ return items.Cast().ToList();
+ }
+
+ private readonly FilterMethod m_filter;
+
+ [CanBeNull]
+ private readonly SelectMethod m_select;
+
+ private List> Filter(IEnumerable> rows)
+ {
+ var enumerable = rows;
+ var i = 0;
+ if (IsColumnVisible(i) && m_filter != null)
+ {
+ enumerable = from item in enumerable
+ where m_filter(item.Data, m_text)
+ select item;
+ }
+ return enumerable.ToList();
+ }
+ private CommonTableColumn Col(int idx)
+ {
+ return (CommonTableColumn)multiColumnHeader.state.columns[idx];
+ }
+
+ private void Sort(IList rows, int sortIdx)
+ {
+ var flag = multiColumnHeader.IsSortedAscending(sortIdx);
+ var comp = Col(sortIdx).Compare;
+ var list = (List)rows;
+ if (comp != null)
+ {
+ Comparison comparison = (lhs, rhs) =>
+ {
+ var x1 = (CommonTreeViewItem)lhs;
+ var x2 = (CommonTreeViewItem)rhs;
+ return comp(x1.Data, x2.Data);
+ };
+ Comparison comparison2 = (lhs, rhs) =>
+ {
+ var x1 = (CommonTreeViewItem)lhs;
+ var x2 = (CommonTreeViewItem)rhs;
+ return -comp(x1.Data, x2.Data);
+ };
+ list.Sort(!flag ? comparison2 : comparison);
+ }
+ }
+
+ protected override void RowGUI(RowGUIArgs args)
+ {
+ var item = (CommonTreeViewItem)args.item;
+ for (var i = 0; i < args.GetNumVisibleColumns(); i++)
+ {
+ CellGUI(args.GetCellRect(i), item.Data, args.GetColumn(i));
+ }
+ }
+
+ private void CellGUI(Rect cellRect, T item, int columnIndex)
+ {
+ CenterRectUsingSingleLineHeight(ref cellRect);
+ var column = (CommonTableColumn)multiColumnHeader.GetColumn(columnIndex);
+ if (column.DrawCell != null)
+ column.DrawCell(cellRect, item);
+ }
+
+ public void OnCheckAllGUI()
+ {
+ var selectedList = this.GetSelection();
+ if (selectedList.Count != m_datas.Count)
+ {
+ isAllCheck = false;
+ }
+ var newState = GUI.Toggle(new Rect(5, 20, 50, 20), isAllCheck, "全选");
+ if (newState != isAllCheck)
+ {
+ isAllCheck = newState;
+ if (isAllCheck)
+ {
+ if (m_datas.Count != 0)
+ {
+ this.SelectAllRows();
+ }
+ } else
+ {
+ this.SetSelection(new List());
+ }
+ if (m_toggleSelectAll != null)
+ {
+ m_toggleSelectAll(isAllCheck);
+ }
+ }
+ }
+
+ public void OnFilterGUI(Rect r)
+ {
+ EditorGUI.BeginChangeCheck();
+ var width = r.width;
+ var num = 16f;
+ r.width = num;
+ r.x += num;
+ r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x;
+
+ //EditorGUI.LabelField(r, Styles.filterSelection);
+ r.width = Mathf.Min(width - (r.x + r.width), 300f);
+ r.x = width - r.width + 25;
+ FilterGUI(r);
+ if (EditorGUI.EndChangeCheck())
+ {
+ Reload();
+ }
+ }
+
+ private string m_text;
+ private void FilterGUI(Rect r)
+ {
+ r.width -= 15f;
+ //GUI.SetNextControlName("InputText");
+ m_text = EditorGUI.DelayedTextField(r, GUIContent.none, m_text, Styles.searchField);
+ //EditorGUI.FocusTextInControl("InputText");
+ r.x += r.width;
+ r.width = 15f;
+ bool flag = m_text != "";
+ if (GUI.Button(r, GUIContent.none, (!flag) ? Styles.searchFieldCancelButtonEmpty : Styles.searchFieldCancelButton) && flag)
+ {
+ m_text = "";
+ GUIUtility.keyboardControl = 0;
+ }
+ }
+
+ private bool IsColumnVisible(int idx)
+ {
+ return multiColumnHeader.state.visibleColumns.Any(t => t == idx);
+ }
+
+ protected override void KeyEvent()
+ {
+ if (Event.current.type == EventType.KeyDown)
+ {
+ if (Event.current.character == '\t')
+ {
+ GUI.FocusControl(Styles.focusHelper);
+ Event.current.Use();
+ }
+ }
+ }
+
+ protected override void SelectionChanged(IList selectedIds)
+ {
+ var datas = new List();
+ foreach (var id in selectedIds)
+ {
+ if (id < 0 || id > m_datas.Count)
+ {
+ Debug.Log(id + "out of range");
+ continue;
+ }
+ var data = m_datas[id];
+ datas.Add(data);
+ }
+ if (m_select != null)
+ m_select(datas);
+ }
+ }
+
+ public class CommonTableColumn : MultiColumnHeaderState.Column
+ {
+ public DrawCellMethod DrawCell;
+
+ //public IFilter Filter;
+ public CompareMethod Compare { get; set; }
+ }
+
+ //public interface IFilter
+ //{
+ // void OnGUI(Rect r);
+ //}
+
+ //public interface IFilter : IFilter
+ //{
+ // bool Filter(T prop);
+ //}
+
+ //public class StringFilter
+ //{
+ // [SerializeField]
+ // protected string m_Text = "";
+ // public void OnGUI(Rect r)
+ // {
+
+ // }
+
+ // public bool Filter(string prop)
+ // {
+ // return prop.IndexOf(m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0;
+ // }
+ //}
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs.meta
old mode 100755
new mode 100644
index fafb13da..501988ee
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeView.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 140f89fd874af114195925d1022b71a3
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 140f89fd874af114195925d1022b71a3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs
old mode 100755
new mode 100644
index 2c8bdad9..b8e659af
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs
@@ -1,15 +1,15 @@
-using UnityEditor.IMGUI.Controls;
-
-namespace WeChatWASM.Analysis
-{
- internal class CommonTreeViewItem : TreeViewItem where T : class
- {
- public T Data { get; private set; }
-
- public CommonTreeViewItem(int id, int depth, T data)
- : base(id, depth, data == null ? "Root" : data.ToString())
- {
- Data = data;
- }
- }
+using UnityEditor.IMGUI.Controls;
+
+namespace WeChatWASM.Analysis
+{
+ internal class CommonTreeViewItem : TreeViewItem where T : class
+ {
+ public T Data { get; private set; }
+
+ public CommonTreeViewItem(int id, int depth, T data)
+ : base(id, depth, data == null ? "Root" : data.ToString())
+ {
+ Data = data;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs.meta
old mode 100755
new mode 100644
index ac208ad3..f0458732
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/CommonTreeViewItem.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 6cc83ac7be086cb4fa205a6a463b7ab7
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 6cc83ac7be086cb4fa205a6a463b7ab7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs
old mode 100755
new mode 100644
index c0a68596..d90e43a1
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs
@@ -1,140 +1,140 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
-using System.Linq;
-using System;
-
-namespace WeChatWASM.Analysis
-{
- public class FontWindow : BaseWindow
- {
- private AssetDataTable m_table;
- private List selectedObjects;
- private List originalInfos;
- private List renderInfos;
-
- public class AssetDataTable : CommonTable
- {
- public AssetDataTable(List datas,
- CommonTableColumn[] cs,
- FilterMethod onfilter,
- SelectMethod onselect = null)
- : base(datas, cs, onfilter, onselect)
- {
- }
- }
-
- public FontWindow() : base()
- {
- if (m_table == null)
- {
- var datas = new List();
- var cols = GetViewColumn();
- m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
- }
- }
-
- public CommonTableColumn[] GetViewColumn()
- {
- var cols = new CommonTableColumn[]
- {
- new CommonTableColumn
- {
- headerContent = new GUIContent("name"),
- canSort = true,
- minWidth = 170,
- width = 170,
- Compare = (a,b) => -a.name.CompareTo(b.name),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
- },
- new CommonTableColumn
- {
- headerContent = new GUIContent("path"),
- canSort = true,
- minWidth = 350,
- width = 350,
- Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
- }
- };
-
- return cols;
- }
-
- public void OnRowSelect(List datas)
- {
- currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
- selectedObjects = new List(datas);
- var list = new List();
- }
-
- private bool OnFilter(FontInfo data, string std)
- {
- string name = std;
- if (name.Length == 0)
- {
- return true;
- }
- return data.name.ToLower().IndexOf(name.ToLower()) > -1;
- }
-
- public override void RefreshTable()
- {
- if (needUpdateMainContent)
- {
- needUpdateMainContent = false;
- var cols = GetViewColumn();
- m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
- }
- m_table.OnGUI();
- }
-
- public override void DrawOptionArea()
- {
- GUILayout.Space(40);
- if (GUILayout.Button("搜索字体文件", GUILayout.Width(160), GUILayout.Height(40)))
- {
- CollectAssets();
- }
- }
-
- public void CollectAssets(Boolean needRefreshCurrentFolder = true)
- {
- if (needRefreshCurrentFolder)
- {
- this.currentFolder = GetCurrentFolder();
- }
- originalInfos = new List();
- var guids = AssetDatabase.FindAssets("t:font", new[] { this.currentFolder });
- var count = guids.Length;
- var current = 0;
- foreach (string guid in guids)
- {
- current++;
- EditorUtility.DisplayCancelableProgressBar("search font", "searching " + current, (float)current / count);
- var obj = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
- var filePath = AssetDatabase.GetAssetPath(obj);
- originalInfos.Add(new FontInfo(obj, filePath));
- }
-
- EditorUtility.ClearProgressBar();
-
- renderInfos = new List(originalInfos);
-
- needUpdateMainContent = true;
- Selection.objects = null;
- }
- }
-
- public class FontInfo
- {
- public string assetPath;
- public string name;
-
- public FontInfo(Font info, string assetPath)
- {
- this.assetPath = assetPath;
- this.name = info.name;
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System.Collections.Generic;
+using System.Linq;
+using System;
+
+namespace WeChatWASM.Analysis
+{
+ public class FontWindow : BaseWindow
+ {
+ private AssetDataTable m_table;
+ private List selectedObjects;
+ private List originalInfos;
+ private List renderInfos;
+
+ public class AssetDataTable : CommonTable
+ {
+ public AssetDataTable(List datas,
+ CommonTableColumn[] cs,
+ FilterMethod onfilter,
+ SelectMethod onselect = null)
+ : base(datas, cs, onfilter, onselect)
+ {
+ }
+ }
+
+ public FontWindow() : base()
+ {
+ if (m_table == null)
+ {
+ var datas = new List();
+ var cols = GetViewColumn();
+ m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
+ }
+ }
+
+ public CommonTableColumn[] GetViewColumn()
+ {
+ var cols = new CommonTableColumn[]
+ {
+ new CommonTableColumn
+ {
+ headerContent = new GUIContent("name"),
+ canSort = true,
+ minWidth = 170,
+ width = 170,
+ Compare = (a,b) => -a.name.CompareTo(b.name),
+ DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
+ },
+ new CommonTableColumn
+ {
+ headerContent = new GUIContent("path"),
+ canSort = true,
+ minWidth = 350,
+ width = 350,
+ Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
+ DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
+ }
+ };
+
+ return cols;
+ }
+
+ public void OnRowSelect(List datas)
+ {
+ currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
+ selectedObjects = new List(datas);
+ var list = new List();
+ }
+
+ private bool OnFilter(FontInfo data, string std)
+ {
+ string name = std;
+ if (name.Length == 0)
+ {
+ return true;
+ }
+ return data.name.ToLower().IndexOf(name.ToLower()) > -1;
+ }
+
+ public override void RefreshTable()
+ {
+ if (needUpdateMainContent)
+ {
+ needUpdateMainContent = false;
+ var cols = GetViewColumn();
+ m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
+ }
+ m_table.OnGUI();
+ }
+
+ public override void DrawOptionArea()
+ {
+ GUILayout.Space(40);
+ if (GUILayout.Button("搜索字体文件", GUILayout.Width(160), GUILayout.Height(40)))
+ {
+ CollectAssets();
+ }
+ }
+
+ public void CollectAssets(Boolean needRefreshCurrentFolder = true)
+ {
+ if (needRefreshCurrentFolder)
+ {
+ this.currentFolder = GetCurrentFolder();
+ }
+ originalInfos = new List();
+ var guids = AssetDatabase.FindAssets("t:font", new[] { this.currentFolder });
+ var count = guids.Length;
+ var current = 0;
+ foreach (string guid in guids)
+ {
+ current++;
+ EditorUtility.DisplayCancelableProgressBar("search font", "searching " + current, (float)current / count);
+ var obj = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
+ var filePath = AssetDatabase.GetAssetPath(obj);
+ originalInfos.Add(new FontInfo(obj, filePath));
+ }
+
+ EditorUtility.ClearProgressBar();
+
+ renderInfos = new List(originalInfos);
+
+ needUpdateMainContent = true;
+ Selection.objects = null;
+ }
+ }
+
+ public class FontInfo
+ {
+ public string assetPath;
+ public string name;
+
+ public FontInfo(Font info, string assetPath)
+ {
+ this.assetPath = assetPath;
+ this.name = info.name;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs.meta
old mode 100755
new mode 100644
index feefe18e..7514cf42
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/FontWindow.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 8778b602782fa0845bc139a7683d43f9
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 8778b602782fa0845bc139a7683d43f9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs
old mode 100755
new mode 100644
index c83bc989..0c73232a
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs
@@ -1,65 +1,65 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
-using UnityEngine.Profiling;
-using System;
-using UnityEditor.IMGUI.Controls;
-using System.IO;
-using System.Linq;
-using System.Runtime.Serialization.Formatters.Binary;
-
-namespace WeChatWASM.Analysis
-{
- public class OptimizeOverview
- {
- private EditorWindow win;
- // 单例
- private static OptimizeOverview instance;
- private static readonly object locker = new object();
-
- private OptimizeOverview()
- {
- win = AnalysisWindow.GetCurrentWindow();
- }
-
- public static OptimizeOverview GetInstance()
- {
- lock (locker)
- {
- if (instance == null)
- {
- instance = new OptimizeOverview();
- }
- }
- return instance;
- }
-
- public void Show()
- {
- GUILayout.BeginHorizontal();
- if (GUILayout.Button("检查资源", GUILayout.Width(140), GUILayout.Height(40)))
- {
- GetOverview();
- }
- GUILayout.EndHorizontal();
-
- //DrawOverview();
- }
-
- public void GetOverview()
- {
- var textureWindow = TextureWindow.GetInstance();
- textureWindow.CollectAssets();
- }
-
- public void DrawOverview()
- {
- GUILayout.BeginVertical();
-
- var textureWindow = TextureWindow.GetInstance();
-
-
- GUILayout.EndVertical();
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System.Collections.Generic;
+using UnityEngine.Profiling;
+using System;
+using UnityEditor.IMGUI.Controls;
+using System.IO;
+using System.Linq;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace WeChatWASM.Analysis
+{
+ public class OptimizeOverview
+ {
+ private EditorWindow win;
+ // 单例
+ private static OptimizeOverview instance;
+ private static readonly object locker = new object();
+
+ private OptimizeOverview()
+ {
+ win = AnalysisWindow.GetCurrentWindow();
+ }
+
+ public static OptimizeOverview GetInstance()
+ {
+ lock (locker)
+ {
+ if (instance == null)
+ {
+ instance = new OptimizeOverview();
+ }
+ }
+ return instance;
+ }
+
+ public void Show()
+ {
+ GUILayout.BeginHorizontal();
+ if (GUILayout.Button("检查资源", GUILayout.Width(140), GUILayout.Height(40)))
+ {
+ GetOverview();
+ }
+ GUILayout.EndHorizontal();
+
+ //DrawOverview();
+ }
+
+ public void GetOverview()
+ {
+ var textureWindow = TextureWindow.GetInstance();
+ textureWindow.CollectAssets();
+ }
+
+ public void DrawOverview()
+ {
+ GUILayout.BeginVertical();
+
+ var textureWindow = TextureWindow.GetInstance();
+
+
+ GUILayout.EndVertical();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs.meta
old mode 100755
new mode 100644
index e177cd46..0b2878f9
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeOverview.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 18cb6224e95e79540ad2fdc8626616de
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 18cb6224e95e79540ad2fdc8626616de
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs
old mode 100755
new mode 100644
index 92d1ada2..4c7f6fba
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs
@@ -1,234 +1,234 @@
-using UnityEngine;
-using UnityEditor;
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Runtime.Serialization.Formatters.Binary;
-
-namespace WeChatWASM.Analysis
-{
- public static class OptimizeTexture
- {
- static string CACHE_PATH = "Library/AssetImporterbak";
- public static Boolean CheckNeedOptimization(Texture texture, out TextureImporter textureImporter)
- {
- var textureWindow = TextureWindow.GetInstance();
- string path = AssetDatabase.GetAssetPath(texture);
- textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
- if (!textureImporter || !texture)
- {
- return false;
- }
- var _info = textureImporter.GetPlatformTextureSettings("WebGL");
- if (textureWindow.checkMipMap)
- {
- if (!textureImporter.mipmapEnabled)
- {
- return false;
- }
- }
- if (textureWindow.formatError)
- {
- var list = new List() { TextureImporterFormat.DXT5, TextureImporterFormat.DXT5Crunched, TextureImporterFormat.DXT1, TextureImporterFormat.DXT1Crunched };
- var format = _info.format == TextureImporterFormat.Automatic ? textureImporter.GetAutomaticFormat("WebGL") : _info.format;
- if (!(!IsPowerOfTwo(texture.width) || !IsPowerOfTwo(texture.height)))
- {
- return false;
- }
- }
- if (textureWindow.checkIsReadable)
- {
- if (!textureImporter.isReadable)
- {
- return false;
- }
- }
- if (textureWindow.checkMaxSize)
- {
- if (!(_info.maxTextureSize >= 512))
- {
- return false;
- }
- }
- return true;
- }
-
- static bool IsPowerOfTwo(int x)
- {
- return (x & (x - 1)) == 0;
- }
-
- public static void Optimize(List textureInfos)
- {
- RecordSettings(textureInfos);
- var textureWindow = TextureWindow.GetInstance();
- var totalCount = textureInfos.Count;
- var idx = 0;
- var changedTextures = new List();
- foreach (var info in textureInfos)
- {
- idx++;
- TextureImporter textureImporter = AssetImporter.GetAtPath(info.assetPath) as TextureImporter;
- TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
- settings.overridden = true;
- int maxRect = Math.Max(info.width, info.height) / 2;
- var needReImport = false;
- if (textureWindow.disableReadable)
- {
- needReImport = true;
- textureImporter.isReadable = false;
- }
- if (textureWindow.disableMipmap)
- {
- needReImport = true;
- textureImporter.mipmapEnabled = false;
- }
- if (textureWindow.changeMaxSize)
- {
- needReImport = true;
- if (textureWindow.selectedMaxSizeIdx == 0)
- {
- settings.maxTextureSize = getMaxSize(maxRect);
- //textureImporter.maxTextureSize = getMaxSize(maxRect);
- }
- else
- {
- settings.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
- //textureImporter.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
- }
- }
- if (textureWindow.changeFormat)
- {
- needReImport = true;
- var formatMap = textureWindow.formatMap;
- var list = new List(formatMap.Keys);
- var i = textureWindow.textureFormatSelected;
- TextureImporterFormat format = formatMap[list[i]];
- settings.name = "WebGL";
- settings.format = format;
-
- }
- if (needReImport)
- {
- var tex = AssetDatabase.LoadAssetAtPath(info.assetPath);
- changedTextures.Add(tex);
- EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + idx, (float)idx / totalCount);
- textureImporter.SetPlatformTextureSettings(settings);
- textureImporter.SaveAndReimport();
- AssetDatabase.ImportAsset(info.assetPath);
- }
- }
- //Undo.RecordObjects(changedTextures.ToArray(), "optimize");
- EditorUtility.ClearProgressBar();
- }
-
- private static int getMaxSize(int size)
- {
- if (size <= 32)
- {
- return 32;
- }
- else if (size > 32 && size <= 64)
- {
- return 64;
- }
- else if (size > 64 && size <= 128)
- {
- return 128;
- }
- else if (size > 128 && size <= 256)
- {
- return 256;
- }
- else if (size > 256 && size <= 512)
- {
- return 512;
- }
- else if (size > 512 && size <= 1024)
- {
- return 1024;
- }
- return 1024;
- }
-
- public static void RecordSettings(List textureInfos)
- {
- if (textureInfos.Count == 0)
- {
- return;
- }
- if (File.Exists(CACHE_PATH))
- {
- File.Delete(CACHE_PATH);
- }
- var guids = new List();
- var importsettings = new List();
- foreach (var info in textureInfos)
- {
- var textInfo = new BaseInfo();
- textInfo.assetPath = info.assetPath;
- textInfo.maxTextureSize = info.maxTextureSize;
- textInfo.mipmapEnabled = info.mipmapEnabled;
- textInfo.isReadable = info.isReadable;
- textInfo._webglFormat = info._webglFormat;
- guids.Add(AssetDatabase.AssetPathToGUID(info.assetPath));
- importsettings.Add(textInfo);
- }
- using (FileStream fs = File.OpenWrite(CACHE_PATH))
- {
- BinaryFormatter bf = new BinaryFormatter();
- bf.Serialize(fs, guids);
- bf.Serialize(fs, importsettings);
- }
- }
-
- public static void Recover(List textureInfos)
- {
- if (File.Exists(CACHE_PATH))
- {
- var guids = new List();
- var importSettings = new List();
- using (FileStream fs = File.OpenRead(CACHE_PATH))
- {
- BinaryFormatter bf = new BinaryFormatter();
- guids = (List)bf.Deserialize(fs);
- importSettings = (List)bf.Deserialize(fs);
- }
-
- var totalCount = textureInfos.Count;
- for (int i = 0; i < totalCount; i++)
- {
- string path = textureInfos[i].assetPath;
- if (!string.IsNullOrEmpty(path))
- {
- TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
- EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + i, (float)i / totalCount);
- TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
- BaseInfo info = importSettings[i];
- textureImporter.maxTextureSize = info.maxTextureSize;
- textureImporter.mipmapEnabled = info.mipmapEnabled;
- textureImporter.isReadable = info.isReadable;
- settings.name = "WebGL";
- settings.format = info._webglFormat;
- textureImporter.SetPlatformTextureSettings(settings);
- textureImporter.SaveAndReimport();
- AssetDatabase.ImportAsset(path);
- }
- }
- File.Delete(CACHE_PATH);
- EditorUtility.ClearProgressBar();
- }
- //Debug.Log("call undo");
-
- //var list = new List();
- //foreach (var data in textureInfos)
- //{
- // var texture = data.texture;
- // list.Add(texture);
- //}
- //Selection.objects = list.ToArray();
-
- //Undo.PerformUndo();
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace WeChatWASM.Analysis
+{
+ public static class OptimizeTexture
+ {
+ static string CACHE_PATH = "Library/AssetImporterbak";
+ public static Boolean CheckNeedOptimization(Texture texture, out TextureImporter textureImporter)
+ {
+ var textureWindow = TextureWindow.GetInstance();
+ string path = AssetDatabase.GetAssetPath(texture);
+ textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
+ if (!textureImporter || !texture)
+ {
+ return false;
+ }
+ var _info = textureImporter.GetPlatformTextureSettings("WebGL");
+ if (textureWindow.checkMipMap)
+ {
+ if (!textureImporter.mipmapEnabled)
+ {
+ return false;
+ }
+ }
+ if (textureWindow.formatError)
+ {
+ var list = new List() { TextureImporterFormat.DXT5, TextureImporterFormat.DXT5Crunched, TextureImporterFormat.DXT1, TextureImporterFormat.DXT1Crunched };
+ var format = _info.format == TextureImporterFormat.Automatic ? textureImporter.GetAutomaticFormat("WebGL") : _info.format;
+ if (!(!IsPowerOfTwo(texture.width) || !IsPowerOfTwo(texture.height)))
+ {
+ return false;
+ }
+ }
+ if (textureWindow.checkIsReadable)
+ {
+ if (!textureImporter.isReadable)
+ {
+ return false;
+ }
+ }
+ if (textureWindow.checkMaxSize)
+ {
+ if (!(_info.maxTextureSize >= 512))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static bool IsPowerOfTwo(int x)
+ {
+ return (x & (x - 1)) == 0;
+ }
+
+ public static void Optimize(List textureInfos)
+ {
+ RecordSettings(textureInfos);
+ var textureWindow = TextureWindow.GetInstance();
+ var totalCount = textureInfos.Count;
+ var idx = 0;
+ var changedTextures = new List();
+ foreach (var info in textureInfos)
+ {
+ idx++;
+ TextureImporter textureImporter = AssetImporter.GetAtPath(info.assetPath) as TextureImporter;
+ TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
+ settings.overridden = true;
+ int maxRect = Math.Max(info.width, info.height) / 2;
+ var needReImport = false;
+ if (textureWindow.disableReadable)
+ {
+ needReImport = true;
+ textureImporter.isReadable = false;
+ }
+ if (textureWindow.disableMipmap)
+ {
+ needReImport = true;
+ textureImporter.mipmapEnabled = false;
+ }
+ if (textureWindow.changeMaxSize)
+ {
+ needReImport = true;
+ if (textureWindow.selectedMaxSizeIdx == 0)
+ {
+ settings.maxTextureSize = getMaxSize(maxRect);
+ //textureImporter.maxTextureSize = getMaxSize(maxRect);
+ }
+ else
+ {
+ settings.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
+ //textureImporter.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
+ }
+ }
+ if (textureWindow.changeFormat)
+ {
+ needReImport = true;
+ var formatMap = textureWindow.formatMap;
+ var list = new List(formatMap.Keys);
+ var i = textureWindow.textureFormatSelected;
+ TextureImporterFormat format = formatMap[list[i]];
+ settings.name = "WebGL";
+ settings.format = format;
+
+ }
+ if (needReImport)
+ {
+ var tex = AssetDatabase.LoadAssetAtPath(info.assetPath);
+ changedTextures.Add(tex);
+ EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + idx, (float)idx / totalCount);
+ textureImporter.SetPlatformTextureSettings(settings);
+ textureImporter.SaveAndReimport();
+ AssetDatabase.ImportAsset(info.assetPath);
+ }
+ }
+ //Undo.RecordObjects(changedTextures.ToArray(), "optimize");
+ EditorUtility.ClearProgressBar();
+ }
+
+ private static int getMaxSize(int size)
+ {
+ if (size <= 32)
+ {
+ return 32;
+ }
+ else if (size > 32 && size <= 64)
+ {
+ return 64;
+ }
+ else if (size > 64 && size <= 128)
+ {
+ return 128;
+ }
+ else if (size > 128 && size <= 256)
+ {
+ return 256;
+ }
+ else if (size > 256 && size <= 512)
+ {
+ return 512;
+ }
+ else if (size > 512 && size <= 1024)
+ {
+ return 1024;
+ }
+ return 1024;
+ }
+
+ public static void RecordSettings(List textureInfos)
+ {
+ if (textureInfos.Count == 0)
+ {
+ return;
+ }
+ if (File.Exists(CACHE_PATH))
+ {
+ File.Delete(CACHE_PATH);
+ }
+ var guids = new List();
+ var importsettings = new List();
+ foreach (var info in textureInfos)
+ {
+ var textInfo = new BaseInfo();
+ textInfo.assetPath = info.assetPath;
+ textInfo.maxTextureSize = info.maxTextureSize;
+ textInfo.mipmapEnabled = info.mipmapEnabled;
+ textInfo.isReadable = info.isReadable;
+ textInfo._webglFormat = info._webglFormat;
+ guids.Add(AssetDatabase.AssetPathToGUID(info.assetPath));
+ importsettings.Add(textInfo);
+ }
+ using (FileStream fs = File.OpenWrite(CACHE_PATH))
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ bf.Serialize(fs, guids);
+ bf.Serialize(fs, importsettings);
+ }
+ }
+
+ public static void Recover(List textureInfos)
+ {
+ if (File.Exists(CACHE_PATH))
+ {
+ var guids = new List();
+ var importSettings = new List();
+ using (FileStream fs = File.OpenRead(CACHE_PATH))
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ guids = (List)bf.Deserialize(fs);
+ importSettings = (List)bf.Deserialize(fs);
+ }
+
+ var totalCount = textureInfos.Count;
+ for (int i = 0; i < totalCount; i++)
+ {
+ string path = textureInfos[i].assetPath;
+ if (!string.IsNullOrEmpty(path))
+ {
+ TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
+ EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + i, (float)i / totalCount);
+ TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
+ BaseInfo info = importSettings[i];
+ textureImporter.maxTextureSize = info.maxTextureSize;
+ textureImporter.mipmapEnabled = info.mipmapEnabled;
+ textureImporter.isReadable = info.isReadable;
+ settings.name = "WebGL";
+ settings.format = info._webglFormat;
+ textureImporter.SetPlatformTextureSettings(settings);
+ textureImporter.SaveAndReimport();
+ AssetDatabase.ImportAsset(path);
+ }
+ }
+ File.Delete(CACHE_PATH);
+ EditorUtility.ClearProgressBar();
+ }
+ //Debug.Log("call undo");
+
+ //var list = new List();
+ //foreach (var data in textureInfos)
+ //{
+ // var texture = data.texture;
+ // list.Add(texture);
+ //}
+ //Selection.objects = list.ToArray();
+
+ //Undo.PerformUndo();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs.meta b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs.meta
old mode 100755
new mode 100644
index 2a576729..4b4184f9
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs.meta
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/OptimizeTexture.cs.meta
@@ -1,11 +1,11 @@
-fileFormatVersion: 2
-guid: 369d620a6ebd49d48b655b7f71fa0cd9
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
+fileFormatVersion: 2
+guid: 369d620a6ebd49d48b655b7f71fa0cd9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/PrefabWindow.cs b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/PrefabWindow.cs
old mode 100755
new mode 100644
index 18c9e1e3..1959480d
--- a/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/PrefabWindow.cs
+++ b/Assets/WX-WASM-SDK/Editor/MinigameAssetAnalysis/PrefabWindow.cs
@@ -1,153 +1,153 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
-using System.Linq;
-using System;
-
-namespace WeChatWASM.Analysis
-{
- public class PrefabWindow : BaseWindow
- {
- private AssetDataTable m_table;
- private List selectedObjects;
- private List originalInfos;
- private List renderInfos;
-
- public class AssetDataTable : CommonTable
- {
- public AssetDataTable(List datas,
- CommonTableColumn[] cs,
- FilterMethod onfilter,
- SelectMethod onselect = null)
- : base(datas, cs, onfilter, onselect)
- {
- }
- }
-
- public PrefabWindow() : base()
- {
- if (m_table == null)
- {
- var datas = new List();
- var cols = GetViewColumn();
- m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
- }
- }
-
- public CommonTableColumn[] GetViewColumn()
- {
- var cols = new CommonTableColumn[]
- {
- new CommonTableColumn
- {
- headerContent = new GUIContent("name"),
- canSort = true,
- minWidth = 210,
- width = 210,
- Compare = (a,b) => -a.name.CompareTo(b.name),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
- },
- new CommonTableColumn
- {
- headerContent = new GUIContent("path"),
- canSort = true,
- minWidth = 650,
- width = 650,
- Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
- DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
- }
- };
-
- return cols;
- }
-
- public void OnRowSelect(List datas)
- {
- currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
- selectedObjects = new List(datas);
- var list = new List();
- foreach (var data in datas)
- {
- var info = data._info;
- list.Add(info);
- }
- Selection.objects = list.ToArray();
- }
-
- private bool OnFilter(PrefabInfo data, string std)
- {
- string name = std;
- if (name.Length == 0)
- {
- return true;
- }
- return data.name.ToLower().IndexOf(name.ToLower()) > -1;
- }
-
- public override void RefreshTable()
- {
- if (needUpdateMainContent)
- {
- needUpdateMainContent = false;
- var cols = GetViewColumn();
- m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
- }
- m_table.OnGUI();
- }
-
- public override void DrawOptionArea()
- {
- GUILayout.Space(40);
- if (GUILayout.Button("搜索prefab", GUILayout.Width(160), GUILayout.Height(40)))
- {
- CollectAssets();
- }
- }
-
- public void CollectAssets(Boolean needRefreshCurrentFolder = true)
- {
- if (needRefreshCurrentFolder)
- {
- this.currentFolder = GetCurrentFolder();
- }
-
- originalInfos = new List();
- var guids = AssetDatabase.FindAssets("t:prefab", new[] { this.currentFolder });
- var count = guids.Length;
- var current = 0;
- foreach (string guid in guids)
- {
- current++;
- EditorUtility.DisplayCancelableProgressBar("search prefab", "searching " + current, (float)current / count);
- var obj = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
- PrefabAssetType pType = PrefabUtility.GetPrefabAssetType(obj);
- if (pType == PrefabAssetType.Regular)
- {
- var filePath = AssetDatabase.GetAssetPath(obj);
- originalInfos.Add(new PrefabInfo(obj, filePath));
- }
- }
-
- EditorUtility.ClearProgressBar();
-
- renderInfos = new List(originalInfos);
-
- needUpdateMainContent = true;
- Selection.objects = null;
- }
- }
-
- public class PrefabInfo
- {
- public string assetPath;
- public string name;
- public GameObject _info;
-
- public PrefabInfo(GameObject info, string assetPath)
- {
- this._info = info;
- this.assetPath = assetPath;
- this.name = info.name;
- }
- }
+using UnityEngine;
+using UnityEditor;
+using System.Collections.Generic;
+using System.Linq;
+using System;
+
+namespace WeChatWASM.Analysis
+{
+ public class PrefabWindow : BaseWindow
+ {
+ private AssetDataTable m_table;
+ private List selectedObjects;
+ private List