Beispiel #1
0
        private void PasteActions()
        {
            var generalDict           = GetGeneralActionDict();
            var skillDict             = GetSkillActionDict();
            List <ActionEditor> paste = new List <ActionEditor>();

            if (Clipboard.TryPaste(out paste))
            {
                foreach (var item in paste)
                {
                    if (skillDict.ContainsKey(item.ActionName) ||
                        generalDict.ContainsKey(item.ActionName))
                    {
                        Debug.LogFormat("<color=orange>[粘贴行为]{0} 行为重复!</color>", item.ActionName);
                        continue;
                    }

                    if (item.IsSkillAction)
                    {
                        SkillActions.Add(item);
                    }
                    else
                    {
                        GeneralActions.Add(item);
                    }
                    item.ResetActorEditor(this);
                    item.IsSelected = false;
                }
            }
            else
            {
                EditorUtility.DisplayDialog("粘贴异常", "行为数据粘贴失败,或者无数据可张贴~~", "确定");
            }
        }
Beispiel #2
0
 public ActorEditor(string path, XmlCfg.Skill.ActorConfig cfg = null)
 {
     _path     = path;
     _actorCfg = cfg != null ? cfg : new XmlCfg.Skill.ActorConfig();
     if (File.Exists(path))
     {
         _actorCfg.LoadAConfig(path);
     }
     if (CfgManager.Model.ContainsKey(_actorCfg.ModelName))
     {
         _model = CfgManager.Model[_actorCfg.ModelName];
     }
     if (_actorCfg != null)
     {
         foreach (var item in _actorCfg.GeneralActions)
         {
             var action = new ActionEditor(this, item.Value, false);
             action.ActState = ActionEditor.ActionState.New;
             GeneralActions.Add(action);
         }
         foreach (var item in _actorCfg.SkillActions)
         {
             var action = new ActionEditor(this, item.Value, true);
             action.ActState = ActionEditor.ActionState.New;
             SkillActions.Add(action);
         }
     }
 }
Beispiel #3
0
        void RemoveAllBaseAction()
        {
            var array = GeneralActions.ToArray();

            GeneralActions.Clear();
            foreach (var item in array)
            {
                switch (item.ActState)
                {
                case ActionEditor.ActionState.New:
                    GeneralActions.Add(item);
                    break;

                case ActionEditor.ActionState.Inherit:
                    break;

                case ActionEditor.ActionState.Override:
                    item.ActState = ActionEditor.ActionState.New;
                    GeneralActions.Add(item);
                    break;

                default:
                    break;
                }
            }
            array = SkillActions.ToArray();
            SkillActions.Clear();
            foreach (var item in array)
            {
                switch (item.ActState)
                {
                case ActionEditor.ActionState.New:
                    SkillActions.Add(item);
                    break;

                case ActionEditor.ActionState.Inherit:
                    break;

                case ActionEditor.ActionState.Override:
                    item.ActState = ActionEditor.ActionState.New;
                    SkillActions.Add(item);
                    break;

                default:
                    break;
                }
            }
        }