Пример #1
0
        public ScriptComannd SwitchComannd(string Command)
        {
            if (Command != null)
            {
                string[]      command = Command.Split(' ');
                string[]      dir;
                ScriptComannd sc;
                switch (command[0])
                {
                //左立绘
                case "ld":
                    sc = new ScriptComannd()
                    {
                        comanndType = ComanndType.ld
                    };
                    dir = command[1].Split(',');
                    if (dir.Length == 1)
                    {
                        sc.Name = dir[0];
                    }
                    else if (dir.Length == 3)
                    {
                        sc.Position = new Vector2(float.Parse(dir[0]), float.Parse(dir[1]));
                        sc.Name     = dir[2];
                    }
                    return(sc);

                //右立绘
                case "rd":
                    sc = new ScriptComannd()
                    {
                        comanndType = ComanndType.rd
                    };
                    dir = command[1].Split(',');
                    if (dir.Length == 1)
                    {
                        sc.Name = dir[0];
                    }
                    else if (dir.Length == 3)
                    {
                        sc.Position = new Vector2(float.Parse(dir[0]), float.Parse(dir[1]));
                        sc.Name     = dir[2];
                    }
                    return(sc);

                //对话
                case "say":
                    sc = new ScriptComannd()
                    {
                        comanndType = ComanndType.say
                    };
                    sc.text = int.Parse(command[1]);
                    return(sc);
                }
            }
            return(null);
        }
Пример #2
0
        public ScriptComannd SwitchComannd(string Command)
        {
            if(Command != null)
            {
                string[] command = Command.Split(' ');
                string[] dir;
                ScriptComannd sc;
                switch(command[0])
                {
                    //左立绘
                    case "ld":
                    sc = new ScriptComannd(){comanndType = ComanndType.ld};
                    dir = command[1].Split(',');
                    if(dir.Length == 1)
                    {
                        sc.Name = dir[0];
                    }
                    else if(dir.Length == 3)
                    {
                        sc.Position = new Vector2(float.Parse(dir[0]),float.Parse(dir[1]));
                        sc.Name = dir[2];
                    }
                    return sc;

                    //右立绘
                    case "rd":
                    sc = new ScriptComannd(){comanndType = ComanndType.rd};
                    dir = command[1].Split(',');
                    if(dir.Length == 1)
                    {
                        sc.Name = dir[0];
                    }
                    else if(dir.Length == 3)
                    {
                        sc.Position = new Vector2(float.Parse(dir[0]),float.Parse(dir[1]));
                        sc.Name = dir[2];
                    }
                    return sc;

                    //对话
                    case "say":
                    sc = new ScriptComannd(){comanndType = ComanndType.say};
                    sc.text = int.Parse(command[1]);
                    return sc;
                }
            }
            return null;
        }