Пример #1
0
 void Start()
 {
     currentState = State.MainMenu;
     menuCanvas.gameObject.SetActive(false);
     vnManager.gameObject.SetActive(false);
     gameplayUI = GameObject.Find("GameplayUI");
     gameplayUI.SetActive(false);
     credits.SetActive(false);
     cameraDirector.ChangeCamera("CameraMenu");
 }
Пример #2
0
    void RefreshView()
    {
        // Remove all the UI on screen
        RemoveChildren();

        // Read all the content until we can't continue any more
        if (story.canContinue)
        {
            string text;
            do
            {
                // Continue gets the next line of the story
                text = story.Continue();
                // This removes any white space from the text.
                text = text.Trim();
                if (text.StartsWith("CAMERA"))
                {                // If we're changing the camera
                    string cameraName = text.Substring(7);
                    Debug.Log("change camera to " + cameraName);
                    cameraDirector.ChangeCamera(cameraName);
                    text = "";                    // Skip this line
                }
                else if (text.StartsWith("ENTER"))
                {                // If a character is entering
                    string characterName = text.Substring(6);
                    Debug.Log("enter character " + characterName);
                    actingCoach.EnterCharacter(characterName);
                    text = "";                    // Skip this line
                }
                else if (text.StartsWith("EXIT"))
                {                // If a character is exiting
                    string characterName = text.Substring(5);
                    Debug.Log("enter character " + characterName);
                    actingCoach.ExitCharacter(characterName);
                    text = "";                    // Skip this line
                }
                else if (text.StartsWith("EXPRESSION"))
                {                // If a character is changing expression
                    string[] expressionSplit = text.Split(' ');
                    if (expressionSplit.Length == 3)
                    {
                        Debug.Log("expression " + expressionSplit[1] + " " + expressionSplit[2]);
                        actingCoach.CharacterChangeExpression(expressionSplit[1], expressionSplit[2]);
                    }
                    text = "";                    // Skip this line
                }
                else if (text.StartsWith("POSE"))
                {                // If a character is changing pose
                    string[] poseSplit = text.Split(' ');
                    if (poseSplit.Length == 3)
                    {
                        Debug.Log("pose " + poseSplit[1] + " " + poseSplit[2]);
                        actingCoach.CharacterChangePose(poseSplit[1], poseSplit[2]);
                    }
                    text = "";                    // Skip this line
                }
                else if (text.StartsWith("MAKE_TEA"))
                {
                    bbtManager.BubbleTea.Reset();
                    bbtManager.gameObject.SetActive(true);
                    gameplayUI.SetActive(true);
                    dialogueBox.SetActive(false);
                    cameraDirector.ChangeCamera("MakingCamera2");
                    this.gameObject.SetActive(false);
                    return;
                }
            }while (text.Length == 0 && story.canContinue);
            // Display the text on screen!
            if ((text.Length > 0))
            {
                dialogueBox.SetActive(true);
                CreateContentView(text);
                return;
            }
        }

        // Display all the choices, if there are any!
        if (story.currentChoices.Count > 0)
        {
            Debug.Log("Choices " + story.currentChoices.Count);
            for (int i = 0; i < story.currentChoices.Count; i++)
            {
                Choice choice = story.currentChoices[i];
                Button button = CreateChoiceView(choice.text.Trim());
                // Tell the button what to do when we press it
                button.onClick.AddListener(delegate {
                    OnClickChoiceButton(choice);
                });
            }
        }
        else
        {        // If we've read all the content and there's no choices, the story is finished!
            Button choice = CreateChoiceView("THE END");
            choice.onClick.AddListener(delegate
            {
                Debug.Log("End game");
                dialogueBox.SetActive(false);
                RemoveChildren();
                main.Credits();
            });
        }
    }