Exemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //这个Class是等会要注册到Lua环境里的,这里演示了一下这个对象的主要接口的功能
            MyClass theClass = new MyClass();
            AddOb theOb = new AddOb();
            theClass.OnAddFinish += theOb.OnAddFinish;
            theClass.Add(100, 200);

            BoltWarper.Instance().InitBolt("");

            LuaMyClass.RegisterClass();
            string searPath = System.Windows.Forms.Application.StartupPath + "\\..\\samples\\HelloBolt\\XAR\\";
            BoltWarper.Instance().AddXARSearchPath(searPath);
            BoltWarper.Instance().LoadXAR("HelloBolt7");

            Application.Run();
        }
Exemplo n.º 2
0
 private static int CreateMyClassInstance(IntPtr luaState)
 {
     //这里要把一个C#的obj instance传递到lua虚拟机中
     //注意result的生命周期管理
     MyClass result = new MyClass();
     result.myname = "MyClass:"+s_currentIndex;
     allLuaMyClassObj[s_currentIndex] = result;
     XLLRTWarper.XLLRT_PushXLObject(luaState, "HelloBolt.MyClass", new IntPtr(s_currentIndex));
     s_currentIndex++;
     return 1;
 }