示例#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);
 }
示例#2
0
    public void OnlyTextParser()
    {
        var parser = A.Dummy <ITextParser>();
        var sut    = ElementParserSettings.Normal(parser);

        sut.ShouldBeNormal(parser);
    }
示例#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
         );
 }
示例#4
0
    public static ElementParserSettings Normal(params object[] parsers)
    {
        var settings = new ElementParserSettings();

        foreach (var parser in parsers)
        {
            switch (parser)
            {
            case IAttributeParser attributeParser:
                settings.AttributeParsers.Add(attributeParser);
                break;

            case INodeParser nodeParser:
                settings.ChildParsers.Add(nodeParser);
                break;

            case ITextParser textParser:
                settings.TextParser = textParser;
                break;

            default:
                throw new ArgumentException($"Argumento do tipo '{parser.GetType().Name}' não é válido.");
            }
        }

        return(settings);
    }
示例#5
0
    public void OnlyNodeParser()
    {
        var parser = Helper.FakeParser <INodeParser>("a");
        var sut    = ElementParserSettings.Normal(parser);

        sut.ShouldBeNormal(parser);
    }
示例#6
0
 public UnsetNodeParser(
     IElementParser elementParser,
     INameTextParser nameTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(nameTextParser);
 }
示例#7
0
    public void InvalidArgument()
    {
        var ex = Assert.Throws <ArgumentException>(
            () => ElementParserSettings.Normal("gibberish")
            );

        ex.Message.Should().Be("Argumento do tipo 'String' não é válido.");
    }
示例#8
0
 public MoodNodeParser(
     IElementParser elementParser,
     IMoodTextParser moodTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(moodTextParser);
 }
示例#9
0
 public ChoiceOptionDisabledTextNodeParser(
     IElementParser elementParser,
     IBalloonTextParser balloonTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(balloonTextParser);
 }
示例#10
0
    public void NonRepeat()
    {
        var nodeParser1 = Helper.FakeParser <INodeParser>("c");
        var nodeParser2 = Helper.FakeParser <INodeParser>("d");

        var sut = ElementParserSettings.NonRepeat(nodeParser1, nodeParser2);

        sut.ShouldBeNonRepeat(nodeParser1, nodeParser2);
    }
示例#11
0
 public BackgroundColorNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IColorTextParser colorTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, colorTextParser);
 }
示例#12
0
    public void Aggregated()
    {
        var nodeParser1 = Helper.FakeParser <INodeParser>("c");
        var nodeParser2 = Helper.FakeParser <INodeParser>("d");

        var sut = ElementParserSettings.Aggregated(nodeParser1, nodeParser2);

        sut.ShouldBeAggregated(nodeParser1, nodeParser2);
    }
示例#13
0
 public PauseNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IIntegerTextParser integerTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, integerTextParser);
 }
示例#14
0
 public BackgroundRightNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     IBackgroundImageTextParser backgroundImageTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, backgroundImageTextParser);
 }
示例#15
0
 public ProtagonistNodeParser(
     IElementParser elementParser,
     IWhenAttributeParser whenAttributeParser,
     INameTextParser nameTextParser
     )
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser, nameTextParser);
 }
示例#16
0
 public SetNodeParser(
     IVarSetParser varSetParser,
     IElementParser elementParser,
     IVarSetTextParser varSetTextParser
     )
 {
     this.varSetParser  = varSetParser;
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(varSetTextParser);
 }
示例#17
0
    public void Normal()
    {
        var textParser  = A.Dummy <ITextParser>();
        var attParser1  = Helper.FakeParser <IAttributeParser>("a");
        var attParser2  = Helper.FakeParser <IAttributeParser>("b");
        var nodeParser1 = Helper.FakeParser <INodeParser>("c");
        var nodeParser2 = Helper.FakeParser <INodeParser>("d");

        var sut = ElementParserSettings.Normal(textParser, attParser1, attParser2, nodeParser1, nodeParser2);

        sut.ShouldBeNormal(textParser, attParser1, attParser2, nodeParser1, nodeParser2);
    }
示例#18
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);
 }
示例#19
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);
 }
示例#20
0
    public ChoiceNodeParser(
        IElementParser elementParser,
        IChoiceTimeLimitNodeParser timeLimitNodeParser,
        IChoiceDefaultNodeParser defaultNodeParser,
        IChoiceOptionNodeParser optionNodeParser
        )
    {
        this.elementParser = elementParser;

        Settings = ElementParserSettings.Normal(
            timeLimitNodeParser,
            defaultNodeParser,
            optionNodeParser
            );
    }
示例#21
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
            );
    }
示例#22
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
         );
 }
示例#23
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
            );
    }
示例#24
0
 public BackgroundScrollNodeParser(IElementParser elementParser, IWhenAttributeParser whenAttributeParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(whenAttributeParser);
 }
示例#25
0
 public ChoiceTimeLimitNodeParser(IElementParser elementParser, IIntegerTextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
示例#26
0
 public GenericTextNodeParserBase(IElementParser elementParser, ITextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
示例#27
0
 public ChoiceOptionIconNodeParser(IElementParser elementParser, INameTextParser nameTextParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(nameTextParser);
 }
示例#28
0
 public ChoiceOptionEnabledWhenNodeParser(IElementParser elementParser, IBalloonTextParser textParser, IConditionParser conditionParser)
 {
     this.elementParser   = elementParser;
     this.conditionParser = conditionParser;
     Settings             = ElementParserSettings.Normal(textParser);
 }
示例#29
0
 public ChoiceDefaultNodeParser(IElementParser elementParser, INameTextParser textParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal(textParser);
 }
示例#30
0
 public ChoiceRandomOrderNodeParser(IElementParser elementParser)
 {
     this.elementParser = elementParser;
     Settings           = ElementParserSettings.Normal();
 }