예제 #1
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error     = null;
     _Name     = groups[1].Value;
     _Position = StringDefine.ParseVector3(groups[2].Value);
     _Duration = StringDefine.ParseFloat(groups[3].Value, 0.0f);
 }
예제 #2
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error     = null;
     _Name     = groups[1].Value;
     _Position = StringDefine.ParseVector2(groups[2].Value);
     _Url      = groups[3].Value;
 }
예제 #3
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error       = null;
     _ModelName  = groups[1].Value;
     _MotionName = groups[2].Value;
     _MotionLoop = StringDefine.ParseBoolean(groups[3].Value, false);
 }
예제 #4
0
    public void ParsingVector2Test()
    {
        string  text = "(0,-1.5)";
        Vector2 vec  = StringDefine.ParseVector2(text);

        Assert.AreEqual(new Vector2(0.0f, -1.5f), vec);
    }
예제 #5
0
    public void ParsingVector3Test()
    {
        string  text = "(0,-1.5,10.0)";
        Vector3 vec  = StringDefine.ParseVector3(text);

        Assert.AreEqual(new Vector3(0.0f, -1.5f, 10.0f), vec);
    }
예제 #6
0
    public void ParsingColorTest()
    {
        string text  = "(255,0,255)";
        Color  color = StringDefine.ParseColor(text);

        Assert.AreEqual(new Color(1.0f, 0.0f, 1.0f), color);
    }
예제 #7
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error           = null;
     _Name           = groups[1].Value;
     _MotionName     = groups[2].Value;
     _MotionLoop     = StringDefine.ParseBoolean(groups[3].Value, false);
     _ExpressionName = groups[4].Value;
     _Position       = StringDefine.ParseVector3(groups[5].Value);
     _Duration       = StringDefine.ParseFloat(groups[6].Value, 0.0f);
 }
예제 #8
0
    public void SplitFirstWordSingleWordTest()
    {
        string text = "word";
        string word;
        string remain;

        StringDefine.SplitFirstWord(text, out word, out remain);

        Assert.AreEqual("word", word);
        Assert.AreEqual("", remain);
    }
예제 #9
0
    public void SplitFirstWordMultiWordTest()
    {
        string text = "word text1 text2 text3";
        string word;
        string remain;

        StringDefine.SplitFirstWord(text, out word, out remain);

        Assert.AreEqual("word", word);
        Assert.AreEqual("text1 text2 text3", remain);
    }
예제 #10
0
        private Command ParseToCommand(string line, out CommandError error)
        {
            if (line == "" || line.StartsWith("//"))
            {
                error = null;
                return(null);
            }

            string commandID;
            string commandParam;

            StringDefine.SplitFirstWord(line, out commandID, out commandParam);

            Command command = CreateCommandFromID(commandID);

            if (command == null)
            {
                error = new CommandInvalidIDError(commandID);
                return(null);
            }

            CommandError parseError = null;

            command.Parse(commandParam, out parseError);
            if (parseError != null)
            {
                error = parseError;
                return(null);
            }

            CommandError onParsedError = null;

            command.OnParsed(out onParsedError);
            if (onParsedError != null)
            {
                error = parseError;
                return(null);
            }

            error = null;
            return(command);
        }
예제 #11
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error  = null;
     _Color = StringDefine.ParseColor(groups[1].Value);
 }
예제 #12
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error = null;
     _Text = StringDefine.ReplaceEscape(groups[0].Value);
 }
예제 #13
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error     = null;
     _ToLeft   = (groups[1].Value == "left");
     _Duration = StringDefine.ParseFloat(groups[2].Value, Define._foregroundCoverDefaultDuration);
 }