Exemplo n.º 1
0
 /// <summary>
 /// Begins a dialogue stream.
 /// </summary>
 /// <param name="i">The scene index for dialogue.</param>
 private void BeginText(int i)
 {
     GameManager.PauseEvent();
     dParser.LoadDialogue(i);
     ClearTexts();
     ClearPortraits();
     textOverlay.SelfFadeIn();
     StartCoroutine(RunDialogue());
 }
Exemplo n.º 2
0
 private void Start()
 {
     AssignViewEvents();
     mainMenu.Hide();
     mainMenu.SelfFadeIn();
     waves.amplitude = 15;
     waves.frequency = 15;
     waves.gameObject.SetActive(false);
     ObjectPooler.instance.DisableAllTagged("WaveBar");
 }
Exemplo n.º 3
0
 private void BeginText(int i)
 {
     GameManager.Pausing();
     pauseButton.gameObject.SetActive(false);
     textOverlay.SelfFadeIn();
     Camera.main.GetComponent <BlurOptimized>().enabled = true;
     sempaiText.ClearText();
     kidText.ClearText();
     StartCoroutine(dialogues[i]());
 }
Exemplo n.º 4
0
 /// <summary>
 /// Used when the game pauses.
 /// </summary>
 private void Pause()
 {
     if (Time.timeScale == 0.0f)
     {
         overlay.SelfFadeIn();
     }
     else
     {
         overlay.SelfFadeOut();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Begins a dialogue stream.
 /// </summary>
 /// <param name="i">The scene index for dialogue.</param>
 /// <param name="c">The number of conversations left for this character.</param>
 /// <param name="b">Whether or not there is available dialogue.</param>
 private void BeginText(int i, bool b, Character ch, bool trust = true)
 {
     trustUIActive = trust;
     GameManager.PauseEvent();
     Pause();
     ClearTexts();
     ClearPortraits();
     ClearTrustUI();
     textOverlay.SelfFadeIn();
     StartCoroutine(RunDialogue(i, !b, ch));
 }
Exemplo n.º 6
0
    /// <summary>
    /// Runs the dialogue for the scene loaded in the dialogue parser.
    /// </summary>
    private IEnumerator RunDialogue()
    {
        Dictionary <Character, Expression> lastExpression = new Dictionary <Character, Expression>();

        for (int i = 0; i < dParser.Lines.Count; ++i)
        {
            DialogueParser.DialogueLine d = dParser.Lines[i];
            if (d.character == Character.end)
            {
                break;
            }
            if (d.character != Character.options)
            {
                if (!lastExpression.ContainsKey(d.character) || d.expression != lastExpression[d.character])
                {
                    SetExpression(d.character, d.expression, d.position == "R");
                }
                if (!lastExpression.ContainsKey(d.character))
                {
                    lastExpression.Add(d.character, d.expression);
                }
                else
                {
                    lastExpression[d.character] = d.expression;
                }
                yield return(CharacterDialogue(d.character, d.content));
            }
            else
            {
                ClearTexts();
                presentingOptions = true;

                for (int j = 0; j < d.options.Length; ++j)
                {
                    dialogueButtons[j].gameObject.SetActive(true);
                    dialogueButtons[j].GetComponent <TextMeshProUGUI>().text = d.options[j].Split(':')[0];
                    // On click gets called after j is incremented, so we have to save it as a temp value.
                    int temp = j;
                    dialogueButtons[temp].onClick.AddListener(() => UpdateLine(ref i, int.Parse(d.options[temp].Split(':')[1])));
                }

                questionText.text = lastQuestion;
                question.SelfFadeIn();

                while (presentingOptions)
                {
                    yield return(null);
                }

                question.SelfFadeOut();
            }
        }
        FinishText();
    }
Exemplo n.º 7
0
 /// <summary>
 /// Updates the description.
 /// </summary>
 private void UpdateDescrip()
 {
     descripText.ClearText();
     if (description.IsVisible)
     {
         description.SelfFadeOut();
     }
     else
     {
         description.SelfFadeIn();
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Used when the game pauses.
 /// </summary>
 private void Pause()
 {
     if (Time.timeScale == 0.0f)
     {
         overlay.SelfFadeIn();
     }
     else
     {
         overlay.SelfFadeOut();
     }
     Camera.main.GetComponent <BlurOptimized>().enabled = Time.timeScale == 0.0f;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Fades in and out the controls when the 'Controls' button is pressed.
 /// </summary>
 public void ToggleControls()
 {
     if (!controls.IsFading)
     {
         if (controls.IsVisible)
         {
             controls.SelfFadeOut(dur: 0.15f);
         }
         else
         {
             controls.SelfFadeIn(dur: 0.15f);
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Begins a dialogue stream.
 /// </summary>
 /// <param name="i">The scene index for dialogue.</param>
 /// <param name="c">The number of conversations left for this character.</param>
 /// <param name="c">Whether or not there is available dialogue.</param>
 private void BeginText(int i, int c, bool b)
 {
     GameManager.PauseEvent();
     Pause();
     if (c > 0 && !b)
     {
         dParser.LoadDialogue("Dialogue/Dialogue" + i);
         Stats.CurrentTime += Stats.DIALOGUE_START_TIME_INCREMENT;
     }
     else
     {
         dParser.LoadDialogue("Snippets/Snippet" + i);
     }
     ClearTexts();
     ClearPortraits();
     textOverlay.SelfFadeIn();
     StartCoroutine(RunDialogue());
 }
Exemplo n.º 11
0
    /// <summary>
    /// Runs the dialogue for the scene loaded in the dialogue parser.
    /// </summary>
    private IEnumerator RunDialogue(int scene, bool dialogue, Character c)
    {
        if (c == Character.stan && scene == 4)
        {
            SoundManager.SongEvent(1);
        }
        Dictionary <Character, Expression> lastExpression = new Dictionary <Character, Expression>();

        if (dialogue)
        {
            yield return(dParser.LoadDialogue(Path.Combine(Path.Combine("Dialogue", c.ToString()), "Dialogue" + scene)));

            if (trustUIActive)
            {
                Stats.CurrentTime += Stats.DIALOGUE_START_TIME_INCREMENT;
            }
        }
        else
        {
            yield return(dParser.LoadDialogue(Path.Combine(Path.Combine("Snippet", c.ToString()), "Snippet" + scene)));
        }
        DialogueParser.DialogueLine l = dParser.Head;
        while (true)
        {
            // Handle things done before dialogue
            string position = l.node.character == Character.player || l.node.forceLeft ? "L" : "R";
            Image  e        = (position == "R" ? rightCharacterPortraits : leftCharacterPortraits)[(int)l.node.character][(int)l.node.expression].GetComponent <Image>();
            HandleTrustUI(l);
            e.color = Color.white;

            // Handle dialogue
            AssignExpression(ref lastExpression, l.node.character, l.node.expression, position);
            yield return(CharacterDialogue(l.node.character, l.node.dialogue));

            // Handle things after dialogue
            e.color = new Color(135 / 255.0f, 135 / 255.0f, 135 / 255.0f, 165 / 255.0f);
            if (l.node.longOption)
            {
                IncrementDialogueTime();
            }
            if (l.node.positive)
            {
                AddRelationshipPoints(l.node.characterAffected, 1);
            }
            if (l.node.negative)
            {
                AddRelationshipPoints(l.node.characterAffected, -1);
            }
            if (l.node.fired)
            {
                FiredCharacter(l.node.characterAffected);
            }
            if (-1 < l.node.infoGathered && l.node.infoGathered < 11)
            {
                GotInfoOnCharacter(l.node.characterAffected, l.node.infoGathered);
            }
            l.RestrictConnections();
            if (l.connections.Count < 2)
            {
                if (l.connections.Count == 1)
                {
                    l = l.connections[0];
                }
                else
                {
                    break;
                }
            }
            else
            {
                ClearTexts();
                presentingOptions = true;

                for (int j = 0; j < l.connections.Count; ++j)
                {
                    dialogueButtons[j].gameObject.SetActive(true);
                    dialogueButtons[j].GetComponent <TextMeshProUGUI>().text = Stats.ReplacePlayerName(l.connections[j].node.dialogue);
                    // On click gets called after j is incremented, so we have to save it as a temp value.
                    int temp = j;
                    dialogueButtons[j].onClick.AddListener(() => UpdateLine(ref l, l.connections[temp]));
                }

                questionText.text = l.node.dialogue;
                question.SelfFadeIn();

                while (presentingOptions)
                {
                    yield return(null);
                }

                question.SelfFadeOut();
            }
        }
        if (c == Character.stan && scene == 4)
        {
            if (Stats.fired[Character.stan])
            {
                SoundManager.SongEvent(5);
            }
            else
            {
                SoundManager.SongEvent(4);
            }
        }
        if (scene > 10)
        {
            Stats.CurrentTime = 60 * 17;
        }
        FinishText();
    }
Exemplo n.º 12
0
 private void EndGame()
 {
     lose.useUnscaledDeltaTimeForUI = true;
     lose.SelfFadeIn();
 }
Exemplo n.º 13
0
    /// <summary>
    /// Runs the dialogue for the scene loaded in the dialogue parser.
    /// </summary>
    private IEnumerator RunDialogue()
    {
        Dictionary <Character, Expression> lastExpression = new Dictionary <Character, Expression>();

        for (int i = 0; i < dParser.Lines.Count; ++i)
        {
            DialogueParser.DialogueLine d = dParser.Lines[i];
            if (d.character == Character.end)
            {
                break;
            }
            if (d.character != Character.options)
            {
                AssignExpression(ref lastExpression, d.character, d.expression, d.position);
                if (d.receiving != Character.end)
                {
                    AssignExpression(ref lastExpression, d.receiving, d.rExpression, d.position == "R" ? "L" : "R");
                }
                yield return(CharacterDialogue(d.character, d.content));

                if (d.options[0] != null)
                {
                    if (d.options.Length == 1)
                    {
                        UpdateLine(ref i, int.Parse(d.options[0]));
                    }
                }
            }
            else
            {
                ClearTexts();
                presentingOptions = true;

                for (int j = 0; j < d.options.Length; ++j)
                {
                    dialogueButtons[j].gameObject.SetActive(true);
                    dialogueButtons[j].GetComponent <TextMeshProUGUI>().text = d.options[j].Split(':')[0];
                    // On click gets called after j is incremented, so we have to save it as a temp value.
                    string[] options = d.options[j].Split(':');
                    dialogueButtons[j].onClick.AddListener(() => UpdateLine(ref i, int.Parse(options[1])));
                    // Handle option stat modifications if present
                    for (int k = 2; k < options.Length; k++)
                    {
                        if (options[k].ToUpper() == "L")
                        {
                            dialogueButtons[j].onClick.AddListener(IncrementDialogueTime);
                        }
                        else
                        {
                            string[]  statMods = options[k].Split(',');
                            Character c        = (Character)Enum.Parse(typeof(Character), statMods[0]);
                            if (statMods[1] == "+")
                            {
                                dialogueButtons[j].onClick.AddListener(() => AddRelationshipPoints(c, 1));
                            }
                            else if (statMods[1] == "-")
                            {
                                dialogueButtons[j].onClick.AddListener(() => AddRelationshipPoints(c, -1));
                            }
                            else
                            {
                                dialogueButtons[j].onClick.AddListener(() => GotInfoOnCharacter(c, int.Parse(statMods[1])));
                            }
                        }
                    }
                }

                questionText.text = lastQuestion;
                question.SelfFadeIn();

                while (presentingOptions)
                {
                    yield return(null);
                }

                question.SelfFadeOut();
            }
        }
        FinishText();
    }