コード例 #1
0
    //private bool hasGameFinished = false;
    //private bool gameWon = false;
    //private bool gameLost = false;



    // Use this for initialization
    void Start()
    {
        sD = GetComponent <StoryDisplay>();
        //Disable button on startup
        MasterUI.anchorMax = new Vector2(1, 2);
        MasterUI.anchorMin = new Vector2(0, 2);
        MasterUI.sizeDelta = new Vector2(500, 500);
    }
コード例 #2
0
 /**
  * Draws the numbered option to the screen.
  */
 protected abstract void DisplayOption(int optionNumber, int totalOptions, string text, Canvas canvas, StoryDisplay parser);
コード例 #3
0
 /**
  * Draws to the GUI based on the text in the story..
  */
 protected abstract void DisplayMoment(string text, Canvas canvas, StoryDisplay parser);
コード例 #4
0
    protected override void DisplayOption(int optionNumber, int totalOptions, string text, Canvas canvas, StoryDisplay parser)
    {
        //Create the new button from the prefab and configure position in regards to parent (button origin).
        Button newButton = UnityEngine.Object.Instantiate(buttonBase, Vector3.zero, Quaternion.identity, optionsOrigin);

        newButton.transform.localPosition = new Vector3(
            optionNumber * buttonRelativeDifferences.x - buttonRelativeDifferences.x * totalOptions / 2,
            optionNumber * buttonRelativeDifferences.y - buttonRelativeDifferences.y * totalOptions / 2,
            newButton.transform.localPosition.z //Don't change z.
            );


        //Configure button as an option button.
        newButton.GetComponentInChildren <Text>().text = text;
        newButton.onClick.AddListener(delegate() {
            Debug.Log("Selecting Option " + optionNumber);
            OnSelectOption(optionNumber);
        });
        newButton.name = text;
        optionButtons.Add(newButton);
    }
コード例 #5
0
 protected override void DisplayMoment(string text, Canvas canvas, StoryDisplay parser)
 {
     //Add the new text to the text on screen.
     textBeingDisplayed = textBeingDisplayed.Insert(textBeingDisplayed.Length, text);
     displayText.text   = textBeingDisplayed;
 }