| | |
| | | static string uiroot2 = "Assets/ResourcesOut/UI/PriorityWindow"; |
| | | static string uiroot3 = "Assets/ResourcesOut/UI/Prefab"; |
| | | |
| | | static string soskillroot = "Assets/ResourcesOut/Refdata/ScriptableObject/SoSkill"; |
| | | static string newbieguideroot = "Assets/ResourcesOut/Refdata/ScriptableObject/SoNewBieGuide"; |
| | | |
| | | static int taskCount = 1; |
| | | static int completedTaskCount = 0; |
| | | static Dictionary<string, List<string>> iconKeyMap = new Dictionary<string, List<string>>(); |
| | |
| | | static List<UIEffect> uieffects = new List<UIEffect>(); |
| | | static List<Column> iconKeyRefrences = new List<Column>(); |
| | | static List<string> csharpFileContents = new List<string>(); |
| | | static List<NewBieGuideScriptableObject> newbieGuides = new List<NewBieGuideScriptableObject>(); |
| | | static List<SoSkill> soSkills = new List<SoSkill>(); |
| | | static List<AnalyzeTask> tasks = new List<AnalyzeTask>(); |
| | | |
| | | [MenuItem("程序/Effect Assets/移除无用的EffectKey")] |
| | |
| | | iconKeyRefrences = GetAllEffectKeyRefrences(); |
| | | csharpFileContents = GetAllCSharpFileContents(); |
| | | uieffects = GetEffectComponents(); |
| | | soSkills = GetSoSkills(); |
| | | newbieGuides = GetNewbieGuides(); |
| | | |
| | | try |
| | | { |
| | |
| | | var info = task.effectKeys[i]; |
| | | if (info.folder.ToLower() == "cj") |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (ContainBySoSkills(info.key, ref soSkills)) |
| | | { |
| | | Debug.LogFormat("找到一个被soskill依赖的 effect key:{0}", info.key); |
| | | continue; |
| | | } |
| | | |
| | | if (ContainByNewbieGuides(info.key, ref newbieGuides)) |
| | | { |
| | | Debug.LogFormat("找到一个被新手引导依赖的 effect key:{0}", info.key); |
| | | continue; |
| | | } |
| | | |
| | | if (ContainByPrefab(info.key, ref uieffects)) |
| | | { |
| | | Debug.LogFormat("找到一个被prefab依赖的 effect key:{0}", info.key); |
| | | continue; |
| | | } |
| | | |
| | |
| | | return uieffects; |
| | | } |
| | | |
| | | static List<SoSkill> GetSoSkills() |
| | | { |
| | | var guids = new List<string>(); |
| | | guids.AddRange(AssetDatabase.FindAssets("t:ScriptableObject", new string[] { soskillroot })); |
| | | |
| | | var assetPaths = new List<string>(); |
| | | foreach (var item in guids) |
| | | { |
| | | assetPaths.Add(AssetDatabase.GUIDToAssetPath(item)); |
| | | } |
| | | |
| | | var soskills = new List<SoSkill>(); |
| | | foreach ( var path in assetPaths) |
| | | { |
| | | var soskill = AssetDatabase.LoadAssetAtPath<SoSkill>(path); |
| | | if ( soskill!=null) |
| | | { |
| | | soskills.Add(soskill); |
| | | } |
| | | } |
| | | |
| | | return soskills; |
| | | } |
| | | |
| | | static List<NewBieGuideScriptableObject> GetNewbieGuides() |
| | | { |
| | | var guids = new List<string>(); |
| | | guids.AddRange(AssetDatabase.FindAssets("t:ScriptableObject", new string[] { newbieguideroot })); |
| | | |
| | | var assetPaths = new List<string>(); |
| | | foreach (var item in guids) |
| | | { |
| | | assetPaths.Add(AssetDatabase.GUIDToAssetPath(item)); |
| | | } |
| | | |
| | | var newbieguides = new List<NewBieGuideScriptableObject>(); |
| | | foreach (var path in assetPaths) |
| | | { |
| | | var so = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(path); |
| | | if (newbieguides != null) |
| | | { |
| | | newbieguides.Add(so); |
| | | } |
| | | } |
| | | |
| | | return newbieguides; |
| | | } |
| | | |
| | | static bool ContainByTables(string key, ref List<Column> columns) |
| | | { |
| | | foreach (var column in columns) |
| | |
| | | |
| | | static bool ContainByCSharpFile(string key, ref List<string> csharpContents) |
| | | { |
| | | var pattern1 = string.Format(@"SFXPlayUtility.Instance.PlayBattleEffect.*{0}.*\);", key); |
| | | var pattern2 = string.Format(@"SFXPlayUtility.Instance.PlayEffectAsync.*{0}.*\);", key); |
| | | var pattern1 = string.Format(@"SFXPlayUtility.Instance.PlayBattleEffect.*{0}", key); |
| | | var pattern2 = string.Format(@"SFXPlayUtility.Instance.PlayEffectAsync.*{0}", key); |
| | | var pattern3 = string.Format(@"SFXPlayUtility.Instance.PlayWithEulerAngle.*{0}", key); |
| | | var pattern4 = string.Format(@"SFXPlayUtility.Instance.Play.*{0}", key); |
| | | |
| | | foreach (var content in csharpContents) |
| | | { |
| | |
| | | } |
| | | |
| | | if (Regex.IsMatch(content, pattern2)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (Regex.IsMatch(content, pattern3)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (Regex.IsMatch(content, pattern4)) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | static bool ContainBySoSkills(string key, ref List<SoSkill> soSkills) |
| | | { |
| | | foreach (var soskill in soSkills) |
| | | { |
| | | foreach (var frameEvent in soskill.animationEventList) |
| | | { |
| | | if (frameEvent.frameEventType == E_FrameEventType.OnPlayEffect) |
| | | { |
| | | if (frameEvent.intParam.ToString() == key) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | static bool ContainByNewbieGuides(string key, ref List<NewBieGuideScriptableObject> newbieGuides) |
| | | { |
| | | foreach (var newbieGuide in newbieGuides) |
| | | { |
| | | if (newbieGuide.effect2.ToString() == key) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | static void OnUpdate() |
| | | { |
| | | var done = true; |