Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #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);
 }
    public void ParsingVector2Test()
    {
        string  text = "(0,-1.5)";
        Vector2 vec  = StringDefine.ParseVector2(text);

        Assert.AreEqual(new Vector2(0.0f, -1.5f), vec);
    }
    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);
    }
    public void ParsingColorTest()
    {
        string text  = "(255,0,255)";
        Color  color = StringDefine.ParseColor(text);

        Assert.AreEqual(new Color(1.0f, 0.0f, 1.0f), color);
    }
Beispiel #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);
 }
    public void SplitFirstWordSingleWordTest()
    {
        string text = "word";
        string word;
        string remain;

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

        Assert.AreEqual("word", word);
        Assert.AreEqual("", remain);
    }
    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);
    }
Beispiel #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);
        }
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error  = null;
     _Color = StringDefine.ParseColor(groups[1].Value);
 }
Beispiel #12
0
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error = null;
     _Text = StringDefine.ReplaceEscape(groups[0].Value);
 }
 protected override void SetValue(GroupCollection groups, out CommandError error)
 {
     error     = null;
     _ToLeft   = (groups[1].Value == "left");
     _Duration = StringDefine.ParseFloat(groups[2].Value, Define._foregroundCoverDefaultDuration);
 }