Exemplo n.º 1
0
 public BlockNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IWhileAttributeParser whileAttributeParser,
     IMusicNodeParser musicNodeParser,
     IBackgroundNodeParser backgroundNodeParser,
     IPauseNodeParser pauseNodeParser,
     IProtagonistNodeParser protagonistNodeParser,
     IPersonNodeParser personNodeParser,
     INarrationNodeParser narrationNodeParser,
     ITutorialNodeParser tutorialNodeParser,
     ISetNodeParser setNodeParser,
     IUnsetNodeParser unsetNodeParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(
         whenAttributeParser,
         whileAttributeParser,
         musicNodeParser,
         backgroundNodeParser,
         pauseNodeParser,
         protagonistNodeParser,
         personNodeParser,
         narrationNodeParser,
         tutorialNodeParser,
         setNodeParser,
         unsetNodeParser
         );
     Settings.ChildParsers.Add(this);
 }
Exemplo n.º 2
0
    public static void ShouldContainOnly(this IElementParserSettings settings, params object[] parsers)
    {
        var attributeParserCount = 0;
        var nodeParserCount      = 0;
        var textParserFound      = false;

        foreach (var parser in parsers)
        {
            if (parser is ITextParser)
            {
                settings.TextParser.Should().BeSameAs(parser);
                textParserFound = true;
            }
            else if (parser is IAttributeParser attributeParser)
            {
                settings.AttributeParsers[attributeParser.Name].Should().BeSameAs(attributeParser);
                attributeParserCount++;
            }
            else if (parser is INodeParser nodeParser)
            {
                settings.ChildParsers[nodeParser.Name].Should().BeSameAs(nodeParser);
                nodeParserCount++;
            }
            else
            {
                throw new InvalidOperationException("Objeto não é um parser.");
            }
        }
        settings.AttributeParsers.Count.Should().Be(attributeParserCount);
        settings.ChildParsers.Count.Should().Be(nodeParserCount);
        if (!textParserFound)
        {
            settings.TextParser.Should().BeNull();
        }
    }
Exemplo n.º 3
0
 public RootBlockParser(
     IElementParser elementParser,
     IMusicNodeParser musicNodeParser,
     IBackgroundNodeParser backgroundNodeParser,
     IBlockNodeParser blockNodeParser,
     IPauseNodeParser pauseNodeParser,
     IProtagonistNodeParser protagonistNodeParser,
     IPersonNodeParser personNodeParser,
     INarrationNodeParser narrationNodeParser,
     ITutorialNodeParser tutorialNodeParser,
     ISetNodeParser setNodeParser,
     IUnsetNodeParser unsetNodeParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(
         musicNodeParser,
         backgroundNodeParser,
         blockNodeParser,
         pauseNodeParser,
         protagonistNodeParser,
         personNodeParser,
         narrationNodeParser,
         tutorialNodeParser,
         setNodeParser,
         unsetNodeParser
         );
 }
Exemplo n.º 4
0
 public MoodNodeParser(
     IElementParser elementParser,
     IMoodTextParser moodTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(moodTextParser);
 }
Exemplo n.º 5
0
 public UnsetNodeParser(
     IElementParser elementParser,
     INameTextParser nameTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(nameTextParser);
 }
Exemplo n.º 6
0
 public ChoiceOptionDisabledTextNodeParser(
     IElementParser elementParser,
     IBalloonTextParser balloonTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(balloonTextParser);
 }
Exemplo n.º 7
0
 public BackgroundRightNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IBackgroundImageTextParser backgroundImageTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, backgroundImageTextParser);
 }
Exemplo n.º 8
0
 public ProtagonistNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     INameTextParser nameTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, nameTextParser);
 }
Exemplo n.º 9
0
 public BackgroundColorNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IColorTextParser colorTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, colorTextParser);
 }
Exemplo n.º 10
0
 public PauseNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IIntegerTextParser integerTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, integerTextParser);
 }
Exemplo n.º 11
0
 public SetNodeParser(
     IVarSetParser varSetParser,
     IElementParser elementParser,
     IVarSetTextParser varSetTextParser
     )
 {
     this.varSetParser  = varSetParser;
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(varSetTextParser);
 }
Exemplo n.º 12
0
 public BalloonTextNodeParserBase(
     IElementParser elementParser,
     IBalloonChildNodeParser childParser,
     ISetNodeParser setNodeParser,
     IUnsetNodeParser unsetNodeParser
     )
 {
     this.elementParser  = elementParser;
     this.childParser    = childParser;
     Settings            = ElementParserSettings.AggregatedNonRepeat(childParser);
     AggregationSettings = ElementParserSettings.Aggregated(childParser, setNodeParser, unsetNodeParser);
 }
Exemplo n.º 13
0
 public BalloonChildNodeParserBase(
     IElementParser elementParser,
     ITextSourceParser textSourceParser,
     IBalloonTextNodeParser balloonTextNodeParser,
     IChoiceNodeParser choiceNodeParser
     )
 {
     this.elementParser    = elementParser;
     this.textSourceParser = textSourceParser;
     this.childParser      = balloonTextNodeParser;
     Settings            = ElementParserSettings.AggregatedNonRepeat(balloonTextNodeParser);
     AggregationSettings = ElementParserSettings.AggregatedNonRepeat(choiceNodeParser);
 }
Exemplo n.º 14
0
    public ChoiceNodeParser(
        IElementParser elementParser,
        IChoiceTimeLimitNodeParser timeLimitNodeParser,
        IChoiceDefaultNodeParser defaultNodeParser,
        IChoiceOptionNodeParser optionNodeParser
        )
    {
        this.elementParser = elementParser;

        Settings = ElementParserSettings.Normal(
            timeLimitNodeParser,
            defaultNodeParser,
            optionNodeParser
            );
    }
Exemplo n.º 15
0
    public ChoiceOptionNodeParser(
        IElementParser elementParser,
        IWhenAttributeParser whenAttributeParser,
        IBalloonTextParser balloonTextParser,
        IChoiceOptionTextNodeParser choiceOptionTextNodeParser,
        IChoiceOptionEnabledWhenNodeParser choiceOptionEnabledWhenNodeParser,
        IChoiceOptionDisabledTextNodeParser choiceOptionDisabledTextNodeParser,
        IChoiceOptionIconNodeParser choiceOptionIconNodeParser
        )
    {
        this.elementParser = elementParser;

        Settings = ElementParserSettings.NonRepeat(
            whenAttributeParser,
            balloonTextParser,
            choiceOptionTextNodeParser,
            choiceOptionEnabledWhenNodeParser,
            choiceOptionDisabledTextNodeParser,
            choiceOptionIconNodeParser
            );
    }
Exemplo n.º 16
0
 public BackgroundNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IBackgroundImageTextParser backgroundImageTextParser,
     IBackgroundColorNodeParser backgroundColorNodeParser,
     IBackgroundLeftNodeParser backgroundLeftNodeParser,
     IBackgroundRightNodeParser backgroundRightNodeParser,
     IBackgroundScrollNodeParser backgroundScrollNodeParser,
     IPauseNodeParser pauseNodeParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(
         whenAttributeParser,
         backgroundImageTextParser,
         backgroundColorNodeParser,
         backgroundLeftNodeParser,
         backgroundRightNodeParser,
         backgroundScrollNodeParser,
         pauseNodeParser
         );
 }
Exemplo n.º 17
0
    public PersonNodeParser(
        IElementParser elementParser,
        IPersonTextNodeParser personTextNodeParser,
        ISpeechNodeParser speechNodeParser,
        IThoughtNodeParser thoughtNodeParser,
        IMoodNodeParser moodNodeParser,
        IPauseNodeParser pauseNodeParser,
        ISetNodeParser setNodeParser,
        IUnsetNodeParser unsetNodeParser
        )
    {
        this.elementParser = elementParser;
        this.childParser   = personTextNodeParser;
        Settings           = ElementParserSettings.AggregatedNonRepeat(childParser);

        AggregationSettings = ElementParserSettings.Aggregated(
            speechNodeParser,
            thoughtNodeParser,
            moodNodeParser,
            pauseNodeParser,
            setNodeParser,
            unsetNodeParser
            );
    }
Exemplo n.º 18
0
 public BackgroundScrollNodeParser(IElementParser elementParser, IWhenAttributeParser whenAttributeParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser);
 }
Exemplo n.º 19
0
 public ChoiceTimeLimitNodeParser(IElementParser elementParser, IIntegerTextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
Exemplo n.º 20
0
 public ChoiceOptionIconNodeParser(IElementParser elementParser, INameTextParser nameTextParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(nameTextParser);
 }
Exemplo n.º 21
0
 public GenericTextNodeParserBase(IElementParser elementParser, ITextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
Exemplo n.º 22
0
 public ChoiceDefaultNodeParser(IElementParser elementParser, INameTextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
Exemplo n.º 23
0
 public static void ShouldBeNormal(this IElementParserSettings settings, params object[] parsers)
 {
     settings.ShouldContainOnly(parsers);
     settings.NoRepeatNode.Should().BeFalse();
     settings.ExitOnUnknownNode.Should().BeFalse();
 }
Exemplo n.º 24
0
 public static void ShouldBeAggregatedNonRepeat(this IElementParserSettings settings, params object[] parsers)
 {
     settings.ShouldContainOnly(parsers);
     settings.NoRepeatNode.Should().BeTrue();
     settings.ExitOnUnknownNode.Should().BeTrue();
 }
Exemplo n.º 25
0
 public ChoiceOptionEnabledWhenNodeParser(IElementParser elementParser, IBalloonTextParser textParser, IConditionParser conditionParser)
 {
     this.elementParser   = elementParser;
     this.conditionParser = conditionParser;
     Settings             = ElementParserSettings.Normal(textParser);
 }
Exemplo n.º 26
0
 public FakeAggregatedNodeParser(IElementParser elementParser, INodeParser childNodeParser)
 {
     this.elementParser = elementParser;
     settings           = FakeSettings(childNodeParser);
     Name = childNodeParser.Name;
 }
Exemplo n.º 27
0
 public ChoiceRandomOrderNodeParser(IElementParser elementParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal();
 }