Пример #1
0
        private void ChangeVariableType(SkillVariable fsmVariable, VariableType newType)
        {
            if (!this.CheckDeleteVariable(Strings.get_Dialog_Edit_Variable_Type(), Strings.get_Dialog_Edit_Variable_Type_Are_you_sure(), fsmVariable))
            {
                return;
            }
            this.RegisterUndo(Strings.get_Label_Edit_Variable());
            string name            = fsmVariable.Name;
            string tooltip         = fsmVariable.Tooltip;
            string category        = fsmVariable.Category;
            bool   showInInspector = fsmVariable.ShowInInspector;

            if (this.fsmOwner != null)
            {
                SkillBuilder.RemoveVariableUsage(fsmVariable.NamedVar);
            }
            else
            {
                SkillSearch.UpdateAll();
                SkillBuilder.RemoveGlobalVariableUsage(fsmVariable.NamedVar);
            }
            SkillVariable.DeleteVariable(this.target, fsmVariable);
            SkillVariable fsmVariable2 = this.AddVariable(newType, name, false);

            fsmVariable2.Tooltip = tooltip;
            fsmVariable2.SetCategory(category);
            fsmVariable2.ShowInInspector = showInInspector;
            this.BuildFsmVariableList(true);
            this.SelectVariable(name);
        }
Пример #2
0
 public void DeleteVariable(SkillVariable fsmVariable, bool undo = true, bool checkDialog = true)
 {
     if (checkDialog && !this.CheckDeleteVariable(Strings.get_Dialog_Delete_Variable(), Strings.get_Dialog_Delete_Variable_Are_you_sure(), fsmVariable))
     {
         return;
     }
     if (undo)
     {
         this.RegisterUndo(Strings.get_Dialog_Delete_Variable());
     }
     if (!this.editingGlobalVariables)
     {
         SkillBuilder.RemoveVariableUsage(fsmVariable.NamedVar);
         SkillVariable.DeleteVariable(this.target, fsmVariable);
     }
     else
     {
         SkillBuilder.RemoveGlobalVariableUsage(fsmVariable.NamedVar);
         SkillVariable.DeleteVariable(SkillVariables.get_GlobalVariables(), fsmVariable);
     }
     this.listIsDirty = true;
     this.SetDirty(true);
     this.Reset();
 }