Example #1
0
    private void DrawRearrangeButtons()
    {
        if (GUILayout.Button("Move Level Up", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
        {
            LevelDataEditor.MoveLevelUp(currentBoard.levelID);
        }

        if (GUILayout.Button("Move Level Down", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
        {
            LevelDataEditor.MoveLevelDown(currentBoard.levelID);
        }
    }
Example #2
0
    private void DrawMenu()
    {
        GUILayout.BeginArea(new Rect(50, 50, 200, 500));

        //rows
        GUILayout.Label("Rows");
        rows = GUILayout.TextField(rows, 2);
        GUILayout.Space(50);

        //columns
        GUILayout.Label("Columns");
        columns = GUILayout.TextField(columns, 2);
        GUILayout.Space(50);

        //id
        GUILayout.Label("Level #");
        levelID = GUILayout.TextField(levelID, 5);
        GUILayout.Space(50);

        //Level name
        GUILayout.Label("Level Name (Optional)");
        LevelName = GUILayout.TextField(LevelName);
        GUILayout.Space(50);

        //Create level button
        if (GUILayout.Button("Create Level"))
        {
            int intRows    = 0;
            int intColumns = 0;
            int intLevelID = 0;
            int.TryParse(rows, out intRows);
            int.TryParse(columns, out intColumns);
            int.TryParse(levelID, out intLevelID);

            if (intRows > 0 && intColumns > 0 && intLevelID > 0)
            {
                LevelDataEditor.AddLevel(intRows, intColumns, intLevelID, LevelName);
            }

            window.Close();
        }

        GUILayout.EndArea();
    }
Example #3
0
    private void DrawDeleteLevelButton()
    {
        if (GUILayout.Button("Delete Level", GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
        {
            if (currentBoard != null)
            {
                bool dialogResponse = EditorUtility.DisplayDialog("Delete Level?" + currentBoard.levelID,
                                                                  "Are you sure you want to delete the current level? Level: " + currentBoard.levelID + "",
                                                                  "Delete Level", "Cancel");

                if (dialogResponse)
                {
                    LevelDataEditor.DeleteLevel(currentBoard.levelID);

                    //Clear the window to remove the board editing interface for deleted board
                    currentBoard = null;
                    window.Repaint();
                }
            }
        }
    }