Exemplo n.º 1
0
        private CharacterAnimation CurrentCharacterAnimation()
        {
            CharacterAnimation Animation = null;

            if (CurrentTextObject.GetType().Name.Equals("LineOfDialogue"))
            {
                LineOfDialogue Dialogue = (LineOfDialogue)CurrentTextObject;
                Animation = Dialogue.CharacterAnimation;
            }

            return(Animation);
        }
Exemplo n.º 2
0
    /// <summary>
    /// Gets and starts the display process for the next line of text.
    /// </summary>
    private void NextLine()
    {
        current_line = dialogue.NextLine();
        if (current_line != null)
        {
            duration = current_line.Duration();

            if (current_line.text == null && current_line.character == null)
            {
                HideBG();
            }
        }
        else
        {
            duration = 0.0f;
        }
        timer = 0.0f;
        HideLine(); // UX: hiding the line for a TINY amount of time makes the change register to users.
    }
Exemplo n.º 3
0
        public void Update(GameTime gameTime)
        {
            if (CurrentTextObject == null)
            {
                CurrentTextObject = TxtReader.NextTxtObject();
            }

            if (Dialogue != null)
            {
                EndOfLine = Dialogue.Complete();
            }

            switch (CurrentTextObject.GetType().Name)
            {
            case "Background":
                Background = (Background)CurrentTextObject;
                PriorCharacterAnimation = null;
                CurrentTextObject       = TxtReader.NextTxtObject();
                break;

            case "CharacterAnimation":
                CharacterAnimation CurrentAnimation = (CharacterAnimation)CurrentTextObject;
                DefaultAnimation  = CurrentAnimation;
                CurrentTextObject = TxtReader.NextTxtObject();
                break;

            case "LineOfDialogue":
                Dialogue = (LineOfDialogue)CurrentTextObject;
                if (DefaultAnimation != null)
                {
                    Dialogue.SetSecondAnimation(DefaultAnimation, DESATURATION_PERCENT);
                }

                if (PreviousButtonState == ButtonState.Pressed && Mouse.GetState().LeftButton == ButtonState.Released && EndOfLine)
                {
                    CharacterAnimation CurrentCharacter = Dialogue.CharacterAnimation;
                    CurrentTextObject = TxtReader.NextTxtObject();
                    EndOfLine         = false;

                    CharacterAnimation NextCharacter = null;

                    if (CurrentTextObject != null)
                    {
                        NextCharacter = CurrentCharacterAnimation();
                    }

                    if (CurrentCharacter != null && NextCharacter != null &&
                        !NextCharacter.CharacterName.Equals(CurrentCharacter.CharacterName))
                    {
                        PriorCharacterAnimation = CurrentCharacter;
                        DefaultAnimation        = null;
                    }
                }
                break;

            default:
                CurrentTextObject = TxtReader.NextTxtObject();
                break;
            }

            TextEnd = TxtReader.IsEmpty();
            if (!TextEnd)
            {
                CurrentTextObject.Update(gameTime);
                PreviousButtonState = Mouse.GetState().LeftButton;
            }
        }