static int OpenZbsDebugger(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); obj.OpenZbsDebugger(); return(0); } else if (count == 2) { LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.OpenZbsDebugger(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.LuaManager.OpenZbsDebugger")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CallLuaPlaySound(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.CallLuaPlaySound(arg0); return(0); } else if (count == 3) { LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); obj.CallLuaPlaySound(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.LuaManager.CallLuaPlaySound")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_mInst(IntPtr L) { try { LuaFramework.LuaManager arg0 = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 2); LuaFramework.LuaManager.mInst = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LuaGC(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.LuaManager)); obj.LuaGC(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Close(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); obj.Close(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetLuaState(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); LuaInterface.LuaState o = obj.GetLuaState(); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int OnLevelLoaded(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.OnLevelLoaded(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CallReceiveCallBack(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); ByteArray arg0 = (ByteArray)ToLua.CheckObject <ByteArray>(L, 2); obj.CallReceiveCallBack(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int InitStart(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); System.Action arg0 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 2); obj.InitStart(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int DoFile(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.DoFile(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetTable(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.LuaManager)); string arg0 = ToLua.CheckString(L, 2); LuaInterface.LuaTable o = obj.GetTable(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_bundleProgress(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; LuaFramework.LuaManager.OnBundleProgressChanged ret = obj.bundleProgress; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index bundleProgress on a nil value")); } }
void OnInitialize() { //return; Debug.Log(" OnInitialize Manager/Game"); LuaManager.InitStart(); Debug.Log("Manager/Game"); LuaManager.DoFile("Manager/Game"); //加载游戏 LuaManager.DoFile("Manager/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 GameSceneManager.OnInit(); initialize = true; //ResManager.LoadGameObject("prefab/12321132/Cube.prefab", delegate(UnityEngine.Object[] objs) //{ // Debug.Log("load sucess!!!!"); //}); ////类对象池测试 //var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); ////方法1 ////objPool.Release(new TestObjectClass("abcd", 100, 200f)); ////var testObj1 = objPool.Get(); ////方法2 //ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = ObjPoolManager.Get<TestObjectClass>(); //Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); ////游戏对象池测试 //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; //var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); //var gameObj = Instantiate(prefab) as GameObject; //gameObj.name = "TestGameObject_01"; //gameObj.transform.localScale = Vector3.one; //gameObj.transform.localPosition = Vector3.zero; //ObjPoolManager.Release("TestGameObject", gameObj); //var backObj = ObjPoolManager.Get("TestGameObject"); //backObj.transform.SetParent(null); //Debug.Log("TestGameObject--->>>" + backObj); }
static int set_IsLoading(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.IsLoading = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsLoading on a nil value")); } }
static int get_LuaManager(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.GameManager obj = (LuaFramework.GameManager)o; LuaFramework.LuaManager ret = obj.LuaManager; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index LuaManager on a nil value")); } }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/MainLua"); NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 Debug.LogError("测试输出"); Util.CallMethod("MainLua", "Prints", "11111"); initialize = true; //类对象池测试 var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); if (backObj != null) { backObj.transform.SetParent(null); } Debug.Log("TestGameObject--->>>" + backObj); }
static int get_delCreator(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; LuaInterface.IDelegateCreator ret = obj.delCreator; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index delCreator on a nil value")); } }
static int get_mainLua(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; LuaInterface.LuaState ret = obj.mainLua; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mainLua on a nil value")); } }
static int set_delCreator(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; LuaInterface.IDelegateCreator arg0 = (LuaInterface.IDelegateCreator)ToLua.CheckObject <LuaInterface.IDelegateCreator>(L, 2); obj.delCreator = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index delCreator on a nil value")); } }
static int set_bundleProgress(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; LuaFramework.LuaManager.OnBundleProgressChanged arg0 = (LuaFramework.LuaManager.OnBundleProgressChanged)ToLua.CheckDelegate <LuaFramework.LuaManager.OnBundleProgressChanged>(L, 2); obj.bundleProgress = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index bundleProgress on a nil value")); } }
void OnInitialize() { LuaManager.InitStart(); LuaBehaviour.initialize = true; LuaManager.DoFile("Main"); //加载游戏 //LuaManager.DoFile("Logic/Network"); //加载网络 //NetManager.OnInit(); //初始化网络 Util.CallMethod("Main", "main"); //初始化完成 // 初始化数据db DbLoader.init(); // 初始化mgr gameObject.AddComponent <MgrScene>(); gameObject.AddComponent <MgrPanel>(); gameObject.AddComponent <MgrTimer>(); }
void test() { ByteBuffer temp = new ByteBuffer(); temp.WriteString("UTF-8 现在是测试随便传"); temp.WriteString("Hello world"); temp.WriteInt(108); //temp.Close(); ByteBuffer tempR = new ByteBuffer(temp.ToBytes()); //Debug.Log(tempR.ReadInt()); //Debug.Log(tempR.ReadString()); LuaManager.CallLuaFunction <int, ByteBuffer>("Network.OnSocket", 19000, tempR); //LuaManager.DoFile("ui/test/test"); //Util.CallMethod("Test", "FuncTest", tempR); //初始化完成 }
static int get_IsLoading(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)o; bool ret = obj.IsLoading; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsLoading on a nil value")); } }
static int CallFunction(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.LuaManager)); string arg0 = ToLua.CheckString(L, 2); object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2); object[] o = obj.CallFunction(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CallMethod(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); object[] arg2 = ToLua.ToParamsObject(L, 4, count - 3); obj.CallMethod(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/ObjectPool"); NetManager.OnInit(); //初始化网络 ObjPoolManager.OnInit(); //初始化对象池 Util.CallMethod("Game", "OnInitOK", isReload); //初始化完成 initialize = true; //RenderTexture tex = new RenderTexture(128, 128, 1, RenderTextureFormat.ARGB32); //Texture2D texture2D = new Texture2D(256, 256); //texture2D.ReadPixels() //Sprite sprite = Sprite.Create(tx, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); //类对象池测试 // var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 //ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = ObjPoolManager.Get<TestObjectClass>(); //Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; //var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); //var gameObj = Instantiate(prefab) as GameObject; //gameObj.name = "TestGameObject_01"; //gameObj.transform.localScale = Vector3.one; //gameObj.transform.localPosition = Vector3.zero; //ObjPoolManager.Release("TestGameObject", gameObj); //var backObj = ObjPoolManager.Get("TestGameObject"); //backObj.transform.SetParent(null); //Debug.Log("TestGameObject--->>>" + backObj); }
void OnInitialize() { //此处无更新和解压缩时此处来设置载入界面不需要加载 CreateLoading.need = false; CreateLoading.Destory(); LuaManager.InitStart(); // LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/FairyGUIGame"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("FairyGUIGame", "OnInitOK"); //初始化完成 initialize = true; //类对象池测试 var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); var testObj1 = ObjPoolManager.Get <TestObjectClass>(); Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); var gameObj = Instantiate(prefab) as GameObject; gameObj.name = "TestGameObject_01"; gameObj.transform.localScale = Vector3.one; gameObj.transform.localPosition = Vector3.zero; ObjPoolManager.Release("TestGameObject", gameObj); var backObj = ObjPoolManager.Get("TestGameObject"); backObj.transform.SetParent(null); Debug.Log("TestGameObject--->>>" + backObj); }
void OnInitialize() { //这里还应该有其他的东西需要设置 //要根据游戏的开发后期再加 LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 //初始化完成,调用lua脚本里面的OnInitOK方法 //游戏进入正常循环 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; #region 框架自动测试 对象池数据 //类对象池测试 // var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); //方法1 //objPool.Release(new TestObjectClass("abcd", 100, 200f)); //var testObj1 = objPool.Get(); //方法2 // ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); // var testObj1 = ObjPoolManager.Get<TestObjectClass>(); // Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); //游戏对象池测试 //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; //var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); //var gameObj = Instantiate(prefab) as GameObject; //gameObj.name = "TestGameObject_01"; //gameObj.transform.localScale = Vector3.one; //gameObj.transform.localPosition = Vector3.zero; //ObjPoolManager.Release("TestGameObject", gameObj); //var backObj = ObjPoolManager.Get("TestGameObject"); //backObj.transform.SetParent(null); //Debug.Log("TestGameObject--->>>" + backObj); #endregion }
public void Init(LuaTable tb) { LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua); mLuaState = luaMgr.GetLuaState(); if (mLuaState == null) { return; } if (tb == null) { mLuaTable = mLuaState.GetTable(name); } else { mLuaTable = tb; } if (mLuaTable == null) { Debug.LogWarning("mLuaTable is null:" + name); return; } mLuaTable["gameObject"] = gameObject; mLuaTable["transform"] = transform; mLuaTable["lua_behaviour"] = this; LuaFunction awakeFunc = mLuaTable.GetLuaFunction("Awake") as LuaFunction; if (awakeFunc != null) { awakeFunc.BeginPCall(); awakeFunc.Push(mLuaTable); awakeFunc.PCall(); awakeFunc.EndPCall(); awakeFunc.Dispose(); awakeFunc = null; } mUpdateFunc = mLuaTable.GetLuaFunction("Update") as LuaFunction; mFixedUpdateFunc = mLuaTable.GetLuaFunction("FixedUpdate") as LuaFunction; mLateUpdateFunc = mLuaTable.GetLuaFunction("LateUpdate") as LuaFunction; }
void OnInitialize() { LuaManager.InitStart(); //LuaManager.DoFile("Logic/Game"); //加载游戏 //LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 /* * Util.CallMethod("Game", "OnInitOK"); //初始化完成 * * initialize = true; * * //类对象池测试 * var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement); * //方法1 * //objPool.Release(new TestObjectClass("abcd", 100, 200f)); * //var testObj1 = objPool.Get(); * * //方法2 * ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f)); * var testObj1 = ObjPoolManager.Get<TestObjectClass>(); * * Debugger.Log("TestObjectClass--->>>" + testObj1.ToString()); * * //游戏对象池测试 * var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject; * var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab); * * var gameObj = Instantiate(prefab) as GameObject; * gameObj.name = "TestGameObject_01"; * gameObj.transform.localScale = Vector3.one; * gameObj.transform.localPosition = Vector3.zero; * * ObjPoolManager.Release("TestGameObject", gameObj); * var backObj = ObjPoolManager.Get("TestGameObject"); * if (backObj != null) * { * backObj.transform.SetParent(null); * } * * Debug.Log("TestGameObject--->>>" + backObj); */ }