少年修仙传客户端基础资源
client_Wu Xijin
2019-02-14 54fad068f41ba7b0d2f16699a3f774be2a0d84e9
Assets/Editor/Actor/ActorEditor.cs
@@ -3,7 +3,8 @@
using System.Collections.Generic;
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 = NPCConfig.GetValues();
        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
@@ -42,7 +75,7 @@
    private void OnEnable()
    {
        Config.Instance.SyncLoadConfigs();
        ConfigInitiator.EditorLoad();
        m_NpcResBuilder = new NpcResourcesBuilder();
        m_ModelResBuilder = new ModelResourcesBuilder();
    }
@@ -79,23 +112,14 @@
            m_NpcResBuilder.BuildNpc(m_ModelName, m_BuildName, (int)m_NpcType, m_HighMesh);
        }
        // if (GUILayout.Button("生成所有", GUILayout.Height(24)))
        // {
        //     bool _result = EditorUtility.DisplayDialog("温馨提醒", "生成所有换装资源将会耗费比较长的时间, 请记得几点, 是否是需要生成所有的资源, 如果不是, 记得可以去掉不生成的资源,是不是不需要生成已经存在的资源, 如果不需要, 记得勾选[只生成不存在的]", "确认生成", "我按错了");
        //     if (_result)
        //     {
        //         var _dict = Config.Instance.GetAllValues<NPCConfig>();
        //         foreach (var _model in _dict)
        //         {
        //             if (string.IsNullOrEmpty(_model.MODE))
        //             {
        //                 continue;
        //             }
        //             m_NpcResBuilder.BuildNpc(_model.MODE);
        //         }
        //     }
        // }
        if (GUILayout.Button("按照给定的NPC配置信息生成"))
        {
            bool _result = EditorUtility.DisplayDialog("温馨提醒", "生成所有换装资源将会耗费比较长的时间, 请记得几点, 是否是需要生成所有的资源, 如果不是, 记得可以去掉不生成的资源,是不是不需要生成已经存在的资源, 如果不需要, 记得勾选[只生成不存在的]", "确认生成", "我按错了");
            if (_result)
            {
                BuildAllUIAnimatorController();
            }
        }
        GUILayout.Space(10);
@@ -111,7 +135,7 @@
        if (GUILayout.Button("所有翅膀", GUILayout.Height(24)))
        {
            var _dict = Config.Instance.GetAllValues<ModelResConfig>();
            var _dict = ModelResConfig.GetValues();
            foreach (var _item in _dict)
            {
                if (_item.Type == (int)E_ModelResType.Wing)
@@ -124,7 +148,7 @@
        if (GUILayout.Button("所有武器", GUILayout.Height(24)))
        {
            var _dict = Config.Instance.GetAllValues<ModelResConfig>();
            var _dict = ModelResConfig.GetValues();
            foreach (var _item in _dict)
            {
                if (_item.Type == (int)E_ModelResType.Weapon)
@@ -137,7 +161,7 @@
        if (GUILayout.Button("所有副手", GUILayout.Height(24)))
        {
            var _dict = Config.Instance.GetAllValues<ModelResConfig>();
            var _dict = ModelResConfig.GetValues();
            foreach (var _item in _dict)
            {
                if (_item.Type == (int)E_ModelResType.Secondary)
@@ -150,7 +174,7 @@
        if (GUILayout.Button("所有衣服", GUILayout.Height(24)))
        {
            var _dict = Config.Instance.GetAllValues<ModelResConfig>();
            var _dict = ModelResConfig.GetValues();
            foreach (var _item in _dict)
            {
                if (_item.Type == (int)E_ModelResType.Suit)
@@ -163,7 +187,7 @@
        if (GUILayout.Button("所有坐骑", GUILayout.Height(24)))
        {
            var _dict = Config.Instance.GetAllValues<ModelResConfig>();
            var _dict = ModelResConfig.GetValues();
            foreach (var _item in _dict)
            {
                if (_item.Type == (int)E_ModelResType.Horse)
@@ -178,7 +202,7 @@
            bool _result = EditorUtility.DisplayDialog("温馨提醒", "生成所有换装资源将会耗费比较长的时间, 请记得几点, 是否是需要生成所有的资源, 如果不是, 记得可以去掉不生成的资源,是不是不需要生成已经存在的资源, 如果不需要, 记得勾选[只生成不存在的]", "确认生成", "我按错了");
            if (_result)
            {
                var _dict = Config.Instance.GetAllValues<ModelResConfig>();
                var _dict = ModelResConfig.GetValues();
                foreach (var _item in _dict)
                {
                    m_ModelResBuilder.BuildModelRes(_item.ID, m_HighMesh);
@@ -191,6 +215,27 @@
        if (GUILayout.Button("重命名AssetBundle"))
        {
            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;
                }
                var _kv = _modeNames[i].Split('\t');
                m_NpcResBuilder.BuildNpc(_kv[0], _kv[1], int.Parse(_kv[2]), m_HighMesh);
            }
        }
    }
@@ -299,7 +344,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;
@@ -328,7 +373,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)
            {