update wx sdk

This commit is contained in:
zhangjie0072 2022-08-01 11:47:37 +08:00
parent dc47e1dfd2
commit f2fcd1aa8f
416 changed files with 134554 additions and 133968 deletions

880
Assets/WX-WASM-SDK/CHANGELOG.md Executable file → Normal file
View File

@ -1,435 +1,445 @@
<!-- <!--
Added 新增功能/接口 Feature 新增功能/接口
Changed - 功能/接口变更 Changed - 功能/接口变更
Deprecated - 不建议使用的功能/接口 Deprecated - 不建议使用的功能/接口
Removed - 删除功能/接口 Removed - 删除功能/接口
Fixed - 修复问题 Fixed - 修复问题
Others - 其他 Others - 其他
--> -->
## 2022-7-14 ## 2022-7-28
### Fixed ### Feature
* 转换面板的最大内存提示与指引优化 * 增加UDP接口能力
* WebGL导出失败时不进行小游戏转换 ## 2022-7-20
* 非playing状态调用WX接口的告警提示 ### Feature
## 2022-7-1 * 增加重启小游戏的API支持
### Fixed ### Fixed
* 开发阶段没显示耗时弹框 * 纹理压缩并行下载完成未正常显示
* 21.3unity服务器错误且无跨域头导致报错 ### Added
## 2022-6-30 * 设置启动时是否自动检查小游戏版本更新
### Fixed ## 2022-7-14
* 压缩纹理工具逻辑异常,增加进度条 ### Fixed
* 完善限帧率接口SetPreferredFramesPerSecond * 转换面板的最大内存提示与指引优化
* WebGL导出失败时不进行小游戏转换
## 2022-6-28 * 非playing状态调用WX接口的告警提示
### Feature ## 2022-7-1
* 导出插件的brotli压缩不依赖python环境 ### Fixed
### Fixed * 开发阶段没显示耗时弹框
* 压缩纹理工具独立命名避免有NuGet产生dll冲突 * 21.3unity服务器错误且无跨域头导致报错
## 2022-6-30
## 2022-6-18 ### Fixed
### Fixed * 压缩纹理工具逻辑异常,增加进度条
* 小游戏模板错误 * 完善限帧率接口SetPreferredFramesPerSecond
## 2022-6-16
### Added ## 2022-6-28
* 支持自定义可缓存文件及可清理文件 ### Feature
* 优化缓存目录统计 * 导出插件的brotli压缩不依赖python环境
### Fixed
### Fixed * 压缩纹理工具独立命名避免有NuGet产生dll冲突
* 21.3unity在iOS上网络报错
## 2022-6-13 ## 2022-6-18
### Fixed ### Fixed
* `RemoveFile`参数转字符串 * 小游戏模板错误
* 8.0.16安卓worker写文件报错 ## 2022-6-16
## 2022-6-8 ### Added
### Added * 支持自定义可缓存文件及可清理文件
* 提供Loader启动数据 * 优化缓存目录统计
### Fixed ### Fixed
* 修复是否需要下载代码包上报 * 21.3unity在iOS上网络报错
* 21.3版本Unity webrequest设置请求头注册进度事件 ## 2022-6-13
## 2022-6-7 ### Fixed
### Added * `RemoveFile`参数转字符串
* 增加MemoryProfiler开发阶段分析内存 * 8.0.16安卓worker写文件报错
## 2022-6-8
## 2022-6-1 ### Added
### Added * 提供Loader启动数据
* 使用worker做文件写入临时绕过安卓文件写入多时造成卡顿
## 2022-5-31 ### Fixed
### Added * 修复是否需要下载代码包上报
* 暴露插件进度事件 * 21.3版本Unity webrequest设置请求头注册进度事件
## 2022-5-30 ## 2022-6-7
### Fixed ### Added
* pc小游戏首包资源通过分包加载时读取失败 * 增加MemoryProfiler开发阶段分析内存
## 2022-5-26
### Changed ## 2022-6-1
* 默认关闭纹理缓存,影响安卓帧率 ### Added
* 使用worker做文件写入临时绕过安卓文件写入多时造成卡顿
### Fixed ## 2022-5-31
* 修复21.3替换规则 ### Added
## 2022-5-24 * 暴露插件进度事件
### Added ## 2022-5-30
* 增加对21.3版本unity支持 ### Fixed
* MiniGameConfig.asset增加不常用配置入口 * pc小游戏首包资源通过分包加载时读取失败
## 2022-4-29 ## 2022-5-26
### Fixed ### Changed
* 通过分包加载资源时读取bug * 默认关闭纹理缓存,影响安卓帧率
## 2022-4-26 ### Fixed
### Fixed * 修复21.3替换规则
* 带`dataFileSubPrefix`时iOS首包资源下载bug ## 2022-5-24
### Added
### Added * 增加对21.3版本unity支持
* 游戏异常时增加重启游戏按钮 * MiniGameConfig.asset增加不常用配置入口
* 检查是否32位微信导致无法进入游戏 ## 2022-4-29
* 修正URL中非法路径 ### Fixed
## 2022-4-24 * 通过分包加载资源时读取bug
### Fixed
更新独立域插件版本`1.0.60` ## 2022-4-26
* 达缓存上限时未正常清理旧缓存 ### Fixed
* 1.0.58版本插件iOS报错 * 带`dataFileSubPrefix`时iOS首包资源下载bug
## 2022-4-22
### Added
### Fixed * 游戏异常时增加重启游戏按钮
更新独立域插件版本`1.0.58` * 检查是否32位微信导致无法进入游戏
* 预下载问题路径bug * 修正URL中非法路径
* 不支持webgl2时提示 ## 2022-4-24
### Added ### Fixed
* 增加清理指定文件接口`RemoveFile` 更新独立域插件版本`1.0.60`
* 是否缓存纹理开关 * 达缓存上限时未正常清理旧缓存
* 1.0.58版本插件iOS报错
## 2022-4-18 ## 2022-4-22
### Added
* 修改文件删除接口使用方法`CleanFileCache`,`CleanAllFileCache` ### Fixed
## 2022-4-14 更新独立域插件版本`1.0.58`
### Added * 预下载问题路径bug
* 增加清除文件缓存接口`CleanFileCache` * 不支持webgl2时提示
### Added
## 2022-4-11 * 增加清理指定文件接口`RemoveFile`
### Changed * 是否缓存纹理开关
* 2021版本调整为需要手动分离symbols由于Unity自身产生的symbols存在缺失问题
* 增加CleaStreamingAssets选项控制是否清理webgl/StreamingAssets ## 2022-4-18
### Added
## 2022-3-29 * 修改文件删除接口使用方法`CleanFileCache`,`CleanAllFileCache`
### Changed ## 2022-4-14
* 更新插件版本为1.0.53 ### Added
* `streamingUrlSubPath`支持传自定义拼接到streamingcdn后面的路径 * 增加清除文件缓存接口`CleanFileCache`
* iOS不支持webgl2时提示
## 2022-4-11
## 2022-3-22 ### Changed
### Changed * 2021版本调整为需要手动分离symbols由于Unity自身产生的symbols存在缺失问题
* 更新压缩纹理工具使用方式 * 增加CleaStreamingAssets选项控制是否清理webgl/StreamingAssets
## 2022-3-7 ## 2022-3-29
### Changed ### Changed
* 更新独立域插件版本为1.0.51 * 更新插件版本为1.0.53
* 预载列表按照填写顺序生成 * `streamingUrlSubPath`支持传自定义拼接到streamingcdn后面的路径
* Unity2021不再提示分离symbols2021.2.11以后版本已支持 * iOS不支持webgl2时提示
* Pointer_stringify导致的浏览器告警
## 2022-3-22
## 2022-3-7 ### Changed
### Changed * 更新压缩纹理工具使用方式
* 更新独立域插件版本为1.0.50
## 2022-3-7
## 2022-2-17 ### Changed
### Changed * 更新独立域插件版本为1.0.51
* 更新独立域插件版本 * 预载列表按照填写顺序生成
* 增加日志输出 * Unity2021不再提示分离symbols2021.2.11以后版本已支持
* 限帧时禁用后台执行Loop * Pointer_stringify导致的浏览器告警
## 2022-2-15 ## 2022-3-7
### Fixed ### Changed
* UnityAudio循环播放修复 * 更新独立域插件版本为1.0.50
* 2021版本修改为默认使用External Symbols(需升级Unity到2021.2.11以上)
* PlayerSettings默认去除"Run In Background" ## 2022-2-17
### Changed
## 2022-2-14 * 更新独立域插件版本
### Added * 增加日志输出
* 支持PC端DXT5压缩纹理 * 限帧时禁用后台执行Loop
## 2022-2-11 ## 2022-2-15
### Added ### Fixed
* 调整部分API * UnityAudio循环播放修复
* 支持webgl2.0的压缩纹理 * 2021版本修改为默认使用External Symbols(需升级Unity到2021.2.11以上)
* PlayerSettings默认去除"Run In Background"
## 2022-1-26
### Added ## 2022-2-14
* 新增API ### Added
* 修复API中不确定类型的数据可能导致类型转换失败的问题 * 支持PC端DXT5压缩纹理
## 2022-1-25 ## 2022-2-11
### Fixed ### Added
* 修复Login方法默认不传timeout默认超时为1000ms容易失败的问题 * 调整部分API
* 支持webgl2.0的压缩纹理
## 2022-1-24
### Added ## 2022-1-26
* 兼容浏览器环境修复部分API问题 ### Added
* 新增API
## 2022-1-21 * 修复API中不确定类型的数据可能导致类型转换失败的问题
### Added
* 新增WXCleanAllFileCache接口用于清理所有文件缓存 ## 2022-1-25
### Fixed
### Changed * 修复Login方法默认不传timeout默认超时为1000ms容易失败的问题
* 独立域插件版本更新到1.0.46,包含以下修改
1. 自动清理存量旧文件 ## 2022-1-24
2. 达到缓存上限时清理更多空间具体值可通过minigame/unity-namespace.js中releaseMemorySize修改 ### Added
3. 上报unity版本和转换插件版本 * 兼容浏览器环境修复部分API问题
4. 支持以文件名全匹配的方式忽略缓存
5. 插件错误报实时日志 ## 2022-1-21
6. pc小游戏兼容 ### Added
* 新增WXCleanAllFileCache接口用于清理所有文件缓存
## 2022-1-20
### Changed
### Added * 独立域插件版本更新到1.0.46,包含以下修改
* 新增API旧API批量重命名用法保持不变 1. 自动清理存量旧文件
2. 达到缓存上限时清理更多空间具体值可通过minigame/unity-namespace.js中releaseMemorySize修改
## 2022-1-17 3. 上报unity版本和转换插件版本
### Fixed 4. 支持以文件名全匹配的方式忽略缓存
* 同名文件缓存未清理 5. 插件错误报实时日志
6. pc小游戏兼容
### Changed
* 版本限制条件更新 ## 2022-1-20
## 2022-1-13 ### Added
### Fixed * 新增API旧API批量重命名用法保持不变
* Unity Audio能力适配, 不支持设备兼容处理; 退后台暂停播放音频; 性能提升 ## 2022-1-17
### Fixed
## 2022-1-7 * 同名文件缓存未清理
### Fixed
### Changed
* Unity Audio能力适配 * 版本限制条件更新
* Unity Input Touch能力适配
## 2022-1-13
## 2021-12-31 ### Fixed
### Fixed
* Unity Audio能力适配, 不支持设备兼容处理; 退后台暂停播放音频; 性能提升
* 调整为默认不打开性能面板单独提供WX.OpenProfileStats
## 2022-1-7
## 2021-12-30 ### Fixed
### Fixed * Unity Audio能力适配
* 修复引擎初始化失败后依然回调calledMainCb导致统计问题 * Unity Input Touch能力适配
* 修复2021版本abort时执行WXUncaughtException
* 补充小程序框架异常时上报实时日志 ## 2021-12-31
### Fixed
## 2021-12-20
* 调整为默认不打开性能面板单独提供WX.OpenProfileStats
### Fixed
* 2021 dev 运行报错(randomDevices替换) ## 2021-12-30
* 跳转小游戏接口错误
* 缓存大小为0AssetBundle重试失败问题 ### Fixed
* 修复引擎初始化失败后依然回调calledMainCb导致统计问题
## 2021-12-16 * 修复2021版本abort时执行WXUncaughtException
* 补充小程序框架异常时上报实时日志
### Added
* 开发、体验版本增加性能面板 ## 2021-12-20
## 2021-12-10 ### Fixed
* 2021 dev 运行报错(randomDevices替换)
### Fixed * 跳转小游戏接口错误
* 修复独立域插件未编译子包bug * 缓存大小为0AssetBundle重试失败问题
## 2021-12-06 ## 2021-12-16
### Added ### Added
* WebGL2.0 增加适配,该特性处于测试阶段 * 开发、体验版本增加性能面板
* 2021增加embedded symbols分离
* 增加error日志回调 ## 2021-12-10
### Fixed ### Fixed
* 2021 dev 运行报错 * 修复独立域插件未编译子包bug
## 2021-12-02 ## 2021-12-06
### Fixed ### Added
* dev build报错 * WebGL2.0 增加适配,该特性处于测试阶段
* 设备方向无法选中"LandscapeLeft", "LandscapeRight" * 2021增加embedded symbols分离
* 增加error日志回调
## 2021-11-30
### Fixed
### Changed * 2021 dev 运行报错
* 导出配置调整统一资源CDN路径配置配置顺序调整。
## 2021-12-02
### Fixed
* 低版本C#导致markdownviewer报错'interpolated strings' cannot be used. ### Fixed
* dev build报错
## 2021-11-19 * 设备方向无法选中"LandscapeLeft", "LandscapeRight"
### Fixed ## 2021-11-30
* 更新小游戏模板
### Changed
## 2021-11-18 * 导出配置调整统一资源CDN路径配置配置顺序调整。
### Added
增加bundle相关导出配置 ### Fixed
* 低版本C#导致markdownviewer报错'interpolated strings' cannot be used.
* 自定义bundle名中hash长度用于缓存控制默认32
* 自定义需缓存的路径标识符:下载路径命中标识符时会自动缓存本次下载文件。 ## 2021-11-19
* 忽略路径下指定类型文件:路径命中标识符时,过滤不需缓存的文件类型。
### Fixed
### Fixed * 更新小游戏模板
* markdownviewer可能出现guiskin引用丢失
## 2021-11-18
### Changed ### Added
* 更新小游戏模板 增加bundle相关导出配置
## 2021-10-26 * 自定义bundle名中hash长度用于缓存控制默认32
### Added * 自定义需缓存的路径标识符:下载路径命中标识符时会自动缓存本次下载文件。
* 增加部分文件操作API * 忽略路径下指定类型文件:路径命中标识符时,过滤不需缓存的文件类型。
* 压缩纹理替换优化,提升转换速度
### Fixed
## 2021-10-09 * markdownviewer可能出现guiskin引用丢失
### Added
* 增加Unity2020、2021版本支持 ### Changed
* 更新小游戏模板
## 2021-09-23 ## 2021-10-26
### Fixed ### Added
* 程序crash时触发用户反馈入口 * 增加部分文件操作API
* 压缩纹理替换优化,提升转换速度
## 2021-09-22 ## 2021-10-09
### Added
### Added * 增加Unity2020、2021版本支持
* 支持短音频的播放APIWX.ShortAudioPlayer更接近Unity的API调用方式
### Added ## 2021-09-23
* 当禁用异常时程序即将crash之前弹出用户反馈入口并自动提交用户反馈日志、JS Error与实时日志 ### Fixed
* 程序crash时触发用户反馈入口
### Added
* 编译选项增加"Profiling Funcs", 仅调试问题时勾选此选项时,编译代码将含有函数名,代码体积变大
## 2021-09-22
## 2021-09-14
### Added
### Added * 支持短音频的播放APIWX.ShortAudioPlayer更接近Unity的API调用方式
* 支持PlayerPrefs优化支持配置key
### Fixed ### Added
* 修复排行榜内存增长问题 * 当禁用异常时程序即将crash之前弹出用户反馈入口并自动提交用户反馈日志、JS Error与实时日志
## 2021-09-06 ### Added
* 编译选项增加"Profiling Funcs", 仅调试问题时勾选此选项时,编译代码将含有函数名,代码体积变大
### Added
* 支持导出时配置封面图 ## 2021-09-14
## 2021-8-20 ### Added
* 支持PlayerPrefs优化支持配置key
### Added ### Fixed
* 支持创建视频 * 修复排行榜内存增长问题
## 2021-8-12 ## 2021-09-06
### Added ### Added
* 修复IOS下音频被系统打断后的恢复问题 * 支持导出时配置封面图
* 支持客服消息
## 2021-8-20
## 2021-8-10
### Added
### Changed * 支持创建视频
* 小游戏项目模板更新
* 独立域插件更新为1.0.27。优化文件删除修复资源预载bug ## 2021-8-12
## 2021-08-05 ### Added
* 修复IOS下音频被系统打断后的恢复问题
### Added * 支持客服消息
* 音频支持获取播放状态
* 非POT图也支持延迟加载 ## 2021-8-10
## 2021-08-04 ### Changed
* 小游戏项目模板更新
### Fixed * 独立域插件更新为1.0.27。优化文件删除修复资源预载bug
* 独立域插件版本更新为1.0.24,修复若干问题
## 2021-08-05
## 2021-08-02
### Added
### Fixed * 音频支持获取播放状态
* 独立域插件更新1.0.20,修复首包资源下载异常 * 非POT图也支持延迟加载
* 更新小游戏项目模板
## 2021-08-04
## 2021-08-01
### Fixed
### Changed * 独立域插件版本更新为1.0.24,修复若干问题
* 小游戏项目模板更新
## 2021-08-02
## 2021-07-31
### Fixed
### Added * 独立域插件更新1.0.20,修复首包资源下载异常
* 增加预下载并发数控制接口WX.SetConcurrent * 更新小游戏项目模板
### Changed ## 2021-08-01
* 小游戏项目模板变更
### Changed
## 2021-07-26 * 小游戏项目模板更新
### Added
* 增加预下载猎豹配置自动从导出目录webgl/StreamingAssets查找资源并填充到game.js的Preload列表 ## 2021-07-31
## 2021-07-26 ### Added
### Added * 增加预下载并发数控制接口WX.SetConcurrent
* 支持文件二进制读写(同步和异步)
* 压缩纹理替换速度优化 ### Changed
* 小游戏项目模板变更
## 2021-07-20
### Fixed ## 2021-07-26
* 独立域插件版本升级为1.0.16,修复初始上报时机 ### Added
* 增加预下载猎豹配置自动从导出目录webgl/StreamingAssets查找资源并填充到game.js的Preload列表
## 2021-07-19
## 2021-07-26
### Changed ### Added
* 优化插件更新提示 * 支持文件二进制读写(同步和异步)
* 压缩纹理替换速度优化
## 2021-07-13
## 2021-07-20
### Fixed ### Fixed
* 独立域插件版本升级为1.0.14修复了一些bug * 独立域插件版本升级为1.0.16,修复初始上报时机
### Changed ## 2021-07-19
* 导出插件只提示更新,不自动下载
### Changed
## 2021-07-09 * 优化插件更新提示
### Fixed ## 2021-07-13
* 独立域插件版本升级为1.0.13修复了一些bug
### Fixed
## 2021-07-02 * 独立域插件版本升级为1.0.14修复了一些bug
### Fixed ### Changed
* 微信版本或基础库版本过低时`WXWebAssembly`未定义,未弹框提示更新客户端 * 导出插件只提示更新,不自动下载
## 2021-06-30 ## 2021-07-09
### Fixed ### Fixed
* 独立域插件版本升级为1.0.13修复了一些bug
* 压缩纹理兼容flare
## 2021-07-02
### Added
### Fixed
* 支持游戏恢复到前台后自动播放,默认开启分享 * 微信版本或基础库版本过低时`WXWebAssembly`未定义,未弹框提示更新客户端
## 2021-06-29 ## 2021-06-30
### Fixed ### Fixed
* 云测试设置UI框架导致editor运行错误 * 压缩纹理兼容flare
### Added ### Added
* 引入[UnityMarkdownViewer](https://github.com/gwaredd/UnityMarkdownViewer)在inspector面板预览changelog * 支持游戏恢复到前台后自动播放,默认开启分享
### Removed ## 2021-06-29
* 移除转换小游戏面板中`游戏内存大小`字段: 从Unity 2019开始已不支持设置`PlayerSettings.WebGL.memorySize` ### Fixed
### Changed * 云测试设置UI框架导致editor运行错误
* 资源优化工具代码添加namespace, 避免与游戏代码冲突 ### Added
### Others * 引入[UnityMarkdownViewer](https://github.com/gwaredd/UnityMarkdownViewer)在inspector面板预览changelog
独立域插件更新为(1.0.11) ### Removed
* `.untiy3d`拓展名文件视为bundle文件可做缓存。 * 移除转换小游戏面板中`游戏内存大小`字段: 从Unity 2019开始已不支持设置`PlayerSettings.WebGL.memorySize`
* 根据是否调试模式控制日志输出,规则为: 若为开发版, enableDebugLog=false且为调试模式时输出详细日志其他版本, 开启调试模式则输出详细日志
### Changed
## 2021-06-10
* 资源优化工具代码添加namespace, 避免与游戏代码冲突
### Fixed
### Others
* 独立域插件更新(1.0.10): 修复安卓分片读取包内资源内存越界
独立域插件更新为(1.0.11)
* `.untiy3d`拓展名文件视为bundle文件可做缓存。
* 根据是否调试模式控制日志输出,规则为: 若为开发版, enableDebugLog=false且为调试模式时输出详细日志其他版本, 开启调试模式则输出详细日志
## 2021-06-10
### Fixed
* 独立域插件更新(1.0.10): 修复安卓分片读取包内资源内存越界

14
Assets/WX-WASM-SDK/CHANGELOG.md.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 28f40a500a3f8441ab9cd7f003194f69 guid: 28f40a500a3f8441ab9cd7f003194f69
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

176
Assets/WX-WASM-SDK/Cloud.cs Executable file → Normal file
View File

@ -1,88 +1,88 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace WeChatWASM namespace WeChatWASM
{ {
/// <summary> /// <summary>
/// 云函数调用前必须先Init初始化 /// 云函数调用前必须先Init初始化
/// </summary> /// </summary>
public class Cloud public class Cloud
{ {
#region C#JS桥接方法 #region C#JS桥接方法
#if UNITY_WEBGL #if UNITY_WEBGL
[DllImport("__Internal")] [DllImport("__Internal")]
#endif #endif
private static extern void WXCallFunction(string name, string data, string conf, string s, string f, string c); private static extern void WXCallFunction(string name, string data, string conf, string s, string f, string c);
#if UNITY_WEBGL #if UNITY_WEBGL
[DllImport("__Internal")] [DllImport("__Internal")]
#endif #endif
private static extern void WXCallFunctionInit(string conf); private static extern void WXCallFunctionInit(string conf);
#if UNITY_WEBGL #if UNITY_WEBGL
[DllImport("__Internal")] [DllImport("__Internal")]
#endif #endif
private static extern string WXCloudID(string cloudID); private static extern string WXCloudID(string cloudID);
#endregion #endregion
/// <summary> /// <summary>
/// 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html /// 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html
/// </summary> /// </summary>
/// <param name="param"></param> /// <param name="param"></param>
public void Init(CallFunctionInitParam param) public void Init(CallFunctionInitParam param)
{ {
WXCallFunctionInit(JsonUtility.ToJson(param)); WXCallFunctionInit(JsonUtility.ToJson(param));
} }
/// <summary> /// <summary>
/// 调用云函数,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html /// 调用云函数,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html
/// </summary> /// </summary>
/// <param name="param"></param> /// <param name="param"></param>
/// <example> /// <example>
//WX.cloud.Init(new CallFunctionInitParam() //WX.cloud.Init(new CallFunctionInitParam()
//{ //{
// env = "product", // env = "product",
// traceUser = false // traceUser = false
// }); // });
// var p = new C() // var p = new C()
// { // {
// content = "haha" // content = "haha"
// }; // };
//WX.cloud.CallFunction(new CallFunctionParam() //WX.cloud.CallFunction(new CallFunctionParam()
//{ //{
// name = "msgSecCheck", // name = "msgSecCheck",
// data = JsonUtility.ToJson(p), // data = JsonUtility.ToJson(p),
// success = (res) => { // success = (res) => {
// Debug.Log("success"); // Debug.Log("success");
// Debug.Log(res.result); // Debug.Log(res.result);
// }, // },
// fail = (res) => { // fail = (res) => {
// Debug.Log("fail"); // Debug.Log("fail");
// Debug.Log(res.errMsg); // Debug.Log(res.errMsg);
// }, // },
// complete = (res) => { // complete = (res) => {
// Debug.Log("complete"); // Debug.Log("complete");
// Debug.Log(res.result); // Debug.Log(res.result);
// } // }
// }); // });
/// </example> /// </example>
public void CallFunction(CallFunctionParam param) public void CallFunction(CallFunctionParam param)
{ {
WXCallFunction(param.name, param.data, WXCallFunction(param.name, param.data,
param.config == null ? "" : JsonUtility.ToJson(param.config), param.config == null ? "" : JsonUtility.ToJson(param.config),
WXCallBackHandler.Add(param.success), WXCallBackHandler.Add(param.fail), WXCallBackHandler.Add(param.complete)); WXCallBackHandler.Add(param.success), WXCallBackHandler.Add(param.fail), WXCallBackHandler.Add(param.complete));
} }
/// <summary> /// <summary>
/// 声明字符串为 CloudID开放数据 ID该接口传入一个字符串返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html /// 声明字符串为 CloudID开放数据 ID该接口传入一个字符串返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html
/// </summary> /// </summary>
/// <param name="cloudID">通过开放能力在小程序端 / web 端获取得到的 CloudID</param> /// <param name="cloudID">通过开放能力在小程序端 / web 端获取得到的 CloudID</param>
/// <returns>返回字符串,原样传回云函数调用就好</returns> /// <returns>返回字符串,原样传回云函数调用就好</returns>
public string CloudID(string cloudID) public string CloudID(string cloudID)
{ {
return WXCloudID(cloudID); return WXCloudID(cloudID);
} }
} }
} }

22
Assets/WX-WASM-SDK/Cloud.cs.meta Executable file → Normal file
View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7dc67f38c6b669248935f7a81515cc15 guid: 7dc67f38c6b669248935f7a81515cc15
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,19 +1,19 @@
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 094d36fd8b54c4c3d98d21b57d92ae26 guid: 094d36fd8b54c4c3d98d21b57d92ae26
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,2 +1,2 @@
https://github.com/Unity-Technologies/brotli https://github.com/Unity-Technologies/brotli
359ceef04a4eae97cb8a161c4b768fd639eef98b 359ceef04a4eae97cb8a161c4b768fd639eef98b

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5aaeb4910866f4388a86efc2ac5bde76 guid: 5aaeb4910866f4388a86efc2ac5bde76
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c7d34b53fefa24bf5b0ce2914fc60ad8 guid: c7d34b53fefa24bf5b0ce2914fc60ad8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 74b4e5c821cda4b7d8f401d7935a892e guid: 74b4e5c821cda4b7d8f401d7935a892e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 14077bb4dfcdf487aa222261b4719a0e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,27 +1,27 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 482c84c1110074e5295b51734fa3053b guid: 482c84c1110074e5295b51734fa3053b
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,27 +1,27 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 713e2b6c25b3540e595a5036bacaedbd guid: 713e2b6c25b3540e595a5036bacaedbd
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,27 +1,27 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 250ffb10dd8854b5d8b5d31a7f9afd14 guid: 250ffb10dd8854b5d8b5d31a7f9afd14
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,27 +1,27 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e23a7460c65914b4995b078d7edfcd55 guid: e23a7460c65914b4995b078d7edfcd55
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,27 +1,27 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 466c0abf5fe5847879df912061e09f9e guid: 466c0abf5fe5847879df912061e09f9e
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,12 +1,12 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class Analysis : ScriptableObject public class Analysis : ScriptableObject
{ {
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2aab4fbbf46a75b408a8a38ff77fbbb9 guid: 2aab4fbbf46a75b408a8a38ff77fbbb9
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,75 +1,75 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System; using System;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class AnalysisWindow : EditorWindow public class AnalysisWindow : EditorWindow
{ {
public int AssetsTypeSelected; public int AssetsTypeSelected;
public string[] AssetsTypeOptions = new string[] { "Texture", "Font", "Audio", "Prefab" }; public string[] AssetsTypeOptions = new string[] { "Texture", "Font", "Audio", "Prefab" };
public TextureWindow TextureWindow; public TextureWindow TextureWindow;
public FontWindow FontWindow; public FontWindow FontWindow;
public AudioWindow AudioWindow; public AudioWindow AudioWindow;
public PrefabWindow PrefabWindow; public PrefabWindow PrefabWindow;
static private EditorWindow win; static private EditorWindow win;
[MenuItem("微信小游戏 / 资源优化工具")] [MenuItem("微信小游戏 / 资源优化工具")]
static void ShowTextureWindow() static void ShowTextureWindow()
{ {
//EditorUtility.DisplayDialog("MyTool", "Do It in C# !", "OK", ""); //EditorUtility.DisplayDialog("MyTool", "Do It in C# !", "OK", "");
win = AnalysisWindow.GetCurrentWindow(); win = AnalysisWindow.GetCurrentWindow();
win.minSize = new Vector2(1600, 800); win.minSize = new Vector2(1600, 800);
win.Show(); win.Show();
} }
public static EditorWindow GetCurrentWindow() public static EditorWindow GetCurrentWindow()
{ {
return GetWindow(typeof(AnalysisWindow), false, "Optimize", true); return GetWindow(typeof(AnalysisWindow), false, "Optimize", true);
} }
private void OnEnable() private void OnEnable()
{ {
this.TextureWindow = TextureWindow.GetInstance(); this.TextureWindow = TextureWindow.GetInstance();
this.FontWindow = FontWindow.GetInstance(); this.FontWindow = FontWindow.GetInstance();
this.AudioWindow = AudioWindow.GetInstance(); this.AudioWindow = AudioWindow.GetInstance();
this.PrefabWindow = PrefabWindow.GetInstance(); this.PrefabWindow = PrefabWindow.GetInstance();
} }
private void OnDisable() private void OnDisable()
{ {
this.TextureWindow = null; this.TextureWindow = null;
this.FontWindow = null; this.FontWindow = null;
} }
private void OnGUI() private void OnGUI()
{ {
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(25f) }; GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(25f) };
this.AssetsTypeSelected = GUILayout.Toolbar(this.AssetsTypeSelected, this.AssetsTypeOptions, "LargeButton", GUI.ToolbarButtonSize.FitToContents, options); this.AssetsTypeSelected = GUILayout.Toolbar(this.AssetsTypeSelected, this.AssetsTypeOptions, "LargeButton", GUI.ToolbarButtonSize.FitToContents, options);
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
switch (this.AssetsTypeSelected) switch (this.AssetsTypeSelected)
{ {
case 0: case 0:
this.TextureWindow.Show(); this.TextureWindow.Show();
break; break;
case 1: case 1:
this.FontWindow.Show(); this.FontWindow.Show();
break; break;
case 2: case 2:
this.AudioWindow.Show(); this.AudioWindow.Show();
break; break;
case 3: case 3:
this.PrefabWindow.Show(); this.PrefabWindow.Show();
break; break;
default: default:
break; break;
} }
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7d06d74ece63a234b9cf5994c689e33e guid: 7d06d74ece63a234b9cf5994c689e33e
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,164 +1,164 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
//带数据的TreeViewItem //带数据的TreeViewItem
public class AssetViewItem : TreeViewItem public class AssetViewItem : TreeViewItem
{ {
public ReferenceFinderData.AssetDescription data; public ReferenceFinderData.AssetDescription data;
} }
//资源引用树 //资源引用树
public class AssetTreeView : TreeView public class AssetTreeView : TreeView
{ {
//图标宽度 //图标宽度
const float kIconWidth = 18f; const float kIconWidth = 18f;
//列表高度 //列表高度
const float kRowHeights = 20f; const float kRowHeights = 20f;
public AssetViewItem assetRoot; public AssetViewItem assetRoot;
private GUIStyle stateGUIStyle = new GUIStyle { richText = true, alignment = TextAnchor.MiddleCenter }; private GUIStyle stateGUIStyle = new GUIStyle { richText = true, alignment = TextAnchor.MiddleCenter };
//列信息 //列信息
enum MyColumns enum MyColumns
{ {
Name, Name,
Path, Path,
State, State,
} }
public AssetTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader) : base(state, multicolumnHeader) public AssetTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader) : base(state, multicolumnHeader)
{ {
useScrollView = false; useScrollView = false;
rowHeight = kRowHeights; rowHeight = kRowHeights;
columnIndexForTreeFoldouts = 0; columnIndexForTreeFoldouts = 0;
showAlternatingRowBackgrounds = true; showAlternatingRowBackgrounds = true;
showBorder = false; showBorder = false;
customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI
extraSpaceBeforeIconAndLabel = kIconWidth; extraSpaceBeforeIconAndLabel = kIconWidth;
} }
//响应双击事件 //响应双击事件
protected override void DoubleClickedItem(int id) protected override void DoubleClickedItem(int id)
{ {
var item = (AssetViewItem)FindItem(id, rootItem); var item = (AssetViewItem)FindItem(id, rootItem);
//在ProjectWindow中高亮双击资源 //在ProjectWindow中高亮双击资源
if (item != null) if (item != null)
{ {
var assetObject = AssetDatabase.LoadAssetAtPath(item.data.path, typeof(UnityEngine.Object)); var assetObject = AssetDatabase.LoadAssetAtPath(item.data.path, typeof(UnityEngine.Object));
EditorUtility.FocusProjectWindow(); EditorUtility.FocusProjectWindow();
Selection.activeObject = assetObject; Selection.activeObject = assetObject;
EditorGUIUtility.PingObject(assetObject); EditorGUIUtility.PingObject(assetObject);
} }
} }
//生成ColumnHeader //生成ColumnHeader
public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(float treeViewWidth) public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(float treeViewWidth)
{ {
var columns = new[] var columns = new[]
{ {
//图标+名称 //图标+名称
new MultiColumnHeaderState.Column new MultiColumnHeaderState.Column
{ {
headerContent = new GUIContent("Name"), headerContent = new GUIContent("Name"),
headerTextAlignment = TextAlignment.Center, headerTextAlignment = TextAlignment.Center,
sortedAscending = false, sortedAscending = false,
width = 200, width = 200,
minWidth = 60, minWidth = 60,
autoResize = false, autoResize = false,
allowToggleVisibility = false, allowToggleVisibility = false,
canSort = false canSort = false
}, },
//路径 //路径
new MultiColumnHeaderState.Column new MultiColumnHeaderState.Column
{ {
headerContent = new GUIContent("Path"), headerContent = new GUIContent("Path"),
headerTextAlignment = TextAlignment.Center, headerTextAlignment = TextAlignment.Center,
sortedAscending = false, sortedAscending = false,
width = 360, width = 360,
minWidth = 60, minWidth = 60,
autoResize = false, autoResize = false,
allowToggleVisibility = false, allowToggleVisibility = false,
canSort = false canSort = false
}, },
////状态 ////状态
//new MultiColumnHeaderState.Column //new MultiColumnHeaderState.Column
//{ //{
// headerContent = new GUIContent("State"), // headerContent = new GUIContent("State"),
// headerTextAlignment = TextAlignment.Center, // headerTextAlignment = TextAlignment.Center,
// sortedAscending = false, // sortedAscending = false,
// width = 60, // width = 60,
// minWidth = 60, // minWidth = 60,
// autoResize = false, // autoResize = false,
// allowToggleVisibility = true, // allowToggleVisibility = true,
// canSort = false // canSort = false
//}, //},
}; };
var state = new MultiColumnHeaderState(columns); var state = new MultiColumnHeaderState(columns);
return state; return state;
} }
protected override TreeViewItem BuildRoot() protected override TreeViewItem BuildRoot()
{ {
return assetRoot; return assetRoot;
} }
protected override void RowGUI(RowGUIArgs args) protected override void RowGUI(RowGUIArgs args)
{ {
var item = (AssetViewItem)args.item; var item = (AssetViewItem)args.item;
for (int i = 0; i < args.GetNumVisibleColumns(); ++i) for (int i = 0; i < args.GetNumVisibleColumns(); ++i)
{ {
CellGUI(args.GetCellRect(i), item, (MyColumns)args.GetColumn(i), ref args); CellGUI(args.GetCellRect(i), item, (MyColumns)args.GetColumn(i), ref args);
} }
} }
//绘制列表中的每项内容 //绘制列表中的每项内容
void CellGUI(Rect cellRect, AssetViewItem item, MyColumns column, ref RowGUIArgs args) void CellGUI(Rect cellRect, AssetViewItem item, MyColumns column, ref RowGUIArgs args)
{ {
CenterRectUsingSingleLineHeight(ref cellRect); CenterRectUsingSingleLineHeight(ref cellRect);
switch (column) switch (column)
{ {
case MyColumns.Name: case MyColumns.Name:
{ {
var iconRect = cellRect; var iconRect = cellRect;
iconRect.x += GetContentIndent(item); iconRect.x += GetContentIndent(item);
iconRect.width = kIconWidth; iconRect.width = kIconWidth;
if (iconRect.x < cellRect.xMax) if (iconRect.x < cellRect.xMax)
{ {
var icon = GetIcon(item.data.path); var icon = GetIcon(item.data.path);
if (icon != null) if (icon != null)
GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit);
} }
args.rowRect = cellRect; args.rowRect = cellRect;
base.RowGUI(args); base.RowGUI(args);
} }
break; break;
case MyColumns.Path: case MyColumns.Path:
{ {
GUI.Label(cellRect, item.data.path); GUI.Label(cellRect, item.data.path);
} }
break; break;
case MyColumns.State: case MyColumns.State:
{ {
GUI.Label(cellRect, ReferenceFinderData.GetInfoByState(item.data.state), stateGUIStyle); GUI.Label(cellRect, ReferenceFinderData.GetInfoByState(item.data.state), stateGUIStyle);
} }
break; break;
} }
} }
//根据资源信息获取资源图标 //根据资源信息获取资源图标
private Texture2D GetIcon(string path) private Texture2D GetIcon(string path)
{ {
Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(Object)); Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(Object));
if (obj != null) if (obj != null)
{ {
Texture2D icon = AssetPreview.GetMiniThumbnail(obj); Texture2D icon = AssetPreview.GetMiniThumbnail(obj);
if (icon == null) if (icon == null)
icon = AssetPreview.GetMiniTypeThumbnail(obj.GetType()); icon = AssetPreview.GetMiniTypeThumbnail(obj.GetType());
return icon; return icon;
} }
return null; return null;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 913d7b4e37be64446863ebfd1b6b3294 guid: 913d7b4e37be64446863ebfd1b6b3294
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,148 +1,148 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class AudioWindow : BaseWindow<AudioWindow> public class AudioWindow : BaseWindow<AudioWindow>
{ {
private AssetDataTable m_table; private AssetDataTable m_table;
private List<AudioInfo> selectedObjects; private List<AudioInfo> selectedObjects;
private List<AudioInfo> originalInfos; private List<AudioInfo> originalInfos;
private List<AudioInfo> renderInfos; private List<AudioInfo> renderInfos;
public class AssetDataTable : CommonTable<AudioInfo> public class AssetDataTable : CommonTable<AudioInfo>
{ {
public AssetDataTable(List<AudioInfo> datas, public AssetDataTable(List<AudioInfo> datas,
CommonTableColumn<AudioInfo>[] cs, CommonTableColumn<AudioInfo>[] cs,
FilterMethod<AudioInfo> onfilter, FilterMethod<AudioInfo> onfilter,
SelectMethod<AudioInfo> onselect = null) SelectMethod<AudioInfo> onselect = null)
: base(datas, cs, onfilter, onselect) : base(datas, cs, onfilter, onselect)
{ {
} }
} }
public AudioWindow() : base() public AudioWindow() : base()
{ {
if (m_table == null) if (m_table == null)
{ {
var datas = new List<AudioInfo>(); var datas = new List<AudioInfo>();
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
} }
} }
public CommonTableColumn<AudioInfo>[] GetViewColumn() public CommonTableColumn<AudioInfo>[] GetViewColumn()
{ {
var cols = new CommonTableColumn<AudioInfo>[] var cols = new CommonTableColumn<AudioInfo>[]
{ {
new CommonTableColumn<AudioInfo> new CommonTableColumn<AudioInfo>
{ {
headerContent = new GUIContent("name"), headerContent = new GUIContent("name"),
canSort = true, canSort = true,
minWidth = 170, minWidth = 170,
width = 170, width = 170,
Compare = (a,b) => -a.name.CompareTo(b.name), Compare = (a,b) => -a.name.CompareTo(b.name),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
}, },
new CommonTableColumn<AudioInfo> new CommonTableColumn<AudioInfo>
{ {
headerContent = new GUIContent("path"), headerContent = new GUIContent("path"),
canSort = true, canSort = true,
minWidth = 350, minWidth = 350,
width = 350, width = 350,
Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath), Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
} }
}; };
return cols; return cols;
} }
public void OnRowSelect(List<AudioInfo> datas) public void OnRowSelect(List<AudioInfo> datas)
{ {
currentAssetPathList = datas.Select((info) => info.assetPath).ToArray(); currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
selectedObjects = new List<AudioInfo>(datas); selectedObjects = new List<AudioInfo>(datas);
var list = new List<AudioClip>(); var list = new List<AudioClip>();
foreach (var data in datas) foreach (var data in datas)
{ {
var info = data._info; var info = data._info;
list.Add(info); list.Add(info);
} }
Selection.objects = list.ToArray(); Selection.objects = list.ToArray();
} }
private bool OnFilter(AudioInfo data, string std) private bool OnFilter(AudioInfo data, string std)
{ {
string name = std; string name = std;
if (name.Length == 0) if (name.Length == 0)
{ {
return true; return true;
} }
return data.name.ToLower().IndexOf(name.ToLower()) > -1; return data.name.ToLower().IndexOf(name.ToLower()) > -1;
} }
public override void RefreshTable() public override void RefreshTable()
{ {
if (needUpdateMainContent) if (needUpdateMainContent)
{ {
needUpdateMainContent = false; needUpdateMainContent = false;
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
} }
m_table.OnGUI(); m_table.OnGUI();
} }
public override void DrawOptionArea() public override void DrawOptionArea()
{ {
GUILayout.Space(40); GUILayout.Space(40);
if (GUILayout.Button("搜索音频文件", GUILayout.Width(160), GUILayout.Height(40))) if (GUILayout.Button("搜索音频文件", GUILayout.Width(160), GUILayout.Height(40)))
{ {
CollectAssets(); CollectAssets();
} }
} }
public void CollectAssets(Boolean needRefreshCurrentFolder = true) public void CollectAssets(Boolean needRefreshCurrentFolder = true)
{ {
if (needRefreshCurrentFolder) if (needRefreshCurrentFolder)
{ {
this.currentFolder = GetCurrentFolder(); this.currentFolder = GetCurrentFolder();
} }
originalInfos = new List<AudioInfo>(); originalInfos = new List<AudioInfo>();
var guids = AssetDatabase.FindAssets("t:audioclip", new[] { this.currentFolder }); var guids = AssetDatabase.FindAssets("t:audioclip", new[] { this.currentFolder });
var count = guids.Length; var count = guids.Length;
var current = 0; var current = 0;
foreach (string guid in guids) foreach (string guid in guids)
{ {
current++; current++;
EditorUtility.DisplayCancelableProgressBar("search Audio", "searching " + current, (float)current / count); EditorUtility.DisplayCancelableProgressBar("search Audio", "searching " + current, (float)current / count);
var obj = AssetDatabase.LoadAssetAtPath<AudioClip>(AssetDatabase.GUIDToAssetPath(guid)); var obj = AssetDatabase.LoadAssetAtPath<AudioClip>(AssetDatabase.GUIDToAssetPath(guid));
var filePath = AssetDatabase.GetAssetPath(obj); var filePath = AssetDatabase.GetAssetPath(obj);
originalInfos.Add(new AudioInfo(obj, filePath)); originalInfos.Add(new AudioInfo(obj, filePath));
} }
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
renderInfos = new List<AudioInfo>(originalInfos); renderInfos = new List<AudioInfo>(originalInfos);
needUpdateMainContent = true; needUpdateMainContent = true;
Selection.objects = null; Selection.objects = null;
} }
} }
public class AudioInfo public class AudioInfo
{ {
public string assetPath; public string assetPath;
public string name; public string name;
public AudioClip _info; public AudioClip _info;
public AudioInfo(AudioClip info, string assetPath) public AudioInfo(AudioClip info, string assetPath)
{ {
this._info = info; this._info = info;
this.assetPath = assetPath; this.assetPath = assetPath;
this.name = info.name; this.name = info.name;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e222bfdf52432fb429ffe36b48050b51 guid: e222bfdf52432fb429ffe36b48050b51
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,254 +1,254 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System; using System;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
//public abstract class BaseWindow //public abstract class BaseWindow
//{ //{
//} //}
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class BaseWindow<T> where T : class, new() public class BaseWindow<T> where T : class, new()
{ {
//private AssetDataTable m_table; //private AssetDataTable m_table;
Vector2 assetListScrollPosition = Vector2.zero; Vector2 assetListScrollPosition = Vector2.zero;
float splitterPos = 1000; float splitterPos = 1000;
Rect splitterRect; Rect splitterRect;
float splitterWidth = 5; float splitterWidth = 5;
bool dragging; bool dragging;
Vector2 refrenceListScrollPostion = Vector2.zero; Vector2 refrenceListScrollPostion = Vector2.zero;
public EditorWindow win; public EditorWindow win;
public string currentFolder; public string currentFolder;
public Boolean needRefreshCurrentFolder; public Boolean needRefreshCurrentFolder;
public string[] currentAssetPathList; public string[] currentAssetPathList;
public AssetTreeView assetTreeView; public AssetTreeView assetTreeView;
public List<string> selectedAssetGuid = new List<string>(); public List<string> selectedAssetGuid = new List<string>();
public static ReferenceFinderData assetRefrenceDatas = new ReferenceFinderData(); public static ReferenceFinderData assetRefrenceDatas = new ReferenceFinderData();
public Boolean initializedRefrenceData = false; public Boolean initializedRefrenceData = false;
public TreeViewState treeViewState; public TreeViewState treeViewState;
// 是否需要刷新扫描结果 // 是否需要刷新扫描结果
public Boolean needUpdateMainContent = false; public Boolean needUpdateMainContent = false;
// 是否更新资源引用结果 // 是否更新资源引用结果
public Boolean needUpdateAssetTree = false; public Boolean needUpdateAssetTree = false;
// 单例 // 单例
public static T instance; public static T instance;
public static readonly object locker = new object(); public static readonly object locker = new object();
public BaseWindow() public BaseWindow()
{ {
win = AnalysisWindow.GetCurrentWindow(); win = AnalysisWindow.GetCurrentWindow();
if (!initializedRefrenceData) if (!initializedRefrenceData)
{ {
if (!assetRefrenceDatas.ReadFromCache()) if (!assetRefrenceDatas.ReadFromCache())
{ {
assetRefrenceDatas.CollectDependenciesInfo(); assetRefrenceDatas.CollectDependenciesInfo();
} }
initializedRefrenceData = true; initializedRefrenceData = true;
} }
} }
public static T GetInstance() public static T GetInstance()
{ {
lock (locker) lock (locker)
{ {
if (instance == null) if (instance == null)
{ {
instance = new T(); instance = new T();
} }
} }
return instance; return instance;
} }
public void Show() public void Show()
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
DrawOptionBtn(); DrawOptionBtn();
DrawMainContent(); DrawMainContent();
DrawSplitter(); DrawSplitter();
DrawReferenceLayout(); DrawReferenceLayout();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
public void DrawOptionBtn() public void DrawOptionBtn()
{ {
GUILayout.BeginVertical(); GUILayout.BeginVertical();
DrawOptionArea(); DrawOptionArea();
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
public virtual void DrawOptionArea() public virtual void DrawOptionArea()
{ {
} }
public string GetCurrentFolder() public string GetCurrentFolder()
{ {
string path = "Assets"; string path = "Assets";
foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets)) foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
{ {
path = AssetDatabase.GetAssetPath(obj); path = AssetDatabase.GetAssetPath(obj);
if (!string.IsNullOrEmpty(path) && File.Exists(path)) if (!string.IsNullOrEmpty(path) && File.Exists(path))
{ {
path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path);
break; break;
} }
} }
return path; return path;
} }
public void DrawMainContent() public void DrawMainContent()
{ {
assetListScrollPosition = GUILayout.BeginScrollView(assetListScrollPosition, GUILayout.Width(splitterPos), GUILayout.MinWidth(splitterPos), GUILayout.MaxWidth(splitterPos)); assetListScrollPosition = GUILayout.BeginScrollView(assetListScrollPosition, GUILayout.Width(splitterPos), GUILayout.MinWidth(splitterPos), GUILayout.MaxWidth(splitterPos));
RefreshTable(); RefreshTable();
GUILayout.EndScrollView(); GUILayout.EndScrollView();
} }
public virtual void RefreshTable() public virtual void RefreshTable()
{ {
} }
public void DrawSplitter() public void DrawSplitter()
{ {
// splitter // splitter
GUILayout.Box("", GUILayout.Box("",
GUILayout.Width(splitterWidth), GUILayout.Width(splitterWidth),
GUILayout.MaxWidth(splitterWidth), GUILayout.MaxWidth(splitterWidth),
GUILayout.MinWidth(splitterWidth), GUILayout.MinWidth(splitterWidth),
GUILayout.ExpandHeight(true)); GUILayout.ExpandHeight(true));
splitterRect = GUILayoutUtility.GetLastRect(); splitterRect = GUILayoutUtility.GetLastRect();
if (Event.current != null) if (Event.current != null)
{ {
switch (Event.current.rawType) switch (Event.current.rawType)
{ {
case EventType.MouseDown: case EventType.MouseDown:
if (splitterRect.Contains(Event.current.mousePosition)) if (splitterRect.Contains(Event.current.mousePosition))
{ {
dragging = true; dragging = true;
} }
break; break;
case EventType.MouseDrag: case EventType.MouseDrag:
if (dragging) if (dragging)
{ {
splitterPos += Event.current.delta.x; splitterPos += Event.current.delta.x;
win.Repaint(); win.Repaint();
} }
break; break;
case EventType.MouseUp: case EventType.MouseUp:
if (dragging) if (dragging)
{ {
dragging = false; dragging = false;
} }
break; break;
} }
} }
} }
public void DrawReferenceLayout() public void DrawReferenceLayout()
{ {
GUILayout.BeginVertical(); GUILayout.BeginVertical();
if (GUILayout.Button("检查依赖", GUILayout.Width(160), GUILayout.Height(40))) if (GUILayout.Button("检查依赖", GUILayout.Width(160), GUILayout.Height(40)))
{ {
if (currentAssetPathList.Length > 0) if (currentAssetPathList.Length > 0)
{ {
selectedAssetGuid.Clear(); selectedAssetGuid.Clear();
selectedAssetGuid.Add(AssetDatabase.AssetPathToGUID(currentAssetPathList[0])); selectedAssetGuid.Add(AssetDatabase.AssetPathToGUID(currentAssetPathList[0]));
needUpdateAssetTree = true; needUpdateAssetTree = true;
} }
} }
var btnRect = GUILayoutUtility.GetLastRect(); var btnRect = GUILayoutUtility.GetLastRect();
// asset reference // asset reference
var scrollViewWidth = win.position.width - splitterRect.xMax; var scrollViewWidth = win.position.width - splitterRect.xMax;
var scrollViewY = btnRect.yMax + 5; var scrollViewY = btnRect.yMax + 5;
refrenceListScrollPostion = GUILayout.BeginScrollView(refrenceListScrollPostion, GUILayout.Width(scrollViewWidth), GUILayout.MinWidth(scrollViewWidth), GUILayout.MaxWidth(scrollViewWidth), GUILayout.ExpandHeight(true)); refrenceListScrollPostion = GUILayout.BeginScrollView(refrenceListScrollPostion, GUILayout.Width(scrollViewWidth), GUILayout.MinWidth(scrollViewWidth), GUILayout.MaxWidth(scrollViewWidth), GUILayout.ExpandHeight(true));
UpdateAssetTree(); UpdateAssetTree();
if (assetTreeView != null) if (assetTreeView != null)
{ {
var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height); var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
if (Event.current.type != EventType.Layout) if (Event.current.type != EventType.Layout)
{ {
assetTreeView.OnGUI(rect); assetTreeView.OnGUI(rect);
} }
} }
GUILayout.EndScrollView(); GUILayout.EndScrollView();
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
public void UpdateAssetTree() public void UpdateAssetTree()
{ {
if (needUpdateAssetTree && selectedAssetGuid.Count != 0) if (needUpdateAssetTree && selectedAssetGuid.Count != 0)
{ {
var root = SelectedAssetGuidToRootItem(selectedAssetGuid); var root = SelectedAssetGuidToRootItem(selectedAssetGuid);
if (assetTreeView == null) if (assetTreeView == null)
{ {
if (treeViewState == null) if (treeViewState == null)
{ {
treeViewState = new TreeViewState(); treeViewState = new TreeViewState();
} }
var headerState = AssetTreeView.CreateDefaultMultiColumnHeaderState(win.position.width - splitterRect.x); var headerState = AssetTreeView.CreateDefaultMultiColumnHeaderState(win.position.width - splitterRect.x);
var multiColumnHeader = new MultiColumnHeader(headerState); var multiColumnHeader = new MultiColumnHeader(headerState);
assetTreeView = new AssetTreeView(treeViewState, multiColumnHeader); assetTreeView = new AssetTreeView(treeViewState, multiColumnHeader);
} }
assetTreeView.assetRoot = root; assetTreeView.assetRoot = root;
assetTreeView.CollapseAll(); assetTreeView.CollapseAll();
assetTreeView.Reload(); assetTreeView.Reload();
needUpdateAssetTree = false; needUpdateAssetTree = false;
} }
} }
//生成root相关 //生成root相关
private HashSet<string> updatedAssetSet = new HashSet<string>(); private HashSet<string> updatedAssetSet = new HashSet<string>();
//通过选择资源列表生成TreeView的根节点 //通过选择资源列表生成TreeView的根节点
private AssetViewItem SelectedAssetGuidToRootItem(List<string> selectedAssetGuid) private AssetViewItem SelectedAssetGuidToRootItem(List<string> selectedAssetGuid)
{ {
updatedAssetSet.Clear(); updatedAssetSet.Clear();
int elementCount = 0; int elementCount = 0;
var root = new AssetViewItem { id = elementCount, depth = -1, displayName = "Root", data = null }; var root = new AssetViewItem { id = elementCount, depth = -1, displayName = "Root", data = null };
int depth = 0; int depth = 0;
foreach (var childGuid in selectedAssetGuid) foreach (var childGuid in selectedAssetGuid)
{ {
root.AddChild(CreateTree(childGuid, ref elementCount, depth)); root.AddChild(CreateTree(childGuid, ref elementCount, depth));
} }
updatedAssetSet.Clear(); updatedAssetSet.Clear();
return root; return root;
} }
//通过每个节点的数据生成子节点 //通过每个节点的数据生成子节点
private AssetViewItem CreateTree(string guid, ref int elementCount, int _depth) private AssetViewItem CreateTree(string guid, ref int elementCount, int _depth)
{ {
if (!updatedAssetSet.Contains(guid)) if (!updatedAssetSet.Contains(guid))
{ {
assetRefrenceDatas.UpdateAssetState(guid); assetRefrenceDatas.UpdateAssetState(guid);
updatedAssetSet.Add(guid); updatedAssetSet.Add(guid);
} }
++elementCount; ++elementCount;
var referenceData = assetRefrenceDatas.assetDict[guid]; var referenceData = assetRefrenceDatas.assetDict[guid];
var root = new AssetViewItem { id = elementCount, displayName = referenceData.name, data = referenceData, depth = _depth }; var root = new AssetViewItem { id = elementCount, displayName = referenceData.name, data = referenceData, depth = _depth };
var childGuids = referenceData.references; var childGuids = referenceData.references;
foreach (var childGuid in childGuids) foreach (var childGuid in childGuids)
{ {
root.AddChild(CreateTree(childGuid, ref elementCount, _depth + 1)); root.AddChild(CreateTree(childGuid, ref elementCount, _depth + 1));
} }
return root; return root;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ea47c9c594c266a4f94dff634585161e guid: ea47c9c594c266a4f94dff634585161e
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,122 +1,122 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using UnityEngine; using UnityEngine;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public abstract class CommonTable public abstract class CommonTable
{ {
public abstract void OnGUI(); public abstract void OnGUI();
} }
public class CommonTable<T> : CommonTable where T : class public class CommonTable<T> : CommonTable where T : class
{ {
private const float DragHeight = 20f; private const float DragHeight = 20f;
private const float DragWidth = 5f; private const float DragWidth = 5f;
private readonly float m_FilterHeight = 20f; private readonly float m_FilterHeight = 20f;
private bool m_initialized; private bool m_initialized;
private CommonTreeView<T> m_treeView; private CommonTreeView<T> m_treeView;
private TreeViewState m_treeViewState; private TreeViewState m_treeViewState;
private readonly List<T> m_datas; private readonly List<T> m_datas;
private readonly FilterMethod<T> m_filter; private readonly FilterMethod<T> m_filter;
private readonly SelectMethod<T> m_select; private readonly SelectMethod<T> m_select;
private readonly Action<Boolean> m_toggleSelectAll; private readonly Action<Boolean> m_toggleSelectAll;
protected MultiColumnHeaderState MultiColumnHeaderState { get; private set; } protected MultiColumnHeaderState MultiColumnHeaderState { get; private set; }
public CommonTable(List<T> datas, CommonTableColumn<T>[] cs, FilterMethod<T> onfilter, SelectMethod<T> onselect = null, Action<Boolean> toggleSelectAll = null) public CommonTable(List<T> datas, CommonTableColumn<T>[] cs, FilterMethod<T> onfilter, SelectMethod<T> onselect = null, Action<Boolean> toggleSelectAll = null)
{ {
var state = new MultiColumnHeaderState(cs); var state = new MultiColumnHeaderState(cs);
MultiColumnHeaderState = state; MultiColumnHeaderState = state;
m_filter = onfilter; m_filter = onfilter;
m_datas = datas; m_datas = datas;
m_select = onselect; m_select = onselect;
m_toggleSelectAll = toggleSelectAll; m_toggleSelectAll = toggleSelectAll;
} }
private void InitIfNeeded() private void InitIfNeeded()
{ {
if (!m_initialized) if (!m_initialized)
{ {
if (m_treeViewState == null) if (m_treeViewState == null)
m_treeViewState = new TreeViewState(); m_treeViewState = new TreeViewState();
var multiColumnHeader = new MultiColumnHeader(MultiColumnHeaderState); var multiColumnHeader = new MultiColumnHeader(MultiColumnHeaderState);
m_treeView = new CommonTreeView<T>(m_treeViewState, multiColumnHeader, m_datas, m_filter, m_select, m_toggleSelectAll); m_treeView = new CommonTreeView<T>(m_treeViewState, multiColumnHeader, m_datas, m_filter, m_select, m_toggleSelectAll);
m_treeView.Reload(); m_treeView.Reload();
m_initialized = true; m_initialized = true;
} }
} }
public void SelectAll() public void SelectAll()
{ {
if (m_treeView != null) if (m_treeView != null)
{ {
m_treeView.SelectAllRows(); m_treeView.SelectAllRows();
} }
} }
public override void OnGUI() public override void OnGUI()
{ {
InitIfNeeded(); InitIfNeeded();
var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height); var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
if (Event.current.type == EventType.Layout) if (Event.current.type == EventType.Layout)
return; return;
rect.x += DragWidth; rect.x += DragWidth;
rect.width -= DragWidth; rect.width -= DragWidth;
rect.y += DragHeight; rect.y += DragHeight;
var r = rect; var r = rect;
rect.y += m_FilterHeight; rect.y += m_FilterHeight;
rect.height = rect.height - m_FilterHeight - DragHeight * 2; rect.height = rect.height - m_FilterHeight - DragHeight * 2;
var rect2 = rect; var rect2 = rect;
m_treeView.OnCheckAllGUI(); m_treeView.OnCheckAllGUI();
m_treeView.OnGUI(rect2); m_treeView.OnGUI(rect2);
//DrawExportButton(r); //DrawExportButton(r);
m_treeView.OnFilterGUI(r); m_treeView.OnFilterGUI(r);
//if (m_treeView.IsFilteredDirty()) //if (m_treeView.IsFilteredDirty())
// m_treeView.Reload(); // m_treeView.Reload();
} }
//private void DrawExportButton(Rect rect) //private void DrawExportButton(Rect rect)
//{ //{
// var br = rect; // var br = rect;
// br.height = 20; // br.height = 20;
// br.width = 50; // br.width = 50;
// if (GUI.Button(br, "Export")) // if (GUI.Button(br, "Export"))
// { // {
// var path = EditorUtility.SaveFilePanel("file", Application.dataPath, "data", "xml"); // var path = EditorUtility.SaveFilePanel("file", Application.dataPath, "data", "xml");
// if (!string.IsNullOrEmpty(path)) // if (!string.IsNullOrEmpty(path))
// Serializer.SaveAsXml(m_datas, path); // Serializer.SaveAsXml(m_datas, path);
// } // }
//} //}
} }
public delegate void DrawCellMethod<in T>(Rect cellRect, T item); public delegate void DrawCellMethod<in T>(Rect cellRect, T item);
public delegate bool FilterMethod<in T>(T data, string std); public delegate bool FilterMethod<in T>(T data, string std);
public delegate int CompareMethod<in T>(T data1, T data2); public delegate int CompareMethod<in T>(T data1, T data2);
public delegate void SelectMethod<T>(List<T> datas); public delegate void SelectMethod<T>(List<T> datas);
public class StringFilter public class StringFilter
{ {
public static bool Contains(string req, string std) public static bool Contains(string req, string std)
{ {
if (req == null || std == null) if (req == null || std == null)
return false; return false;
return req.IndexOf(std, 0, StringComparison.OrdinalIgnoreCase) >= 0; return req.IndexOf(std, 0, StringComparison.OrdinalIgnoreCase) >= 0;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3141a5220cd78d9468884a5aaa571bd1 guid: 3141a5220cd78d9468884a5aaa571bd1
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,275 +1,275 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using UnityEditor; using UnityEditor;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using UnityEngine; using UnityEngine;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class CommonTreeView<T> : TreeView where T : class public class CommonTreeView<T> : TreeView where T : class
{ {
private List<CommonTreeViewItem<T>> m_items; private List<CommonTreeViewItem<T>> m_items;
private Boolean isAllCheck; private Boolean isAllCheck;
private Action<Boolean> m_toggleSelectAll; private Action<Boolean> m_toggleSelectAll;
private readonly List<T> m_datas; private readonly List<T> m_datas;
public CommonTreeView( public CommonTreeView(
TreeViewState state, TreeViewState state,
MultiColumnHeader multiColumnHeader, MultiColumnHeader multiColumnHeader,
List<T> datas, List<T> datas,
FilterMethod<T> filter, FilterMethod<T> filter,
SelectMethod<T> select = null, SelectMethod<T> select = null,
Action<Boolean> toggleSelectAll = null) Action<Boolean> toggleSelectAll = null)
: base(state, multiColumnHeader) : base(state, multiColumnHeader)
{ {
m_datas = datas; m_datas = datas;
m_filter = filter; m_filter = filter;
m_select = select; m_select = select;
m_toggleSelectAll = toggleSelectAll; m_toggleSelectAll = toggleSelectAll;
multiColumnHeader.sortingChanged += OnSortingChanged; multiColumnHeader.sortingChanged += OnSortingChanged;
multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged; multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged;
showAlternatingRowBackgrounds = true; showAlternatingRowBackgrounds = true;
showBorder = true; showBorder = true;
rowHeight = EditorGUIUtility.singleLineHeight; rowHeight = EditorGUIUtility.singleLineHeight;
} }
private void OnVisibleColumnChanged(MultiColumnHeader multicolumnheader) private void OnVisibleColumnChanged(MultiColumnHeader multicolumnheader)
{ {
Reload(); Reload();
} }
private void OnSortingChanged(MultiColumnHeader multicolumnheader) private void OnSortingChanged(MultiColumnHeader multicolumnheader)
{ {
var rows = GetRows(); var rows = GetRows();
Sort(rows, multiColumnHeader.sortedColumnIndex); Sort(rows, multiColumnHeader.sortedColumnIndex);
} }
protected override TreeViewItem BuildRoot() protected override TreeViewItem BuildRoot()
{ {
return new CommonTreeViewItem<T>(-1, -1, null); return new CommonTreeViewItem<T>(-1, -1, null);
} }
protected override IList<TreeViewItem> BuildRows(TreeViewItem root) protected override IList<TreeViewItem> BuildRows(TreeViewItem root)
{ {
if (m_items == null) if (m_items == null)
{ {
m_items = new List<CommonTreeViewItem<T>>(); m_items = new List<CommonTreeViewItem<T>>();
for (var i = 0; i < m_datas.Count; i++) for (var i = 0; i < m_datas.Count; i++)
{ {
var data = m_datas[i]; var data = m_datas[i];
m_items.Add(new CommonTreeViewItem<T>(i, 0, data)); m_items.Add(new CommonTreeViewItem<T>(i, 0, data));
} }
} }
var items = m_items; var items = m_items;
if (!string.IsNullOrEmpty(m_text)) if (!string.IsNullOrEmpty(m_text))
items = Filter(items); items = Filter(items);
var list = new List<TreeViewItem>(); var list = new List<TreeViewItem>();
foreach (var item in items) foreach (var item in items)
{ {
list.Add(item); list.Add(item);
} }
if (multiColumnHeader.sortedColumnIndex >= 0) if (multiColumnHeader.sortedColumnIndex >= 0)
Sort(list, multiColumnHeader.sortedColumnIndex); Sort(list, multiColumnHeader.sortedColumnIndex);
return items.Cast<TreeViewItem>().ToList(); return items.Cast<TreeViewItem>().ToList();
} }
private readonly FilterMethod<T> m_filter; private readonly FilterMethod<T> m_filter;
[CanBeNull] [CanBeNull]
private readonly SelectMethod<T> m_select; private readonly SelectMethod<T> m_select;
private List<CommonTreeViewItem<T>> Filter(IEnumerable<CommonTreeViewItem<T>> rows) private List<CommonTreeViewItem<T>> Filter(IEnumerable<CommonTreeViewItem<T>> rows)
{ {
var enumerable = rows; var enumerable = rows;
var i = 0; var i = 0;
if (IsColumnVisible(i) && m_filter != null) if (IsColumnVisible(i) && m_filter != null)
{ {
enumerable = from item in enumerable enumerable = from item in enumerable
where m_filter(item.Data, m_text) where m_filter(item.Data, m_text)
select item; select item;
} }
return enumerable.ToList(); return enumerable.ToList();
} }
private CommonTableColumn<T> Col(int idx) private CommonTableColumn<T> Col(int idx)
{ {
return (CommonTableColumn<T>)multiColumnHeader.state.columns[idx]; return (CommonTableColumn<T>)multiColumnHeader.state.columns[idx];
} }
private void Sort(IList<TreeViewItem> rows, int sortIdx) private void Sort(IList<TreeViewItem> rows, int sortIdx)
{ {
var flag = multiColumnHeader.IsSortedAscending(sortIdx); var flag = multiColumnHeader.IsSortedAscending(sortIdx);
var comp = Col(sortIdx).Compare; var comp = Col(sortIdx).Compare;
var list = (List<TreeViewItem>)rows; var list = (List<TreeViewItem>)rows;
if (comp != null) if (comp != null)
{ {
Comparison<TreeViewItem> comparison = (lhs, rhs) => Comparison<TreeViewItem> comparison = (lhs, rhs) =>
{ {
var x1 = (CommonTreeViewItem<T>)lhs; var x1 = (CommonTreeViewItem<T>)lhs;
var x2 = (CommonTreeViewItem<T>)rhs; var x2 = (CommonTreeViewItem<T>)rhs;
return comp(x1.Data, x2.Data); return comp(x1.Data, x2.Data);
}; };
Comparison<TreeViewItem> comparison2 = (lhs, rhs) => Comparison<TreeViewItem> comparison2 = (lhs, rhs) =>
{ {
var x1 = (CommonTreeViewItem<T>)lhs; var x1 = (CommonTreeViewItem<T>)lhs;
var x2 = (CommonTreeViewItem<T>)rhs; var x2 = (CommonTreeViewItem<T>)rhs;
return -comp(x1.Data, x2.Data); return -comp(x1.Data, x2.Data);
}; };
list.Sort(!flag ? comparison2 : comparison); list.Sort(!flag ? comparison2 : comparison);
} }
} }
protected override void RowGUI(RowGUIArgs args) protected override void RowGUI(RowGUIArgs args)
{ {
var item = (CommonTreeViewItem<T>)args.item; var item = (CommonTreeViewItem<T>)args.item;
for (var i = 0; i < args.GetNumVisibleColumns(); i++) for (var i = 0; i < args.GetNumVisibleColumns(); i++)
{ {
CellGUI(args.GetCellRect(i), item.Data, args.GetColumn(i)); CellGUI(args.GetCellRect(i), item.Data, args.GetColumn(i));
} }
} }
private void CellGUI(Rect cellRect, T item, int columnIndex) private void CellGUI(Rect cellRect, T item, int columnIndex)
{ {
CenterRectUsingSingleLineHeight(ref cellRect); CenterRectUsingSingleLineHeight(ref cellRect);
var column = (CommonTableColumn<T>)multiColumnHeader.GetColumn(columnIndex); var column = (CommonTableColumn<T>)multiColumnHeader.GetColumn(columnIndex);
if (column.DrawCell != null) if (column.DrawCell != null)
column.DrawCell(cellRect, item); column.DrawCell(cellRect, item);
} }
public void OnCheckAllGUI() public void OnCheckAllGUI()
{ {
var selectedList = this.GetSelection(); var selectedList = this.GetSelection();
if (selectedList.Count != m_datas.Count) if (selectedList.Count != m_datas.Count)
{ {
isAllCheck = false; isAllCheck = false;
} }
var newState = GUI.Toggle(new Rect(5, 20, 50, 20), isAllCheck, "全选"); var newState = GUI.Toggle(new Rect(5, 20, 50, 20), isAllCheck, "全选");
if (newState != isAllCheck) if (newState != isAllCheck)
{ {
isAllCheck = newState; isAllCheck = newState;
if (isAllCheck) if (isAllCheck)
{ {
if (m_datas.Count != 0) if (m_datas.Count != 0)
{ {
this.SelectAllRows(); this.SelectAllRows();
} }
} else } else
{ {
this.SetSelection(new List<int>()); this.SetSelection(new List<int>());
} }
if (m_toggleSelectAll != null) if (m_toggleSelectAll != null)
{ {
m_toggleSelectAll(isAllCheck); m_toggleSelectAll(isAllCheck);
} }
} }
} }
public void OnFilterGUI(Rect r) public void OnFilterGUI(Rect r)
{ {
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
var width = r.width; var width = r.width;
var num = 16f; var num = 16f;
r.width = num; r.width = num;
r.x += num; r.x += num;
r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x; r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x;
//EditorGUI.LabelField(r, Styles.filterSelection); //EditorGUI.LabelField(r, Styles.filterSelection);
r.width = Mathf.Min(width - (r.x + r.width), 300f); r.width = Mathf.Min(width - (r.x + r.width), 300f);
r.x = width - r.width + 25; r.x = width - r.width + 25;
FilterGUI(r); FilterGUI(r);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
Reload(); Reload();
} }
} }
private string m_text; private string m_text;
private void FilterGUI(Rect r) private void FilterGUI(Rect r)
{ {
r.width -= 15f; r.width -= 15f;
//GUI.SetNextControlName("InputText"); //GUI.SetNextControlName("InputText");
m_text = EditorGUI.DelayedTextField(r, GUIContent.none, m_text, Styles.searchField); m_text = EditorGUI.DelayedTextField(r, GUIContent.none, m_text, Styles.searchField);
//EditorGUI.FocusTextInControl("InputText"); //EditorGUI.FocusTextInControl("InputText");
r.x += r.width; r.x += r.width;
r.width = 15f; r.width = 15f;
bool flag = m_text != ""; bool flag = m_text != "";
if (GUI.Button(r, GUIContent.none, (!flag) ? Styles.searchFieldCancelButtonEmpty : Styles.searchFieldCancelButton) && flag) if (GUI.Button(r, GUIContent.none, (!flag) ? Styles.searchFieldCancelButtonEmpty : Styles.searchFieldCancelButton) && flag)
{ {
m_text = ""; m_text = "";
GUIUtility.keyboardControl = 0; GUIUtility.keyboardControl = 0;
} }
} }
private bool IsColumnVisible(int idx) private bool IsColumnVisible(int idx)
{ {
return multiColumnHeader.state.visibleColumns.Any(t => t == idx); return multiColumnHeader.state.visibleColumns.Any(t => t == idx);
} }
protected override void KeyEvent() protected override void KeyEvent()
{ {
if (Event.current.type == EventType.KeyDown) if (Event.current.type == EventType.KeyDown)
{ {
if (Event.current.character == '\t') if (Event.current.character == '\t')
{ {
GUI.FocusControl(Styles.focusHelper); GUI.FocusControl(Styles.focusHelper);
Event.current.Use(); Event.current.Use();
} }
} }
} }
protected override void SelectionChanged(IList<int> selectedIds) protected override void SelectionChanged(IList<int> selectedIds)
{ {
var datas = new List<T>(); var datas = new List<T>();
foreach (var id in selectedIds) foreach (var id in selectedIds)
{ {
if (id < 0 || id > m_datas.Count) if (id < 0 || id > m_datas.Count)
{ {
Debug.Log(id + "out of range"); Debug.Log(id + "out of range");
continue; continue;
} }
var data = m_datas[id]; var data = m_datas[id];
datas.Add(data); datas.Add(data);
} }
if (m_select != null) if (m_select != null)
m_select(datas); m_select(datas);
} }
} }
public class CommonTableColumn<T> : MultiColumnHeaderState.Column public class CommonTableColumn<T> : MultiColumnHeaderState.Column
{ {
public DrawCellMethod<T> DrawCell; public DrawCellMethod<T> DrawCell;
//public IFilter Filter; //public IFilter Filter;
public CompareMethod<T> Compare { get; set; } public CompareMethod<T> Compare { get; set; }
} }
//public interface IFilter //public interface IFilter
//{ //{
// void OnGUI(Rect r); // void OnGUI(Rect r);
//} //}
//public interface IFilter<T> : IFilter //public interface IFilter<T> : IFilter
//{ //{
// bool Filter(T prop); // bool Filter(T prop);
//} //}
//public class StringFilter //public class StringFilter
//{ //{
// [SerializeField] // [SerializeField]
// protected string m_Text = ""; // protected string m_Text = "";
// public void OnGUI(Rect r) // public void OnGUI(Rect r)
// { // {
// } // }
// public bool Filter(string prop) // public bool Filter(string prop)
// { // {
// return prop.IndexOf(m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0; // return prop.IndexOf(m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0;
// } // }
//} //}
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 140f89fd874af114195925d1022b71a3 guid: 140f89fd874af114195925d1022b71a3
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,15 +1,15 @@
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal class CommonTreeViewItem<T> : TreeViewItem where T : class internal class CommonTreeViewItem<T> : TreeViewItem where T : class
{ {
public T Data { get; private set; } public T Data { get; private set; }
public CommonTreeViewItem(int id, int depth, T data) public CommonTreeViewItem(int id, int depth, T data)
: base(id, depth, data == null ? "Root" : data.ToString()) : base(id, depth, data == null ? "Root" : data.ToString())
{ {
Data = data; Data = data;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6cc83ac7be086cb4fa205a6a463b7ab7 guid: 6cc83ac7be086cb4fa205a6a463b7ab7
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,140 +1,140 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class FontWindow : BaseWindow<FontWindow> public class FontWindow : BaseWindow<FontWindow>
{ {
private AssetDataTable m_table; private AssetDataTable m_table;
private List<FontInfo> selectedObjects; private List<FontInfo> selectedObjects;
private List<FontInfo> originalInfos; private List<FontInfo> originalInfos;
private List<FontInfo> renderInfos; private List<FontInfo> renderInfos;
public class AssetDataTable : CommonTable<FontInfo> public class AssetDataTable : CommonTable<FontInfo>
{ {
public AssetDataTable(List<FontInfo> datas, public AssetDataTable(List<FontInfo> datas,
CommonTableColumn<FontInfo>[] cs, CommonTableColumn<FontInfo>[] cs,
FilterMethod<FontInfo> onfilter, FilterMethod<FontInfo> onfilter,
SelectMethod<FontInfo> onselect = null) SelectMethod<FontInfo> onselect = null)
: base(datas, cs, onfilter, onselect) : base(datas, cs, onfilter, onselect)
{ {
} }
} }
public FontWindow() : base() public FontWindow() : base()
{ {
if (m_table == null) if (m_table == null)
{ {
var datas = new List<FontInfo>(); var datas = new List<FontInfo>();
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
} }
} }
public CommonTableColumn<FontInfo>[] GetViewColumn() public CommonTableColumn<FontInfo>[] GetViewColumn()
{ {
var cols = new CommonTableColumn<FontInfo>[] var cols = new CommonTableColumn<FontInfo>[]
{ {
new CommonTableColumn<FontInfo> new CommonTableColumn<FontInfo>
{ {
headerContent = new GUIContent("name"), headerContent = new GUIContent("name"),
canSort = true, canSort = true,
minWidth = 170, minWidth = 170,
width = 170, width = 170,
Compare = (a,b) => -a.name.CompareTo(b.name), Compare = (a,b) => -a.name.CompareTo(b.name),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
}, },
new CommonTableColumn<FontInfo> new CommonTableColumn<FontInfo>
{ {
headerContent = new GUIContent("path"), headerContent = new GUIContent("path"),
canSort = true, canSort = true,
minWidth = 350, minWidth = 350,
width = 350, width = 350,
Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath), Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
} }
}; };
return cols; return cols;
} }
public void OnRowSelect(List<FontInfo> datas) public void OnRowSelect(List<FontInfo> datas)
{ {
currentAssetPathList = datas.Select((info) => info.assetPath).ToArray(); currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
selectedObjects = new List<FontInfo>(datas); selectedObjects = new List<FontInfo>(datas);
var list = new List<Font>(); var list = new List<Font>();
} }
private bool OnFilter(FontInfo data, string std) private bool OnFilter(FontInfo data, string std)
{ {
string name = std; string name = std;
if (name.Length == 0) if (name.Length == 0)
{ {
return true; return true;
} }
return data.name.ToLower().IndexOf(name.ToLower()) > -1; return data.name.ToLower().IndexOf(name.ToLower()) > -1;
} }
public override void RefreshTable() public override void RefreshTable()
{ {
if (needUpdateMainContent) if (needUpdateMainContent)
{ {
needUpdateMainContent = false; needUpdateMainContent = false;
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
} }
m_table.OnGUI(); m_table.OnGUI();
} }
public override void DrawOptionArea() public override void DrawOptionArea()
{ {
GUILayout.Space(40); GUILayout.Space(40);
if (GUILayout.Button("搜索字体文件", GUILayout.Width(160), GUILayout.Height(40))) if (GUILayout.Button("搜索字体文件", GUILayout.Width(160), GUILayout.Height(40)))
{ {
CollectAssets(); CollectAssets();
} }
} }
public void CollectAssets(Boolean needRefreshCurrentFolder = true) public void CollectAssets(Boolean needRefreshCurrentFolder = true)
{ {
if (needRefreshCurrentFolder) if (needRefreshCurrentFolder)
{ {
this.currentFolder = GetCurrentFolder(); this.currentFolder = GetCurrentFolder();
} }
originalInfos = new List<FontInfo>(); originalInfos = new List<FontInfo>();
var guids = AssetDatabase.FindAssets("t:font", new[] { this.currentFolder }); var guids = AssetDatabase.FindAssets("t:font", new[] { this.currentFolder });
var count = guids.Length; var count = guids.Length;
var current = 0; var current = 0;
foreach (string guid in guids) foreach (string guid in guids)
{ {
current++; current++;
EditorUtility.DisplayCancelableProgressBar("search font", "searching " + current, (float)current / count); EditorUtility.DisplayCancelableProgressBar("search font", "searching " + current, (float)current / count);
var obj = AssetDatabase.LoadAssetAtPath<Font>(AssetDatabase.GUIDToAssetPath(guid)); var obj = AssetDatabase.LoadAssetAtPath<Font>(AssetDatabase.GUIDToAssetPath(guid));
var filePath = AssetDatabase.GetAssetPath(obj); var filePath = AssetDatabase.GetAssetPath(obj);
originalInfos.Add(new FontInfo(obj, filePath)); originalInfos.Add(new FontInfo(obj, filePath));
} }
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
renderInfos = new List<FontInfo>(originalInfos); renderInfos = new List<FontInfo>(originalInfos);
needUpdateMainContent = true; needUpdateMainContent = true;
Selection.objects = null; Selection.objects = null;
} }
} }
public class FontInfo public class FontInfo
{ {
public string assetPath; public string assetPath;
public string name; public string name;
public FontInfo(Font info, string assetPath) public FontInfo(Font info, string assetPath)
{ {
this.assetPath = assetPath; this.assetPath = assetPath;
this.name = info.name; this.name = info.name;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8778b602782fa0845bc139a7683d43f9 guid: 8778b602782fa0845bc139a7683d43f9
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,65 +1,65 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine.Profiling; using UnityEngine.Profiling;
using System; using System;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class OptimizeOverview public class OptimizeOverview
{ {
private EditorWindow win; private EditorWindow win;
// 单例 // 单例
private static OptimizeOverview instance; private static OptimizeOverview instance;
private static readonly object locker = new object(); private static readonly object locker = new object();
private OptimizeOverview() private OptimizeOverview()
{ {
win = AnalysisWindow.GetCurrentWindow(); win = AnalysisWindow.GetCurrentWindow();
} }
public static OptimizeOverview GetInstance() public static OptimizeOverview GetInstance()
{ {
lock (locker) lock (locker)
{ {
if (instance == null) if (instance == null)
{ {
instance = new OptimizeOverview(); instance = new OptimizeOverview();
} }
} }
return instance; return instance;
} }
public void Show() public void Show()
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
if (GUILayout.Button("检查资源", GUILayout.Width(140), GUILayout.Height(40))) if (GUILayout.Button("检查资源", GUILayout.Width(140), GUILayout.Height(40)))
{ {
GetOverview(); GetOverview();
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
//DrawOverview(); //DrawOverview();
} }
public void GetOverview() public void GetOverview()
{ {
var textureWindow = TextureWindow.GetInstance(); var textureWindow = TextureWindow.GetInstance();
textureWindow.CollectAssets(); textureWindow.CollectAssets();
} }
public void DrawOverview() public void DrawOverview()
{ {
GUILayout.BeginVertical(); GUILayout.BeginVertical();
var textureWindow = TextureWindow.GetInstance(); var textureWindow = TextureWindow.GetInstance();
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 18cb6224e95e79540ad2fdc8626616de guid: 18cb6224e95e79540ad2fdc8626616de
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,234 +1,234 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public static class OptimizeTexture public static class OptimizeTexture
{ {
static string CACHE_PATH = "Library/AssetImporterbak"; static string CACHE_PATH = "Library/AssetImporterbak";
public static Boolean CheckNeedOptimization(Texture texture, out TextureImporter textureImporter) public static Boolean CheckNeedOptimization(Texture texture, out TextureImporter textureImporter)
{ {
var textureWindow = TextureWindow.GetInstance(); var textureWindow = TextureWindow.GetInstance();
string path = AssetDatabase.GetAssetPath(texture); string path = AssetDatabase.GetAssetPath(texture);
textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
if (!textureImporter || !texture) if (!textureImporter || !texture)
{ {
return false; return false;
} }
var _info = textureImporter.GetPlatformTextureSettings("WebGL"); var _info = textureImporter.GetPlatformTextureSettings("WebGL");
if (textureWindow.checkMipMap) if (textureWindow.checkMipMap)
{ {
if (!textureImporter.mipmapEnabled) if (!textureImporter.mipmapEnabled)
{ {
return false; return false;
} }
} }
if (textureWindow.formatError) if (textureWindow.formatError)
{ {
var list = new List<TextureImporterFormat>() { TextureImporterFormat.DXT5, TextureImporterFormat.DXT5Crunched, TextureImporterFormat.DXT1, TextureImporterFormat.DXT1Crunched }; var list = new List<TextureImporterFormat>() { TextureImporterFormat.DXT5, TextureImporterFormat.DXT5Crunched, TextureImporterFormat.DXT1, TextureImporterFormat.DXT1Crunched };
var format = _info.format == TextureImporterFormat.Automatic ? textureImporter.GetAutomaticFormat("WebGL") : _info.format; var format = _info.format == TextureImporterFormat.Automatic ? textureImporter.GetAutomaticFormat("WebGL") : _info.format;
if (!(!IsPowerOfTwo(texture.width) || !IsPowerOfTwo(texture.height))) if (!(!IsPowerOfTwo(texture.width) || !IsPowerOfTwo(texture.height)))
{ {
return false; return false;
} }
} }
if (textureWindow.checkIsReadable) if (textureWindow.checkIsReadable)
{ {
if (!textureImporter.isReadable) if (!textureImporter.isReadable)
{ {
return false; return false;
} }
} }
if (textureWindow.checkMaxSize) if (textureWindow.checkMaxSize)
{ {
if (!(_info.maxTextureSize >= 512)) if (!(_info.maxTextureSize >= 512))
{ {
return false; return false;
} }
} }
return true; return true;
} }
static bool IsPowerOfTwo(int x) static bool IsPowerOfTwo(int x)
{ {
return (x & (x - 1)) == 0; return (x & (x - 1)) == 0;
} }
public static void Optimize(List<TextureInfo> textureInfos) public static void Optimize(List<TextureInfo> textureInfos)
{ {
RecordSettings(textureInfos); RecordSettings(textureInfos);
var textureWindow = TextureWindow.GetInstance(); var textureWindow = TextureWindow.GetInstance();
var totalCount = textureInfos.Count; var totalCount = textureInfos.Count;
var idx = 0; var idx = 0;
var changedTextures = new List<Texture>(); var changedTextures = new List<Texture>();
foreach (var info in textureInfos) foreach (var info in textureInfos)
{ {
idx++; idx++;
TextureImporter textureImporter = AssetImporter.GetAtPath(info.assetPath) as TextureImporter; TextureImporter textureImporter = AssetImporter.GetAtPath(info.assetPath) as TextureImporter;
TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings(); TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
settings.overridden = true; settings.overridden = true;
int maxRect = Math.Max(info.width, info.height) / 2; int maxRect = Math.Max(info.width, info.height) / 2;
var needReImport = false; var needReImport = false;
if (textureWindow.disableReadable) if (textureWindow.disableReadable)
{ {
needReImport = true; needReImport = true;
textureImporter.isReadable = false; textureImporter.isReadable = false;
} }
if (textureWindow.disableMipmap) if (textureWindow.disableMipmap)
{ {
needReImport = true; needReImport = true;
textureImporter.mipmapEnabled = false; textureImporter.mipmapEnabled = false;
} }
if (textureWindow.changeMaxSize) if (textureWindow.changeMaxSize)
{ {
needReImport = true; needReImport = true;
if (textureWindow.selectedMaxSizeIdx == 0) if (textureWindow.selectedMaxSizeIdx == 0)
{ {
settings.maxTextureSize = getMaxSize(maxRect); settings.maxTextureSize = getMaxSize(maxRect);
//textureImporter.maxTextureSize = getMaxSize(maxRect); //textureImporter.maxTextureSize = getMaxSize(maxRect);
} }
else else
{ {
settings.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]); settings.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
//textureImporter.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]); //textureImporter.maxTextureSize = int.Parse(textureWindow.maxSizeOptions[textureWindow.selectedMaxSizeIdx]);
} }
} }
if (textureWindow.changeFormat) if (textureWindow.changeFormat)
{ {
needReImport = true; needReImport = true;
var formatMap = textureWindow.formatMap; var formatMap = textureWindow.formatMap;
var list = new List<string>(formatMap.Keys); var list = new List<string>(formatMap.Keys);
var i = textureWindow.textureFormatSelected; var i = textureWindow.textureFormatSelected;
TextureImporterFormat format = formatMap[list[i]]; TextureImporterFormat format = formatMap[list[i]];
settings.name = "WebGL"; settings.name = "WebGL";
settings.format = format; settings.format = format;
} }
if (needReImport) if (needReImport)
{ {
var tex = AssetDatabase.LoadAssetAtPath<Texture>(info.assetPath); var tex = AssetDatabase.LoadAssetAtPath<Texture>(info.assetPath);
changedTextures.Add(tex); changedTextures.Add(tex);
EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + idx, (float)idx / totalCount); EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + idx, (float)idx / totalCount);
textureImporter.SetPlatformTextureSettings(settings); textureImporter.SetPlatformTextureSettings(settings);
textureImporter.SaveAndReimport(); textureImporter.SaveAndReimport();
AssetDatabase.ImportAsset(info.assetPath); AssetDatabase.ImportAsset(info.assetPath);
} }
} }
//Undo.RecordObjects(changedTextures.ToArray(), "optimize"); //Undo.RecordObjects(changedTextures.ToArray(), "optimize");
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
} }
private static int getMaxSize(int size) private static int getMaxSize(int size)
{ {
if (size <= 32) if (size <= 32)
{ {
return 32; return 32;
} }
else if (size > 32 && size <= 64) else if (size > 32 && size <= 64)
{ {
return 64; return 64;
} }
else if (size > 64 && size <= 128) else if (size > 64 && size <= 128)
{ {
return 128; return 128;
} }
else if (size > 128 && size <= 256) else if (size > 128 && size <= 256)
{ {
return 256; return 256;
} }
else if (size > 256 && size <= 512) else if (size > 256 && size <= 512)
{ {
return 512; return 512;
} }
else if (size > 512 && size <= 1024) else if (size > 512 && size <= 1024)
{ {
return 1024; return 1024;
} }
return 1024; return 1024;
} }
public static void RecordSettings(List<TextureInfo> textureInfos) public static void RecordSettings(List<TextureInfo> textureInfos)
{ {
if (textureInfos.Count == 0) if (textureInfos.Count == 0)
{ {
return; return;
} }
if (File.Exists(CACHE_PATH)) if (File.Exists(CACHE_PATH))
{ {
File.Delete(CACHE_PATH); File.Delete(CACHE_PATH);
} }
var guids = new List<string>(); var guids = new List<string>();
var importsettings = new List<BaseInfo>(); var importsettings = new List<BaseInfo>();
foreach (var info in textureInfos) foreach (var info in textureInfos)
{ {
var textInfo = new BaseInfo(); var textInfo = new BaseInfo();
textInfo.assetPath = info.assetPath; textInfo.assetPath = info.assetPath;
textInfo.maxTextureSize = info.maxTextureSize; textInfo.maxTextureSize = info.maxTextureSize;
textInfo.mipmapEnabled = info.mipmapEnabled; textInfo.mipmapEnabled = info.mipmapEnabled;
textInfo.isReadable = info.isReadable; textInfo.isReadable = info.isReadable;
textInfo._webglFormat = info._webglFormat; textInfo._webglFormat = info._webglFormat;
guids.Add(AssetDatabase.AssetPathToGUID(info.assetPath)); guids.Add(AssetDatabase.AssetPathToGUID(info.assetPath));
importsettings.Add(textInfo); importsettings.Add(textInfo);
} }
using (FileStream fs = File.OpenWrite(CACHE_PATH)) using (FileStream fs = File.OpenWrite(CACHE_PATH))
{ {
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, guids); bf.Serialize(fs, guids);
bf.Serialize(fs, importsettings); bf.Serialize(fs, importsettings);
} }
} }
public static void Recover(List<TextureInfo> textureInfos) public static void Recover(List<TextureInfo> textureInfos)
{ {
if (File.Exists(CACHE_PATH)) if (File.Exists(CACHE_PATH))
{ {
var guids = new List<string>(); var guids = new List<string>();
var importSettings = new List<BaseInfo>(); var importSettings = new List<BaseInfo>();
using (FileStream fs = File.OpenRead(CACHE_PATH)) using (FileStream fs = File.OpenRead(CACHE_PATH))
{ {
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
guids = (List<string>)bf.Deserialize(fs); guids = (List<string>)bf.Deserialize(fs);
importSettings = (List<BaseInfo>)bf.Deserialize(fs); importSettings = (List<BaseInfo>)bf.Deserialize(fs);
} }
var totalCount = textureInfos.Count; var totalCount = textureInfos.Count;
for (int i = 0; i < totalCount; i++) for (int i = 0; i < totalCount; i++)
{ {
string path = textureInfos[i].assetPath; string path = textureInfos[i].assetPath;
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
{ {
TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings(); TextureImporterPlatformSettings settings = new TextureImporterPlatformSettings();
EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + i, (float)i / totalCount); EditorUtility.DisplayCancelableProgressBar("Recover", "Reading Cache " + i, (float)i / totalCount);
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
BaseInfo info = importSettings[i]; BaseInfo info = importSettings[i];
textureImporter.maxTextureSize = info.maxTextureSize; textureImporter.maxTextureSize = info.maxTextureSize;
textureImporter.mipmapEnabled = info.mipmapEnabled; textureImporter.mipmapEnabled = info.mipmapEnabled;
textureImporter.isReadable = info.isReadable; textureImporter.isReadable = info.isReadable;
settings.name = "WebGL"; settings.name = "WebGL";
settings.format = info._webglFormat; settings.format = info._webglFormat;
textureImporter.SetPlatformTextureSettings(settings); textureImporter.SetPlatformTextureSettings(settings);
textureImporter.SaveAndReimport(); textureImporter.SaveAndReimport();
AssetDatabase.ImportAsset(path); AssetDatabase.ImportAsset(path);
} }
} }
File.Delete(CACHE_PATH); File.Delete(CACHE_PATH);
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
} }
//Debug.Log("call undo"); //Debug.Log("call undo");
//var list = new List<Texture>(); //var list = new List<Texture>();
//foreach (var data in textureInfos) //foreach (var data in textureInfos)
//{ //{
// var texture = data.texture; // var texture = data.texture;
// list.Add(texture); // list.Add(texture);
//} //}
//Selection.objects = list.ToArray(); //Selection.objects = list.ToArray();
//Undo.PerformUndo(); //Undo.PerformUndo();
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 369d620a6ebd49d48b655b7f71fa0cd9 guid: 369d620a6ebd49d48b655b7f71fa0cd9
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,153 +1,153 @@
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class PrefabWindow : BaseWindow<PrefabWindow> public class PrefabWindow : BaseWindow<PrefabWindow>
{ {
private AssetDataTable m_table; private AssetDataTable m_table;
private List<PrefabInfo> selectedObjects; private List<PrefabInfo> selectedObjects;
private List<PrefabInfo> originalInfos; private List<PrefabInfo> originalInfos;
private List<PrefabInfo> renderInfos; private List<PrefabInfo> renderInfos;
public class AssetDataTable : CommonTable<PrefabInfo> public class AssetDataTable : CommonTable<PrefabInfo>
{ {
public AssetDataTable(List<PrefabInfo> datas, public AssetDataTable(List<PrefabInfo> datas,
CommonTableColumn<PrefabInfo>[] cs, CommonTableColumn<PrefabInfo>[] cs,
FilterMethod<PrefabInfo> onfilter, FilterMethod<PrefabInfo> onfilter,
SelectMethod<PrefabInfo> onselect = null) SelectMethod<PrefabInfo> onselect = null)
: base(datas, cs, onfilter, onselect) : base(datas, cs, onfilter, onselect)
{ {
} }
} }
public PrefabWindow() : base() public PrefabWindow() : base()
{ {
if (m_table == null) if (m_table == null)
{ {
var datas = new List<PrefabInfo>(); var datas = new List<PrefabInfo>();
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(datas, cols, OnFilter, OnRowSelect);
} }
} }
public CommonTableColumn<PrefabInfo>[] GetViewColumn() public CommonTableColumn<PrefabInfo>[] GetViewColumn()
{ {
var cols = new CommonTableColumn<PrefabInfo>[] var cols = new CommonTableColumn<PrefabInfo>[]
{ {
new CommonTableColumn<PrefabInfo> new CommonTableColumn<PrefabInfo>
{ {
headerContent = new GUIContent("name"), headerContent = new GUIContent("name"),
canSort = true, canSort = true,
minWidth = 210, minWidth = 210,
width = 210, width = 210,
Compare = (a,b) => -a.name.CompareTo(b.name), Compare = (a,b) => -a.name.CompareTo(b.name),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.name)
}, },
new CommonTableColumn<PrefabInfo> new CommonTableColumn<PrefabInfo>
{ {
headerContent = new GUIContent("path"), headerContent = new GUIContent("path"),
canSort = true, canSort = true,
minWidth = 650, minWidth = 650,
width = 650, width = 650,
Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath), Compare = (a,b) => -a.assetPath.CompareTo(b.assetPath),
DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath) DrawCell = (rect, data) => EditorGUI.LabelField(rect, data.assetPath)
} }
}; };
return cols; return cols;
} }
public void OnRowSelect(List<PrefabInfo> datas) public void OnRowSelect(List<PrefabInfo> datas)
{ {
currentAssetPathList = datas.Select((info) => info.assetPath).ToArray(); currentAssetPathList = datas.Select((info) => info.assetPath).ToArray();
selectedObjects = new List<PrefabInfo>(datas); selectedObjects = new List<PrefabInfo>(datas);
var list = new List<GameObject>(); var list = new List<GameObject>();
foreach (var data in datas) foreach (var data in datas)
{ {
var info = data._info; var info = data._info;
list.Add(info); list.Add(info);
} }
Selection.objects = list.ToArray(); Selection.objects = list.ToArray();
} }
private bool OnFilter(PrefabInfo data, string std) private bool OnFilter(PrefabInfo data, string std)
{ {
string name = std; string name = std;
if (name.Length == 0) if (name.Length == 0)
{ {
return true; return true;
} }
return data.name.ToLower().IndexOf(name.ToLower()) > -1; return data.name.ToLower().IndexOf(name.ToLower()) > -1;
} }
public override void RefreshTable() public override void RefreshTable()
{ {
if (needUpdateMainContent) if (needUpdateMainContent)
{ {
needUpdateMainContent = false; needUpdateMainContent = false;
var cols = GetViewColumn(); var cols = GetViewColumn();
m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect); m_table = new AssetDataTable(renderInfos, cols, OnFilter, OnRowSelect);
} }
m_table.OnGUI(); m_table.OnGUI();
} }
public override void DrawOptionArea() public override void DrawOptionArea()
{ {
GUILayout.Space(40); GUILayout.Space(40);
if (GUILayout.Button("搜索prefab", GUILayout.Width(160), GUILayout.Height(40))) if (GUILayout.Button("搜索prefab", GUILayout.Width(160), GUILayout.Height(40)))
{ {
CollectAssets(); CollectAssets();
} }
} }
public void CollectAssets(Boolean needRefreshCurrentFolder = true) public void CollectAssets(Boolean needRefreshCurrentFolder = true)
{ {
if (needRefreshCurrentFolder) if (needRefreshCurrentFolder)
{ {
this.currentFolder = GetCurrentFolder(); this.currentFolder = GetCurrentFolder();
} }
originalInfos = new List<PrefabInfo>(); originalInfos = new List<PrefabInfo>();
var guids = AssetDatabase.FindAssets("t:prefab", new[] { this.currentFolder }); var guids = AssetDatabase.FindAssets("t:prefab", new[] { this.currentFolder });
var count = guids.Length; var count = guids.Length;
var current = 0; var current = 0;
foreach (string guid in guids) foreach (string guid in guids)
{ {
current++; current++;
EditorUtility.DisplayCancelableProgressBar("search prefab", "searching " + current, (float)current / count); EditorUtility.DisplayCancelableProgressBar("search prefab", "searching " + current, (float)current / count);
var obj = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(guid)); var obj = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GUIDToAssetPath(guid));
PrefabAssetType pType = PrefabUtility.GetPrefabAssetType(obj); PrefabAssetType pType = PrefabUtility.GetPrefabAssetType(obj);
if (pType == PrefabAssetType.Regular) if (pType == PrefabAssetType.Regular)
{ {
var filePath = AssetDatabase.GetAssetPath(obj); var filePath = AssetDatabase.GetAssetPath(obj);
originalInfos.Add(new PrefabInfo(obj, filePath)); originalInfos.Add(new PrefabInfo(obj, filePath));
} }
} }
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
renderInfos = new List<PrefabInfo>(originalInfos); renderInfos = new List<PrefabInfo>(originalInfos);
needUpdateMainContent = true; needUpdateMainContent = true;
Selection.objects = null; Selection.objects = null;
} }
} }
public class PrefabInfo public class PrefabInfo
{ {
public string assetPath; public string assetPath;
public string name; public string name;
public GameObject _info; public GameObject _info;
public PrefabInfo(GameObject info, string assetPath) public PrefabInfo(GameObject info, string assetPath)
{ {
this._info = info; this._info = info;
this.assetPath = assetPath; this.assetPath = assetPath;
this.name = info.name; this.name = info.name;
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f6b6e40684e6347479197156333a29e2 guid: f6b6e40684e6347479197156333a29e2
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,255 +1,255 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
public class ReferenceFinderData public class ReferenceFinderData
{ {
//缓存路径 //缓存路径
private const string CACHE_PATH = "Library/ReferenceFinderCache"; private const string CACHE_PATH = "Library/ReferenceFinderCache";
//资源引用信息字典 //资源引用信息字典
public Dictionary<string, AssetDescription> assetDict = new Dictionary<string, AssetDescription>(); public Dictionary<string, AssetDescription> assetDict = new Dictionary<string, AssetDescription>();
//收集资源引用信息并更新缓存 //收集资源引用信息并更新缓存
public void CollectDependenciesInfo() public void CollectDependenciesInfo()
{ {
try try
{ {
//ReadFromCache(); //ReadFromCache();
var allAssets = AssetDatabase.GetAllAssetPaths(); var allAssets = AssetDatabase.GetAllAssetPaths();
int totalCount = allAssets.Length; int totalCount = allAssets.Length;
for (int i = 0; i < allAssets.Length; i++) for (int i = 0; i < allAssets.Length; i++)
{ {
//每遍历100个Asset更新一下进度条同时对进度条的取消操作进行处理 //每遍历100个Asset更新一下进度条同时对进度条的取消操作进行处理
if ((i % 100 == 0) && EditorUtility.DisplayCancelableProgressBar("Refresh", string.Format("Collecting {0} assets", i), (float)i / totalCount)) if ((i % 100 == 0) && EditorUtility.DisplayCancelableProgressBar("Refresh", string.Format("Collecting {0} assets", i), (float)i / totalCount))
{ {
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
return; return;
} }
if (File.Exists(allAssets[i])) if (File.Exists(allAssets[i]))
ImportAsset(allAssets[i]); ImportAsset(allAssets[i]);
if (i % 2000 == 0) if (i % 2000 == 0)
GC.Collect(); GC.Collect();
} }
////将信息写入缓存 ////将信息写入缓存
//EditorUtility.DisplayCancelableProgressBar("Refresh", "Write to cache", 1f); //EditorUtility.DisplayCancelableProgressBar("Refresh", "Write to cache", 1f);
//WriteToChache(); //WriteToChache();
////生成引用数据 ////生成引用数据
//EditorUtility.DisplayCancelableProgressBar("Refresh", "Generating asset reference info", 1f); //EditorUtility.DisplayCancelableProgressBar("Refresh", "Generating asset reference info", 1f);
UpdateReferenceInfo(); UpdateReferenceInfo();
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogError(e); Debug.LogError(e);
EditorUtility.ClearProgressBar(); EditorUtility.ClearProgressBar();
} }
} }
//通过依赖信息更新引用信息 //通过依赖信息更新引用信息
private void UpdateReferenceInfo() private void UpdateReferenceInfo()
{ {
foreach (var asset in assetDict) foreach (var asset in assetDict)
{ {
foreach (var assetGuid in asset.Value.dependencies) foreach (var assetGuid in asset.Value.dependencies)
{ {
assetDict[assetGuid].references.Add(asset.Key); assetDict[assetGuid].references.Add(asset.Key);
} }
} }
} }
//生成并加入引用信息 //生成并加入引用信息
private void ImportAsset(string path) private void ImportAsset(string path)
{ {
//通过path获取guid进行储存 //通过path获取guid进行储存
string guid = AssetDatabase.AssetPathToGUID(path); string guid = AssetDatabase.AssetPathToGUID(path);
//获取该资源的最后修改时间,用于之后的修改判断 //获取该资源的最后修改时间,用于之后的修改判断
Hash128 assetDependencyHash = AssetDatabase.GetAssetDependencyHash(path); Hash128 assetDependencyHash = AssetDatabase.GetAssetDependencyHash(path);
//如果assetDict没包含该guid或包含了修改时间不一样则需要更新 //如果assetDict没包含该guid或包含了修改时间不一样则需要更新
if (!assetDict.ContainsKey(guid) || assetDict[guid].assetDependencyHash != assetDependencyHash) if (!assetDict.ContainsKey(guid) || assetDict[guid].assetDependencyHash != assetDependencyHash)
{ {
//将每个资源的直接依赖资源转化为guid进行储存 //将每个资源的直接依赖资源转化为guid进行储存
var guids = AssetDatabase.GetDependencies(path, false). var guids = AssetDatabase.GetDependencies(path, false).
Select(p => AssetDatabase.AssetPathToGUID(p)). Select(p => AssetDatabase.AssetPathToGUID(p)).
ToList(); ToList();
//生成asset依赖信息被引用需要在所有的asset依赖信息生成完后才能生成 //生成asset依赖信息被引用需要在所有的asset依赖信息生成完后才能生成
AssetDescription ad = new AssetDescription(); AssetDescription ad = new AssetDescription();
ad.name = Path.GetFileNameWithoutExtension(path); ad.name = Path.GetFileNameWithoutExtension(path);
ad.path = path; ad.path = path;
ad.assetDependencyHash = assetDependencyHash; ad.assetDependencyHash = assetDependencyHash;
ad.dependencies = guids; ad.dependencies = guids;
if (assetDict.ContainsKey(guid)) if (assetDict.ContainsKey(guid))
assetDict[guid] = ad; assetDict[guid] = ad;
else else
assetDict.Add(guid, ad); assetDict.Add(guid, ad);
} }
} }
//读取缓存信息 //读取缓存信息
public bool ReadFromCache() public bool ReadFromCache()
{ {
assetDict.Clear(); assetDict.Clear();
if (File.Exists(CACHE_PATH)) if (File.Exists(CACHE_PATH))
{ {
var serializedGuid = new List<string>(); var serializedGuid = new List<string>();
var serializedDependencyHash = new List<Hash128>(); var serializedDependencyHash = new List<Hash128>();
var serializedDenpendencies = new List<int[]>(); var serializedDenpendencies = new List<int[]>();
//反序列化数据 //反序列化数据
using (FileStream fs = File.OpenRead(CACHE_PATH)) using (FileStream fs = File.OpenRead(CACHE_PATH))
{ {
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
//EditorUtility.DisplayCancelableProgressBar("Import Cache", "Reading Cache", 0); //EditorUtility.DisplayCancelableProgressBar("Import Cache", "Reading Cache", 0);
serializedGuid = (List<string>)bf.Deserialize(fs); serializedGuid = (List<string>)bf.Deserialize(fs);
serializedDependencyHash = (List<Hash128>)bf.Deserialize(fs); serializedDependencyHash = (List<Hash128>)bf.Deserialize(fs);
serializedDenpendencies = (List<int[]>)bf.Deserialize(fs); serializedDenpendencies = (List<int[]>)bf.Deserialize(fs);
//EditorUtility.ClearProgressBar(); //EditorUtility.ClearProgressBar();
} }
for (int i = 0; i < serializedGuid.Count; ++i) for (int i = 0; i < serializedGuid.Count; ++i)
{ {
string path = AssetDatabase.GUIDToAssetPath(serializedGuid[i]); string path = AssetDatabase.GUIDToAssetPath(serializedGuid[i]);
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
{ {
var ad = new AssetDescription(); var ad = new AssetDescription();
ad.name = Path.GetFileNameWithoutExtension(path); ad.name = Path.GetFileNameWithoutExtension(path);
ad.path = path; ad.path = path;
ad.assetDependencyHash = serializedDependencyHash[i]; ad.assetDependencyHash = serializedDependencyHash[i];
assetDict.Add(serializedGuid[i], ad); assetDict.Add(serializedGuid[i], ad);
} }
} }
for (int i = 0; i < serializedGuid.Count; ++i) for (int i = 0; i < serializedGuid.Count; ++i)
{ {
string guid = serializedGuid[i]; string guid = serializedGuid[i];
if (assetDict.ContainsKey(guid)) if (assetDict.ContainsKey(guid))
{ {
var guids = serializedDenpendencies[i]. var guids = serializedDenpendencies[i].
Select(index => serializedGuid[index]). Select(index => serializedGuid[index]).
Where(g => assetDict.ContainsKey(g)). Where(g => assetDict.ContainsKey(g)).
ToList(); ToList();
assetDict[guid].dependencies = guids; assetDict[guid].dependencies = guids;
} }
} }
UpdateReferenceInfo(); UpdateReferenceInfo();
return true; return true;
} }
return false; return false;
} }
//写入缓存 //写入缓存
private void WriteToChache() private void WriteToChache()
{ {
if (File.Exists(CACHE_PATH)) if (File.Exists(CACHE_PATH))
File.Delete(CACHE_PATH); File.Delete(CACHE_PATH);
var serializedGuid = new List<string>(); var serializedGuid = new List<string>();
var serializedDependencyHash = new List<Hash128>(); var serializedDependencyHash = new List<Hash128>();
var serializedDenpendencies = new List<int[]>(); var serializedDenpendencies = new List<int[]>();
//辅助映射字典 //辅助映射字典
var guidIndex = new Dictionary<string, int>(); var guidIndex = new Dictionary<string, int>();
//序列化 //序列化
using (FileStream fs = File.OpenWrite(CACHE_PATH)) using (FileStream fs = File.OpenWrite(CACHE_PATH))
{ {
foreach (var pair in assetDict) foreach (var pair in assetDict)
{ {
guidIndex.Add(pair.Key, guidIndex.Count); guidIndex.Add(pair.Key, guidIndex.Count);
serializedGuid.Add(pair.Key); serializedGuid.Add(pair.Key);
serializedDependencyHash.Add(pair.Value.assetDependencyHash); serializedDependencyHash.Add(pair.Value.assetDependencyHash);
} }
foreach (var guid in serializedGuid) foreach (var guid in serializedGuid)
{ {
int[] indexes = assetDict[guid].dependencies.Select(s => guidIndex[s]).ToArray(); int[] indexes = assetDict[guid].dependencies.Select(s => guidIndex[s]).ToArray();
serializedDenpendencies.Add(indexes); serializedDenpendencies.Add(indexes);
} }
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, serializedGuid); bf.Serialize(fs, serializedGuid);
bf.Serialize(fs, serializedDependencyHash); bf.Serialize(fs, serializedDependencyHash);
bf.Serialize(fs, serializedDenpendencies); bf.Serialize(fs, serializedDenpendencies);
} }
} }
//更新引用信息状态 //更新引用信息状态
public void UpdateAssetState(string guid) public void UpdateAssetState(string guid)
{ {
AssetDescription ad; AssetDescription ad;
if (assetDict.TryGetValue(guid, out ad) && ad.state != AssetState.NODATA) if (assetDict.TryGetValue(guid, out ad) && ad.state != AssetState.NODATA)
{ {
if (File.Exists(ad.path)) if (File.Exists(ad.path))
{ {
//修改时间与记录的不同为修改过的资源 //修改时间与记录的不同为修改过的资源
if (ad.assetDependencyHash != AssetDatabase.GetAssetDependencyHash(ad.path)) if (ad.assetDependencyHash != AssetDatabase.GetAssetDependencyHash(ad.path))
{ {
ad.state = AssetState.CHANGED; ad.state = AssetState.CHANGED;
} }
else else
{ {
//默认为普通资源 //默认为普通资源
ad.state = AssetState.NORMAL; ad.state = AssetState.NORMAL;
} }
} }
//不存在为丢失 //不存在为丢失
else else
{ {
ad.state = AssetState.MISSING; ad.state = AssetState.MISSING;
} }
} }
//字典中没有该数据 //字典中没有该数据
else if (!assetDict.TryGetValue(guid, out ad)) else if (!assetDict.TryGetValue(guid, out ad))
{ {
string path = AssetDatabase.GUIDToAssetPath(guid); string path = AssetDatabase.GUIDToAssetPath(guid);
ad = new AssetDescription(); ad = new AssetDescription();
ad.name = Path.GetFileNameWithoutExtension(path); ad.name = Path.GetFileNameWithoutExtension(path);
ad.path = path; ad.path = path;
ad.state = AssetState.NODATA; ad.state = AssetState.NODATA;
assetDict.Add(guid, ad); assetDict.Add(guid, ad);
} }
} }
//根据引用信息状态获取状态描述 //根据引用信息状态获取状态描述
public static string GetInfoByState(AssetState state) public static string GetInfoByState(AssetState state)
{ {
if (state == AssetState.CHANGED) if (state == AssetState.CHANGED)
{ {
return "<color=#F0672AFF>Changed</color>"; return "<color=#F0672AFF>Changed</color>";
} }
else if (state == AssetState.MISSING) else if (state == AssetState.MISSING)
{ {
return "<color=#FF0000FF>Missing</color>"; return "<color=#FF0000FF>Missing</color>";
} }
else if (state == AssetState.NODATA) else if (state == AssetState.NODATA)
{ {
return "<color=#FFE300FF>No Data</color>"; return "<color=#FFE300FF>No Data</color>";
} }
return "Normal"; return "Normal";
} }
public class AssetDescription public class AssetDescription
{ {
public string name = ""; public string name = "";
public string path = ""; public string path = "";
public Hash128 assetDependencyHash; public Hash128 assetDependencyHash;
public List<string> dependencies = new List<string>(); public List<string> dependencies = new List<string>();
public List<string> references = new List<string>(); public List<string> references = new List<string>();
public AssetState state = AssetState.NORMAL; public AssetState state = AssetState.NORMAL;
} }
public enum AssetState public enum AssetState
{ {
NORMAL, NORMAL,
CHANGED, CHANGED,
MISSING, MISSING,
NODATA, NODATA,
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1a00bcbadc21a944794aa56d47279b44 guid: 1a00bcbadc21a944794aa56d47279b44
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,135 +1,135 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling; using UnityEngine.Profiling;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal class SerializedPropertyDataStore internal class SerializedPropertyDataStore
{ {
private Data[] m_elements; private Data[] m_elements;
private readonly GatherDelegate m_gatherDel; private readonly GatherDelegate m_gatherDel;
private Object[] m_objects; private Object[] m_objects;
private readonly string[] m_propNames; private readonly string[] m_propNames;
public SerializedPropertyDataStore(string[] propNames, GatherDelegate gatherDel) public SerializedPropertyDataStore(string[] propNames, GatherDelegate gatherDel)
{ {
m_propNames = propNames; m_propNames = propNames;
m_gatherDel = gatherDel; m_gatherDel = gatherDel;
Repopulate(); Repopulate();
} }
public Data[] GetElements() public Data[] GetElements()
{ {
return m_elements; return m_elements;
} }
~SerializedPropertyDataStore() ~SerializedPropertyDataStore()
{ {
Clear(); Clear();
} }
public bool Repopulate() public bool Repopulate()
{ {
Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate"); Profiler.BeginSample("SerializedPropertyDataStore.Repopulate.GatherDelegate");
var array = m_gatherDel(); var array = m_gatherDel();
Profiler.EndSample(); Profiler.EndSample();
if (m_objects != null) if (m_objects != null)
{ {
if (array.Length == m_objects.Length && if (array.Length == m_objects.Length &&
ArrayUtility.ArrayReferenceEquals(array, m_objects)) ArrayUtility.ArrayReferenceEquals(array, m_objects))
{ {
return false; return false;
} }
Clear(); Clear();
} }
m_objects = array; m_objects = array;
m_elements = new Data[array.Length]; m_elements = new Data[array.Length];
for (var i = 0; i < array.Length; i++) for (var i = 0; i < array.Length; i++)
m_elements[i] = new Data(array[i], m_propNames); m_elements[i] = new Data(array[i], m_propNames);
return true; return true;
} }
private void Clear() private void Clear()
{ {
foreach (var t in m_elements) foreach (var t in m_elements)
t.Dispose(); t.Dispose();
m_objects = null; m_objects = null;
m_elements = null; m_elements = null;
} }
internal class Data internal class Data
{ {
private Object m_object; private Object m_object;
public Data(Object obj, IList<string> props) public Data(Object obj, IList<string> props)
{ {
m_object = obj; m_object = obj;
SerializedObject = new SerializedObject(obj); SerializedObject = new SerializedObject(obj);
Properties = new SerializedProperty[props.Count]; Properties = new SerializedProperty[props.Count];
for (var i = 0; i < props.Count; i++) for (var i = 0; i < props.Count; i++)
Properties[i] = SerializedObject.FindProperty(props[i]); Properties[i] = SerializedObject.FindProperty(props[i]);
} }
public string Name public string Name
{ {
get { return !(m_object != null) ? string.Empty : m_object.name; } get { return !(m_object != null) ? string.Empty : m_object.name; }
} }
public SerializedObject SerializedObject { get; private set; } public SerializedObject SerializedObject { get; private set; }
public SerializedProperty[] Properties { get; private set; } public SerializedProperty[] Properties { get; private set; }
public int ObjectId public int ObjectId
{ {
get get
{ {
int result; int result;
if (!m_object) if (!m_object)
{ {
result = 0; result = 0;
} }
else else
{ {
var component = m_object as Component; var component = m_object as Component;
result = !(component != null) result = !(component != null)
? m_object.GetInstanceID() ? m_object.GetInstanceID()
: component.gameObject.GetInstanceID(); : component.gameObject.GetInstanceID();
} }
return result; return result;
} }
} }
public void Dispose() public void Dispose()
{ {
var serializedProperties = Properties; var serializedProperties = Properties;
for (var i = 0; i < serializedProperties.Length; i++) for (var i = 0; i < serializedProperties.Length; i++)
{ {
var serializedProperty = serializedProperties[i]; var serializedProperty = serializedProperties[i];
if (serializedProperty != null) if (serializedProperty != null)
serializedProperty.Dispose(); serializedProperty.Dispose();
} }
SerializedObject.Dispose(); SerializedObject.Dispose();
m_object = null; m_object = null;
SerializedObject = null; SerializedObject = null;
Properties = null; Properties = null;
} }
public bool Update() public bool Update()
{ {
return m_object != null && SerializedObject.UpdateIfRequiredOrScript(); return m_object != null && SerializedObject.UpdateIfRequiredOrScript();
} }
public void Store() public void Store()
{ {
if (m_object != null) if (m_object != null)
SerializedObject.ApplyModifiedProperties(); SerializedObject.ApplyModifiedProperties();
} }
} }
internal delegate Object[] GatherDelegate(); internal delegate Object[] GatherDelegate();
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a64fa4108bbbbd24180bd924f26457f4 guid: a64fa4108bbbbd24180bd924f26457f4
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,116 +1,116 @@
using System; using System;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal class SerializedPropertyFilters internal class SerializedPropertyFilters
{ {
internal interface IFilter internal interface IFilter
{ {
bool Active(); bool Active();
bool Filter(SerializedProperty prop); bool Filter(SerializedProperty prop);
void OnGUI(Rect r); void OnGUI(Rect r);
string SerializeState(); string SerializeState();
void DeserializeState(string state); void DeserializeState(string state);
} }
internal abstract class SerializableFilter : SerializedPropertyFilters.IFilter internal abstract class SerializableFilter : SerializedPropertyFilters.IFilter
{ {
public abstract bool Active(); public abstract bool Active();
public abstract bool Filter(SerializedProperty prop); public abstract bool Filter(SerializedProperty prop);
public abstract void OnGUI(Rect r); public abstract void OnGUI(Rect r);
public string SerializeState() public string SerializeState()
{ {
return JsonUtility.ToJson(this); return JsonUtility.ToJson(this);
} }
public void DeserializeState(string state) public void DeserializeState(string state)
{ {
JsonUtility.FromJsonOverwrite(state, this); JsonUtility.FromJsonOverwrite(state, this);
} }
} }
internal class String : SerializedPropertyFilters.SerializableFilter internal class String : SerializedPropertyFilters.SerializableFilter
{ {
private static class Styles private static class Styles
{ {
public static readonly GUIStyle searchField = "SearchTextField"; public static readonly GUIStyle searchField = "SearchTextField";
public static readonly GUIStyle searchFieldCancelButton = "SearchCancelButton"; public static readonly GUIStyle searchFieldCancelButton = "SearchCancelButton";
public static readonly GUIStyle searchFieldCancelButtonEmpty = "SearchCancelButtonEmpty"; public static readonly GUIStyle searchFieldCancelButtonEmpty = "SearchCancelButtonEmpty";
} }
[SerializeField] [SerializeField]
protected string m_Text = ""; protected string m_Text = "";
public override bool Active() public override bool Active()
{ {
return !string.IsNullOrEmpty(this.m_Text); return !string.IsNullOrEmpty(this.m_Text);
} }
public override bool Filter(SerializedProperty prop) public override bool Filter(SerializedProperty prop)
{ {
return prop.stringValue.IndexOf(this.m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0; return prop.stringValue.IndexOf(this.m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0;
} }
public override void OnGUI(Rect r) public override void OnGUI(Rect r)
{ {
r.width -= 15f; r.width -= 15f;
this.m_Text = EditorGUI.TextField(r, GUIContent.none, this.m_Text, SerializedPropertyFilters.String.Styles.searchField); this.m_Text = EditorGUI.TextField(r, GUIContent.none, this.m_Text, SerializedPropertyFilters.String.Styles.searchField);
r.x += r.width; r.x += r.width;
r.width = 15f; r.width = 15f;
bool flag = this.m_Text != ""; bool flag = this.m_Text != "";
if (GUI.Button(r, GUIContent.none, (!flag) ? SerializedPropertyFilters.String.Styles.searchFieldCancelButtonEmpty : SerializedPropertyFilters.String.Styles.searchFieldCancelButton) && flag) if (GUI.Button(r, GUIContent.none, (!flag) ? SerializedPropertyFilters.String.Styles.searchFieldCancelButtonEmpty : SerializedPropertyFilters.String.Styles.searchFieldCancelButton) && flag)
{ {
this.m_Text = ""; this.m_Text = "";
GUIUtility.keyboardControl = 0; GUIUtility.keyboardControl = 0;
} }
} }
} }
internal sealed class Name : SerializedPropertyFilters.String internal sealed class Name : SerializedPropertyFilters.String
{ {
public bool Filter(string str) public bool Filter(string str)
{ {
return str.IndexOf(this.m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0; return str.IndexOf(this.m_Text, 0, StringComparison.OrdinalIgnoreCase) >= 0;
} }
} }
internal sealed class None : SerializedPropertyFilters.IFilter internal sealed class None : SerializedPropertyFilters.IFilter
{ {
public bool Active() public bool Active()
{ {
return false; return false;
} }
public bool Filter(SerializedProperty prop) public bool Filter(SerializedProperty prop)
{ {
return true; return true;
} }
public void OnGUI(Rect r) public void OnGUI(Rect r)
{ {
} }
public string SerializeState() public string SerializeState()
{ {
return null; return null;
} }
public void DeserializeState(string state) public void DeserializeState(string state)
{ {
} }
} }
internal static readonly SerializedPropertyFilters.None s_FilterNone = new SerializedPropertyFilters.None(); internal static readonly SerializedPropertyFilters.None s_FilterNone = new SerializedPropertyFilters.None();
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 66f1c580c01b20b45aed097c7b7f5655 guid: 66f1c580c01b20b45aed097c7b7f5655
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,141 +1,141 @@
using UnityEditor; using UnityEditor;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling; using UnityEngine.Profiling;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal class SerializedPropertyTable internal class SerializedPropertyTable
{ {
private readonly float m_DragHeight = 20f; private readonly float m_DragHeight = 20f;
private readonly float m_DragWidth = 32f; private readonly float m_DragWidth = 32f;
private readonly float m_FilterHeight = 20f; private readonly float m_FilterHeight = 20f;
private float m_ColumnHeaderHeight; private float m_ColumnHeaderHeight;
private SerializedPropertyDataStore m_DataStore; private SerializedPropertyDataStore m_DataStore;
private readonly SerializedPropertyDataStore.GatherDelegate m_GatherDelegate; private readonly SerializedPropertyDataStore.GatherDelegate m_GatherDelegate;
private readonly HeaderDelegate m_HeaderDelegate; private readonly HeaderDelegate m_HeaderDelegate;
private bool m_Initialized; private bool m_Initialized;
private MultiColumnHeaderState m_MultiColumnHeaderState; private MultiColumnHeaderState m_MultiColumnHeaderState;
private readonly string m_SerializationUID; private readonly string m_SerializationUID;
//private float m_TableHeight = 200f; //private float m_TableHeight = 200f;
private SerializedPropertyTreeView m_TreeView; private SerializedPropertyTreeView m_TreeView;
private TreeViewState m_TreeViewState; private TreeViewState m_TreeViewState;
public SerializedPropertyTable(string serializationUID, SerializedPropertyDataStore.GatherDelegate gatherDelegate, HeaderDelegate headerDelegate) public SerializedPropertyTable(string serializationUID, SerializedPropertyDataStore.GatherDelegate gatherDelegate, HeaderDelegate headerDelegate)
{ {
//dragHandleEnabled = true; //dragHandleEnabled = true;
m_SerializationUID = serializationUID; m_SerializationUID = serializationUID;
m_GatherDelegate = gatherDelegate; m_GatherDelegate = gatherDelegate;
m_HeaderDelegate = headerDelegate; m_HeaderDelegate = headerDelegate;
//OnEnable(); //OnEnable();
} }
//public bool dragHandleEnabled { get; set; } //public bool dragHandleEnabled { get; set; }
private void InitIfNeeded() private void InitIfNeeded()
{ {
if (!m_Initialized) if (!m_Initialized)
{ {
if (m_TreeViewState == null) if (m_TreeViewState == null)
m_TreeViewState = new TreeViewState(); m_TreeViewState = new TreeViewState();
if (m_MultiColumnHeaderState == null) if (m_MultiColumnHeaderState == null)
{ {
string[] propNames; string[] propNames;
m_MultiColumnHeaderState = new MultiColumnHeaderState(m_HeaderDelegate(out propNames)); m_MultiColumnHeaderState = new MultiColumnHeaderState(m_HeaderDelegate(out propNames));
m_DataStore = new SerializedPropertyDataStore(propNames, m_GatherDelegate); m_DataStore = new SerializedPropertyDataStore(propNames, m_GatherDelegate);
} }
var multiColumnHeader = new MultiColumnHeader(m_MultiColumnHeaderState); var multiColumnHeader = new MultiColumnHeader(m_MultiColumnHeaderState);
m_ColumnHeaderHeight = multiColumnHeader.height; m_ColumnHeaderHeight = multiColumnHeader.height;
m_TreeView = new SerializedPropertyTreeView(m_TreeViewState, multiColumnHeader, m_DataStore); m_TreeView = new SerializedPropertyTreeView(m_TreeViewState, multiColumnHeader, m_DataStore);
m_TreeView.DeserializeState(m_SerializationUID); m_TreeView.DeserializeState(m_SerializationUID);
m_TreeView.Reload(); m_TreeView.Reload();
m_Initialized = true; m_Initialized = true;
} }
} }
private float GetMinHeight() private float GetMinHeight()
{ {
var singleLineHeight = EditorGUIUtility.singleLineHeight; var singleLineHeight = EditorGUIUtility.singleLineHeight;
var num = m_FilterHeight + m_ColumnHeaderHeight + singleLineHeight + m_DragHeight; var num = m_FilterHeight + m_ColumnHeaderHeight + singleLineHeight + m_DragHeight;
return num + singleLineHeight * 3f; return num + singleLineHeight * 3f;
} }
public void OnInspectorUpdate() public void OnInspectorUpdate()
{ {
if (m_DataStore != null && m_DataStore.Repopulate() && m_TreeView != null) if (m_DataStore != null && m_DataStore.Repopulate() && m_TreeView != null)
m_TreeView.FullReload(); m_TreeView.FullReload();
else if (m_TreeView != null && m_TreeView.Update()) else if (m_TreeView != null && m_TreeView.Update())
m_TreeView.Repaint(); m_TreeView.Repaint();
} }
public void OnHierarchyChange() public void OnHierarchyChange()
{ {
if (m_DataStore != null && m_DataStore.Repopulate() && m_TreeView != null) if (m_DataStore != null && m_DataStore.Repopulate() && m_TreeView != null)
m_TreeView.FullReload(); m_TreeView.FullReload();
} }
public void OnSelectionChange() public void OnSelectionChange()
{ {
OnSelectionChange(Selection.instanceIDs); OnSelectionChange(Selection.instanceIDs);
} }
public void OnSelectionChange(int[] instanceIDs) public void OnSelectionChange(int[] instanceIDs)
{ {
if (m_TreeView != null) if (m_TreeView != null)
m_TreeView.SetSelection(instanceIDs); m_TreeView.SetSelection(instanceIDs);
} }
public void OnGUI() public void OnGUI()
{ {
Profiler.BeginSample("SerializedPropertyTable.OnGUI"); Profiler.BeginSample("SerializedPropertyTable.OnGUI");
InitIfNeeded(); InitIfNeeded();
var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height); var rect = GUILayoutUtility.GetRect(0f, Screen.width, 0f, Screen.height);
if (Event.current.type != EventType.Layout) if (Event.current.type != EventType.Layout)
{ {
rect.x += m_DragWidth; rect.x += m_DragWidth;
rect.width -= m_DragWidth * 2; rect.width -= m_DragWidth * 2;
rect.y += m_DragHeight; rect.y += m_DragHeight;
var r = rect; var r = rect;
rect.y += m_FilterHeight; rect.y += m_FilterHeight;
rect.height = rect.height - m_FilterHeight - m_DragHeight * 2; rect.height = rect.height - m_FilterHeight - m_DragHeight * 2;
var rect2 = rect; var rect2 = rect;
Profiler.BeginSample("TreeView.OnGUI"); Profiler.BeginSample("TreeView.OnGUI");
m_TreeView.OnGUI(rect2); m_TreeView.OnGUI(rect2);
Profiler.EndSample(); Profiler.EndSample();
m_TreeView.OnFilterGUI(r); m_TreeView.OnFilterGUI(r);
if (m_TreeView.IsFilteredDirty()) if (m_TreeView.IsFilteredDirty())
m_TreeView.Reload(); m_TreeView.Reload();
Profiler.EndSample(); Profiler.EndSample();
} }
} }
public void OnDisable() public void OnDisable()
{ {
if (m_TreeView != null) if (m_TreeView != null)
m_TreeView.SerializeState(m_SerializationUID); m_TreeView.SerializeState(m_SerializationUID);
} }
private static class Styles private static class Styles
{ {
public static readonly GUIStyle DragHandle = "RL DragHandle"; public static readonly GUIStyle DragHandle = "RL DragHandle";
} }
internal delegate SerializedPropertyTreeView.Column[] HeaderDelegate(out string[] propNames); internal delegate SerializedPropertyTreeView.Column[] HeaderDelegate(out string[] propNames);
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dcac989aac674be479bf8b07308aff05 guid: dcac989aac674be479bf8b07308aff05
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,479 +1,479 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEditor.IMGUI.Controls; using UnityEditor.IMGUI.Controls;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling; using UnityEngine.Profiling;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal class SerializedPropertyTreeView : TreeView internal class SerializedPropertyTreeView : TreeView
{ {
private bool m_bFilterSelection; private bool m_bFilterSelection;
private int m_ChangedId; private int m_ChangedId;
private readonly ColumnInternal[] m_ColumnsInternal; private readonly ColumnInternal[] m_ColumnsInternal;
private readonly SerializedPropertyDataStore m_DataStore; private readonly SerializedPropertyDataStore m_DataStore;
private List<TreeViewItem> m_Items; private List<TreeViewItem> m_Items;
private int[] m_SelectionFilter; private int[] m_SelectionFilter;
public SerializedPropertyTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, public SerializedPropertyTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader,
SerializedPropertyDataStore dataStore) SerializedPropertyDataStore dataStore)
: base(state, multicolumnHeader) : base(state, multicolumnHeader)
{ {
m_DataStore = dataStore; m_DataStore = dataStore;
var num = multiColumnHeader.state.columns.Length; var num = multiColumnHeader.state.columns.Length;
m_ColumnsInternal = new ColumnInternal[num]; m_ColumnsInternal = new ColumnInternal[num];
for (var i = 0; i < num; i++) for (var i = 0; i < num; i++)
{ {
var column = Col(i); var column = Col(i);
if (column.propertyName != null) if (column.propertyName != null)
m_ColumnsInternal[i].dependencyProps = new SerializedProperty[column.propertyName.Length]; m_ColumnsInternal[i].dependencyProps = new SerializedProperty[column.propertyName.Length];
} }
multiColumnHeader.sortingChanged += OnSortingChanged; multiColumnHeader.sortingChanged += OnSortingChanged;
multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged; multiColumnHeader.visibleColumnsChanged += OnVisibleColumnChanged;
showAlternatingRowBackgrounds = true; showAlternatingRowBackgrounds = true;
showBorder = true; showBorder = true;
rowHeight = EditorGUIUtility.singleLineHeight; rowHeight = EditorGUIUtility.singleLineHeight;
} }
public void SerializeState(string uid) public void SerializeState(string uid)
{ {
SessionState.SetBool(uid + Styles.serializeFilterSelection, SessionState.SetBool(uid + Styles.serializeFilterSelection,
m_bFilterSelection); m_bFilterSelection);
for (var i = 0; i < multiColumnHeader.state.columns.Length; i++) for (var i = 0; i < multiColumnHeader.state.columns.Length; i++)
{ {
var filter = Col(i).filter; var filter = Col(i).filter;
if (filter != null) if (filter != null)
{ {
var value = filter.SerializeState(); var value = filter.SerializeState();
if (!string.IsNullOrEmpty(value)) if (!string.IsNullOrEmpty(value))
SessionState.SetString(uid + Styles.serializeFilter + i, value); SessionState.SetString(uid + Styles.serializeFilter + i, value);
} }
} }
SessionState.SetString(uid + Styles.serializeTreeViewState, SessionState.SetString(uid + Styles.serializeTreeViewState,
JsonUtility.ToJson(state)); JsonUtility.ToJson(state));
SessionState.SetString(uid + Styles.serializeColumnHeaderState, SessionState.SetString(uid + Styles.serializeColumnHeaderState,
JsonUtility.ToJson(multiColumnHeader.state)); JsonUtility.ToJson(multiColumnHeader.state));
} }
public void DeserializeState(string uid) public void DeserializeState(string uid)
{ {
m_bFilterSelection = m_bFilterSelection =
SessionState.GetBool(uid + Styles.serializeFilterSelection, false); SessionState.GetBool(uid + Styles.serializeFilterSelection, false);
for (var i = 0; i < multiColumnHeader.state.columns.Length; i++) for (var i = 0; i < multiColumnHeader.state.columns.Length; i++)
{ {
var filter = Col(i).filter; var filter = Col(i).filter;
if (filter != null) if (filter != null)
{ {
var @string = SessionState.GetString(uid + Styles.serializeFilter + i, var @string = SessionState.GetString(uid + Styles.serializeFilter + i,
null); null);
if (!string.IsNullOrEmpty(@string)) if (!string.IsNullOrEmpty(@string))
filter.DeserializeState(@string); filter.DeserializeState(@string);
} }
} }
var string2 = SessionState.GetString(uid + Styles.serializeTreeViewState, ""); var string2 = SessionState.GetString(uid + Styles.serializeTreeViewState, "");
var string3 = SessionState.GetString(uid + Styles.serializeColumnHeaderState, var string3 = SessionState.GetString(uid + Styles.serializeColumnHeaderState,
""); "");
if (!string.IsNullOrEmpty(string2)) if (!string.IsNullOrEmpty(string2))
JsonUtility.FromJsonOverwrite(string2, state); JsonUtility.FromJsonOverwrite(string2, state);
if (!string.IsNullOrEmpty(string3)) if (!string.IsNullOrEmpty(string3))
JsonUtility.FromJsonOverwrite(string3, multiColumnHeader.state); JsonUtility.FromJsonOverwrite(string3, multiColumnHeader.state);
} }
public bool IsFilteredDirty() public bool IsFilteredDirty()
{ {
return m_ChangedId != 0 && (m_ChangedId != GUIUtility.keyboardControl || return m_ChangedId != 0 && (m_ChangedId != GUIUtility.keyboardControl ||
!EditorGUIUtility.editingTextField); !EditorGUIUtility.editingTextField);
} }
public bool Update() public bool Update()
{ {
var rows = GetRows(); var rows = GetRows();
int num; int num;
int num2; int num2;
GetFirstAndLastVisibleRows(out num, out num2); GetFirstAndLastVisibleRows(out num, out num2);
var flag = false; var flag = false;
if (num2 != -1) if (num2 != -1)
for (var i = num; i <= num2; i++) for (var i = num; i <= num2; i++)
flag = flag || ((SerializedPropertyItem)rows[i]).GetData().Update(); flag = flag || ((SerializedPropertyItem)rows[i]).GetData().Update();
return flag; return flag;
} }
public void FullReload() public void FullReload()
{ {
m_Items = null; m_Items = null;
Reload(); Reload();
} }
protected override TreeViewItem BuildRoot() protected override TreeViewItem BuildRoot()
{ {
return new SerializedPropertyItem(-1, -1, null); return new SerializedPropertyItem(-1, -1, null);
} }
protected override IList<TreeViewItem> BuildRows(TreeViewItem root) protected override IList<TreeViewItem> BuildRows(TreeViewItem root)
{ {
if (m_Items == null) if (m_Items == null)
{ {
var elements = m_DataStore.GetElements(); var elements = m_DataStore.GetElements();
m_Items = new List<TreeViewItem>(elements.Length); m_Items = new List<TreeViewItem>(elements.Length);
for (var i = 0; i < elements.Length; i++) for (var i = 0; i < elements.Length; i++)
{ {
var item2 = new SerializedPropertyItem(elements[i].ObjectId, 0, elements[i]); var item2 = new SerializedPropertyItem(elements[i].ObjectId, 0, elements[i]);
m_Items.Add(item2); m_Items.Add(item2);
} }
} }
IEnumerable<TreeViewItem> enumerable = m_Items; IEnumerable<TreeViewItem> enumerable = m_Items;
if (m_bFilterSelection) if (m_bFilterSelection)
{ {
if (m_SelectionFilter == null) if (m_SelectionFilter == null)
m_SelectionFilter = Selection.instanceIDs; m_SelectionFilter = Selection.instanceIDs;
enumerable = from item in m_Items enumerable = from item in m_Items
where m_SelectionFilter.Contains(item.id) where m_SelectionFilter.Contains(item.id)
select item; select item;
} }
else else
{ {
m_SelectionFilter = null; m_SelectionFilter = null;
} }
enumerable = Filter(enumerable); enumerable = Filter(enumerable);
var list = enumerable.ToList(); var list = enumerable.ToList();
if (multiColumnHeader.sortedColumnIndex >= 0) if (multiColumnHeader.sortedColumnIndex >= 0)
Sort(list, multiColumnHeader.sortedColumnIndex); Sort(list, multiColumnHeader.sortedColumnIndex);
m_ChangedId = 0; m_ChangedId = 0;
//TreeViewUtility.SetParentAndChildrenForItems(list, root); //TreeViewUtility.SetParentAndChildrenForItems(list, root);
return list; return list;
} }
protected override void RowGUI(RowGUIArgs args) protected override void RowGUI(RowGUIArgs args)
{ {
var item = var item =
(SerializedPropertyItem)args.item; (SerializedPropertyItem)args.item;
for (var i = 0; i < args.GetNumVisibleColumns(); i++) for (var i = 0; i < args.GetNumVisibleColumns(); i++)
CellGUI(args.GetCellRect(i), item, args.GetColumn(i), ref args); CellGUI(args.GetCellRect(i), item, args.GetColumn(i), ref args);
} }
private void CellGUI(Rect cellRect, SerializedPropertyItem item, int columnIndex, private void CellGUI(Rect cellRect, SerializedPropertyItem item, int columnIndex,
ref RowGUIArgs args) ref RowGUIArgs args)
{ {
Profiler.BeginSample("SerializedPropertyTreeView.CellGUI"); Profiler.BeginSample("SerializedPropertyTreeView.CellGUI");
CenterRectUsingSingleLineHeight(ref cellRect); CenterRectUsingSingleLineHeight(ref cellRect);
var data = item.GetData(); var data = item.GetData();
var column = (Column)multiColumnHeader.GetColumn(columnIndex); var column = (Column)multiColumnHeader.GetColumn(columnIndex);
if (column.drawDelegate == DefaultDelegates.s_DrawName) if (column.drawDelegate == DefaultDelegates.s_DrawName)
{ {
Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.LabelField"); Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.LabelField");
DefaultGUI.Label(cellRect, data.Name, IsSelected(args.item.id), false); DefaultGUI.Label(cellRect, data.Name, IsSelected(args.item.id), false);
Profiler.EndSample(); Profiler.EndSample();
} }
else if (column.drawDelegate != null) else if (column.drawDelegate != null)
{ {
var properties = data.Properties; var properties = data.Properties;
var num = column.dependencyIndices == null ? 0 : column.dependencyIndices.Length; var num = column.dependencyIndices == null ? 0 : column.dependencyIndices.Length;
for (var i = 0; i < num; i++) for (var i = 0; i < num; i++)
m_ColumnsInternal[columnIndex].dependencyProps[i] = properties[column.dependencyIndices[i]]; m_ColumnsInternal[columnIndex].dependencyProps[i] = properties[column.dependencyIndices[i]];
if (args.item.id == state.lastClickedID && HasFocus() && columnIndex == multiColumnHeader.state.visibleColumns[multiColumnHeader.state.visibleColumns[0] != 0 ? 0 : 1]) if (args.item.id == state.lastClickedID && HasFocus() && columnIndex == multiColumnHeader.state.visibleColumns[multiColumnHeader.state.visibleColumns[0] != 0 ? 0 : 1])
GUI.SetNextControlName(Styles.focusHelper); GUI.SetNextControlName(Styles.focusHelper);
var serializedProperty = data.Properties[columnIndex]; var serializedProperty = data.Properties[columnIndex];
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.drawDelegate"); Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.drawDelegate");
column.drawDelegate(cellRect, serializedProperty, m_ColumnsInternal[columnIndex].dependencyProps); column.drawDelegate(cellRect, serializedProperty, m_ColumnsInternal[columnIndex].dependencyProps);
Profiler.EndSample(); Profiler.EndSample();
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
m_ChangedId = column.filter == null || !column.filter.Active() m_ChangedId = column.filter == null || !column.filter.Active()
? m_ChangedId ? m_ChangedId
: GUIUtility.keyboardControl; : GUIUtility.keyboardControl;
data.Store(); data.Store();
var selection = GetSelection(); var selection = GetSelection();
if (selection.Contains(data.ObjectId)) if (selection.Contains(data.ObjectId))
{ {
var list = FindRows(selection); var list = FindRows(selection);
Undo.RecordObjects((from r in list Undo.RecordObjects((from r in list
select ((SerializedPropertyItem)r).GetData() select ((SerializedPropertyItem)r).GetData()
.SerializedObject.targetObject).ToArray(), .SerializedObject.targetObject).ToArray(),
"Modify Multiple Properties"); "Modify Multiple Properties");
foreach (var current in list) foreach (var current in list)
if (current.id != args.item.id) if (current.id != args.item.id)
{ {
var data2 = var data2 =
((SerializedPropertyItem)current).GetData(); ((SerializedPropertyItem)current).GetData();
if (IsEditable(data2.SerializedObject.targetObject)) if (IsEditable(data2.SerializedObject.targetObject))
{ {
if (column.copyDelegate != null) if (column.copyDelegate != null)
column.copyDelegate(data2.Properties[columnIndex], serializedProperty); column.copyDelegate(data2.Properties[columnIndex], serializedProperty);
else else
DefaultDelegates.s_CopyDefault(data2.Properties[columnIndex], DefaultDelegates.s_CopyDefault(data2.Properties[columnIndex],
serializedProperty); serializedProperty);
data2.Store(); data2.Store();
} }
} }
} }
} }
Profiler.EndSample(); Profiler.EndSample();
} }
} }
private static bool IsEditable(Object target) private static bool IsEditable(Object target)
{ {
return (target.hideFlags & HideFlags.NotEditable) == HideFlags.None; return (target.hideFlags & HideFlags.NotEditable) == HideFlags.None;
} }
protected override void BeforeRowsGUI() protected override void BeforeRowsGUI()
{ {
var rows = GetRows(); var rows = GetRows();
int num; int num;
int num2; int num2;
GetFirstAndLastVisibleRows(out num, out num2); GetFirstAndLastVisibleRows(out num, out num2);
if (num2 != -1) if (num2 != -1)
for (var i = num; i <= num2; i++) for (var i = num; i <= num2; i++)
((SerializedPropertyItem)rows[i]).GetData().Update(); ((SerializedPropertyItem)rows[i]).GetData().Update();
var list = FindRows(GetSelection()); var list = FindRows(GetSelection());
using (var enumerator = list.GetEnumerator()) using (var enumerator = list.GetEnumerator())
{ {
while (enumerator.MoveNext()) while (enumerator.MoveNext())
{ {
var serializedPropertyItem = var serializedPropertyItem =
(SerializedPropertyItem)enumerator.Current; (SerializedPropertyItem)enumerator.Current;
serializedPropertyItem.GetData().Update(); serializedPropertyItem.GetData().Update();
} }
} }
base.BeforeRowsGUI(); base.BeforeRowsGUI();
} }
public void OnFilterGUI(Rect r) public void OnFilterGUI(Rect r)
{ {
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
var width = r.width; var width = r.width;
var num = 16f; var num = 16f;
r.width = num; r.width = num;
m_bFilterSelection = EditorGUI.Toggle(r, m_bFilterSelection); m_bFilterSelection = EditorGUI.Toggle(r, m_bFilterSelection);
r.x += num; r.x += num;
r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x; r.width = GUI.skin.label.CalcSize(Styles.filterSelection).x;
EditorGUI.LabelField(r, Styles.filterSelection); EditorGUI.LabelField(r, Styles.filterSelection);
r.width = Mathf.Min(width - (r.x + r.width), 300f); r.width = Mathf.Min(width - (r.x + r.width), 300f);
r.x = width - r.width + 25; r.x = width - r.width + 25;
for (var i = 0; i < multiColumnHeader.state.columns.Length; i++) for (var i = 0; i < multiColumnHeader.state.columns.Length; i++)
{ {
if (IsColumnVisible(i)) if (IsColumnVisible(i))
{ {
var column = Col(i); var column = Col(i);
if (column.filter != null && column.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name))) if (column.filter != null && column.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name)))
column.filter.OnGUI(r); column.filter.OnGUI(r);
} }
} }
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
Reload(); Reload();
} }
protected override void SelectionChanged(IList<int> selectedIds) protected override void SelectionChanged(IList<int> selectedIds)
{ {
Selection.instanceIDs = selectedIds.ToArray(); Selection.instanceIDs = selectedIds.ToArray();
} }
protected override void KeyEvent() protected override void KeyEvent()
{ {
if (Event.current.type == EventType.KeyDown) if (Event.current.type == EventType.KeyDown)
if (Event.current.character == '\t') if (Event.current.character == '\t')
{ {
GUI.FocusControl(Styles.focusHelper); GUI.FocusControl(Styles.focusHelper);
Event.current.Use(); Event.current.Use();
} }
} }
private void OnVisibleColumnChanged(MultiColumnHeader header) private void OnVisibleColumnChanged(MultiColumnHeader header)
{ {
Reload(); Reload();
} }
private void OnSortingChanged(MultiColumnHeader multiColumnHeader) private void OnSortingChanged(MultiColumnHeader multiColumnHeader)
{ {
var rows = GetRows(); var rows = GetRows();
Sort(rows, multiColumnHeader.sortedColumnIndex); Sort(rows, multiColumnHeader.sortedColumnIndex);
} }
private void Sort(IList<TreeViewItem> rows, int sortIdx) private void Sort(IList<TreeViewItem> rows, int sortIdx)
{ {
var flag = multiColumnHeader.IsSortedAscending(sortIdx); var flag = multiColumnHeader.IsSortedAscending(sortIdx);
var comp = Col(sortIdx).compareDelegate; var comp = Col(sortIdx).compareDelegate;
var list = rows as List<TreeViewItem>; var list = rows as List<TreeViewItem>;
if (comp != null) if (comp != null)
{ {
Comparison<TreeViewItem> comparison; Comparison<TreeViewItem> comparison;
Comparison<TreeViewItem> comparison2; Comparison<TreeViewItem> comparison2;
if (comp == DefaultDelegates.s_CompareName) if (comp == DefaultDelegates.s_CompareName)
{ {
comparison = (lhs, rhs) => EditorUtility.NaturalCompare( comparison = (lhs, rhs) => EditorUtility.NaturalCompare(
((SerializedPropertyItem)lhs).GetData().Name, ((SerializedPropertyItem)lhs).GetData().Name,
((SerializedPropertyItem)rhs).GetData().Name); ((SerializedPropertyItem)rhs).GetData().Name);
comparison2 = (lhs, rhs) => -EditorUtility.NaturalCompare( comparison2 = (lhs, rhs) => -EditorUtility.NaturalCompare(
((SerializedPropertyItem)lhs).GetData().Name, ((SerializedPropertyItem)lhs).GetData().Name,
((SerializedPropertyItem)rhs).GetData().Name); ((SerializedPropertyItem)rhs).GetData().Name);
} }
else else
{ {
comparison = (lhs, rhs) => comp( comparison = (lhs, rhs) => comp(
((SerializedPropertyItem)lhs).GetData().Properties[sortIdx], ((SerializedPropertyItem)lhs).GetData().Properties[sortIdx],
((SerializedPropertyItem)rhs).GetData().Properties[sortIdx]); ((SerializedPropertyItem)rhs).GetData().Properties[sortIdx]);
comparison2 = (lhs, rhs) => -comp( comparison2 = (lhs, rhs) => -comp(
((SerializedPropertyItem)lhs).GetData().Properties[sortIdx], ((SerializedPropertyItem)lhs).GetData().Properties[sortIdx],
((SerializedPropertyItem)rhs).GetData().Properties[sortIdx]); ((SerializedPropertyItem)rhs).GetData().Properties[sortIdx]);
} }
list.Sort(!flag ? comparison2 : comparison); list.Sort(!flag ? comparison2 : comparison);
} }
} }
private IEnumerable<TreeViewItem> Filter(IEnumerable<TreeViewItem> rows) private IEnumerable<TreeViewItem> Filter(IEnumerable<TreeViewItem> rows)
{ {
var enumerable = rows; var enumerable = rows;
var num = m_ColumnsInternal.Length; var num = m_ColumnsInternal.Length;
for (var i = 0; i < num; i++) for (var i = 0; i < num; i++)
if (IsColumnVisible(i)) if (IsColumnVisible(i))
{ {
var c = Col(i); var c = Col(i);
var idx = i; var idx = i;
if (c.filter != null) if (c.filter != null)
if (c.filter.Active()) if (c.filter.Active())
if (c.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name))) if (c.filter.GetType().Equals(typeof(SerializedPropertyFilters.Name)))
{ {
var f = (SerializedPropertyFilters.Name)c.filter; var f = (SerializedPropertyFilters.Name)c.filter;
enumerable = from item in enumerable enumerable = from item in enumerable
where f.Filter(((SerializedPropertyItem)item).GetData().Name) where f.Filter(((SerializedPropertyItem)item).GetData().Name)
select item; select item;
} }
else else
{ {
enumerable = from item in enumerable enumerable = from item in enumerable
where c.filter.Filter(((SerializedPropertyItem)item) where c.filter.Filter(((SerializedPropertyItem)item)
.GetData() .GetData()
.Properties[idx]) .Properties[idx])
select item; select item;
} }
} }
return enumerable; return enumerable;
} }
private bool IsColumnVisible(int idx) private bool IsColumnVisible(int idx)
{ {
bool result; bool result;
for (var i = 0; i < multiColumnHeader.state.visibleColumns.Length; i++) for (var i = 0; i < multiColumnHeader.state.visibleColumns.Length; i++)
if (multiColumnHeader.state.visibleColumns[i] == idx) if (multiColumnHeader.state.visibleColumns[i] == idx)
{ {
result = true; result = true;
return result; return result;
} }
result = false; result = false;
return result; return result;
} }
private Column Col(int idx) private Column Col(int idx)
{ {
return (Column)multiColumnHeader.state.columns[idx]; return (Column)multiColumnHeader.state.columns[idx];
} }
internal class SerializedPropertyItem : TreeViewItem internal class SerializedPropertyItem : TreeViewItem
{ {
private readonly SerializedPropertyDataStore.Data m_Data; private readonly SerializedPropertyDataStore.Data m_Data;
public SerializedPropertyItem(int id, int depth, SerializedPropertyDataStore.Data ltd) public SerializedPropertyItem(int id, int depth, SerializedPropertyDataStore.Data ltd)
: base(id, depth, ltd == null ? "root" : ltd.Name) : base(id, depth, ltd == null ? "root" : ltd.Name)
{ {
m_Data = ltd; m_Data = ltd;
} }
public SerializedPropertyDataStore.Data GetData() public SerializedPropertyDataStore.Data GetData()
{ {
return m_Data; return m_Data;
} }
} }
internal class Column : MultiColumnHeaderState.Column internal class Column : MultiColumnHeaderState.Column
{ {
public delegate int CompareEntry(SerializedProperty lhs, SerializedProperty rhs); public delegate int CompareEntry(SerializedProperty lhs, SerializedProperty rhs);
public delegate void CopyDelegate(SerializedProperty target, SerializedProperty source); public delegate void CopyDelegate(SerializedProperty target, SerializedProperty source);
public delegate void DrawEntry(Rect r, SerializedProperty prop, SerializedProperty[] dependencies); public delegate void DrawEntry(Rect r, SerializedProperty prop, SerializedProperty[] dependencies);
public CompareEntry compareDelegate = null; public CompareEntry compareDelegate = null;
public CopyDelegate copyDelegate = null; public CopyDelegate copyDelegate = null;
public int[] dependencyIndices = null; public int[] dependencyIndices = null;
public DrawEntry drawDelegate = null; public DrawEntry drawDelegate = null;
public SerializedPropertyFilters.IFilter filter = null; public SerializedPropertyFilters.IFilter filter = null;
public string propertyName = null; public string propertyName = null;
} }
private struct ColumnInternal private struct ColumnInternal
{ {
public SerializedProperty[] dependencyProps; public SerializedProperty[] dependencyProps;
} }
internal class DefaultDelegates internal class DefaultDelegates
{ {
public static readonly Column.DrawEntry s_DrawDefault = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dependencies) public static readonly Column.DrawEntry s_DrawDefault = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dependencies)
{ {
Profiler.BeginSample("PropDrawDefault"); Profiler.BeginSample("PropDrawDefault");
EditorGUI.PropertyField(r, prop, GUIContent.none); EditorGUI.PropertyField(r, prop, GUIContent.none);
Profiler.EndSample(); Profiler.EndSample();
}; };
public static readonly Column.DrawEntry s_DrawCheckbox = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dependencies) public static readonly Column.DrawEntry s_DrawCheckbox = delegate(Rect r, SerializedProperty prop, SerializedProperty[] dependencies)
{ {
Profiler.BeginSample("PropDrawCheckbox"); Profiler.BeginSample("PropDrawCheckbox");
var num = r.width / 2f - 8f; var num = r.width / 2f - 8f;
r.x += num < 0f ? 0f : num; r.x += num < 0f ? 0f : num;
EditorGUI.PropertyField(r, prop, GUIContent.none); EditorGUI.PropertyField(r, prop, GUIContent.none);
Profiler.EndSample(); Profiler.EndSample();
}; };
public static readonly Column.DrawEntry s_DrawName = delegate { }; public static readonly Column.DrawEntry s_DrawName = delegate { };
public static readonly Column.CompareEntry s_CompareFloat = public static readonly Column.CompareEntry s_CompareFloat =
(SerializedProperty lhs, SerializedProperty rhs) => lhs.floatValue.CompareTo(rhs.floatValue); (SerializedProperty lhs, SerializedProperty rhs) => lhs.floatValue.CompareTo(rhs.floatValue);
public static readonly Column.CompareEntry s_CompareCheckbox = public static readonly Column.CompareEntry s_CompareCheckbox =
(SerializedProperty lhs, SerializedProperty rhs) => lhs.boolValue.CompareTo(rhs.boolValue); (SerializedProperty lhs, SerializedProperty rhs) => lhs.boolValue.CompareTo(rhs.boolValue);
public static readonly Column.CompareEntry s_CompareEnum = public static readonly Column.CompareEntry s_CompareEnum =
(SerializedProperty lhs, SerializedProperty rhs) => lhs.enumValueIndex.CompareTo(rhs.enumValueIndex); (SerializedProperty lhs, SerializedProperty rhs) => lhs.enumValueIndex.CompareTo(rhs.enumValueIndex);
public static readonly Column.CompareEntry s_CompareInt = public static readonly Column.CompareEntry s_CompareInt =
(SerializedProperty lhs, SerializedProperty rhs) => lhs.intValue.CompareTo(rhs.intValue); (SerializedProperty lhs, SerializedProperty rhs) => lhs.intValue.CompareTo(rhs.intValue);
public static readonly Column.CompareEntry s_CompareColor = public static readonly Column.CompareEntry s_CompareColor =
delegate(SerializedProperty lhs, SerializedProperty rhs) delegate(SerializedProperty lhs, SerializedProperty rhs)
{ {
float num; float num;
float num2; float num2;
float num3; float num3;
Color.RGBToHSV(lhs.colorValue, out num, out num2, out num3); Color.RGBToHSV(lhs.colorValue, out num, out num2, out num3);
float value; float value;
float num4; float num4;
float num5; float num5;
Color.RGBToHSV(rhs.colorValue, out value, out num4, out num5); Color.RGBToHSV(rhs.colorValue, out value, out num4, out num5);
return num.CompareTo(value); return num.CompareTo(value);
}; };
public static readonly Column.CompareEntry s_CompareName = public static readonly Column.CompareEntry s_CompareName =
(SerializedProperty lhs, SerializedProperty rhs) => 0; (SerializedProperty lhs, SerializedProperty rhs) => 0;
public static readonly Column.CopyDelegate s_CopyDefault = public static readonly Column.CopyDelegate s_CopyDefault =
delegate(SerializedProperty target, SerializedProperty source) delegate(SerializedProperty target, SerializedProperty source)
{ {
target.serializedObject.CopyFromSerializedProperty(source); target.serializedObject.CopyFromSerializedProperty(source);
}; };
} }
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 93a5c5e05a8ac744593adecef346aba2 guid: 93a5c5e05a8ac744593adecef346aba2
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,42 +1,42 @@
using UnityEngine; using UnityEngine;
namespace WeChatWASM.Analysis namespace WeChatWASM.Analysis
{ {
internal static class Styles internal static class Styles
{ {
public static readonly GUIStyle entryEven = "OL EntryBackEven"; public static readonly GUIStyle entryEven = "OL EntryBackEven";
public static readonly GUIStyle entryOdd = "OL EntryBackOdd"; public static readonly GUIStyle entryOdd = "OL EntryBackOdd";
public static readonly string focusHelper = "SerializedPropertyTreeViewFocusHelper"; public static readonly string focusHelper = "SerializedPropertyTreeViewFocusHelper";
public static readonly string serializeFilterSelection = "_FilterSelection"; public static readonly string serializeFilterSelection = "_FilterSelection";
public static readonly string serializeFilterDisable = "_FilterDisable"; public static readonly string serializeFilterDisable = "_FilterDisable";
public static readonly string serializeFilterInvert = "_FilterInvert"; public static readonly string serializeFilterInvert = "_FilterInvert";
public static readonly string serializeTreeViewState = "_TreeViewState"; public static readonly string serializeTreeViewState = "_TreeViewState";
public static readonly string serializeColumnHeaderState = "_ColumnHeaderState"; public static readonly string serializeColumnHeaderState = "_ColumnHeaderState";
public static readonly string serializeFilter = "_Filter_"; public static readonly string serializeFilter = "_Filter_";
public static readonly GUIContent filterSelection = public static readonly GUIContent filterSelection =
new GUIContent("Lock Selection|Limits the table contents to the active selection."); new GUIContent("Lock Selection|Limits the table contents to the active selection.");
//EditorGUIUtility.TextContent("Lock Selection|Limits the table contents to the active selection."); //EditorGUIUtility.TextContent("Lock Selection|Limits the table contents to the active selection.");
public static readonly GUIContent filterDisable = new GUIContent("Disable All|Disables all filters."); public static readonly GUIContent filterDisable = new GUIContent("Disable All|Disables all filters.");
//EditorGUIUtility.TextContent("Disable All|Disables all filters."); //EditorGUIUtility.TextContent("Disable All|Disables all filters.");
public static readonly GUIContent filterInvert = public static readonly GUIContent filterInvert =
new GUIContent("Invert Result|Inverts the filtered results."); new GUIContent("Invert Result|Inverts the filtered results.");
public static readonly GUIStyle searchField = "SearchTextField"; public static readonly GUIStyle searchField = "SearchTextField";
public static readonly GUIStyle searchFieldCancelButton = "SearchCancelButton"; public static readonly GUIStyle searchFieldCancelButton = "SearchCancelButton";
public static readonly GUIStyle searchFieldCancelButtonEmpty = "SearchCancelButtonEmpty"; public static readonly GUIStyle searchFieldCancelButtonEmpty = "SearchCancelButtonEmpty";
//EditorGUIUtility.TextContent("Invert Result|Inverts the filtered results."); //EditorGUIUtility.TextContent("Invert Result|Inverts the filtered results.");
} }
} }

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5b841dfa9061ee246bc65f481fe18160 guid: 5b841dfa9061ee246bc65f481fe18160
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f56be9693b9d775419c521676c9d04f4 guid: f56be9693b9d775419c521676c9d04f4
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

542
Assets/WX-WASM-SDK/Editor/Node/_docompress.js Executable file → Normal file
View File

@ -1,271 +1,271 @@
const fs = require('fs'); const fs = require('fs');
const Conf = require('./conf'); const Conf = require('./conf');
const { spawn } = require('child_process'); const { spawn } = require('child_process');
const os = require('os'); const os = require('os');
//最多同时调用4个子进程如果觉得卡死了电脑可以把这个改小但是生成速度就会变慢 //最多同时调用4个子进程如果觉得卡死了电脑可以把这个改小但是生成速度就会变慢
const MaxThreadCount = 4; const MaxThreadCount = 4;
// 判断是M1芯片 // 判断是M1芯片
const isM1 = os.cpus().some((v)=>v.model.toLowerCase().indexOf('apple')>-1); const isM1 = os.cpus().some((v)=>v.model.toLowerCase().indexOf('apple')>-1);
const potList = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]; const potList = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
//模拟信号量 //模拟信号量
const Semaphore = { const Semaphore = {
_count:0, _count:0,
_waitList:[], _waitList:[],
waitOne(){ waitOne(){
return new Promise((resolve)=>{ return new Promise((resolve)=>{
if(this._count < MaxThreadCount){ if(this._count < MaxThreadCount){
this._count++; this._count++;
resolve(); resolve();
}else{ }else{
this._waitList.push(resolve); this._waitList.push(resolve);
} }
}) })
}, },
release(){ release(){
const resolve = this._waitList.shift(); const resolve = this._waitList.shift();
if(!resolve){ if(!resolve){
this._count--; this._count--;
if(this._count<0){ if(this._count<0){
this._count = 0; this._count = 0;
} }
}else{ }else{
resolve(); resolve();
} }
} }
}; };
const Mod = { const Mod = {
startTime:0, startTime:0,
async start(isFull){ async start(isFull){
Conf.isAstcOnly = !isFull; Conf.isAstcOnly = !isFull;
Mod.startTime = new Date(); Mod.startTime = new Date();
console.warn("格式转换开始!",new Date().toLocaleString()); console.warn("格式转换开始!",new Date().toLocaleString());
await this.startTextureTask(); await this.startTextureTask();
}, },
async startTextureTask(){ async startTextureTask(){
console.log('total textureList:', Conf.textureList.length); console.log('total textureList:', Conf.textureList.length);
for(let i=0;i<Conf.textureList.length;i++){ for(let i=0;i<Conf.textureList.length;i++){
let {path,width,height} = Conf.textureList[i]; let {path,width,height} = Conf.textureList[i];
path = decodeURIComponent(path); path = decodeURIComponent(path);
let src = `${Conf.dst}/Assets/Textures/png/${width}/${path}.png`; let src = `${Conf.dst}/Assets/Textures/png/${width}/${path}.png`;
if(!fs.existsSync(`${Conf.dst}/Assets/Textures/astc/${width}/`)){ if(!fs.existsSync(`${Conf.dst}/Assets/Textures/astc/${width}/`)){
fs.mkdirSync(`${Conf.dst}/Assets/Textures/astc/${width}/`,{ recursive: true }); fs.mkdirSync(`${Conf.dst}/Assets/Textures/astc/${width}/`,{ recursive: true });
} }
if (i % 20 == 0) { if (i % 20 == 0) {
console.log("-----current progress-----", i, Conf.textureList.length); console.log("-----current progress-----", i, Conf.textureList.length);
} }
await this.astc({ await this.astc({
src, src,
dstPath:`${Conf.dst}/Assets/Textures/astc/${width}/${path}` dstPath:`${Conf.dst}/Assets/Textures/astc/${width}/${path}`
}); });
if(Conf.useDXT5 && width%4=== 0 && height%4===0){ if(Conf.useDXT5 && width%4=== 0 && height%4===0){
if(!fs.existsSync(`${Conf.dst}/Assets/Textures/dds/${width}/`)){ if(!fs.existsSync(`${Conf.dst}/Assets/Textures/dds/${width}/`)){
fs.mkdirSync(`${Conf.dst}/Assets/Textures/dds/${width}/`,{ recursive: true }); fs.mkdirSync(`${Conf.dst}/Assets/Textures/dds/${width}/`,{ recursive: true });
} }
await this.dxt5({ await this.dxt5({
src, src,
dstPath:`${Conf.dst}/Assets/Textures/dds/${width}/${path}` dstPath:`${Conf.dst}/Assets/Textures/dds/${width}/${path}`
}); });
} }
if(!Conf.isAstcOnly){ if(!Conf.isAstcOnly){
if(width === height && potList.indexOf(width)>-1){ if(width === height && potList.indexOf(width)>-1){
if(!fs.existsSync(`${Conf.dst}/Assets/Textures/pvr/${width}/`)){ if(!fs.existsSync(`${Conf.dst}/Assets/Textures/pvr/${width}/`)){
fs.mkdirSync(`${Conf.dst}/Assets/Textures/pvr/${width}/`,{ recursive: true }); fs.mkdirSync(`${Conf.dst}/Assets/Textures/pvr/${width}/`,{ recursive: true });
} }
await this.pvrtc({ await this.pvrtc({
src, src,
dstPath:`${Conf.dst}/Assets/Textures/pvr/${width}/${path}` dstPath:`${Conf.dst}/Assets/Textures/pvr/${width}/${path}`
}); });
} }
if(!fs.existsSync(`${Conf.dst}/Assets/Textures/etc2/${width}/`)){ if(!fs.existsSync(`${Conf.dst}/Assets/Textures/etc2/${width}/`)){
fs.mkdirSync(`${Conf.dst}/Assets/Textures/etc2/${width}/`,{ recursive: true }); fs.mkdirSync(`${Conf.dst}/Assets/Textures/etc2/${width}/`,{ recursive: true });
} }
await this.etc2({ await this.etc2({
src, src,
dstPath:`${Conf.dst}/Assets/Textures/etc2/${width}/${path}`, dstPath:`${Conf.dst}/Assets/Textures/etc2/${width}/${path}`,
callback:async (isExist)=>{ callback:async (isExist)=>{
!isExist && await this.minPng({src}); !isExist && await this.minPng({src});
} }
}); });
} }
} }
}, },
async astc({src,dstPath}){ async astc({src,dstPath}){
try{ try{
await fs.promises.access(dstPath+".txt"); await fs.promises.access(dstPath+".txt");
return; return;
}catch (e){} }catch (e){}
await Semaphore.waitOne(); await Semaphore.waitOne();
const startTime = new Date(); const startTime = new Date();
let exe = 'astcenc-sse4.1.exe'; let exe = 'astcenc-sse4.1.exe';
if(os.type() === 'Darwin'){ if(os.type() === 'Darwin'){
if(isM1){ if(isM1){
exe = 'astcenc-neon'; exe = 'astcenc-neon';
}else{ }else{
exe = 'astcenc-avx2'; exe = 'astcenc-avx2';
} }
} }
const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/${exe}`, ['-cs', src, dstPath+".astc",'8x8', '-medium']); const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/${exe}`, ['-cs', src, dstPath+".astc",'8x8', '-medium']);
cm.stdout.on('data', (data) => { cm.stdout.on('data', (data) => {
// console.log(`${src} astc stdout: ${data}`); // console.log(`${src} astc stdout: ${data}`);
}); });
cm.stderr.on('data', (data) => { cm.stderr.on('data', (data) => {
console.error(`${src} astc stderr: ${data}`); console.error(`${src} astc stderr: ${data}`);
}); });
cm.on('close', (code) => { cm.on('close', (code) => {
console.log(`【astc】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`); console.log(`【astc】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`);
fs.rename(dstPath+".astc",dstPath+".txt",(err)=>{ fs.rename(dstPath+".astc",dstPath+".txt",(err)=>{
if(err){ if(err){
console.error(err,"图片:" + src + " 生成astc压缩纹理失败"); console.error(err,"图片:" + src + " 生成astc压缩纹理失败");
} }
}); });
Semaphore.release(); Semaphore.release();
}); });
}, },
async etc2({src,dstPath,callback}){ async etc2({src,dstPath,callback}){
try{ try{
await fs.promises.access(dstPath+".txt"); await fs.promises.access(dstPath+".txt");
callback && callback(true); callback && callback(true);
return; return;
}catch (e){} }catch (e){}
await Semaphore.waitOne(); await Semaphore.waitOne();
const startTime = new Date(); const startTime = new Date();
const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath, '-f', 'ETC2_RGBA,UBN,sRGB']); const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath, '-f', 'ETC2_RGBA,UBN,sRGB']);
cm.stdout.on('data', (data) => { cm.stdout.on('data', (data) => {
// console.log(`${src} etc2 stdout: ${data}`); // console.log(`${src} etc2 stdout: ${data}`);
}); });
cm.stderr.on('data', (data) => { cm.stderr.on('data', (data) => {
// console.error(`${src} etc2 stderr: ${data}`); // console.error(`${src} etc2 stderr: ${data}`);
}); });
cm.on('close', (code) => { cm.on('close', (code) => {
console.log(`【etc2】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`); console.log(`【etc2】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`);
const finalDst = dstPath + ".txt"; const finalDst = dstPath + ".txt";
fs.rename(dstPath + ".pvr", finalDst,(err)=>{ fs.rename(dstPath + ".pvr", finalDst,(err)=>{
if(err){ if(err){
console.error("图片:" + src + " 生成etc2压缩纹理失败"); console.error("图片:" + src + " 生成etc2压缩纹理失败");
}else{ }else{
fs.readFile(finalDst,(e,buffer)=>{ fs.readFile(finalDst,(e,buffer)=>{
fs.writeFile(finalDst,buffer.slice(52),(e)=>{ fs.writeFile(finalDst,buffer.slice(52),(e)=>{
if(e){ if(e){
console.error("图片:" + src + " 生成etc2压缩纹理失败"); console.error("图片:" + src + " 生成etc2压缩纹理失败");
} }
}); });
}); });
} }
}); });
callback && callback(); callback && callback();
Semaphore.release(); Semaphore.release();
}); });
}, },
async dxt5({src,dstPath,callback}){ async dxt5({src,dstPath,callback}){
try{ try{
await fs.promises.access(dstPath+".txt"); await fs.promises.access(dstPath+".txt");
callback && callback(); callback && callback();
return; return;
}catch (e){} }catch (e){}
await Semaphore.waitOne(); await Semaphore.waitOne();
const startTime = new Date(); const startTime = new Date();
const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath+".dds", '-f', 'BC3,UBN,sRGB']); const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath+".dds", '-f', 'BC3,UBN,sRGB']);
cm.stdout.on('data', (data) => { cm.stdout.on('data', (data) => {
// console.log(`${src} pvrtc stdout: ${data}`); // console.log(`${src} pvrtc stdout: ${data}`);
}); });
cm.stderr.on('data', (data) => { cm.stderr.on('data', (data) => {
// console.error(`${src} pvrtc stderr: ${data}`); // console.error(`${src} pvrtc stderr: ${data}`);
}); });
cm.on('close', (code) => { cm.on('close', (code) => {
console.log(`【DXT5】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`); console.log(`【DXT5】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`);
const finalDst = dstPath + ".txt"; const finalDst = dstPath + ".txt";
fs.rename(dstPath+".dds", finalDst,(err)=>{ fs.rename(dstPath+".dds", finalDst,(err)=>{
if(err){ if(err){
console.error("图片:" + src + " 生dxt5压缩纹理失败"); console.error("图片:" + src + " 生dxt5压缩纹理失败");
} }
}); });
callback && callback(); callback && callback();
Semaphore.release(); Semaphore.release();
}); });
}, },
async pvrtc({src,dstPath,callback}){ async pvrtc({src,dstPath,callback}){
try{ try{
await fs.promises.access(dstPath+".txt"); await fs.promises.access(dstPath+".txt");
callback && callback(); callback && callback();
return; return;
}catch (e){} }catch (e){}
await Semaphore.waitOne(); await Semaphore.waitOne();
const startTime = new Date(); const startTime = new Date();
const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath+".pvr", '-f', 'PVRTC1_4,UBN,sRGB']); const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/PVRTexToolCLI${os.type() === 'Darwin' ? '' : '.exe'}`, ['-i', src, '-o', dstPath+".pvr", '-f', 'PVRTC1_4,UBN,sRGB']);
cm.stdout.on('data', (data) => { cm.stdout.on('data', (data) => {
// console.log(`${src} pvrtc stdout: ${data}`); // console.log(`${src} pvrtc stdout: ${data}`);
}); });
cm.stderr.on('data', (data) => { cm.stderr.on('data', (data) => {
// console.error(`${src} pvrtc stderr: ${data}`); // console.error(`${src} pvrtc stderr: ${data}`);
}); });
cm.on('close', (code) => { cm.on('close', (code) => {
console.log(`【pvrtc】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`); console.log(`【pvrtc】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`);
const finalDst = dstPath + ".txt"; const finalDst = dstPath + ".txt";
fs.rename(dstPath+".pvr", finalDst,(err)=>{ fs.rename(dstPath+".pvr", finalDst,(err)=>{
if(err){ if(err){
console.error("图片:" + src + " 生pvrtc压缩纹理失败"); console.error("图片:" + src + " 生pvrtc压缩纹理失败");
} }
}); });
callback && callback(); callback && callback();
Semaphore.release(); Semaphore.release();
}); });
}, },
async minPng({src}){ async minPng({src}){
await Semaphore.waitOne(); await Semaphore.waitOne();
const startTime = new Date(); const startTime = new Date();
const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/pngquant${os.type() === 'Darwin' ? '' : '.exe'}`, [src, '-o', src, '-f']); const cm = spawn(`${Conf.dataPath}/WX-WASM-SDK/Editor/pngquant${os.type() === 'Darwin' ? '' : '.exe'}`, [src, '-o', src, '-f']);
cm.stdout.on('data', (data) => { cm.stdout.on('data', (data) => {
// console.log(`${src} minPng stdout: ${data}`); // console.log(`${src} minPng stdout: ${data}`);
}); });
cm.stderr.on('data', (data) => { cm.stderr.on('data', (data) => {
// console.error(`${src} minPng stderr: ${data}`); // console.error(`${src} minPng stderr: ${data}`);
}); });
cm.on('close', (code) => { cm.on('close', (code) => {
console.log(`【minPng】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`); console.log(`【minPng】${src.substring(src.lastIndexOf('/')+1)} 耗时:${new Date() - startTime}ms`);
Semaphore.release(); Semaphore.release();
}); });
} }
}; };
process.on('exit',()=>{ process.on('exit',()=>{
console.warn(new Date().toLocaleString(),`格式转换结束!!!总耗时:${(new Date() - Mod.startTime)/1000}秒。如果有提示转换失败的可以再次执行本条命令。`) console.warn(new Date().toLocaleString(),`格式转换结束!!!总耗时:${(new Date() - Mod.startTime)/1000}秒。如果有提示转换失败的可以再次执行本条命令。`)
}); });
module.exports = { module.exports = {
start:function(isFull){ start:function(isFull){
Mod.start(isFull); Mod.start(isFull);
} }
}; };

14
Assets/WX-WASM-SDK/Editor/Node/_docompress.js.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1b220604542c34893ab7ea633d9b550b guid: 1b220604542c34893ab7ea633d9b550b
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

6
Assets/WX-WASM-SDK/Editor/Node/compress_all.js Executable file → Normal file
View File

@ -1,3 +1,3 @@
const compressor = require('./_docompress.js'); const compressor = require('./_docompress.js');
compressor.start(true); compressor.start(true);

14
Assets/WX-WASM-SDK/Editor/Node/compress_all.js.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3a05ba21881a149268211f8ea1d7c2fd guid: 3a05ba21881a149268211f8ea1d7c2fd
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

6
Assets/WX-WASM-SDK/Editor/Node/compress_astc_only.js Executable file → Normal file
View File

@ -1,3 +1,3 @@
const compressor = require('./_docompress.js'); const compressor = require('./_docompress.js');
compressor.start(false); compressor.start(false);

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f8df5396ed3cc40158fb3d1d10cd7568 guid: f8df5396ed3cc40158fb3d1d10cd7568
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

12
Assets/WX-WASM-SDK/Editor/Node/compressor.js Executable file → Normal file
View File

@ -1,6 +1,6 @@
console.warn(` console.warn(`
如仅仅是测试可以使用compress_astc_only.js, 能节省压缩时间 如仅仅是测试可以使用compress_astc_only.js, 能节省压缩时间
如果是正式上线就需要使用compress_all.js生成全部纹理格式 如果是正式上线就需要使用compress_all.js生成全部纹理格式
`); `);

14
Assets/WX-WASM-SDK/Editor/Node/compressor.js.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8a571215513454dc7a35ceece8e06a26 guid: 8a571215513454dc7a35ceece8e06a26
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

46
Assets/WX-WASM-SDK/Editor/Node/dump_wasm_symbol.mjs Executable file → Normal file
View File

@ -1,23 +1,23 @@
import binaryen from "binaryen"; import binaryen from "binaryen";
import process from "process"; import process from "process";
import fs from "fs"; import fs from "fs";
if (process.argv.length < 3) { if (process.argv.length < 3) {
console.error("cannot find wasmcode, Usage: node dump_wasm_symbo.mjs <your_minigame_dir>"); console.error("cannot find wasmcode, Usage: node dump_wasm_symbo.mjs <your_minigame_dir>");
process.exit(-1); process.exit(-1);
} }
let dir = process.argv[2]; let dir = process.argv[2];
if (!dir.endsWith("/")) { if (!dir.endsWith("/")) {
dir += "/"; dir += "/";
} }
let bin = fs.readFileSync(dir + "webgl/Build/webgl.wasm"); let bin = fs.readFileSync(dir + "webgl/Build/webgl.wasm");
let mod = binaryen.readBinary(bin); let mod = binaryen.readBinary(bin);
let symbols = {}; let symbols = {};
for (let i = 0; i < mod.getNumFunctions(); ++i) { for (let i = 0; i < mod.getNumFunctions(); ++i) {
let ref = mod.getFunctionByIndex(i); let ref = mod.getFunctionByIndex(i);
let func = binaryen.getFunctionInfo(ref); let func = binaryen.getFunctionInfo(ref);
symbols[i] = func.name; symbols[i] = func.name;
} }
fs.writeFileSync(dir + "minigame/webgl.wasm.symbols.unityweb", JSON.stringify(symbols)); fs.writeFileSync(dir + "minigame/webgl.wasm.symbols.unityweb", JSON.stringify(symbols));

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e5abb6c95bc17485f832ec3d792e39c6 guid: e5abb6c95bc17485f832ec3d792e39c6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

64
Assets/WX-WASM-SDK/Editor/Node/package-lock.json generated Executable file → Normal file
View File

@ -1,32 +1,32 @@
{ {
"name": "node", "name": "node",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "node", "name": "node",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"binaryen": "^103.0.0" "binaryen": "^103.0.0"
} }
}, },
"node_modules/binaryen": { "node_modules/binaryen": {
"version": "103.0.0", "version": "103.0.0",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-103.0.0.tgz", "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-103.0.0.tgz",
"integrity": "sha512-dejnXckPWetpBYc021d1hnbM8tECz7cjACKhJWEQEtiqTarYMqLLzH20AthjMgblnySkcRUzEMXbeWPI7UYTQw==", "integrity": "sha512-dejnXckPWetpBYc021d1hnbM8tECz7cjACKhJWEQEtiqTarYMqLLzH20AthjMgblnySkcRUzEMXbeWPI7UYTQw==",
"bin": { "bin": {
"wasm-opt": "bin/wasm-opt", "wasm-opt": "bin/wasm-opt",
"wasm2js": "bin/wasm2js" "wasm2js": "bin/wasm2js"
} }
} }
}, },
"dependencies": { "dependencies": {
"binaryen": { "binaryen": {
"version": "103.0.0", "version": "103.0.0",
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-103.0.0.tgz", "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-103.0.0.tgz",
"integrity": "sha512-dejnXckPWetpBYc021d1hnbM8tECz7cjACKhJWEQEtiqTarYMqLLzH20AthjMgblnySkcRUzEMXbeWPI7UYTQw==" "integrity": "sha512-dejnXckPWetpBYc021d1hnbM8tECz7cjACKhJWEQEtiqTarYMqLLzH20AthjMgblnySkcRUzEMXbeWPI7UYTQw=="
} }
} }
} }

14
Assets/WX-WASM-SDK/Editor/Node/package-lock.json.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a12734edb0eab4b4ebe6b38203e8e3ff guid: a12734edb0eab4b4ebe6b38203e8e3ff
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

20
Assets/WX-WASM-SDK/Editor/Node/package.json Executable file → Normal file
View File

@ -1,10 +1,10 @@
{ {
"name": "unity-wasm", "name": "unity-wasm",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"binaryen": "^103.0.0" "binaryen": "^103.0.0"
} }
} }

14
Assets/WX-WASM-SDK/Editor/Node/package.json.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b7da9cba2e99b4eaf9c4813ef99dd093 guid: b7da9cba2e99b4eaf9c4813ef99dd093
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b24e50552812c4744bee4993ab8c8100
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
Assets/WX-WASM-SDK/Editor/PVRTexToolCLI.meta Executable file → Normal file
View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bcb8bb06aa1a44d7cbca104dd2861127 guid: bcb8bb06aa1a44d7cbca104dd2861127
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

278
Assets/WX-WASM-SDK/Editor/PicCompressor.cs Executable file → Normal file
View File

@ -1,139 +1,139 @@
using UnityEngine; using UnityEngine;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
namespace WeChatWASM namespace WeChatWASM
{ {
public class PicTask public class PicTask
{ {
/// <summary> /// <summary>
/// 0: png, 1:astc, 2:etc23pvrtc /// 0: png, 1:astc, 2:etc23pvrtc
/// </summary> /// </summary>
public int type; public int type;
/// <summary> /// <summary>
/// 图片路径 /// 图片路径
/// </summary> /// </summary>
public string src; public string src;
public string dst; public string dst;
public int width; public int width;
public int height; public int height;
} }
/// <summary> /// <summary>
/// 基于ImageMagick的图片处理 /// 基于ImageMagick的图片处理
/// </summary> /// </summary>
/// ///
public static class PicCompressor public static class PicCompressor
{ {
static string ASTCPath; static string ASTCPath;
static string PVRTCPath; static string PVRTCPath;
static string PNGPath; static string PNGPath;
static string DXT5Path; static string DXT5Path;
static Semaphore sempore = new Semaphore(8, 8); //最多设置8个进程 static Semaphore sempore = new Semaphore(8, 8); //最多设置8个进程
public static string GetASTCPath() public static string GetASTCPath()
{ {
if (Application.platform == RuntimePlatform.WindowsEditor) if (Application.platform == RuntimePlatform.WindowsEditor)
{ {
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-sse4.1.exe"); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-sse4.1.exe");
} }
if (UnityEngine.SystemInfo.processorType.ToLower().Contains("apple")) { if (UnityEngine.SystemInfo.processorType.ToLower().Contains("apple")) {
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-neon"); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-neon");
} }
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-avx2"); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/astcenc-avx2");
} }
public static string GetPVRTCPath() public static string GetPVRTCPath()
{ {
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/PVRTexToolCLI" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "")); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/PVRTexToolCLI" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : ""));
} }
public static string GetDXT5Path() public static string GetDXT5Path()
{ {
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/PVRTexToolCLI" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "")); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/PVRTexToolCLI" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : ""));
} }
public static string GetPNGPath() public static string GetPNGPath()
{ {
return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/pngquant" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : "")); return Path.Combine(Application.dataPath, "WX-WASM-SDK/Editor/pngquant" + (Application.platform == RuntimePlatform.WindowsEditor ? ".exe" : ""));
} }
public static void TestASTC() public static void TestASTC()
{ {
var p = new System.Diagnostics.Process(); var p = new System.Diagnostics.Process();
p.StartInfo.FileName = GetASTCPath(); p.StartInfo.FileName = GetASTCPath();
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true; p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = " -help"; p.StartInfo.Arguments = " -help";
p.Start(); p.Start();
string strOuput = p.StandardOutput.ReadToEnd(); string strOuput = p.StandardOutput.ReadToEnd();
Debug.Log(strOuput); Debug.Log(strOuput);
p.WaitForExit(); p.WaitForExit();
p.Close(); p.Close();
} }
public static void TestMinPNG() public static void TestMinPNG()
{ {
var p = new System.Diagnostics.Process(); var p = new System.Diagnostics.Process();
p.StartInfo.FileName = GetPNGPath(); p.StartInfo.FileName = GetPNGPath();
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true; p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = " -help"; p.StartInfo.Arguments = " -help";
p.Start(); p.Start();
/* /*
string strOuput = p.StandardOutput.ReadToEnd(); string strOuput = p.StandardOutput.ReadToEnd();
Debug.Log(strOuput); Debug.Log(strOuput);
p.WaitForExit(); p.WaitForExit();
p.Close(); p.Close();
*/ */
} }
public static void TestPVRTC() public static void TestPVRTC()
{ {
var p = new System.Diagnostics.Process(); var p = new System.Diagnostics.Process();
p.StartInfo.FileName = GetPVRTCPath(); p.StartInfo.FileName = GetPVRTCPath();
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true; p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = " -help"; p.StartInfo.Arguments = " -help";
p.Start(); p.Start();
} }
} }
} }

22
Assets/WX-WASM-SDK/Editor/PicCompressor.cs.meta Executable file → Normal file
View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 754294920db552147b647fac612b55d2 guid: 754294920db552147b647fac612b55d2
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

878
Assets/WX-WASM-SDK/Editor/ReplaceRules.cs Executable file → Normal file
View File

@ -1,439 +1,439 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
namespace WeChatWASM namespace WeChatWASM
{ {
public class Rule public class Rule
{ {
public string old; public string old;
public string newStr; public string newStr;
} }
public class ReplaceRules public class ReplaceRules
{ {
public static Rule[] rules = { public static Rule[] rules = {
new Rule() new Rule()
{ {
old=@"function *doRun\(\) *{", old=@"function *doRun\(\) *{",
newStr="function doRun() {GameGlobal.manager.TimeLogger.timeStart(\"callMain耗时\");" newStr="function doRun() {GameGlobal.manager.TimeLogger.timeStart(\"callMain耗时\");"
}, },
new Rule() new Rule()
{ {
old=@"calledMain *= *true", old=@"calledMain *= *true",
newStr="if(ABORT===true)return;calledMain = true;if(Module.calledMainCb){Module.calledMainCb()}" newStr="if(ABORT===true)return;calledMain = true;if(Module.calledMainCb){Module.calledMainCb()}"
}, },
new Rule() new Rule()
{ {
old="self\\[\"performance\"\\]\\[\"now\"\\]", old="self\\[\"performance\"\\]\\[\"now\"\\]",
newStr="wx.getPerformance().now" newStr="wx.getPerformance().now"
} }
,new Rule() ,new Rule()
{ {
old="self\\[\"performance\"\\]", old="self\\[\"performance\"\\]",
newStr="wx.getPerformance && wx.getPerformance()" newStr="wx.getPerformance && wx.getPerformance()"
},new Rule() },new Rule()
{ {
old="var IDBFS", old="var IDBFS",
newStr="var IDBFS = GameGlobal.unityNamespace.IDBFS" newStr="var IDBFS = GameGlobal.unityNamespace.IDBFS"
}, },
new Rule() new Rule()
{ {
old=@"return WebAssembly\.instantiate *\(binary *, *info\)", old=@"return WebAssembly\.instantiate *\(binary *, *info\)",
newStr="if(Module[\"wasmBin\"]){return WebAssembly.instantiate(Module[\"wasmBin\"], info);}return WebAssembly.instantiate(Module[\"wasmPath\"], info)" newStr="if(Module[\"wasmBin\"]){return WebAssembly.instantiate(Module[\"wasmBin\"], info);}return WebAssembly.instantiate(Module[\"wasmPath\"], info)"
}, },
new Rule() new Rule()
{ {
old="var FS *=", old="var FS *=",
newStr="var FS = GameGlobal.unityNamespace.FS=" newStr="var FS = GameGlobal.unityNamespace.FS="
}, },
// ----MemoryProfiler Begin-----// // ----MemoryProfiler Begin-----//
new Rule() new Rule()
{ {
old="(new Error).stack.toString()", old="(new Error).stack.toString()",
newStr="\"\"" newStr="\"\""
}, },
new Rule() new Rule()
{ {
old="if *\\(location.search.toLowerCase", old="if *\\(location.search.toLowerCase",
newStr="return; if(location.search.toLowerCase" newStr="return; if(location.search.toLowerCase"
}, },
new Rule() new Rule()
{ {
old="if *\\(this.hookStackAlloc", old="if *\\(this.hookStackAlloc",
newStr="return;if(this.hookStackAlloc" newStr="return;if(this.hookStackAlloc"
}, },
// ----MemoryProfiler End-----// // ----MemoryProfiler End-----//
#if !UNITY_2021 #if !UNITY_2021
new Rule() new Rule()
{ {
old=@"t\.clientX *- *canvasRect\.left", old=@"t\.clientX *- *canvasRect\.left",
newStr="(t.clientX - canvasRect.left) * window._ScaleRate * (canvas.width / window.innerWidth / devicePixelRatio)" newStr="(t.clientX - canvasRect.left) * window._ScaleRate * (canvas.width / window.innerWidth / devicePixelRatio)"
},new Rule() },new Rule()
{ {
old=@"t\.clientY *- *canvasRect\.top", old=@"t\.clientY *- *canvasRect\.top",
newStr="(t.clientY - canvasRect.top) * window._ScaleRate * (canvas.height / window.innerHeight / devicePixelRatio)" newStr="(t.clientY - canvasRect.top) * window._ScaleRate * (canvas.height / window.innerHeight / devicePixelRatio)"
},new Rule() },new Rule()
{ {
old=@"t\.clientX *- *targetRect\.left", old=@"t\.clientX *- *targetRect\.left",
newStr="(t.clientX - targetRect.left) * window._ScaleRate * (canvas.width / window.innerWidth / devicePixelRatio)" newStr="(t.clientX - targetRect.left) * window._ScaleRate * (canvas.width / window.innerWidth / devicePixelRatio)"
},new Rule() },new Rule()
{ {
old=@"t\.clientY *- *targetRect\.top", old=@"t\.clientY *- *targetRect\.top",
newStr="(t.clientY - targetRect.top) * window._ScaleRate * (canvas.height / window.innerHeight / devicePixelRatio)" newStr="(t.clientY - targetRect.top) * window._ScaleRate * (canvas.height / window.innerHeight / devicePixelRatio)"
}, },
#endif #endif
new Rule() new Rule()
{ {
old=@"document\.URL", old=@"document\.URL",
newStr="GameGlobal.unityNamespace.DATA_CDN || \"https://game.weixin.qq.com\"" newStr="GameGlobal.unityNamespace.DATA_CDN || \"https://game.weixin.qq.com\""
},new Rule() },new Rule()
{ {
old=@"canvas\.style\.setProperty *\(", old=@"canvas\.style\.setProperty *\(",
newStr="if(canvas.style.setProperty)canvas.style.setProperty(" newStr="if(canvas.style.setProperty)canvas.style.setProperty("
},new Rule() },new Rule()
{ {
old=@"canvas\.style\.removeProperty *\(", old=@"canvas\.style\.removeProperty *\(",
newStr="if(canvas.style.removeProperty)canvas.style.removeProperty(" newStr="if(canvas.style.removeProperty)canvas.style.removeProperty("
},new Rule() },new Rule()
{ {
old="if *\\(!\\(Module\\[\"wasmMemory\"\\]", old="if *\\(!\\(Module\\[\"wasmMemory\"\\]",
newStr="if(!Module.IsWxGame && !(Module[\"wasmMemory\"]" newStr="if(!Module.IsWxGame && !(Module[\"wasmMemory\"]"
}, },
new Rule() new Rule()
{ {
old=@"function *getBinary *\( *\) *{", old=@"function *getBinary *\( *\) *{",
newStr="function getBinary() {return;" newStr="function getBinary() {return;"
},new Rule() },new Rule()
{ {
old="addRunDependency\\(\"wasm-instantiate\"\\)", old="addRunDependency\\(\"wasm-instantiate\"\\)",
newStr="addRunDependency(\"wasm-instantiate\");addRunDependency(\"wasm-preloadAssets\");GameGlobal.manager.TimeLogger.timeStart(\"wasm编译耗时\");" newStr="addRunDependency(\"wasm-instantiate\");addRunDependency(\"wasm-preloadAssets\");GameGlobal.manager.TimeLogger.timeStart(\"wasm编译耗时\");"
},new Rule() },new Rule()
{ {
old="removeRunDependency\\(\"wasm-instantiate\"\\)", old="removeRunDependency\\(\"wasm-instantiate\"\\)",
newStr="if(Module.wasmInstantiated){Module.wasmInstantiated();removeRunDependency(\"wasm-instantiate\")}" newStr="if(Module.wasmInstantiated){Module.wasmInstantiated();removeRunDependency(\"wasm-instantiate\")}"
}, },
new Rule() new Rule()
{ {
old="var runDependencies", old="var runDependencies",
newStr="var runDependencies = GameGlobal.unityNamespace.runDependencies" newStr="var runDependencies = GameGlobal.unityNamespace.runDependencies"
}, },
new Rule() new Rule()
{ {
old=@"function *addRunDependency *\(id\) *{", old=@"function *addRunDependency *\(id\) *{",
newStr="function addRunDependency(id) {console.log(\"addRunDependency: \", id);" newStr="function addRunDependency(id) {console.log(\"addRunDependency: \", id);"
}, },
new Rule() new Rule()
{ {
old=@"function *removeRunDependency *\(id\) *{", old=@"function *removeRunDependency *\(id\) *{",
newStr="function removeRunDependency(id) {console.log(\"removeRunDependency: \", id);" newStr="function removeRunDependency(id) {console.log(\"removeRunDependency: \", id);"
}, },
new Rule() new Rule()
{ {
old=": *_JS_Sound_Create_Channel", old=": *_JS_Sound_Create_Channel",
newStr=":window.WXWASMSDK._JS_Sound_Create_Channel" newStr=":window.WXWASMSDK._JS_Sound_Create_Channel"
}, },
new Rule() new Rule()
{ {
old=": *_JS_Sound_GetLength", old=": *_JS_Sound_GetLength",
newStr=":window.WXWASMSDK._JS_Sound_GetLength" newStr=":window.WXWASMSDK._JS_Sound_GetLength"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_GetLoadState", old=": *_JS_Sound_GetLoadState",
newStr=":window.WXWASMSDK._JS_Sound_GetLoadState" newStr=":window.WXWASMSDK._JS_Sound_GetLoadState"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_Init", old=": *_JS_Sound_Init",
newStr=":window.WXWASMSDK._JS_Sound_Init" newStr=":window.WXWASMSDK._JS_Sound_Init"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_Load", old=": *_JS_Sound_Load",
newStr=":window.WXWASMSDK._JS_Sound_Load" newStr=":window.WXWASMSDK._JS_Sound_Load"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_Load_PCM", old=": *_JS_Sound_Load_PCM",
newStr=":window.WXWASMSDK._JS_Sound_Load_PCM" newStr=":window.WXWASMSDK._JS_Sound_Load_PCM"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_Play", old=": *_JS_Sound_Play",
newStr=":window.WXWASMSDK._JS_Sound_Play" newStr=":window.WXWASMSDK._JS_Sound_Play"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_ReleaseInstance", old=": *_JS_Sound_ReleaseInstance",
newStr=":window.WXWASMSDK._JS_Sound_ReleaseInstance" newStr=":window.WXWASMSDK._JS_Sound_ReleaseInstance"
}, new Rule() }, new Rule()
{ {
old=": *_JS_Sound_ResumeIfNeeded", old=": *_JS_Sound_ResumeIfNeeded",
newStr=":window.WXWASMSDK._JS_Sound_ResumeIfNeeded" newStr=":window.WXWASMSDK._JS_Sound_ResumeIfNeeded"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_Set3D", old=": *_JS_Sound_Set3D",
newStr=":window.WXWASMSDK._JS_Sound_Set3D" newStr=":window.WXWASMSDK._JS_Sound_Set3D"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetListenerOrientation", old=": *_JS_Sound_SetListenerOrientation",
newStr=":window.WXWASMSDK._JS_Sound_SetListenerOrientation" newStr=":window.WXWASMSDK._JS_Sound_SetListenerOrientation"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetListenerPosition", old=": *_JS_Sound_SetListenerPosition",
newStr=":window.WXWASMSDK._JS_Sound_SetListenerPosition" newStr=":window.WXWASMSDK._JS_Sound_SetListenerPosition"
}, },
new Rule() new Rule()
{ {
old=": *_JS_Sound_SetLoop", old=": *_JS_Sound_SetLoop",
newStr=":window.WXWASMSDK._JS_Sound_SetLoop" newStr=":window.WXWASMSDK._JS_Sound_SetLoop"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetLoopPoints", old=": *_JS_Sound_SetLoopPoints",
newStr=":window.WXWASMSDK._JS_Sound_SetLoopPoints" newStr=":window.WXWASMSDK._JS_Sound_SetLoopPoints"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetPaused", old=": *_JS_Sound_SetPaused",
newStr=":window.WXWASMSDK._JS_Sound_SetPaused" newStr=":window.WXWASMSDK._JS_Sound_SetPaused"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetPitch", old=": *_JS_Sound_SetPitch",
newStr=":window.WXWASMSDK._JS_Sound_SetPitch" newStr=":window.WXWASMSDK._JS_Sound_SetPitch"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetPosition", old=": *_JS_Sound_SetPosition",
newStr=":window.WXWASMSDK._JS_Sound_SetPosition" newStr=":window.WXWASMSDK._JS_Sound_SetPosition"
},new Rule() },new Rule()
{ {
old=": *_JS_Sound_SetVolume", old=": *_JS_Sound_SetVolume",
newStr=":window.WXWASMSDK._JS_Sound_SetVolume" newStr=":window.WXWASMSDK._JS_Sound_SetVolume"
},new Rule(){ },new Rule(){
old=": *_JS_Sound_Stop", old=": *_JS_Sound_Stop",
newStr=":window.WXWASMSDK._JS_Sound_Stop" newStr=":window.WXWASMSDK._JS_Sound_Stop"
},new Rule() },new Rule()
{ {
old="assert\\(typeof Module\\[\"pthreadMainPrefixURL\"\\]", old="assert\\(typeof Module\\[\"pthreadMainPrefixURL\"\\]",
newStr="// assert(typeof Module[\"pthreadMainPrefixURL\"]" newStr="// assert(typeof Module[\"pthreadMainPrefixURL\"]"
},new Rule() },new Rule()
{ {
old=@"var *Browser *=", old=@"var *Browser *=",
newStr="var Browser = GameGlobal.unityNamespace.Browser =" newStr="var Browser = GameGlobal.unityNamespace.Browser ="
},new Rule() },new Rule()
{ {
old="safeSetInterval: *\\( *function *\\(func, *timeout\\) *{[\\s\\S]*?Module\\[\"noExitRuntime\"\\] *= *true;", old="safeSetInterval: *\\( *function *\\(func, *timeout\\) *{[\\s\\S]*?Module\\[\"noExitRuntime\"\\] *= *true;",
newStr="safeSetInterval: (function(func, timeout) {Module[\"noExitRuntime\"] = true;if (!GameGlobal.unityNamespace.isLoopRunnerEnable) return;" newStr="safeSetInterval: (function(func, timeout) {Module[\"noExitRuntime\"] = true;if (!GameGlobal.unityNamespace.isLoopRunnerEnable) return;"
},new Rule() },new Rule()
{ {
old=@"_emscripten_set_main_loop_timing\(1, *1\)", old=@"_emscripten_set_main_loop_timing\(1, *1\)",
newStr="_emscripten_set_main_loop_timing(1, 1);if (!GameGlobal.unityNamespace.isLoopRunnerEnable) return;" newStr="_emscripten_set_main_loop_timing(1, 1);if (!GameGlobal.unityNamespace.isLoopRunnerEnable) return;"
},new Rule(){ },new Rule(){
old="\"parent\": *Module\\b", old="\"parent\": *Module\\b",
newStr="\"parent\": Module,wx:{ignore_opt_glue_apis:[\"_glGenTextures\",\"_glBindTexture\",\"_glDeleteTextures\",\"_glFramebufferTexture2D\",\"_glIsTexture\",\"_glCompressedTexImage2D\",\"_glGetString\"]}" newStr="\"parent\": Module,wx:{ignore_opt_glue_apis:[\"_glGenTextures\",\"_glBindTexture\",\"_glDeleteTextures\",\"_glFramebufferTexture2D\",\"_glIsTexture\",\"_glCompressedTexImage2D\",\"_glGetString\"]}"
},new Rule(){ },new Rule(){
old = "GL.createContext\\(([^)]+)\\);", old = "GL.createContext\\(([^)]+)\\);",
newStr="GL.createContext($1);WXWASMSDK.canvasContext && WXWASMSDK.canvasContext._triggerCallback();" newStr="GL.createContext($1);WXWASMSDK.canvasContext && WXWASMSDK.canvasContext._triggerCallback();"
},new Rule(){ },new Rule(){
old = "throw\"abort", old = "throw\"abort",
newStr = "if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);else throw\"abort" newStr = "if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);else throw\"abort"
}, },
new Rule(){ new Rule(){
old = "err\\(\"Looks like", old = "err\\(\"Looks like",
newStr = "console.warn(\"Looks like" newStr = "console.warn(\"Looks like"
}, },
new Rule(){ new Rule(){
old = "case 4:console.error", old = "case 4:console.error",
newStr = "case 4:if(str.startsWith('An abnormal situation')){if(GameGlobal.logAbNormalOnce!=undefined)return;GameGlobal.logAbNormalOnce=1;}if(str.indexOf('is corrupted! Remove it and launch unity again!')>-1){return;}console.error" newStr = "case 4:if(str.startsWith('An abnormal situation')){if(GameGlobal.logAbNormalOnce!=undefined)return;GameGlobal.logAbNormalOnce=1;}if(str.indexOf('is corrupted! Remove it and launch unity again!')>-1){return;}console.error"
}, },
new Rule(){ new Rule(){
old = @"console.error\(", old = @"console.error\(",
newStr = "err(" newStr = "err("
}, },
new Rule(){ new Rule(){
old = "Module\\[\"ccall\"\\] *=", old = "Module\\[\"ccall\"\\] *=",
newStr = " Module['GL'] = GL; Module['ccall'] =" newStr = " Module['GL'] = GL; Module['ccall'] ="
}, },
new Rule(){ new Rule(){
old = "var exts *= *GLctx\\.getSupportedExtensions\\(\\)( *\\|\\| *\\[\\])?;", old = "var exts *= *GLctx\\.getSupportedExtensions\\(\\)( *\\|\\| *\\[\\])?;",
newStr = "var exts = GLctx.getSupportedExtensions() || [];GameGlobal.USED_TEXTURE_COMPRESSION && exts.push('WEBGL_compressed_texture_etc1');" newStr = "var exts = GLctx.getSupportedExtensions() || [];GameGlobal.USED_TEXTURE_COMPRESSION && exts.push('WEBGL_compressed_texture_etc1');"
}, },
new Rule(){ new Rule(){
old = "Browser.mainLoop.runIter", old = "Browser.mainLoop.runIter",
newStr = "if(GameGlobal.manager.isVisible) Browser.mainLoop.runIter" newStr = "if(GameGlobal.manager.isVisible) Browser.mainLoop.runIter"
}, },
new Rule(){ new Rule(){
old = "function _glTexStorage2D\\(x0, *x1, *x2, *x3, *x4\\) *{", old = "function _glTexStorage2D\\(x0, *x1, *x2, *x3, *x4\\) *{",
newStr = "function _glTexStorage2D(x0, x1, x2, x3, x4) {window._lastTexStorage2DParams = [x0, x1, x2, x3, x4];if(x2 == 36196){return;}" newStr = "function _glTexStorage2D(x0, x1, x2, x3, x4) {window._lastTexStorage2DParams = [x0, x1, x2, x3, x4];if(x2 == 36196){return;}"
}, },
#if UNITY_2020 #if UNITY_2020
new Rule() new Rule()
{ {
old="FileSystem_Initialize\\(\\) *{", old="FileSystem_Initialize\\(\\) *{",
newStr="FileSystem_Initialize(){if (!Module.indexedDB) return;" newStr="FileSystem_Initialize(){if (!Module.indexedDB) return;"
}, },
new Rule() new Rule()
{ {
old="_JS_FileSystem_Sync\\(\\) *{", old="_JS_FileSystem_Sync\\(\\) *{",
newStr="_JS_FileSystem_Sync(){if (!Module.indexedDB) return;" newStr="_JS_FileSystem_Sync(){if (!Module.indexedDB) return;"
}, },
new Rule() new Rule()
{ {
old="Module.SystemInfo", old="Module.SystemInfo",
newStr="UnityLoader.SystemInfo" newStr="UnityLoader.SystemInfo"
}, },
new Rule() new Rule()
{ {
old=@"GetStreamingAssetsURL\(buffer, *bufferSize\) *{", old=@"GetStreamingAssetsURL\(buffer, *bufferSize\) *{",
newStr="GetStreamingAssetsURL(buffer,bufferSize){if(Module.IsWxGame) Module.streamingAssetsUrl=Module.resolveBuildUrl(\"StreamingAssets\");" newStr="GetStreamingAssetsURL(buffer,bufferSize){if(Module.IsWxGame) Module.streamingAssetsUrl=Module.resolveBuildUrl(\"StreamingAssets\");"
}, },
#endif #endif
#if UNITY_2021 #if UNITY_2021
new Rule() new Rule()
{ {
old="if *\\(buffer.buffer *=== *HEAP8.buffer", old="if *\\(buffer.buffer *=== *HEAP8.buffer",
newStr="if (!Module.IsWxGame && buffer.buffer === HEAP8.buffer" newStr="if (!Module.IsWxGame && buffer.buffer === HEAP8.buffer"
}, },
new Rule() new Rule()
{ {
old="return ext.getSupportedProfiles\\(", old="return ext.getSupportedProfiles\\(",
newStr="return Module.IsWxGame ? false:ext.getSupportedProfiles(" newStr="return Module.IsWxGame ? false:ext.getSupportedProfiles("
}, },
new Rule() new Rule()
{ {
old="function UTF8ToString", old="function UTF8ToString",
newStr="function Pointer_stringify(ptr){return UTF8ToString(ptr)}function UTF8ToString" newStr="function Pointer_stringify(ptr){return UTF8ToString(ptr)}function UTF8ToString"
}, },
new Rule() new Rule()
{ {
old=@"var result *= *WebAssembly\.instantiate *\(binary *, *info\)", old=@"var result *= *WebAssembly\.instantiate *\(binary *, *info\)",
newStr="if(Module[\"wasmBin\"]){return WebAssembly.instantiate(Module[\"wasmBin\"], info);}return WebAssembly.instantiate(Module[\"wasmPath\"], info)" newStr="if(Module[\"wasmBin\"]){return WebAssembly.instantiate(Module[\"wasmBin\"], info);}return WebAssembly.instantiate(Module[\"wasmPath\"], info)"
}, },
new Rule() new Rule()
{ {
old="if *\\(readAsync", old="if *\\(readAsync",
newStr="if (readAsync && !Module.IsWxGame" newStr="if (readAsync && !Module.IsWxGame"
}, },
new Rule() new Rule()
{ {
old="return ver", old="return ver",
newStr="if(Module.IsWxGame)return gl;return ver" newStr="if(Module.IsWxGame)return gl;return ver"
}, },
new Rule() new Rule()
{ {
old="Module.SystemInfo", old="Module.SystemInfo",
newStr="UnityLoader.SystemInfo" newStr="UnityLoader.SystemInfo"
}, },
new Rule() new Rule()
{ {
old="FileSystem_Initialize\\(\\) *{", old="FileSystem_Initialize\\(\\) *{",
newStr="FileSystem_Initialize(){if (!Module.indexedDB) return;" newStr="FileSystem_Initialize(){if (!Module.indexedDB) return;"
}, },
new Rule() new Rule()
{ {
old="return JSEvents.lastGamepadState", old="return JSEvents.lastGamepadState",
newStr="return Module.IsWxGame ? 0 : JSEvents.lastGamepadState" newStr="return Module.IsWxGame ? 0 : JSEvents.lastGamepadState"
}, },
new Rule() new Rule()
{ {
old=@"function *_emscripten_get_num_gamepads *\( *\) *{", old=@"function *_emscripten_get_num_gamepads *\( *\) *{",
newStr="function _emscripten_get_num_gamepads(){ if(Module.IsWxGame)return 0;" newStr="function _emscripten_get_num_gamepads(){ if(Module.IsWxGame)return 0;"
}, },
new Rule() new Rule()
{ {
old="fs.sync\\(false\\)", old="fs.sync\\(false\\)",
newStr="if(Module.IsWxGame)return;fs.sync(false)" newStr="if(Module.IsWxGame)return;fs.sync(false)"
}, },
new Rule() new Rule()
{ {
old=@"function *getBinary *\(file *\) *{", old=@"function *getBinary *\(file *\) *{",
newStr="function getBinary(file) {return;" newStr="function getBinary(file) {return;"
}, },
new Rule() new Rule()
{ {
old=@"GetStreamingAssetsURL\(buffer, *bufferSize\) *{", old=@"GetStreamingAssetsURL\(buffer, *bufferSize\) *{",
newStr="GetStreamingAssetsURL(buffer,bufferSize){if(Module.IsWxGame) Module.streamingAssetsUrl=Module.resolveBuildUrl(\"StreamingAssets\");" newStr="GetStreamingAssetsURL(buffer,bufferSize){if(Module.IsWxGame) Module.streamingAssetsUrl=Module.resolveBuildUrl(\"StreamingAssets\");"
}, },
new Rule() new Rule()
{ {
old="abort\\(\"randomDevice\"\\)", old="abort\\(\"randomDevice\"\\)",
newStr="if(Module.IsWxGame)return Math.random()*256|0;abort(\"randomDevice\")" newStr="if(Module.IsWxGame)return Math.random()*256|0;abort(\"randomDevice\")"
}, },
new Rule() new Rule()
{ {
old=@"function *getRandomDevice *\( *\) *{", old=@"function *getRandomDevice *\( *\) *{",
newStr="function getRandomDevice(){ if(Module.IsWxGame)return function () {return Math.random() * 256 | 0};" newStr="function getRandomDevice(){ if(Module.IsWxGame)return function () {return Math.random() * 256 | 0};"
}, },
new Rule() new Rule()
{ {
old="!Module\\[\"canvas\"\\].id", old="!Module\\[\"canvas\"\\].id",
newStr="!Module.IsWxGame && !Module[\"canvas\"].id" newStr="!Module.IsWxGame && !Module[\"canvas\"].id"
}, },
new Rule() new Rule()
{ {
old="typeof allocator === \"number\"", old="typeof allocator === \"number\"",
newStr="true" newStr="true"
}, },
new Rule() new Rule()
{ {
old="typeof slab !== \"number\"", old="typeof slab !== \"number\"",
newStr="true" newStr="true"
}, },
new Rule() new Rule()
{ {
old="var message=\"abort", old="var message=\"abort",
newStr="if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);var message=\"abort" newStr="if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);var message=\"abort"
}, },
new Rule() new Rule()
{ {
old="what=\"abort", old="what=\"abort",
newStr="if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);what=\"abort" newStr="if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);what=\"abort"
}, },
#endif #endif
#if UNITY_2021_3_OR_NEWER #if UNITY_2021_3_OR_NEWER
new Rule() new Rule()
{ {
old="new AbortController(\\(\\)|\\b);?", old="new AbortController(\\(\\)|\\b);?",
newStr="new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();if(GameGlobal.TEXTURE_PARALLEL_BUNDLE){GameGlobal.ParalleLDownloadTexture(_url)}" newStr="new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();if(GameGlobal.TEXTURE_PARALLEL_BUNDLE){GameGlobal.ParalleLDownloadTexture(_url)}"
}, },
new Rule() new Rule()
{ {
old="fetchImpl\\(", old="fetchImpl\\(",
newStr="fetchImpl = abortController.openAndSend;fetchImpl(" newStr="fetchImpl = abortController.openAndSend;fetchImpl("
}, },
new Rule() new Rule()
{ {
old="requestOptions.init.body *= *new Blob\\(\\[ *postData *\\]\\)", old="requestOptions.init.body *= *new Blob\\(\\[ *postData *\\]\\)",
newStr="requestOptions.init.body = postData" newStr="requestOptions.init.body = postData"
}, },
new Rule(){ new Rule(){
old = "function HandleError\\(err, *code\\) *{", old = "function HandleError\\(err, *code\\) *{",
newStr = "function HandleError(err, code){ abortController.retryCount = abortController.retryCount || 0; if (typeof abortController !='undefined' && abortController.paramsCache.method === 'GET' && /\\b(settings|catalog)\\.json\\b/.test(abortController.paramsCache.url) && abortController.retryCount<2) {return setTimeout(function () {_reTryRequest(requestId, arg, onresponse)}, 1000);}" newStr = "function HandleError(err, code){ abortController.retryCount = abortController.retryCount || 0; if (typeof abortController !='undefined' && abortController.paramsCache.method === 'GET' && /\\b(settings|catalog)\\.json\\b/.test(abortController.paramsCache.url) && abortController.retryCount<2) {return setTimeout(function () {_reTryRequest(requestId, arg, onresponse)}, 1000);}"
}, },
new Rule() new Rule()
{ {
old="function _JS_WebRequest_Send", old="function _JS_WebRequest_Send",
newStr="function _reTryRequest(requestId,arg,onresponse,needRetry){var abortController = wr.abortControllers[requestId];abortController.retryCount = abortController.retryCount || 0;abortController.retryCount++;var xml=new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();xml.open('GET',abortController.paramsCache.url,true);xml.responseType=abortController.responseType;xml.onload=function(){if(abortController.status>=400&&needRetry){setTimeout(function(){_reTryRequest(requestId,arg,onresponse)},1000);return false;}else{if(onresponse){var kWebRequestOK=0;var byteArray=new Uint8Array(xml.response);if(byteArray.length!=0){var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);dynCall('viiiiii',onresponse,[arg,xml.status,buffer,byteArray.length,0,kWebRequestOK])}else{dynCall('viiiiii',onresponse,[arg,xml.status,0,0,0,kWebRequestOK])}}}};xml.send(abortController.postData);xml.onerror=abortController.onerror;xml.ontimeout=abortController.ontimeout;xml.onabort=abortController.onabort;console.error('load url error:' + abortController.paramsCache.url);GameGlobal.logmanager.warn('load url error:'+abortController.paramsCache.url);GameGlobal.realtimeLogManager.error('load url error:'+abortController.paramsCache.url);} function _JS_WebRequest_Send" newStr="function _reTryRequest(requestId,arg,onresponse,needRetry){var abortController = wr.abortControllers[requestId];abortController.retryCount = abortController.retryCount || 0;abortController.retryCount++;var xml=new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();xml.open('GET',abortController.paramsCache.url,true);xml.responseType=abortController.responseType;xml.onload=function(){if(abortController.status>=400&&needRetry){setTimeout(function(){_reTryRequest(requestId,arg,onresponse)},1000);return false;}else{if(onresponse){var kWebRequestOK=0;var byteArray=new Uint8Array(xml.response);if(byteArray.length!=0){var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);dynCall('viiiiii',onresponse,[arg,xml.status,buffer,byteArray.length,0,kWebRequestOK])}else{dynCall('viiiiii',onresponse,[arg,xml.status,0,0,0,kWebRequestOK])}}}};xml.send(abortController.postData);xml.onerror=abortController.onerror;xml.ontimeout=abortController.ontimeout;xml.onabort=abortController.onabort;console.error('load url error:' + abortController.paramsCache.url);GameGlobal.logmanager.warn('load url error:'+abortController.paramsCache.url);GameGlobal.realtimeLogManager.error('load url error:'+abortController.paramsCache.url);} function _JS_WebRequest_Send"
} }
#else #else
new Rule() new Rule()
{ {
old = "function _JS_WebRequest_SetResponseHandler", old = "function _JS_WebRequest_SetResponseHandler",
newStr = "function _reTryRequest(request,arg,onresponse,needRetry){var http=wr.requestInstances[request];http.retryCount = http.retryCount || 0;http.retryCount++;var xml=new XMLHttpRequest();xml.open('GET',http.paramsCache.url,true);xml.responseType=http.responseType;xml.onload=function(){if(http.status>=400&&needRetry){setTimeout(function(){_reTryRequest(request,arg,onresponse)},1000);return false;}else{if(onresponse){var kWebRequestOK=0;var byteArray=new Uint8Array(xml.response);if(byteArray.length!=0){var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);dynCall('viiiiii',onresponse,[arg,xml.status,buffer,byteArray.length,0,kWebRequestOK])}else{dynCall('viiiiii',onresponse,[arg,xml.status,0,0,0,kWebRequestOK])}}}};xml.send(http.postData);xml.onerror=http.onerror;xml.ontimeout=http.ontimeout;xml.onabort=http.onabort;console.error('load url error:' + http.paramsCache.url);GameGlobal.logmanager.warn('load url error:'+http.paramsCache.url);GameGlobal.realtimeLogManager.error('load url error:'+http.paramsCache.url);} function _JS_WebRequest_SetResponseHandler" newStr = "function _reTryRequest(request,arg,onresponse,needRetry){var http=wr.requestInstances[request];http.retryCount = http.retryCount || 0;http.retryCount++;var xml=new XMLHttpRequest();xml.open('GET',http.paramsCache.url,true);xml.responseType=http.responseType;xml.onload=function(){if(http.status>=400&&needRetry){setTimeout(function(){_reTryRequest(request,arg,onresponse)},1000);return false;}else{if(onresponse){var kWebRequestOK=0;var byteArray=new Uint8Array(xml.response);if(byteArray.length!=0){var buffer=_malloc(byteArray.length);HEAPU8.set(byteArray,buffer);dynCall('viiiiii',onresponse,[arg,xml.status,buffer,byteArray.length,0,kWebRequestOK])}else{dynCall('viiiiii',onresponse,[arg,xml.status,0,0,0,kWebRequestOK])}}}};xml.send(http.postData);xml.onerror=http.onerror;xml.ontimeout=http.ontimeout;xml.onabort=http.onabort;console.error('load url error:' + http.paramsCache.url);GameGlobal.logmanager.warn('load url error:'+http.paramsCache.url);GameGlobal.realtimeLogManager.error('load url error:'+http.paramsCache.url);} function _JS_WebRequest_SetResponseHandler"
}, },
new Rule(){ new Rule(){
old = "function HandleError\\(err, *code\\) *{", old = "function HandleError\\(err, *code\\) *{",
newStr = "function HandleError(err, code){ http.retryCount = http.retryCount || 0; if (typeof http !='undefined' && http.paramsCache.method === 'GET' && /\\b(settings|catalog)\\.json\\b/.test(http.paramsCache.url) && http.retryCount<2) {return setTimeout(function () {_reTryRequest(request, arg, onresponse)}, 1000);}" newStr = "function HandleError(err, code){ http.retryCount = http.retryCount || 0; if (typeof http !='undefined' && http.paramsCache.method === 'GET' && /\\b(settings|catalog)\\.json\\b/.test(http.paramsCache.url) && http.retryCount<2) {return setTimeout(function () {_reTryRequest(request, arg, onresponse)}, 1000);}"
}, },
new Rule(){ new Rule(){
old = "function http_onload\\(e\\) *{", old = "function http_onload\\(e\\) *{",
newStr = "function http_onload(e){if(http.status>=400&&http.paramsCache.method==='GET'&&/\\b(settings|catalog)\\.json\\b/.test(http.paramsCache.url)){return _reTryRequest(request,arg,onresponse,true)}" newStr = "function http_onload(e){if(http.status>=400&&http.paramsCache.method==='GET'&&/\\b(settings|catalog)\\.json\\b/.test(http.paramsCache.url)){return _reTryRequest(request,arg,onresponse,true)}"
}, },
new Rule() new Rule()
{ {
old="http\\.open\\( *_method *, *_url *, *true *\\);", old="http\\.open\\( *_method *, *_url *, *true *\\);",
newStr="if(GameGlobal.TEXTURE_PARALLEL_BUNDLE){GameGlobal.ParalleLDownloadTexture(_url)}var http = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();http.open(_method, _url, true);" newStr="if(GameGlobal.TEXTURE_PARALLEL_BUNDLE){GameGlobal.ParalleLDownloadTexture(_url)}var http = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();http.open(_method, _url, true);"
} }
#endif #endif
}; };
} }
} }

22
Assets/WX-WASM-SDK/Editor/ReplaceRules.cs.meta Executable file → Normal file
View File

@ -1,11 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7d4d943d555e9d649bf3a8d38bbb8468 guid: 7d4d943d555e9d649bf3a8d38bbb8468
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: 0
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 223111426b53a4573b5c2a670c3bfe37 guid: 223111426b53a4573b5c2a670c3bfe37
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2090b7dc8553349e9bccd6c134fd9ab5 guid: 2090b7dc8553349e9bccd6c134fd9ab5
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1eac7a8fa06404390b20a6114156c30a guid: 1eac7a8fa06404390b20a6114156c30a
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 595965503343d48e28189108b69672e0 guid: 595965503343d48e28189108b69672e0
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c5a9fda64938c40e0b15033702dde422 guid: c5a9fda64938c40e0b15033702dde422
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: afad6e2db784c436897637bafaa2cd9d guid: afad6e2db784c436897637bafaa2cd9d
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 32c75a0b5a2b041d0b3537706a5fa82d guid: 32c75a0b5a2b041d0b3537706a5fa82d
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="utf-8"?><doc> <?xml version="1.0" encoding="utf-8"?><doc>
<assembly> <assembly>
<name>System.Buffers</name> <name>System.Buffers</name>
</assembly> </assembly>
<members> <members>
<member name="T:System.Buffers.ArrayPool`1"> <member name="T:System.Buffers.ArrayPool`1">
<summary>Provides a resource pool that enables reusing instances of type <see cref="T[]"></see>.</summary> <summary>Provides a resource pool that enables reusing instances of type <see cref="T[]"></see>.</summary>
<typeparam name="T">The type of the objects that are in the resource pool.</typeparam> <typeparam name="T">The type of the objects that are in the resource pool.</typeparam>
</member> </member>
<member name="M:System.Buffers.ArrayPool`1.#ctor"> <member name="M:System.Buffers.ArrayPool`1.#ctor">
<summary>Initializes a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class.</summary> <summary>Initializes a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class.</summary>
</member> </member>
<member name="M:System.Buffers.ArrayPool`1.Create"> <member name="M:System.Buffers.ArrayPool`1.Create">
<summary>Creates a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class.</summary> <summary>Creates a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class.</summary>
<returns>A new instance of the <see cref="System.Buffers.ArrayPool`1"></see> class.</returns> <returns>A new instance of the <see cref="System.Buffers.ArrayPool`1"></see> class.</returns>
</member> </member>
<member name="M:System.Buffers.ArrayPool`1.Create(System.Int32,System.Int32)"> <member name="M:System.Buffers.ArrayPool`1.Create(System.Int32,System.Int32)">
<summary>Creates a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class using the specifed configuration.</summary> <summary>Creates a new instance of the <see cref="T:System.Buffers.ArrayPool`1"></see> class using the specifed configuration.</summary>
<param name="maxArrayLength">The maximum length of an array instance that may be stored in the pool.</param> <param name="maxArrayLength">The maximum length of an array instance that may be stored in the pool.</param>
<param name="maxArraysPerBucket">The maximum number of array instances that may be stored in each bucket in the pool. The pool groups arrays of similar lengths into buckets for faster access.</param> <param name="maxArraysPerBucket">The maximum number of array instances that may be stored in each bucket in the pool. The pool groups arrays of similar lengths into buckets for faster access.</param>
<returns>A new instance of the <see cref="System.Buffers.ArrayPool`1"></see> class with the specified configuration.</returns> <returns>A new instance of the <see cref="System.Buffers.ArrayPool`1"></see> class with the specified configuration.</returns>
</member> </member>
<member name="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"> <member name="M:System.Buffers.ArrayPool`1.Rent(System.Int32)">
<summary>Retrieves a buffer that is at least the requested length.</summary> <summary>Retrieves a buffer that is at least the requested length.</summary>
<param name="minimumLength">The minimum length of the array.</param> <param name="minimumLength">The minimum length of the array.</param>
<returns>An array of type <see cref="T[]"></see> that is at least <paramref name="minimumLength">minimumLength</paramref> in length.</returns> <returns>An array of type <see cref="T[]"></see> that is at least <paramref name="minimumLength">minimumLength</paramref> in length.</returns>
</member> </member>
<member name="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)"> <member name="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)">
<summary>Returns an array to the pool that was previously obtained using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method on the same <see cref="T:System.Buffers.ArrayPool`1"></see> instance.</summary> <summary>Returns an array to the pool that was previously obtained using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method on the same <see cref="T:System.Buffers.ArrayPool`1"></see> instance.</summary>
<param name="array">A buffer to return to the pool that was previously obtained using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method.</param> <param name="array">A buffer to return to the pool that was previously obtained using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method.</param>
<param name="clearArray">Indicates whether the contents of the buffer should be cleared before reuse. If <paramref name="clearArray">clearArray</paramref> is set to true, and if the pool will store the buffer to enable subsequent reuse, the <see cref="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)"></see> method will clear the <paramref name="array">array</paramref> of its contents so that a subsequent caller using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method will not see the content of the previous caller. If <paramref name="clearArray">clearArray</paramref> is set to false or if the pool will release the buffer, the array&amp;#39;s contents are left unchanged.</param> <param name="clearArray">Indicates whether the contents of the buffer should be cleared before reuse. If <paramref name="clearArray">clearArray</paramref> is set to true, and if the pool will store the buffer to enable subsequent reuse, the <see cref="M:System.Buffers.ArrayPool`1.Return(`0[],System.Boolean)"></see> method will clear the <paramref name="array">array</paramref> of its contents so that a subsequent caller using the <see cref="M:System.Buffers.ArrayPool`1.Rent(System.Int32)"></see> method will not see the content of the previous caller. If <paramref name="clearArray">clearArray</paramref> is set to false or if the pool will release the buffer, the array&amp;#39;s contents are left unchanged.</param>
</member> </member>
<member name="P:System.Buffers.ArrayPool`1.Shared"> <member name="P:System.Buffers.ArrayPool`1.Shared">
<summary>Gets a shared <see cref="T:System.Buffers.ArrayPool`1"></see> instance.</summary> <summary>Gets a shared <see cref="T:System.Buffers.ArrayPool`1"></see> instance.</summary>
<returns>A shared <see cref="System.Buffers.ArrayPool`1"></see> instance.</returns> <returns>A shared <see cref="System.Buffers.ArrayPool`1"></see> instance.</returns>
</member> </member>
</members> </members>
</doc> </doc>

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8b765598ff9384f88a7dde4719df439a guid: 8b765598ff9384f88a7dde4719df439a
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 98f7f51ba4e0d4eb5a8bf091dc15d2fa guid: 98f7f51ba4e0d4eb5a8bf091dc15d2fa
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,355 +1,355 @@
<?xml version="1.0" encoding="utf-8"?><doc> <?xml version="1.0" encoding="utf-8"?><doc>
<assembly> <assembly>
<name>System.Memory</name> <name>System.Memory</name>
</assembly> </assembly>
<members> <members>
<member name="T:System.Span`1"> <member name="T:System.Span`1">
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
</member> </member>
<member name="M:System.Span`1.#ctor(`0[])"> <member name="M:System.Span`1.#ctor(`0[])">
<param name="array"></param> <param name="array"></param>
</member> </member>
<member name="M:System.Span`1.#ctor(System.Void*,System.Int32)"> <member name="M:System.Span`1.#ctor(System.Void*,System.Int32)">
<param name="pointer"></param> <param name="pointer"></param>
<param name="length"></param> <param name="length"></param>
</member> </member>
<member name="M:System.Span`1.#ctor(`0[],System.Int32)"> <member name="M:System.Span`1.#ctor(`0[],System.Int32)">
<param name="array"></param> <param name="array"></param>
<param name="start"></param> <param name="start"></param>
</member> </member>
<member name="M:System.Span`1.#ctor(`0[],System.Int32,System.Int32)"> <member name="M:System.Span`1.#ctor(`0[],System.Int32,System.Int32)">
<param name="array"></param> <param name="array"></param>
<param name="start"></param> <param name="start"></param>
<param name="length"></param> <param name="length"></param>
</member> </member>
<member name="M:System.Span`1.Clear"> <member name="M:System.Span`1.Clear">
</member> </member>
<member name="M:System.Span`1.CopyTo(System.Span{`0})"> <member name="M:System.Span`1.CopyTo(System.Span{`0})">
<param name="destination"></param> <param name="destination"></param>
</member> </member>
<member name="M:System.Span`1.DangerousCreate(System.Object,`0@,System.Int32)"> <member name="M:System.Span`1.DangerousCreate(System.Object,`0@,System.Int32)">
<param name="obj"></param> <param name="obj"></param>
<param name="objectData"></param> <param name="objectData"></param>
<param name="length"></param> <param name="length"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.DangerousGetPinnableReference"> <member name="M:System.Span`1.DangerousGetPinnableReference">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.Span`1.Empty"> <member name="P:System.Span`1.Empty">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.Equals(System.Object)"> <member name="M:System.Span`1.Equals(System.Object)">
<param name="obj"></param> <param name="obj"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.Fill(`0)"> <member name="M:System.Span`1.Fill(`0)">
<param name="value"></param> <param name="value"></param>
</member> </member>
<member name="M:System.Span`1.GetHashCode"> <member name="M:System.Span`1.GetHashCode">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.Span`1.IsEmpty"> <member name="P:System.Span`1.IsEmpty">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.Span`1.Item(System.Int32)"> <member name="P:System.Span`1.Item(System.Int32)">
<param name="index"></param> <param name="index"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.Span`1.Length"> <member name="P:System.Span`1.Length">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.op_Equality(System.Span{`0},System.Span{`0})"> <member name="M:System.Span`1.op_Equality(System.Span{`0},System.Span{`0})">
<param name="left"></param> <param name="left"></param>
<param name="right"></param> <param name="right"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.op_Implicit(System.ArraySegment{T})~System.Span{T}"> <member name="M:System.Span`1.op_Implicit(System.ArraySegment{T})~System.Span{T}">
<param name="arraySegment"></param> <param name="arraySegment"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.op_Implicit(System.Span{T})~System.ReadOnlySpan{T}"> <member name="M:System.Span`1.op_Implicit(System.Span{T})~System.ReadOnlySpan{T}">
<param name="span"></param> <param name="span"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.op_Implicit(T[])~System.Span{T}"> <member name="M:System.Span`1.op_Implicit(T[])~System.Span{T}">
<param name="array"></param> <param name="array"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.op_Inequality(System.Span{`0},System.Span{`0})"> <member name="M:System.Span`1.op_Inequality(System.Span{`0},System.Span{`0})">
<param name="left"></param> <param name="left"></param>
<param name="right"></param> <param name="right"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.Slice(System.Int32)"> <member name="M:System.Span`1.Slice(System.Int32)">
<param name="start"></param> <param name="start"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.Slice(System.Int32,System.Int32)"> <member name="M:System.Span`1.Slice(System.Int32,System.Int32)">
<param name="start"></param> <param name="start"></param>
<param name="length"></param> <param name="length"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.ToArray"> <member name="M:System.Span`1.ToArray">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.Span`1.TryCopyTo(System.Span{`0})"> <member name="M:System.Span`1.TryCopyTo(System.Span{`0})">
<param name="destination"></param> <param name="destination"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:System.SpanExtensions"> <member name="T:System.SpanExtensions">
</member> </member>
<member name="M:System.SpanExtensions.AsBytes``1(System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.AsBytes``1(System.ReadOnlySpan{``0})">
<param name="source"></param> <param name="source"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.AsBytes``1(System.Span{``0})"> <member name="M:System.SpanExtensions.AsBytes``1(System.Span{``0})">
<param name="source"></param> <param name="source"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.AsSpan(System.String)"> <member name="M:System.SpanExtensions.AsSpan(System.String)">
<param name="text"></param> <param name="text"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.AsSpan``1(System.ArraySegment{``0})"> <member name="M:System.SpanExtensions.AsSpan``1(System.ArraySegment{``0})">
<param name="arraySegment"></param> <param name="arraySegment"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.AsSpan``1(``0[])"> <member name="M:System.SpanExtensions.AsSpan``1(``0[])">
<param name="array"></param> <param name="array"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.CopyTo``1(``0[],System.Span{``0})"> <member name="M:System.SpanExtensions.CopyTo``1(``0[],System.Span{``0})">
<param name="array"></param> <param name="array"></param>
<param name="destination"></param> <param name="destination"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.IndexOf(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf(System.Span{System.Byte},System.Byte)"> <member name="M:System.SpanExtensions.IndexOf(System.Span{System.Byte},System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf(System.ReadOnlySpan{System.Byte},System.Byte)"> <member name="M:System.SpanExtensions.IndexOf(System.ReadOnlySpan{System.Byte},System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.IndexOf(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.IndexOf``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf``1(System.ReadOnlySpan{``0},``0)"> <member name="M:System.SpanExtensions.IndexOf``1(System.ReadOnlySpan{``0},``0)">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf``1(System.Span{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.IndexOf``1(System.Span{``0},System.ReadOnlySpan{``0})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOf``1(System.Span{``0},``0)"> <member name="M:System.SpanExtensions.IndexOf``1(System.Span{``0},``0)">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.Byte,System.Byte,System.Byte)"> <member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.Byte,System.Byte,System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value0"></param> <param name="value0"></param>
<param name="value1"></param> <param name="value1"></param>
<param name="value2"></param> <param name="value2"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.Byte,System.Byte,System.Byte)"> <member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.Byte,System.Byte,System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value0"></param> <param name="value0"></param>
<param name="value1"></param> <param name="value1"></param>
<param name="value2"></param> <param name="value2"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.Byte,System.Byte)"> <member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.Byte,System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value0"></param> <param name="value0"></param>
<param name="value1"></param> <param name="value1"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="values"></param> <param name="values"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.IndexOfAny(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="values"></param> <param name="values"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.Byte,System.Byte)"> <member name="M:System.SpanExtensions.IndexOfAny(System.ReadOnlySpan{System.Byte},System.Byte,System.Byte)">
<param name="span"></param> <param name="span"></param>
<param name="value0"></param> <param name="value0"></param>
<param name="value1"></param> <param name="value1"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.NonPortableCast``2(System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.NonPortableCast``2(System.ReadOnlySpan{``0})">
<param name="source"></param> <param name="source"></param>
<typeparam name="TFrom"></typeparam> <typeparam name="TFrom"></typeparam>
<typeparam name="TTo"></typeparam> <typeparam name="TTo"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.NonPortableCast``2(System.Span{``0})"> <member name="M:System.SpanExtensions.NonPortableCast``2(System.Span{``0})">
<param name="source"></param> <param name="source"></param>
<typeparam name="TFrom"></typeparam> <typeparam name="TFrom"></typeparam>
<typeparam name="TTo"></typeparam> <typeparam name="TTo"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.SequenceEqual(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.SequenceEqual(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="first"></param> <param name="first"></param>
<param name="second"></param> <param name="second"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.SequenceEqual(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.SequenceEqual(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="first"></param> <param name="first"></param>
<param name="second"></param> <param name="second"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.SequenceEqual``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.SequenceEqual``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})">
<param name="first"></param> <param name="first"></param>
<param name="second"></param> <param name="second"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.SequenceEqual``1(System.Span{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.SequenceEqual``1(System.Span{``0},System.ReadOnlySpan{``0})">
<param name="first"></param> <param name="first"></param>
<param name="second"></param> <param name="second"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.StartsWith(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.StartsWith(System.ReadOnlySpan{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.StartsWith(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})"> <member name="M:System.SpanExtensions.StartsWith(System.Span{System.Byte},System.ReadOnlySpan{System.Byte})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.StartsWith``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.StartsWith``1(System.ReadOnlySpan{``0},System.ReadOnlySpan{``0})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.SpanExtensions.StartsWith``1(System.Span{``0},System.ReadOnlySpan{``0})"> <member name="M:System.SpanExtensions.StartsWith``1(System.Span{``0},System.ReadOnlySpan{``0})">
<param name="span"></param> <param name="span"></param>
<param name="value"></param> <param name="value"></param>
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:System.ReadOnlySpan`1"> <member name="T:System.ReadOnlySpan`1">
<typeparam name="T"></typeparam> <typeparam name="T"></typeparam>
</member> </member>
<member name="M:System.ReadOnlySpan`1.#ctor(`0[])"> <member name="M:System.ReadOnlySpan`1.#ctor(`0[])">
<param name="array"></param> <param name="array"></param>
</member> </member>
<member name="M:System.ReadOnlySpan`1.#ctor(System.Void*,System.Int32)"> <member name="M:System.ReadOnlySpan`1.#ctor(System.Void*,System.Int32)">
<param name="pointer"></param> <param name="pointer"></param>
<param name="length"></param> <param name="length"></param>
</member> </member>
<member name="M:System.ReadOnlySpan`1.#ctor(`0[],System.Int32)"> <member name="M:System.ReadOnlySpan`1.#ctor(`0[],System.Int32)">
<param name="array"></param> <param name="array"></param>
<param name="start"></param> <param name="start"></param>
</member> </member>
<member name="M:System.ReadOnlySpan`1.#ctor(`0[],System.Int32,System.Int32)"> <member name="M:System.ReadOnlySpan`1.#ctor(`0[],System.Int32,System.Int32)">
<param name="array"></param> <param name="array"></param>
<param name="start"></param> <param name="start"></param>
<param name="length"></param> <param name="length"></param>
</member> </member>
<member name="M:System.ReadOnlySpan`1.CopyTo(System.Span{`0})"> <member name="M:System.ReadOnlySpan`1.CopyTo(System.Span{`0})">
<param name="destination"></param> <param name="destination"></param>
</member> </member>
<member name="M:System.ReadOnlySpan`1.DangerousCreate(System.Object,`0@,System.Int32)"> <member name="M:System.ReadOnlySpan`1.DangerousCreate(System.Object,`0@,System.Int32)">
<param name="obj"></param> <param name="obj"></param>
<param name="objectData"></param> <param name="objectData"></param>
<param name="length"></param> <param name="length"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.DangerousGetPinnableReference"> <member name="M:System.ReadOnlySpan`1.DangerousGetPinnableReference">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.ReadOnlySpan`1.Empty"> <member name="P:System.ReadOnlySpan`1.Empty">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.Equals(System.Object)"> <member name="M:System.ReadOnlySpan`1.Equals(System.Object)">
<param name="obj"></param> <param name="obj"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.GetHashCode"> <member name="M:System.ReadOnlySpan`1.GetHashCode">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.ReadOnlySpan`1.IsEmpty"> <member name="P:System.ReadOnlySpan`1.IsEmpty">
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.ReadOnlySpan`1.Item(System.Int32)"> <member name="P:System.ReadOnlySpan`1.Item(System.Int32)">
<param name="index"></param> <param name="index"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="P:System.ReadOnlySpan`1.Length"> <member name="P:System.ReadOnlySpan`1.Length">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.op_Equality(System.ReadOnlySpan{`0},System.ReadOnlySpan{`0})"> <member name="M:System.ReadOnlySpan`1.op_Equality(System.ReadOnlySpan{`0},System.ReadOnlySpan{`0})">
<param name="left"></param> <param name="left"></param>
<param name="right"></param> <param name="right"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.op_Implicit(System.ArraySegment{T})~System.ReadOnlySpan{T}"> <member name="M:System.ReadOnlySpan`1.op_Implicit(System.ArraySegment{T})~System.ReadOnlySpan{T}">
<param name="arraySegment"></param> <param name="arraySegment"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.op_Implicit(T[])~System.ReadOnlySpan{T}"> <member name="M:System.ReadOnlySpan`1.op_Implicit(T[])~System.ReadOnlySpan{T}">
<param name="array"></param> <param name="array"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.op_Inequality(System.ReadOnlySpan{`0},System.ReadOnlySpan{`0})"> <member name="M:System.ReadOnlySpan`1.op_Inequality(System.ReadOnlySpan{`0},System.ReadOnlySpan{`0})">
<param name="left"></param> <param name="left"></param>
<param name="right"></param> <param name="right"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.Slice(System.Int32)"> <member name="M:System.ReadOnlySpan`1.Slice(System.Int32)">
<param name="start"></param> <param name="start"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.Slice(System.Int32,System.Int32)"> <member name="M:System.ReadOnlySpan`1.Slice(System.Int32,System.Int32)">
<param name="start"></param> <param name="start"></param>
<param name="length"></param> <param name="length"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.ToArray"> <member name="M:System.ReadOnlySpan`1.ToArray">
<returns></returns> <returns></returns>
</member> </member>
<member name="M:System.ReadOnlySpan`1.TryCopyTo(System.Span{`0})"> <member name="M:System.ReadOnlySpan`1.TryCopyTo(System.Span{`0})">
<param name="destination"></param> <param name="destination"></param>
<returns></returns> <returns></returns>
</member> </member>
</members> </members>
</doc> </doc>

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 39f5f2549987a418d9fc375080a5446d guid: 39f5f2549987a418d9fc375080a5446d
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,46 +1,46 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1bbb37768a74b44cc896cb70d671d785 guid: 1bbb37768a74b44cc896cb70d671d785
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
'': Any '': Any
second: second:
enabled: 0 enabled: 0
settings: settings:
Exclude Editor: 1 Exclude Editor: 1
Exclude Linux: 1 Exclude Linux: 1
Exclude Linux64: 1 Exclude Linux64: 1
Exclude LinuxUniversal: 1 Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1 Exclude OSXUniversal: 1
Exclude WebGL: 1 Exclude WebGL: 1
Exclude Win: 1 Exclude Win: 1
Exclude Win64: 1 Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6071e4c33784d45738202535a1484d2d guid: 6071e4c33784d45738202535a1484d2d
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,33 +1,33 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 25348f08448a048959da2d2d9feec78a guid: 25348f08448a048959da2d2d9feec78a
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
second: second:
enabled: 0 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 1 enabled: 1
settings: settings:
DefaultValueInitialized: true DefaultValueInitialized: true
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More