private static void Open() { var window = GetWindow <ActorEditorWindow>("模型配置窗口"); window.position = GUIHelper.GetEditorWindowRect().AlignCenter(800, 500); window.minSize = new Vector2(400, 500); ActorConfig.LoadInstanceIfAssetExists(); HomeConfig.Instance.LoadAll(); }
public void LoadAll() { ClearAll(); _config = ActorConfig.Instance; CfgManager.ConfigDir = ConfigDir; CfgManager.LoadAll(); //--初始化资源路径 EUtil.GetAssetsInSubFolderRecursively(_config.CharacterRelativeDir, "*.prefab", ref AllCharacters); EUtil.GetAssetsInSubFolderRecursively(_config.AvatarRelativeDir, "*.prefab", ref AllAvatars); EUtil.GetAssetsInSubFolderRecursively(_config.EffectRelativeDir, "*.prefab", ref AllEffects); foreach (var item in AllCharacters) { string searchDir = item.Value.Substring(0, item.Value.LastIndexOf(@"/prefab")) + "/clips"; var selfClips = new Dictionary <string, string>(); EUtil.GetAssetsInSubFolderRecursively(searchDir, "*.anim", ref selfClips); AllCharacterClips[item.Key] = selfClips; } //--加载行为配置 foreach (var model in CfgManager.Model) { var modelName = model.Key; string path = string.Format("{0}/{1}.xml", ActionConfigPath, modelName); if (!File.Exists(path)) { var config = new XmlCfg.Skill.ActorConfig() { ModelName = modelName }; string savePath = string.Format("{0}/{1}.xml", ActorConfig.Instance.ActionConfigPath, modelName); var actor = new ActorEditor(savePath, config); actor.Save(true); Debug.LogFormat("<color=orange>新建Actor - {0}</color>", modelName); } } string[] files = Directory.GetFiles(ActionConfigPath, "*.xml", SearchOption.TopDirectoryOnly); foreach (var path in files) { var actor = new ActorEditor(path); AddActor(actor); } foreach (var item in _modelDict) { item.Value.InitBaseModelAction(); } var window = ActorEditorWindow.GetWindow <ActorEditorWindow>(); window.RefreshTree(); IsInit = true; Debug.Log("加载所有动作 完毕!"); }