CalculateAndSetTimeBasedOnLineLength() public method

public CalculateAndSetTimeBasedOnLineLength ( bool isOptionNode ) : void
isOptionNode bool
return void
Beispiel #1
0
        private TimedDialogueNode VisitTimedDialogueNode(DialogueNode pPrevious)
        {
                        #if DEBUG_WRITE
            Console.WriteLine("VisitTimedDialogueNode()");
                        #endif

            Token  speakerToken = match(Token.TokenType.NAME);
            string speaker      = speakerToken.getTokenString();

            Token  lineToken = match(Token.TokenType.QUOTED_STRING);
            string line      = lineToken.getTokenString();

            TimedDialogueNode n = _dialogueRunner.Create <TimedDialogueNode>(_conversationName, _language, (_nodeCounter++).ToString() + "_line_" + lineToken.LineNr);            // + " (" + line + ")");
            n.speaker = speaker;
            n.line    = line;
            n.CalculateAndSetTimeBasedOnLineLength(false);

            if (lookAheadType(1) == Token.TokenType.BRACKET_LEFT)
            {
                match(Token.TokenType.BRACKET_LEFT);
                string nodeCustomName = match(Token.TokenType.NAME).getTokenString();
                n.name = nodeCustomName;
                match(Token.TokenType.BRACKET_RIGHT);
            }

                        #if DEBUG_WRITE
            Console.WriteLine("Added TimedDialogueNode with name '" + n.name + "' and line '" + n.line + "'");
                        #endif

            AddLinkFromPreviousNode(pPrevious, n);

            return(n);
        }
Beispiel #2
0
        private DialogueNode VisitOption(DialogueNode pScopeEndNode)
        {
                        #if DEBUG_WRITE
            Console.WriteLine("VisitOption()");
                        #endif

            Token t = match(Token.TokenType.QUOTED_STRING);
            match(Token.TokenType.COLON);

            TimedDialogueNode optionNode = _dialogueRunner.Create <TimedDialogueNode>(_conversationName, _language, (_nodeCounter++).ToString());
            optionNode.line    = t.getTokenString();
            optionNode.speaker = _playerCharacterName;
            optionNode.CalculateAndSetTimeBasedOnLineLength(true);

                        #if DEBUG_WRITE
            Console.WriteLine("Created an option node with the name '" + optionNode.name + "'" + " and line " + "'" + optionNode.line + "'");
                        #endif

            Nodes(optionNode, pScopeEndNode);

            return(optionNode);
        }