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); } } }
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("粘贴异常", "行为数据粘贴失败,或者无数据可张贴~~", "确定"); } }
private void PasteActions() { List <ModelActionEditor> paste = new List <ModelActionEditor>(); if (Clipboard.TryPaste(out paste)) { foreach (var item in paste) { if (item.IsSkillAction) { SkillActions.Add(item); } else { ModelActions.Add(item); } item.IsSelected = false; } Clipboard.Clear(); } else { EditorUtility.DisplayDialog("粘贴异常", "行为数据粘贴失败,或者无数据可张贴~~", "确定"); } }
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; } } }
public ModelActionConfigEditor(string path) { _path = path; _modelActionCfg = XmlUtil.Deserialize(path, typeof(ModelActionConfig)) as ModelActionConfig; foreach (var item in _modelActionCfg.ModelActionList) { var action = new ModelActionEditor(this, item, false); action.ActState = ModelActionEditor.ActionState.New; ModelActions.Add(action); } foreach (var item in _modelActionCfg.SkillActionList) { var action = new ModelActionEditor(this, item, true); action.ActState = ModelActionEditor.ActionState.New; SkillActions.Add(action); } }
private void AddBaseModelAction(string name) { var baseModel = HomeConfigPreview.Instance.GetModelEditor(name); var modelDict = GetModelActionDict(); foreach (var item in baseModel.ModelActions) { if (modelDict.ContainsKey(item.ActionName)) { modelDict[item.ActionName].ActState = modelDict[item.ActionName].Equals(item) ? ModelActionEditor.ActionState.Inherit : ModelActionEditor.ActionState.Override; } else { var action = new ModelActionEditor(item); action.ActState = ModelActionEditor.ActionState.Inherit; ModelActions.Add(action); } } var skillDict = GetModelActionDict(); foreach (var item in baseModel.SkillActions) { if (skillDict.ContainsKey(item.ActionName)) { skillDict[item.ActionName].ActState = skillDict[item.ActionName].Equals(item) ? ModelActionEditor.ActionState.Inherit : ModelActionEditor.ActionState.Override; } else { var action = new ModelActionEditor(item); action.ActState = ModelActionEditor.ActionState.Inherit; SkillActions.Add(action); } } }