示例#1
0
        public void Run(CardCollect cc)
        {
            CozyLuaCore lua = new CozyLuaCore();

            lua.LoadCLRPackage();
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')");
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')");
            lua.DoFile(PathTransform.LuaScript(script_));
            var f = lua.GetFunction("shuffle");

            f.Call(cc);
        }
示例#2
0
        public CardCollect Run(CardCollect cc)
        {
            CozyLuaCore lua = new CozyLuaCore();

            lua.LoadCLRPackage();
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')");
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')");
            lua.DoFile(PathTransform.LuaScript(script_));
            var f = lua.GetFunction("deal");

            return((CardCollect)f.Call(cc).First());
        }
示例#3
0
        public CardCollect Run()
        {
            CozyLuaCore lua = new CozyLuaCore();

            lua.LoadCLRPackage();
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')");
            lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')");
            lua.DoFile(PathTransform.LuaScript(script_));
            //lua.DoString(@" import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')");
            //lua.DoString(@"
            //    cc = CardCollect()
            //    c = Card(1,1)
            //    cc:Add(c)");
            return((CardCollect)lua["cc"]);
        }
示例#4
0
        public virtual bool Init(string script)
        {
            lua.InitEnvironment();

            lua.DoFile(PathTransform.LuaScript(script));

            var methods = lua.GetTable("methods");

            for (var em = methods.GetEnumerator(); em.MoveNext();)
            {
                var funcName = (string)em.Value;
                mapMethod.Add(funcName, lua.GetFunction(funcName));
            }
            return(true);
        }
示例#5
0
文件: PatternBase.cs 项目: sgww/cozy
        virtual public bool Init(string script)
        {
            CozyLuaCore lua = new CozyLuaCore();

            lua.DoFile(PathTransform.LuaScript(script));
            mapMethod = new Dictionary <string, string>();
            var methods = lua.GetTable("methods");
            var em      = methods.GetEnumerator();

            while (em.MoveNext())
            {
                mapMethod.Add((string)em.Key, (string)em.Value);
            }
            return(true);
        }
示例#6
0
        public static FollowerPackage GetFollowerPackages()
        {
            var name   = @"Data/FollowerPackage";
            var result = new FollowerPackage();

            int i = 1;

            while (File.Exists(PathTransform.LuaScript(name + i)))
            {
                var lua = new CozyLua.Core.CozyLuaCore();
                lua.InitEnvironment();

                lua.DoFile(PathTransform.LuaScript(name + i));
                var retVal = (FollowerPackage)lua.GetFunction("GetFollowerPackage").Call()[0];
                result.Followers.AddRange(retVal.Followers);
                ++i;
            }
            return(result);
        }
示例#7
0
文件: LuaExt.cs 项目: sgww/cozy
        public static void InitEnvironment(this CozyLuaCore lua)
        {
            lua.LoadCLRPackage();

            lua.DoFile(PathTransform.LuaScript("init"));
        }