少年修仙传客户端基础资源
client_Wu Xijin
2019-04-17 fe60e6d7f2660128d696ec613e2deb41daf27a73
6519 【工具】【2.0】删除无用KYE的工具
1个文件已修改
121 ■■■■■ 已修改文件
Assets/Editor/Tool/EffectAssetCheck.cs 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/EffectAssetCheck.cs
@@ -274,6 +274,9 @@
    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>>();
@@ -281,6 +284,8 @@
    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")]
@@ -311,6 +316,8 @@
        iconKeyRefrences = GetAllEffectKeyRefrences();
        csharpFileContents = GetAllCSharpFileContents();
        uieffects = GetEffectComponents();
        soSkills = GetSoSkills();
        newbieGuides = GetNewbieGuides();
        try
        {
@@ -338,6 +345,24 @@
                    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;
                    }
@@ -548,6 +573,54 @@
        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)
@@ -566,8 +639,10 @@
    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)
        {
@@ -577,6 +652,16 @@
            }
            if (Regex.IsMatch(content, pattern2))
            {
                return true;
            }
            if (Regex.IsMatch(content, pattern3))
            {
                return true;
            }
            if (Regex.IsMatch(content, pattern4))
            {
                return true;
            }
@@ -598,6 +683,38 @@
        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;