| | |
| | | private string m_ModelName; |
| | | private string m_BuildName; |
| | | |
| | | public bool m_HighMesh; |
| | | |
| | | private NpcResourcesBuilder m_NpcResBuilder; |
| | | private ModelResourcesBuilder m_ModelResBuilder; |
| | | |
| | |
| | | EditorGUILayout.BeginVertical(); |
| | | m_ModelName = EditorGUILayout.TextField("来源名", m_ModelName); |
| | | m_BuildName = EditorGUILayout.TextField("生成名", m_BuildName); |
| | | EditorGUILayout.BeginHorizontal(); |
| | | m_NpcType = (BuildNpcType)EditorGUILayout.EnumPopup("类型:", m_NpcType); |
| | | m_HighMesh = EditorGUILayout.ToggleLeft("高模", m_HighMesh); |
| | | EditorGUILayout.EndHorizontal(); |
| | | EditorGUILayout.EndVertical(); |
| | | EditorGUILayout.BeginHorizontal(); |
| | | m_GenerateNoExist = GUILayout.Toggle(m_GenerateNoExist, "只生成不存在的"); |
| | |
| | | |
| | | if (GUILayout.Button("单独生成", GUILayout.Height(24))) |
| | | { |
| | | m_NpcResBuilder.BuildNpc(m_ModelName, m_BuildName, (int)m_NpcType); |
| | | 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; |
| | | } |
| | | // 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); |
| | | } |
| | | } |
| | | } |
| | | // m_NpcResBuilder.BuildNpc(_model.MODE); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | GUILayout.Space(10); |
| | | |
| | |
| | | |
| | | if (GUILayout.Button("单独生成", GUILayout.Height(24))) |
| | | { |
| | | m_ModelResBuilder.BuildModelRes(m_ModelResID); |
| | | m_ModelResBuilder.BuildModelRes(m_ModelResID, m_HighMesh); |
| | | } |
| | | |
| | | if (GUILayout.Button("所有翅膀", GUILayout.Height(24))) |
| | |
| | | { |
| | | if (_item.Type == (int)E_ModelResType.Wing) |
| | | { |
| | | m_ModelResBuilder.BuildWing(_item.ID); |
| | | m_ModelResBuilder.BuildWing(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_item.Type == (int)E_ModelResType.Weapon) |
| | | { |
| | | m_ModelResBuilder.BuildWeapon(_item.ID); |
| | | m_ModelResBuilder.BuildWeapon(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_item.Type == (int)E_ModelResType.Secondary) |
| | | { |
| | | m_ModelResBuilder.BuildSecondary(_item.ID); |
| | | m_ModelResBuilder.BuildSecondary(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_item.Type == (int)E_ModelResType.Suit) |
| | | { |
| | | m_ModelResBuilder.BuildClothes(_item.ID); |
| | | m_ModelResBuilder.BuildClothes(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_item.Type == (int)E_ModelResType.Horse) |
| | | { |
| | | m_ModelResBuilder.BuildHorse(_item.ID); |
| | | m_ModelResBuilder.BuildHorse(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | var _dict = Config.Instance.GetAllValues<ModelResConfig>(); |
| | | foreach (var _item in _dict) |
| | | { |
| | | m_ModelResBuilder.BuildModelRes(_item.ID); |
| | | m_ModelResBuilder.BuildModelRes(_item.ID, m_HighMesh); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public class ModelResourcesBuilder : ResourcesBuilder |
| | | { |
| | | public void BuildModelRes(int id) |
| | | public void BuildModelRes(int id, bool isHighMesh = false) |
| | | { |
| | | ModelResConfig _modelRes = Config.Instance.Get<ModelResConfig>(id); |
| | | if (_modelRes == null) |
| | |
| | | switch ((E_ModelResType)_modelRes.Type) |
| | | { |
| | | case E_ModelResType.Suit: |
| | | BuildClothes(id); |
| | | BuildClothes(id, isHighMesh); |
| | | break; |
| | | case E_ModelResType.Wing: |
| | | BuildWing(id); |
| | | BuildWing(id, isHighMesh); |
| | | break; |
| | | case E_ModelResType.Weapon: |
| | | BuildWeapon(id); |
| | | BuildWeapon(id, isHighMesh); |
| | | break; |
| | | case E_ModelResType.Horse: |
| | | BuildHorse(id); |
| | | BuildHorse(id, isHighMesh); |
| | | break; |
| | | case E_ModelResType.Secondary: |
| | | BuildSecondary(id); |
| | | BuildSecondary(id, isHighMesh); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | public void BuildClothes(int id) |
| | | public void BuildClothes(int id, bool isHighMesh) |
| | | { |
| | | BuildAnimationClip(id); |
| | | BuildAnimatorController(id, "Temple_AnimatorController_Hero", "animatorBuildConfig"); |
| | | BuildPrefab(id, InstanceResourcesLoader.raceSuffix); |
| | | BuildPrefab(id, InstanceResourcesLoader.raceSuffix, isHighMesh); |
| | | } |
| | | |
| | | public void BuildWeapon(int id) |
| | | public void BuildWeapon(int id, bool isHighMesh) |
| | | { |
| | | BuildPrefab(id, InstanceResourcesLoader.weaponSuffix); |
| | | BuildPrefab(id, InstanceResourcesLoader.weaponSuffix, isHighMesh); |
| | | } |
| | | |
| | | public void BuildSecondary(int id) |
| | | public void BuildSecondary(int id, bool isHighMesh) |
| | | { |
| | | BuildPrefab(id, InstanceResourcesLoader.secondarySuffix); |
| | | BuildPrefab(id, InstanceResourcesLoader.secondarySuffix, isHighMesh); |
| | | } |
| | | |
| | | public void BuildHorse(int id) |
| | | public void BuildHorse(int id, bool isHighMesh) |
| | | { |
| | | BuildAnimationClip(id); |
| | | BuildAnimatorController(id, "Temple_AnimatorController_Horse", "animatorBuildConfig"); |
| | | BuildPrefab(id, InstanceResourcesLoader.horseSuffix); |
| | | BuildPrefab(id, InstanceResourcesLoader.horseSuffix, isHighMesh); |
| | | } |
| | | |
| | | public void BuildWing(int id) |
| | | public void BuildWing(int id, bool isHighMesh) |
| | | { |
| | | BuildAnimationClip(id); |
| | | BuildAnimatorController(id, "Temple_AnimatorController_Wing", "animatorBuildConfig_Wing"); |
| | | BuildPrefab(id, InstanceResourcesLoader.wingSuffix); |
| | | BuildPrefab(id, InstanceResourcesLoader.wingSuffix, isHighMesh); |
| | | } |
| | | |
| | | private void BuildPrefab(int id, string suffix) |
| | | private void BuildPrefab(int id, string suffix, bool isHighMesh = false) |
| | | { |
| | | if (!IsBuildPrefab) |
| | | { |
| | |
| | | _path = _path.Substring(0, _modelRes.ResourcesName.IndexOf('/')); |
| | | } |
| | | |
| | | BuildPrefab(_path, _resName, suffix); |
| | | BuildPrefab(_path, _resName, suffix, null, isHighMesh); |
| | | } |
| | | |
| | | public static void BuildAnimationClip(int id) |
| | |
| | |
|
| | | public class NpcResourcesBuilder : ResourcesBuilder
|
| | | {
|
| | | public void BuildNpc(string modelName, string outName = null, int type = -1)
|
| | | public void BuildNpc(string modelName, string outName = null, int type = -1, bool isHighMesh = false)
|
| | | {
|
| | | if (modelName.Contains("A_Zs"))
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | BuildPrefab(modelName, outName);
|
| | | BuildPrefab(modelName, outName, isHighMesh);
|
| | | }
|
| | |
|
| | | public void BuildPrefab(string modelName, string outName)
|
| | | public void BuildPrefab(string modelName, string outName, bool isHighMesh = false)
|
| | | {
|
| | | if (!IsBuildPrefab)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | BuildPrefab(modelName, modelName, InstanceResourcesLoader.raceSuffix, outName);
|
| | | BuildPrefab(modelName, modelName, InstanceResourcesLoader.raceSuffix, outName, isHighMesh);
|
| | | }
|
| | |
|
| | | public void BuildAnimationClip1(string modelName)
|
| | |
| | |
|
| | | protected static List<MountPointInfo> m_MountPointInfoList = new List<MountPointInfo>();
|
| | |
|
| | | public void BuildPrefab(string path, string resName, string suffix, string outName = null)
|
| | | public void BuildPrefab(string path, string resName, string suffix, string outName = null, bool isHighMesh = false)
|
| | | {
|
| | | if (string.IsNullOrEmpty(outName))
|
| | | {
|
| | |
| | | string _absOriginalePath = string.Format("{0}/ART/Role/{1}/{2}.FBX", Application.dataPath, path, resName);
|
| | | string _originalAssetPath = string.Format("Assets/ART/Role/{0}/{1}.FBX", path, resName);
|
| | |
|
| | | string _absAssetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, outName);
|
| | | string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, outName);
|
| | | string _tempPrefabName = outName;
|
| | | if (isHighMesh)
|
| | | {
|
| | | _tempPrefabName += "_UI";
|
| | | }
|
| | |
|
| | | string _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | string _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | string _absAssetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, _tempPrefabName);
|
| | | string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, _tempPrefabName);
|
| | |
|
| | | string _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, path);
|
| | | string _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, path);
|
| | | if (!outName.Equals(resName))
|
| | | {
|
| | | _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | }
|
| | |
|
| | | if (string.IsNullOrEmpty(_absOriginalePath))
|
| | | {
|
| | |
| | | // 指定动画控制器
|
| | | if (!File.Exists(_acAbsAssetPath))
|
| | | {
|
| | | Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", path);
|
| | | Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", _acAssetPath);
|
| | | }
|
| | |
|
| | | ColliderInfo _colliderInfo = null;
|