| | |
| | | using UnityEditor; |
| | | using UnityEditor.Animations; |
| | | using TableConfig; |
| | | using System; |
| | | |
| | | public class ActorEditor : EditorWindow |
| | | { |
| | |
| | | { |
| | | 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 |
| | |
| | | m_NpcResBuilder.BuildNpc(m_ModelName, m_BuildName, (int)m_NpcType, m_HighMesh); |
| | | } |
| | | |
| | | if (GUILayout.Button("生成所有", GUILayout.Height(24))) |
| | | if (GUILayout.Button("按照给定的NPC配置信息生成")) |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | m_NpcResBuilder.BuildNpc(_modeNames[i], null, (int)m_NpcType, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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) |
| | | { |