Esempio n. 1
0
        private void ModifyModelName()
        {
            var models = new List <string>(CfgManager.Model.Keys);

            models.Remove(ModelName);
            SimplePopupCreator.ShowDialog(new List <string>(models), (name) =>
            {
                _actorCfg.ModelName = name;

                ActorCfgWindow window = ActorCfgWindow.GetWindow <ActorCfgWindow>();
                OdinMenuItem item     = window.MenuTree.Selection.FirstOrDefault();
                item.Name             = name;
                item.SearchString     = name;
            });
        }
Esempio n. 2
0
        public void Delete()
        {
            if (EditorUtility.DisplayDialog("删除操作", "确定要删除文件 -> " + ModelName, "确定", "取消"))
            {
                if (File.Exists(_path))
                {
                    File.Delete(_path);
                }

                ActorCfgWindow window = ActorCfgWindow.GetWindow <ActorCfgWindow>();
                OdinMenuItem   item   = window.MenuTree.Selection.FirstOrDefault();
                if (item != null && item.Value != null)
                {
                    ActorConfigEditor model = item.Value as ActorConfigEditor;
                    HomeConfig.Instance.RemoveActor(model);
                    item.Parent.ChildMenuItems.Remove(item);
                    item.MenuTree.Selection.Clear();
                    item.Parent.Select();
                    item.MenuTree.UpdateMenuTree();
                    item.MenuTree.DrawMenuTree();
                }
            }
        }
Esempio n. 3
0
        public void LoadAll()
        {
            ClearAll();

            _config = ActionHomeConfig.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;
            }

            //--初始化资源
            SequenceRoot     = ActorHelper.CreateGameObject("---行为序列---");
            RuntimeAssetRoot = ActorHelper.CreateGameObject("---运行时资源---");

            CharacterDir = ActorHelper.CreateGameObject("Characters", "/---运行时资源---/");
            EffectDir    = ActorHelper.CreateGameObject("Effects", "/---运行时资源---/");
            OtherDir     = ActorHelper.CreateGameObject("Others", "/---运行时资源---/");

            //--加载行为配置
            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 ActorConfig()
                    {
                        ModelName = modelName
                    };
                    string savePath = string.Format("{0}/{1}.xml", ActionHomeConfig.Instance.ActionConfigPath, modelName);
                    var    actor    = new ActorConfigEditor(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 ActorConfigEditor(path);
                AddActor(actor);
            }
            foreach (var item in _modelDict)
            {
                item.Value.InitBaseModelAction();
            }

            var window = ActorCfgWindow.GetWindow <ActorCfgWindow>();

            window.RefreshTree();
            IsInit = true;
            Debug.Log("加载所有动作 完毕!");
        }