public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        StepObject myTarget = (StepObject)target;

        //get all the steps
        List <string> stepsName = new List <string>(Utility.getProgressionSteps().getSteps());

        stepsName.Add("Add new step");

        //display all the steps and let the player select one
        int tmpSelect = EditorGUILayout.Popup("Listened step", Utility.getProgressionSteps().getSteps().IndexOf(myTarget.getListenedStep()), stepsName.ToArray());

        //if "Add new step" is selected
        if (tmpSelect == stepsName.Count - 1)
        {
            AddStepWindow.showWindow();
        }
        else
        {
            //set the listenedStep depending on the selectedIndex
            myTarget.setListenedStep(Utility.getProgressionSteps().getSteps()[tmpSelect]);
            Undo.RegisterUndo(myTarget, "Change listened step");
        }
    }
    public static void showWindow()
    {
        // Get existing open window or if none, make a new one:
        AddStepWindow window = (AddStepWindow)EditorWindow.GetWindow(typeof(AddStepWindow));

        window.ShowPopup();
    }
Example #3
0
        private void AddStep()
        {
            var vm  = new AddStepViewModel(Recipe);
            var win = new AddStepWindow()
            {
                DataContext = vm
            };

            if (win.ShowDialog() ?? false)
            {
                Recipe.Steps.Add(vm.Step);
            }
        }
Example #4
0
        private void AddStep()
        {
            var vm  = new AddStepViewModel(SelectedRecipe);
            var win = new AddStepWindow()
            {
                DataContext = vm
            };

            if (win.ShowDialog() ?? false)
            {
                SelectedRecipe.Steps.Add(vm.Step);
                SqliteDBManager.Instance.SaveDBChanges();
            }
        }