using System.Collections.Generic; using System.IO; using System.Text; using Framework; using Gameplay.UI.Common; using Gameplay.Unit.Data; using PhxhSDK.AOT; using PhxhSDK.AOT.Encrypt; using PhxhSDK.AOT.PreConfig; using UnityEditor; using UnityEngine; using UnityFS; public class TestCode: Editor { [MenuItem("Test/测试")] public static void Test5() { var checkPath = "Art/Grass01/FlowerGroup_2 (8)"; var findObj = GameObjectEx.FindEx(checkPath); DebugUtil.LogError("查找对象:" + checkPath + " 是否存在:" + (findObj != null)); } // [MenuItem("Test/测试")] public static void Test4() { var dataSkill = EditorTableManager.instance.tables.SkillConfig.DataList[0]; var cloneSkill = dataSkill.Clone(); cloneSkill.ReferIds.Add(100); DebugUtil.LogError("refer equal:" + (dataSkill == cloneSkill)); DebugUtil.LogError("技能ID:" + dataSkill.ID + " cloneSkillID:" + cloneSkill.ID); DebugUtil.LogError("referIds:" + dataSkill.ReferIds.Count + " cloneReferIds:" + cloneSkill.ReferIds.Count); } // [MenuItem("Test/测试")] public static void Test3() { var testList = new List(); for (int i = 0; i < 100; i++) { testList.Add(i); } var jsonStr = LitJson.JsonMapper.ToJson(testList); Debug.LogError(jsonStr); } // [MenuItem("Test/测试")] public static void Test2() { var encKey = "test lt enc key, this is just a test, please modify this by yourself"; var encBytes = Encoding.UTF8.GetBytes(encKey); var encStr = ""; for (int i = 0; i < encBytes.Length; i++) { encStr += "0X" + encBytes[i].ToString("X2") + ", "; } Debug.LogError(encStr); } // [MenuItem("Test/测试")] public static void Test() { var pathParent = "C:/Users/82158/Documents/WXWork/1688856871498430/Cache/File/2025-05"; var srcName = "defaultpackage_assets_hotupdatedlls_hotupdatedll.bundle"; var loadSrcBytes = File.ReadAllBytes(pathParent + "/" + srcName); var encryptBytes = new byte[loadSrcBytes.Length]; for (int i = 0; i < loadSrcBytes.Length; i++) { var loadByte = loadSrcBytes[i]; encryptBytes[i] = LTSimpleEncrypt.Change(loadByte, i); } // 把加密后的数据写入到一个新文件中 var saveName = "encrypt_" + srcName; var savePath = pathParent + "/" + saveName; File.WriteAllBytes(savePath, encryptBytes); var customFs = new CustomFileStream(savePath); var decryptBytes = new byte[loadSrcBytes.Length]; customFs.Read(decryptBytes, 0, decryptBytes.Length); for (int i = 0; i < encryptBytes.Length; i++) { var encryptByte = encryptBytes[i]; decryptBytes[i] = LTSimpleEncrypt.Change(encryptByte, i); } var isSame = true; for (int i = 0; i < loadSrcBytes.Length; i++) { var loadSrcByte = loadSrcBytes[i]; var decryptByte = decryptBytes[i]; if (loadSrcByte != decryptByte) { isSame = false; break; } } Debug.LogError("测试结果:" + isSame); } }