From 61b861e120ff49d08d6e446910ebb3c103e5de94 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期六, 13 十月 2018 14:53:04 +0800
Subject: [PATCH] 3270 【开发】主干:模型生成工具, 增加按照配置生成的逻辑

---
 Assets/Editor/Config/ui_ac_config.txt      |    2 +
 Assets/Editor/Config/ui_ac_config.txt.meta |    8 ++++
 Assets/Editor/Actor/NpcResourcesBuilder.cs |    4 ++
 Assets/Editor/Actor/ActorEditor.cs         |   91 ++++++++++++++++++++++++++++-----------------
 4 files changed, 71 insertions(+), 34 deletions(-)

diff --git a/Assets/Editor/Actor/ActorEditor.cs b/Assets/Editor/Actor/ActorEditor.cs
index dff54de..edaa19a 100644
--- a/Assets/Editor/Actor/ActorEditor.cs
+++ b/Assets/Editor/Actor/ActorEditor.cs
@@ -4,6 +4,7 @@
 using UnityEditor;
 using UnityEditor.Animations;
 using TableConfig;
+using System;
 
 public class ActorEditor : EditorWindow
 {
@@ -13,6 +14,38 @@
     {
         EditorWindow _window = CreateInstance<ActorEditor>();
         _window.Show();
+    }
+
+    [MenuItem("绋嬪簭/瑙掕壊鐩稿叧/鍗歌浇NPC鍔ㄧ敾鐘舵�佹満")]
+    static void RemoveAnimator()
+    {
+        var _dict = Config.Instance.GetAllValues<NPCConfig>();
+        int i = 0;
+        foreach (var _model in _dict)
+        {
+            if (_model.NPCType != 0
+             && _model.NPCType != 2
+             && _model.NPCType != 3
+             && _model.NPCType != 4
+             && _model.NPCType != 5
+             && _model.NPCType != 8
+             && _model.NPCType != 9
+             && _model.NPCType != 14
+             && _model.NPCType != 16
+             && _model.NPCType != 17
+             && _model.NPCType != 18
+             && _model.NPCType != 19)
+            {
+                continue;
+            }
+
+            if (string.IsNullOrEmpty(_model.MODE))
+            {
+                continue;
+            }
+
+
+        }
     }
 
     private enum BuildNpcType
@@ -79,42 +112,12 @@
             m_NpcResBuilder.BuildNpc(m_ModelName, m_BuildName, (int)m_NpcType, m_HighMesh);
         }
 
-        if (GUILayout.Button("鐢熸垚鎵�鏈�", GUILayout.Height(24)))
+        if (GUILayout.Button("鎸夌収缁欏畾鐨凬PC閰嶇疆淇℃伅鐢熸垚"))
         {
             bool _result = EditorUtility.DisplayDialog("娓╅Θ鎻愰啋", "鐢熸垚鎵�鏈夋崲瑁呰祫婧愬皢浼氳�楄垂姣旇緝闀跨殑鏃堕棿, 璇疯寰楀嚑鐐�, 鏄惁鏄渶瑕佺敓鎴愭墍鏈夌殑璧勬簮, 濡傛灉涓嶆槸, 璁板緱鍙互鍘绘帀涓嶇敓鎴愮殑璧勬簮,鏄笉鏄笉闇�瑕佺敓鎴愬凡缁忓瓨鍦ㄧ殑璧勬簮, 濡傛灉涓嶉渶瑕�, 璁板緱鍕鹃�塠鍙敓鎴愪笉瀛樺湪鐨刔", "纭鐢熸垚", "鎴戞寜閿欎簡");
             if (_result)
             {
-                var _dict = Config.Instance.GetAllValues<NPCConfig>();
-                int i = 0;
-                foreach (var _model in _dict)
-                {
-                    if (_model.NPCType != 0
-                     && _model.NPCType != 2
-                     && _model.NPCType != 3
-                     && _model.NPCType != 4
-                     && _model.NPCType != 5
-                     && _model.NPCType != 8
-                     && _model.NPCType != 9
-                     && _model.NPCType != 14
-                     && _model.NPCType != 16
-                     && _model.NPCType != 17
-                     && _model.NPCType != 18
-                     && _model.NPCType != 19)
-                    {
-                        continue;
-                    }
-
-                    if (string.IsNullOrEmpty(_model.MODE))
-                    {
-                        continue;
-                    }
-
-                    m_NpcResBuilder.BuildNpc(_model.MODE, m_BuildName, (int)m_NpcType, m_HighMesh);
-                    // if (i++ > 3)
-                    // {
-                    //     break;
-                    // }
-                }
+                BuildAllUIAnimatorController();
             }
         }
 
@@ -212,6 +215,26 @@
         if (GUILayout.Button("閲嶅懡鍚岮ssetBundle"))
         {
             ReAssetBundleName();
+        }
+    }
+
+    private void BuildAllUIAnimatorController()
+    {
+        string _configPath = EditorUtility.OpenFilePanel("閫夋嫨閰嶇疆鏂囦欢", Application.dataPath + "/Editor/Config", "txt");
+        if (!string.IsNullOrEmpty(_configPath))
+        {
+            string[] _modeNames = File.ReadAllLines(_configPath);
+            for (int i = 0; i < _modeNames.Length; ++i)
+            {
+                _modeNames[i] = _modeNames[i].Trim();
+
+                if (string.IsNullOrEmpty(_modeNames[i]))
+                {
+                    continue;
+                }
+
+                m_NpcResBuilder.BuildNpc(_modeNames[i], null, (int)m_NpcType, m_HighMesh);
+            }
         }
     }
 
@@ -320,7 +343,7 @@
     static void ExportAnimationClips()
     {
 
-        Object[] _selectObjects = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
+        UnityEngine.Object[] _selectObjects = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
         if (_selectObjects == null || _selectObjects.Length == 0)
         {
             return;
@@ -349,7 +372,7 @@
             string _assetPath = string.Empty;
             string _newAssetPath = string.Empty;
             string _assetName = string.Empty;
-            Object _clip = null;
+            UnityEngine.Object _clip = null;
             int _index = 0;
             foreach (var _object in _selectObjects)
             {
diff --git a/Assets/Editor/Actor/NpcResourcesBuilder.cs b/Assets/Editor/Actor/NpcResourcesBuilder.cs
index d83cc9c..2d86f3a 100644
--- a/Assets/Editor/Actor/NpcResourcesBuilder.cs
+++ b/Assets/Editor/Actor/NpcResourcesBuilder.cs
@@ -21,6 +21,10 @@
         {
             for (int i = 0; i < _item.showNpcs.Length; i++)
             {
+                if(_item.showNpcs[i] == 0)
+                {
+                    continue;
+                }
                 _npcModel = Config.Instance.Get<NPCConfig>(_item.showNpcs[i]);
                 if (_npcModel == null)
                 {
diff --git a/Assets/Editor/Config/ui_ac_config.txt b/Assets/Editor/Config/ui_ac_config.txt
new file mode 100644
index 0000000..2040912
--- /dev/null
+++ b/Assets/Editor/Config/ui_ac_config.txt
@@ -0,0 +1,2 @@
+M033
+M034
diff --git a/Assets/Editor/Config/ui_ac_config.txt.meta b/Assets/Editor/Config/ui_ac_config.txt.meta
new file mode 100644
index 0000000..b76e42f
--- /dev/null
+++ b/Assets/Editor/Config/ui_ac_config.txt.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a4ececb82ae06a3459d07ab42758226f
+timeCreated: 1539412448
+licenseType: Free
+TextScriptImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

--
Gitblit v1.8.0