| | |
| | | _window.Show(); |
| | | } |
| | | |
| | | private enum BuildNpcType |
| | | { |
| | | Npc, |
| | | Pet, |
| | | Horse |
| | | } |
| | | |
| | | private BuildNpcType m_NpcType; |
| | | |
| | | private bool m_GenerateNoExist = false; |
| | | private bool m_GenerateAnimationClip = false; |
| | | private bool m_GenerateController = false; |
| | |
| | | private int m_ModelResID; |
| | | private int m_NpcID; |
| | | private string m_ModelName; |
| | | private string m_BuildName; |
| | | |
| | | private NpcResourcesBuilder m_NpcResBuilder; |
| | | private ModelResourcesBuilder m_ModelResBuilder; |
| | |
| | | |
| | | EditorGUILayout.LabelField("# 生成Npc角色资源 #"); |
| | | |
| | | m_ModelName = EditorGUILayout.TextField("模型名称", m_ModelName); |
| | | |
| | | EditorGUILayout.BeginVertical(); |
| | | m_ModelName = EditorGUILayout.TextField("来源名", m_ModelName); |
| | | m_BuildName = EditorGUILayout.TextField("生成名", m_BuildName); |
| | | m_NpcType = (BuildNpcType)EditorGUILayout.EnumPopup("类型:", m_NpcType); |
| | | EditorGUILayout.EndVertical(); |
| | | EditorGUILayout.BeginHorizontal(); |
| | | m_GenerateNoExist = GUILayout.Toggle(m_GenerateNoExist, "只生成不存在的"); |
| | | m_GeneratePrefab = GUILayout.Toggle(m_GeneratePrefab, "Prefab"); |
| | |
| | | |
| | | if (GUILayout.Button("单独生成", GUILayout.Height(24))) |
| | | { |
| | | m_NpcResBuilder.BuildNpc(m_ModelName); |
| | | m_NpcResBuilder.BuildNpc(m_ModelName, m_BuildName, (int)m_NpcType); |
| | | } |
| | | |
| | | if (GUILayout.Button("生成所有", GUILayout.Height(24))) |
| | |
| | |
|
| | | public class NpcResourcesBuilder : ResourcesBuilder
|
| | | {
|
| | | public void BuildNpc(string modelName)
|
| | | public void BuildNpc(string modelName, string outName = null, int type = -1)
|
| | | {
|
| | | if (modelName.Contains("A_Zs"))
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | BuildAnimationClip1(modelName);
|
| | | BuildAnimatorController(modelName);
|
| | | BuildAnimatorController(modelName, outName, type);
|
| | |
|
| | | var showConfigs = Config.Instance.GetAllValues<ActorShowConfig>();
|
| | | NPCConfig _npcModel = null;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | BuildPrefab(modelName);
|
| | | BuildPrefab(modelName, outName);
|
| | | }
|
| | |
|
| | | public void BuildPrefab(string modelName)
|
| | | public void BuildPrefab(string modelName, string outName)
|
| | | {
|
| | | if (!IsBuildPrefab)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | BuildPrefab(modelName, modelName, InstanceResourcesLoader.raceSuffix);
|
| | | BuildPrefab(modelName, modelName, InstanceResourcesLoader.raceSuffix, outName);
|
| | | }
|
| | |
|
| | | public void BuildAnimationClip1(string modelName)
|
| | |
| | | BuildAnimationClip(modelName);
|
| | | }
|
| | |
|
| | | public void BuildAnimatorController(string modelName)
|
| | | public void BuildAnimatorController(string modelName, string outName = null, int type = -1)
|
| | | {
|
| | | if (!IsBuildAnimatorController)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (modelName.Contains("B_Cw"))
|
| | | if (type <= 0)
|
| | | {
|
| | | BuildAnimatorController(modelName, "Temple_AnimatorController_Pet", "animatorBuildConfig");
|
| | | BuildAnimatorController(modelName, "Temple_AnimatorController_Mob", "animatorBuildConfig", outName);
|
| | | }
|
| | | else
|
| | | else if (type == 1)
|
| | | {
|
| | | BuildAnimatorController(modelName, "Temple_AnimatorController_Mob", "animatorBuildConfig");
|
| | | BuildAnimatorController(modelName, "Temple_AnimatorController_Pet", "animatorBuildConfig", outName);
|
| | | }
|
| | | else if (type == 2)
|
| | | {
|
| | | BuildAnimatorController(modelName, "Temple_AnimatorController_Horse", "animatorBuildConfig", outName);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | protected static List<MountPointInfo> m_MountPointInfoList = new List<MountPointInfo>();
|
| | |
|
| | | public void BuildPrefab(string path, string resName, string suffix)
|
| | | public void BuildPrefab(string path, string resName, string suffix, string outName = null)
|
| | | {
|
| | | if (string.IsNullOrEmpty(outName))
|
| | | {
|
| | | outName = resName;
|
| | | }
|
| | |
|
| | | 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, resName);
|
| | | string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, 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 _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 (InstanceResourcesLoader.horseSuffix.Equals(suffix)
|
| | | || resName.Contains("B_Cw"))
|
| | | if (outName.StartsWith("M")
|
| | | || outName.StartsWith("N")
|
| | | || outName.StartsWith("B_")
|
| | | || outName.StartsWith("Zq"))
|
| | | {
|
| | | HandlerModelEffect("horseEffectConfig", null, resName, ref _prefab);
|
| | | HandlerModelEffect("horseEffectConfig", null, outName, ref _prefab);
|
| | | }
|
| | | else if (InstanceResourcesLoader.raceSuffix.Equals(suffix))
|
| | | {
|
| | |
| | | AssetDatabase.Refresh();
|
| | | }
|
| | |
|
| | | public static void BuildAnimatorController(string resName, string templeName, string configName)
|
| | | public static void BuildAnimatorController(string resName, string templeName, string configName, string outName = null)
|
| | | {
|
| | | if (string.IsNullOrEmpty(outName))
|
| | | {
|
| | | outName = resName;
|
| | | }
|
| | |
|
| | | string _absAssetPath = string.Format("{0}Mob/{1}", ResourcesPath.ResourcesOutPath, resName);
|
| | |
|
| | | if (!Directory.Exists(_absAssetPath))
|
| | |
| | | Directory.CreateDirectory(_absAssetPath);
|
| | | }
|
| | |
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerSuffix, resName);
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | |
|
| | | string _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerSuffix, resName);
|
| | | string _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | if (templeName.Equals("Temple_AnimatorController_BossShow"))
|
| | | {
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerShowSuffix, resName);
|