Example #1
0
    // Event handling. Add buttons, their shapes and what they do
    void DoMyWindow(int windowID)
    {
        GUI.Label(new Rect((Screen.width / 2) - 250, 50, 500, 300), Text); // DISplay the title as a label
        // Specify button. First dimensions and then text
        if (GUI.Button(new Rect((Screen.width / 2) - 250, 175, 500, 50), options[0]))
        {
            Time.timeScale = 1;     // Enable rendering
            triggered      = false; // Set to untriggered state
            // Clear text and options
            Text    = "";
            options = new List <string>();
            // Set prompt id for following promt in addition to current task and current condition
            followingPromptId = optionId[0];
            currentTask       = task[0];
            currentCondition  = condition[0];
            // reset for next prompt fetch
            optionId  = new List <string>();
            task      = new List <string>();
            condition = new List <string>();
            // callback for sending the current task and condition to ValueContainer
            cont.SetTaskAndCond(currentTask, currentCondition);
        }
        else if (GUI.Button(new Rect((Screen.width / 2) - 250, 300, 500, 50), options[1]))
        {
            Time.timeScale = 1;
            triggered      = false;

            followingPromptId = optionId[1];
            currentTask       = task[1];
            currentCondition  = condition[1];

            Text      = "";
            options   = new List <string>();
            optionId  = new List <string>();
            task      = new List <string>();
            condition = new List <string>();
            cont.SetTaskAndCond(currentTask, currentCondition);
        }
    }