예제 #1
0
파일: MainUI.cs 프로젝트: Zilby/PRadio
 private void FinishText()
 {
     GameManager.Pausing();
     pauseButton.gameObject.SetActive(true);
     textOverlay.SelfFadeOut();
     Camera.main.GetComponent <BlurOptimized>().enabled = false;
 }
예제 #2
0
 /// <summary>
 /// Ends a dialogue scene.
 /// </summary>
 private void FinishText()
 {
     Logger.Log("Ended dialogue.\n");
     GameManager.PauseEvent();
     Pause();
     textOverlay.SelfFadeOut();
 }
예제 #3
0
 /// <summary>
 /// Used when the game pauses.
 /// </summary>
 private void Pause()
 {
     if (Time.timeScale == 0.0f)
     {
         overlay.SelfFadeIn();
     }
     else
     {
         overlay.SelfFadeOut();
     }
 }
예제 #4
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();
    }
예제 #5
0
 /// <summary>
 /// Updates the description.
 /// </summary>
 private void UpdateDescrip()
 {
     descripText.ClearText();
     if (description.IsVisible)
     {
         description.SelfFadeOut();
     }
     else
     {
         description.SelfFadeIn();
     }
 }
예제 #6
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;
 }
예제 #7
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);
         }
     }
 }
예제 #8
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();
    }
예제 #9
0
 /// <summary>
 /// Ends a dialogue scene.
 /// </summary>
 private void FinishText()
 {
     GameManager.PauseEvent();
     textOverlay.SelfFadeOut();
 }
    /// <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();
    }