Beispiel #1
0
    // Script to take in value indicating Yes button was clicked.
    public void SetYes()
    {
        // If the yes/no buttons are being used on a puzle completed screen.
        if (askingReplay)
        {
            // Hide the puzzle completion UI.
            ShowCompletion(false);

            //TODO fix this part.
            // Somewhere in here the references to each slider gets messed up.

            // reload the puzzle
            cubeMgr.InitializeSolution(cubeMgr.puzzleBeingSolved);

            // hide the puzzle selection menu after clicking the level button
            //cubeMgr.puzzleSelector.SetActive(!cubeMgr.puzzleSelector.activeSelf);

            // Get the name of the last puzzle that was run, and re-initialize it.
            return;
        }

        // If yes was clicked, save the puzzle anyway, overwriting the old version
        // then hide the input dialog and yes/no buttons.

        yesNoValue = 1;
        // Save the puzzle here, but now with having the yesNo value set to 1, so it will overwrite
        // the old puzzle solution with the same name.
        buildScript.MakePuzzle();
        ToggleYesNo();

        SetInputStatus(false);  // Allow the rest of the UI to be used again.
    }
    // Do the contained stuff when a string has stopped being edited in the inputField.
    public void EnhancedOnEndEdit(string text)
    {
        // Set the puzzleName string variable to be used in saving the puzzle solution
        builderScript.SetPuzzleName(text);
        // Attempt to save the puzzle
        int val = builderScript.MakePuzzle();

        // If the puzzle was saved (returned 0) then hide the inputField and cancel button.
        if (val == 0)
        {
            //gameObject.SetActive(false);
            uiScript.DisplayTextInputField(false);
            uiScript.SetInputStatus(false);
        }
        // If there was another file with the same name, display that will you overwrite text
        // and the yes/no buttons.
        else if (val == 1)
        {
            uiScript.DisplayTextInputField(false);
        }
    }