Esempio n. 1
0
        static int _m_SetLuaCallbacks(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.LuaGameNet gen_to_be_invoked = (Utopia.LuaGameNet)translator.FastGetCSObj(L, 1);



                {
                    XLua.LuaFunction _openCb    = (XLua.LuaFunction)translator.GetObject(L, 2, typeof(XLua.LuaFunction));
                    XLua.LuaFunction _closeCb   = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction));
                    XLua.LuaFunction _recvMsgCb = (XLua.LuaFunction)translator.GetObject(L, 4, typeof(XLua.LuaFunction));

                    gen_to_be_invoked.SetLuaCallbacks(_openCb, _closeCb, _recvMsgCb);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_AsyncLoadScene(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Lua.LuaResLoaderProxy gen_to_be_invoked = (Lua.LuaResLoaderProxy)translator.FastGetCSObj(L, 1);



                {
                    string           _path       = LuaAPI.lua_tostring(L, 2);
                    bool             _isAddition = LuaAPI.lua_toboolean(L, 3);
                    XLua.LuaFunction _luaFn      = (XLua.LuaFunction)translator.GetObject(L, 4, typeof(XLua.LuaFunction));

                    gen_to_be_invoked.AsyncLoadScene(_path, _isAddition, _luaFn);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 3
0
        static int _m_PopWindow(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                ZhuYuU3d.UIManager __cl_gen_to_be_invoked = (ZhuYuU3d.UIManager)translator.FastGetCSObj(L, 1);



                {
                    string           panelName  = LuaAPI.lua_tostring(L, 2);
                    string           strTitle   = LuaAPI.lua_tostring(L, 3);
                    string           strContent = LuaAPI.lua_tostring(L, 4);
                    int              nType      = LuaAPI.xlua_tointeger(L, 5);
                    string           layer      = LuaAPI.lua_tostring(L, 6);
                    XLua.LuaFunction onOK       = (XLua.LuaFunction)translator.GetObject(L, 7, typeof(XLua.LuaFunction));
                    XLua.LuaFunction onCancel   = (XLua.LuaFunction)translator.GetObject(L, 8, typeof(XLua.LuaFunction));
                    XLua.LuaFunction onLoadOver = (XLua.LuaFunction)translator.GetObject(L, 9, typeof(XLua.LuaFunction));

                    __cl_gen_to_be_invoked.PopWindow(panelName, strTitle, strContent, nType, layer, onOK, onCancel, onLoadOver);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        int i = Random.Range(0, 10);

        Debug.Log(i);
        luaenv.DoString("CS.UnityEngine.Debug.Log('hello')");
        luaenv.DoString("print('lua hello world')");
        luaenv.DoString("require'main'");

        int a = luaenv.Global.Get <int>("a");

        Debug.Log(a);


        Table t = luaenv.Global.Get <Table>("t");

        Debug.Log(t.a);

        XLua.LuaFunction addfun = luaenv.Global.Get <XLua.LuaFunction>("addfun");
        object[]         c      = addfun.Call(1, 2);
        int cint = System.Convert.ToInt32(c[0]);

        Debug.Log(cint);

        XLua.LuaFunction update = luaenv.Global.Get <XLua.LuaFunction>("update");
        update.Call();
    }
        static int _m_AsyncLoadAsset(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Lua.LuaResLoaderProxy gen_to_be_invoked = (Lua.LuaResLoaderProxy)translator.FastGetCSObj(L, 1);



                {
                    string           _path  = LuaAPI.lua_tostring(L, 2);
                    XLua.LuaFunction _luaFn = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction));

                    Utopia.ResourceObserver gen_ret = gen_to_be_invoked.AsyncLoadAsset(_path, _luaFn);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 6
0
 public static void AddLuaFunctionDelegate(List <EventDelegate> list, XLua.LuaFunction func)
 {
     EventDelegate.Add(list, delegate()
     {
         func.Call();
     });
 }
Esempio n. 7
0
        static int _m_ToastTips(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                ZhuYuU3d.UIManager __cl_gen_to_be_invoked = (ZhuYuU3d.UIManager)translator.FastGetCSObj(L, 1);



                {
                    string           strContent = LuaAPI.lua_tostring(L, 2);
                    int              ntime      = LuaAPI.xlua_tointeger(L, 3);
                    int              nfontsize  = LuaAPI.xlua_tointeger(L, 4);
                    int              ndirection = LuaAPI.xlua_tointeger(L, 5);
                    XLua.LuaFunction onover     = (XLua.LuaFunction)translator.GetObject(L, 6, typeof(XLua.LuaFunction));

                    __cl_gen_to_be_invoked.ToastTips(strContent, ntime, nfontsize, ndirection, onover);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 8
0
 public static void OnValueChangedSet(this Slider slider, object callback)
 {
     XLua.LuaFunction func = callback as XLua.LuaFunction;
     slider.onValueChanged.RemoveAllListeners();
     slider.onValueChanged.AddListener(
         (float value) =>
     {
         func?.Call(value);
     });
 }
Esempio n. 9
0
 public static void OnValueChangedSet(this Toggle toggle, object callback)
 {
     XLua.LuaFunction func = callback as XLua.LuaFunction;
     toggle.onValueChanged.RemoveAllListeners();
     toggle.onValueChanged.AddListener(
         (bool flag) =>
     {
         func?.Call();
     });
 }
Esempio n. 10
0
 public static void OnClickSet(this Button button, object callback)
 {
     XLua.LuaFunction func = callback as XLua.LuaFunction;
     button.onClick.RemoveAllListeners();
     button.onClick.AddListener(
         () =>
     {
         func?.Call();
     });
 }
Esempio n. 11
0
        static int _m_LoadPrefab(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLuaFramework.ResourceManager gen_to_be_invoked = (XLuaFramework.ResourceManager)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Action <UnityEngine.Object[]> >(L, 4))
                {
                    string _abName    = LuaAPI.lua_tostring(L, 2);
                    string _assetName = LuaAPI.lua_tostring(L, 3);
                    System.Action <UnityEngine.Object[]> _func = translator.GetDelegate <System.Action <UnityEngine.Object[]> >(L, 4);

                    gen_to_be_invoked.LoadPrefab(_abName, _assetName, _func);



                    return(0);
                }
                if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <string[]>(L, 3) && translator.Assignable <System.Action <UnityEngine.Object[]> >(L, 4))
                {
                    string   _abName     = LuaAPI.lua_tostring(L, 2);
                    string[] _assetNames = (string[])translator.GetObject(L, 3, typeof(string[]));
                    System.Action <UnityEngine.Object[]> _func = translator.GetDelegate <System.Action <UnityEngine.Object[]> >(L, 4);

                    gen_to_be_invoked.LoadPrefab(_abName, _assetNames, _func);



                    return(0);
                }
                if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <string[]>(L, 3) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TFUNCTION))
                {
                    string           _abName     = LuaAPI.lua_tostring(L, 2);
                    string[]         _assetNames = (string[])translator.GetObject(L, 3, typeof(string[]));
                    XLua.LuaFunction _func       = (XLua.LuaFunction)translator.GetObject(L, 4, typeof(XLua.LuaFunction));

                    gen_to_be_invoked.LoadPrefab(_abName, _assetNames, _func);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLuaFramework.ResourceManager.LoadPrefab!"));
        }
Esempio n. 12
0
        static int _m_LoadString(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.LuaEnv gen_to_be_invoked = (XLua.LuaEnv)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TTABLE))
                {
                    string        _chunk     = LuaAPI.lua_tostring(L, 2);
                    string        _chunkName = LuaAPI.lua_tostring(L, 3);
                    XLua.LuaTable _env       = (XLua.LuaTable)translator.GetObject(L, 4, typeof(XLua.LuaTable));

                    XLua.LuaFunction gen_ret = gen_to_be_invoked.LoadString(_chunk, _chunkName, _env);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    string _chunk     = LuaAPI.lua_tostring(L, 2);
                    string _chunkName = LuaAPI.lua_tostring(L, 3);

                    XLua.LuaFunction gen_ret = gen_to_be_invoked.LoadString(_chunk, _chunkName);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    string _chunk = LuaAPI.lua_tostring(L, 2);

                    XLua.LuaFunction gen_ret = gen_to_be_invoked.LoadString(_chunk);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLua.LuaEnv.LoadString!"));
        }
Esempio n. 13
0
        static int _m_SetRawImage_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 4 && translator.Assignable <UnityEngine.UI.RawImage>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TFUNCTION))
                {
                    UnityEngine.UI.RawImage _img   = (UnityEngine.UI.RawImage)translator.GetObject(L, 1, typeof(UnityEngine.UI.RawImage));
                    string           _file_path    = LuaAPI.lua_tostring(L, 2);
                    bool             _is_auto_size = LuaAPI.lua_toboolean(L, 3);
                    XLua.LuaFunction _func         = (XLua.LuaFunction)translator.GetObject(L, 4, typeof(XLua.LuaFunction));

                    XLuaFramework.UIHelper.SetRawImage(_img, _file_path, _is_auto_size, _func);



                    return(0);
                }
                if (gen_param_count == 3 && translator.Assignable <UnityEngine.UI.RawImage>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3))
                {
                    UnityEngine.UI.RawImage _img = (UnityEngine.UI.RawImage)translator.GetObject(L, 1, typeof(UnityEngine.UI.RawImage));
                    string _file_path            = LuaAPI.lua_tostring(L, 2);
                    bool   _is_auto_size         = LuaAPI.lua_toboolean(L, 3);

                    XLuaFramework.UIHelper.SetRawImage(_img, _file_path, _is_auto_size);



                    return(0);
                }
                if (gen_param_count == 2 && translator.Assignable <UnityEngine.UI.RawImage>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    UnityEngine.UI.RawImage _img = (UnityEngine.UI.RawImage)translator.GetObject(L, 1, typeof(UnityEngine.UI.RawImage));
                    string _file_path            = LuaAPI.lua_tostring(L, 2);

                    XLuaFramework.UIHelper.SetRawImage(_img, _file_path);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLuaFramework.UIHelper.SetRawImage!"));
        }
        static int _m_Execute_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 1 && LuaTypes.LUA_TLIGHTUSERDATA == LuaAPI.lua_type(L, 1))
                {
                    System.IntPtr _L = LuaAPI.lua_touserdata(L, 1);

                    int gen_ret = XLua.TemplateEngine.LuaTemplate.Execute(_L);
                    LuaAPI.xlua_pushinteger(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TFUNCTION))
                {
                    XLua.LuaFunction _compiledTemplate = (XLua.LuaFunction)translator.GetObject(L, 1, typeof(XLua.LuaFunction));

                    string gen_ret = XLua.TemplateEngine.LuaTemplate.Execute(_compiledTemplate);
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TFUNCTION) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TTABLE))
                {
                    XLua.LuaFunction _compiledTemplate = (XLua.LuaFunction)translator.GetObject(L, 1, typeof(XLua.LuaFunction));
                    XLua.LuaTable    _parameters       = (XLua.LuaTable)translator.GetObject(L, 2, typeof(XLua.LuaTable));

                    string gen_ret = XLua.TemplateEngine.LuaTemplate.Execute(_compiledTemplate, _parameters);
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLua.TemplateEngine.LuaTemplate.Execute!"));
        }
Esempio n. 15
0
        /// <summary>
        /// 初始化游戏状态机
        /// </summary>
        /// <returns></returns>
        public xc.Machine.State InitFSM()
        {
            m_GameMachine = new xc.Machine();

            xc.Machine.State init_state = new xc.GameInitState(m_GameMachine);

            XLua.LuaFunction initFSMFunc = LuaScriptMgr.Instance.GetLuaFunction("Main_InitFSM");
            if (initFSMFunc != null)
            {
                initFSMFunc.Call(m_GameMachine, init_state);
            }

            m_GameMachine.SetCurState(init_state);
            return(init_state);
        }
Esempio n. 16
0
    // Start is called before the first frame update
    private void Start()
    {
        env = new LuaEnv();
        env.DoString("require 'CallLua'");
        XLua.LuaTable gl = env.Global.Get <XLua.LuaTable>("gameUser");

        Debug.Log("luatable---" + gl.Get <string>("name"));

        //函数
        XLua.LuaFunction fun = gl.Get <XLua.LuaFunction>("Speak");
        fun.Call();
        XLua.LuaFunction fun1     = gl.Get <XLua.LuaFunction>("Caculation");
        object[]         objarray = fun1.Call(gl, 2, 3);
        Debug.Log("result--" + objarray[0]);
    }
Esempio n. 17
0
 public static int SetImageSprite(Image image, string assetPath, XLua.LuaFunction onEnd, bool isSetSize)
 {
     return(ImageRefMonitorMono.Set(image, assetPath, (seq, refMono, i, s) => {
         if (seq == refMono.setOperaSeq)
         {
             i.sprite = s;
             if (isSetSize)
             {
                 i.SetNativeSize();
             }
         }
         if (null != onEnd)
         {
             onEnd.Call(seq, refMono, i, s);
         }
     }));
 }
Esempio n. 18
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <XLua.LuaEnv>(L, 3))
                {
                    int         _reference = LuaAPI.xlua_tointeger(L, 2);
                    XLua.LuaEnv _luaenv    = (XLua.LuaEnv)translator.GetObject(L, 3, typeof(XLua.LuaEnv));

                    XLua.LuaFunction gen_ret = new XLua.LuaFunction(_reference, _luaenv);
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to XLua.LuaFunction constructor!"));
        }
Esempio n. 19
0
        static int _m_BindClickEvent_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.GameObject _obj     = (UnityEngine.GameObject)translator.GetObject(L, 1, typeof(UnityEngine.GameObject));
                    XLua.LuaFunction       _luafunc = (XLua.LuaFunction)translator.GetObject(L, 2, typeof(XLua.LuaFunction));

                    XLuaFramework.UIHelper.BindClickEvent(_obj, _luafunc);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 20
0
        static int _m_SetLuaFunctionDelegate_xlua_st_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



            try {
                {
                    System.Collections.Generic.List <EventDelegate> list = (System.Collections.Generic.List <EventDelegate>)translator.GetObject(L, 1, typeof(System.Collections.Generic.List <EventDelegate>));
                    XLua.LuaFunction func = (XLua.LuaFunction)translator.GetObject(L, 2, typeof(XLua.LuaFunction));

                    LuaScriptUtil.SetLuaFunctionDelegate(list, func);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 21
0
        static int _m_Call(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.LuaFunction gen_to_be_invoked = (XLua.LuaFunction)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count >= 1 && (LuaTypes.LUA_TNONE == LuaAPI.lua_type(L, 2) || translator.Assignable <object>(L, 2)))
                {
                    object[] _args = translator.GetParams <object>(L, 2);

                    object[] gen_ret = gen_to_be_invoked.Call(_args);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && translator.Assignable <object[]>(L, 2) && translator.Assignable <System.Type[]>(L, 3))
                {
                    object[]      _args        = (object[])translator.GetObject(L, 2, typeof(object[]));
                    System.Type[] _returnTypes = (System.Type[])translator.GetObject(L, 3, typeof(System.Type[]));

                    object[] gen_ret = gen_to_be_invoked.Call(_args, _returnTypes);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLua.LuaFunction.Call!"));
        }
Esempio n. 22
0
    public void CreatePanel(string className, XLua.LuaFunction func = null)
    {
        Debug.Log("C# CreatePanel: " + className);

        //AssetBundle.LoadAsset();
        GameObject prefab = Resources.Load <GameObject>("Prefabs/" + className);

        GameObject go = Instantiate(prefab) as GameObject;

        go.name                    = className;
        go.layer                   = LayerMask.NameToLayer("Default");
        go.transform.parent        = Parent;
        go.transform.localScale    = Vector3.one;
        go.transform.localPosition = Vector3.zero;

        go.AddComponent <XLuaTest.LuaAdapter>();

        if (func != null)
        {
            func.Call(go);
        }
    }
Esempio n. 23
0
        static int _m_CreateDelegate_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string           _eventType = LuaAPI.lua_tostring(L, 1);
                    XLua.LuaFunction _func      = (XLua.LuaFunction)translator.GetObject(L, 2, typeof(XLua.LuaFunction));

                    System.Delegate gen_ret = XLuaMessenger.CreateDelegate(_eventType, _func);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 24
0
        static int _m_ToString(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.LuaFunction gen_to_be_invoked = (XLua.LuaFunction)translator.FastGetCSObj(L, 1);



                {
                    string gen_ret = gen_to_be_invoked.ToString(  );
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 25
0
        static int _m_SetExtension_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string           _url            = LuaAPI.lua_tostring(L, 1);
                    System.Type      _baseType       = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    XLua.LuaFunction _extendFunction = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction));

                    FairyGUI.LuaUIHelper.SetExtension(_url, _baseType, _extendFunction);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 26
0
        static int _m_LoadPrefabGameObject(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLuaFramework.ResourceManager gen_to_be_invoked = (XLuaFramework.ResourceManager)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TFUNCTION))
                {
                    string           _file_path = LuaAPI.lua_tostring(L, 2);
                    XLua.LuaFunction _func      = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction));

                    gen_to_be_invoked.LoadPrefabGameObject(_file_path, _func);



                    return(0);
                }
                if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    string _file_path = LuaAPI.lua_tostring(L, 2);

                    gen_to_be_invoked.LoadPrefabGameObject(_file_path);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLuaFramework.ResourceManager.LoadPrefabGameObject!"));
        }
        static int _m_Compile_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 1 && LuaTypes.LUA_TLIGHTUSERDATA == LuaAPI.lua_type(L, 1))
                {
                    System.IntPtr _L = LuaAPI.lua_touserdata(L, 1);

                    int gen_ret = XLua.TemplateEngine.LuaTemplate.Compile(_L);
                    LuaAPI.xlua_pushinteger(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && translator.Assignable <XLua.LuaEnv>(L, 1) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    XLua.LuaEnv _luaenv  = (XLua.LuaEnv)translator.GetObject(L, 1, typeof(XLua.LuaEnv));
                    string      _snippet = LuaAPI.lua_tostring(L, 2);

                    XLua.LuaFunction gen_ret = XLua.TemplateEngine.LuaTemplate.Compile(_luaenv, _snippet);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to XLua.TemplateEngine.LuaTemplate.Compile!"));
        }
Esempio n. 28
0
        static int _m_LuaLoadAsset_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int __gen_param_count = LuaAPI.lua_gettop(L);

                if (__gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TFUNCTION))
                {
                    string           assetName   = LuaAPI.lua_tostring(L, 1);
                    XLua.LuaFunction luaCallback = (XLua.LuaFunction)translator.GetObject(L, 2, typeof(XLua.LuaFunction));

                    LuaMVC.AssetLoader.LuaLoadAsset(assetName, luaCallback);



                    return(0);
                }
                if (__gen_param_count == 3 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TFUNCTION))
                {
                    string           assetFullName = LuaAPI.lua_tostring(L, 1);
                    string           assetName     = LuaAPI.lua_tostring(L, 2);
                    XLua.LuaFunction luaCallback   = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction));

                    LuaMVC.AssetLoader.LuaLoadAsset(assetFullName, assetName, luaCallback);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to LuaMVC.AssetLoader.LuaLoadAsset!"));
        }
Esempio n. 29
0
        static int _m_SetEnv(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.LuaFunction gen_to_be_invoked = (XLua.LuaFunction)translator.FastGetCSObj(L, 1);



                {
                    XLua.LuaTable _env = (XLua.LuaTable)translator.GetObject(L, 2, typeof(XLua.LuaTable));

                    gen_to_be_invoked.SetEnv(_env);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 30
0
 public object[] Call(string funcName, params object[] args)
 {
     XLua.LuaFunction f = mLuaModule.Get <string, XLua.LuaFunction>(funcName);
     if (f == null)
     {
         throw new XLua.LuaException("No lua function: " + funcName);
     }
     object[] allArgs;
     if (args == null)
     {
         allArgs = new object[1];
     }
     else
     {
         allArgs = new object[args.Length + 1];
         for (int i = 0; i < args.Length; i++)
         {
             allArgs[i + 1] = args[i];
         }
     }
     allArgs[0] = mLuaModule;
     return(f.Call(allArgs));
 }