예제 #1
0
        private void MoveToGlobals(object userdata)
        {
            SkillVariable fsmVariable = userdata as SkillVariable;

            if (fsmVariable != null && fsmVariable.NamedVar != null)
            {
                if (SkillVariables.get_GlobalVariables().Contains(fsmVariable.Name))
                {
                    NamedVariable variable = SkillVariables.get_GlobalVariables().GetVariable(fsmVariable.Name);
                    if (variable.get_VariableType() != fsmVariable.NamedVar.get_VariableType())
                    {
                        Dialogs.OkDialog(Strings.get_Dialog_Make_Global_Variable(), Strings.get_VariableManager_MoveToGlobals_Warning());
                        return;
                    }
                    if (Dialogs.YesNoDialog(Strings.get_Dialog_Make_Global_Variable(), Strings.get_VariableManager_MoveToGlobals_Confirm()))
                    {
                        this.RemoveLocalVariable(fsmVariable);
                        return;
                    }
                }
                else
                {
                    if (Dialogs.AreYouSure(Strings.get_Dialog_Make_Global_Variable()))
                    {
                        SkillVariable.AddVariable(SkillVariables.get_GlobalVariables(), fsmVariable.NamedVar.Clone());
                        this.RemoveLocalVariable(fsmVariable);
                    }
                }
            }
        }
예제 #2
0
        public static void DeleteSelectedState()
        {
            if (!Dialogs.AreYouSure(Strings.get_Command_Delete_State()))
            {
                return;
            }
            SkillState selectedState = SkillEditor.SelectedState;

            SkillEditor.Selection.RemoveState(selectedState);
            SkillEditor.RegisterUndo(Strings.get_Command_Delete_State());
            SkillEditor.Builder.DeleteState(selectedState);
            SkillEditor.GraphView.UpdateGraphSize();
            SkillEditor.UpdateActionUsage();
            SkillEditor.UpdateFsmInfo();
            SkillEditor.SetFsmDirty(true, false);
            SkillEditor.Selection.SelectState(null, false, false);
        }
예제 #3
0
        private void DeleteTemplate(object userdata)
        {
            if (!Dialogs.AreYouSure(Strings.get_Dialog_Delete_Template(), Strings.get_Label_You_cannot_undo_this_action()))
            {
                return;
            }
            SkillTemplate fsmTemplate = userdata as SkillTemplate;

            if (fsmTemplate != null)
            {
                if (SkillEditor.SelectedTemplate == fsmTemplate)
                {
                    SkillEditor.Instance.OnSelectionChange();
                }
                string assetPath = AssetDatabase.GetAssetPath(fsmTemplate);
                AssetDatabase.DeleteAsset(assetPath);
            }
        }
예제 #4
0
 private void RenameEvent(SkillEvent fsmEvent, string newName)
 {
     if (fsmEvent == null)
     {
         return;
     }
     if (fsmEvent.get_IsGlobal())
     {
         if (Dialogs.AreYouSure(Strings.get_Dialog_Rename_Event(), Strings.get_Dialog_Rename_Event_Are_you_sure()))
         {
             SkillEditor.Builder.RenameEvent(fsmEvent.get_Name(), newName);
         }
     }
     else
     {
         SkillEditor.Builder.RenameEvent(SkillEditor.SelectedFsm, fsmEvent.get_Name(), newName);
     }
     SkillEditor.SelectedFsm.set_Events(ArrayUtility.Sort <SkillEvent>(SkillEditor.SelectedFsm.get_Events()));
     this.Reset();
 }
예제 #5
0
 public static bool AreYouSure(string title)
 {
     return(Dialogs.AreYouSure(title, Strings.get_Dialog_Are_you_sure()));
 }