/// <summary>
 /// Makes the currently selected scene the first screen after each group of the game.
 /// </summary>
 private void ChangeToWorkflowAction(SMWorkflowActionType action)
 {
     BeforeChange("Change action after group");
     SMGroupedSceneConfigurationOperation.Build(Target).ActionAfterGroup(action).Apply(Target);
     SyncBuildSettingsIfRequired();
     EditorUtility.SetDirty(Target);
 }
 public SMGroupedSceneConfigurationOperation ActionAfterGroup(SMWorkflowActionType actionAfterGroup)
 {
     this.actionAfterGroup = actionAfterGroup;
     return(this);
 }
    /// <summary>
    /// Draws the list of scenes in the inspector GUI.
    /// </summary>
    protected void SceneGUI()
    {
        SMWorkflowActionType action = (SMWorkflowActionType)EditorGUILayout.EnumPopup(new GUIContent("Action after Group", ""), Target.actionAfterGroup);

        if (action != Target.actionAfterGroup)
        {
            ChangeToWorkflowAction(action);
        }
        GUILayout.Space(5);

        sceneListHeight = CUResizableContainer.BeginVertical(sceneListHeight);
        sceneListData   = CUListControl.SelectionList(sceneListData, scenes, sceneRenderer, "Available Scenes");
        CUResizableContainer.EndVertical();

        GUI.enabled = !sceneListData.Empty && SelectedGroup != null;
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Level"))
        {
            ChangeToLevel();
        }
        GUI.enabled = !sceneListData.Empty;
        if (GUILayout.Button("Screen"))
        {
            ChangeToScreen();
        }
        if (GUILayout.Button("Ignore"))
        {
            ChangeToIgnore();
        }
        EditorGUILayout.EndHorizontal();

        GUI.enabled = !sceneListData.Empty && IsScreen(scenes[sceneListData.First]);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("First Screen"))
        {
            ChangeToFirstScreen();
        }
        if (GUILayout.Button("After last Level"))
        {
            ChangeToFirstScreenAfterLevel();
        }

        GUI.enabled = GUI.enabled && Target.actionAfterGroup == SMWorkflowActionType.LoadScreen;
        if (GUILayout.Button("After Group"))
        {
            ChangeToFirstScreenAfterGroup();
        }

        EditorGUILayout.EndHorizontal();
        GUI.enabled = true;
        EditorGUILayout.Space();

        levelListHeight = CUResizableContainer.BeginVertical(levelListHeight);
        EditorGUILayout.BeginHorizontal();
        groupListWidth = CUResizableContainer.BeginHorizontal(groupListWidth);
        int lastGroup = groupListData.First;

        groupListData = CUListControl.SelectionList(groupListData, Target.groups, levelRenderer, "Groups");
        if (lastGroup != groupListData.First)
        {
            // group changed reset level selection
            levelListData.ClearSelection();
        }

        CUResizableContainer.EndHorizontal();
        GUI.enabled   = SelectedGroup != null;
        levelListData = CUListControl.SelectionList(levelListData, currentGroupLevels, levelRenderer, "Levels");
        GUI.enabled   = true;
        EditorGUILayout.EndHorizontal();
        CUResizableContainer.EndVertical();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("+"))
        {
            AddGroup();
        }
        GUI.enabled = !groupListData.Empty && Target.groups.Length > 1;
        if (GUILayout.Button("-"))
        {
            RemoveGroup();
        }
        GUI.enabled = !groupListData.Empty;
        if (GUILayout.Button("Rename"))
        {
            RenameGroup();
        }
        GUI.enabled = true;
        GUILayout.FlexibleSpace();
        GUI.enabled = !levelListData.Empty;
        if (GUILayout.Button("First"))
        {
            MoveToFirst();
        }
        if (GUILayout.Button("Up"))
        {
            MoveUp();
        }
        if (GUILayout.Button("Down"))
        {
            MoveDown();
        }
        if (GUILayout.Button("Last"))
        {
            MoveToLast();
        }
        GUI.enabled = true;
        EditorGUILayout.EndHorizontal();
    }