/// <summary> /// 资源初始化结束 /// </summary> public void OnResourceInited() { uluaManager = new LuaScriptMgr(); uluaManager.Start(); uluaManager.DoFile("logic/game"); //加载游戏 uluaManager.DoFile("logic/network"); //加载网络 ioo.networkManager.OnInit(); //初始化网络 object[] panels = CallMethod("LuaScriptPanel"); //---------------------Lua面板--------------------------- foreach (object o in panels) { string name = o.ToString().Trim(); if (string.IsNullOrEmpty(name)) { continue; } name += "Panel"; //添加 uluaManager.DoFile("logic/" + name); Debug.LogWarning("LoadLua---->>>>" + name + ".lua"); } //------------------------------------------------------------ CallMethod("OnInitOK"); //初始化完成 }
/// <summary> /// 资源初始化结束 /// </summary> private IEnumerator OnResourceInited() { // 先加载AssetBundleManifest yield return(StartCoroutine(ioo.resourceManager.LoadAssetBundleManifest())); uluaMgr = new LuaScriptMgr(); uluaMgr.Start(); uluaMgr.DoFile("logic/game"); //加载游戏 uluaMgr.DoFile("logic/network"); //加载网络 ioo.networkManager.OnInit(); //初始化网络 object[] panels = CallMethod("LuaScriptPanel"); //---------------------Lua面板--------------------------- foreach (object o in panels) { string name = o.ToString().Trim(); if (string.IsNullOrEmpty(name)) { continue; } name += "Panel"; //添加 uluaMgr.DoFile("logic/" + name); Debug.LogWarning("LoadLua---->>>>" + name + ".lua"); } //------------------------------------------------------------ CallMethod("OnInitOK"); //初始化完成*/ }
// Use this for initialization void Start() { //打开lua state m_LuaMgr = new LuaScriptMgr(); m_LuaMgr.DoFile("System/Wrap.lua"); m_LuaMgr.DoFile("Common/library.lua"); m_LuaMgr.DoFile("Common/debugger.lua"); m_LuaMgr.DoFile("main.lua"); }
private LuaScriptMgr NewLua(params string[] LuaNames) { LuaScriptMgr lua = new LuaScriptMgr(); lua.DoFile("define"); foreach (string luaName in LuaNames) { //直接读文件二进制码,后续加密在DoFile里面 lua.DoFile(luaName); } return(lua); }
public void TestCSV() { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaParseTable.lua"); TextAsset textAsset = Resources.Load <TextAsset>("Table/Chat"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("LuaParseTable.chat"); luaFunction.Call(new object[] { textAsset.text }); textAsset = Resources.Load <TextAsset>("Table/FashionRank"); luaFunction = luaScriptMgr.GetLuaFunction("LuaParseTable.rank"); luaFunction.Call(new object[] { textAsset.text }); textAsset = Resources.Load <TextAsset>("Table/CampInfo"); luaFunction = luaScriptMgr.GetLuaFunction("LuaParseTable.camp"); luaFunction.Call(new object[] { textAsset.text }); textAsset = Resources.Load <TextAsset>("Table/EquipList"); luaFunction = luaScriptMgr.GetLuaFunction("LuaParseTable.equip"); luaFunction.Call(new object[] { textAsset.text }); luaFunction = luaScriptMgr.GetLuaFunction("LuaParseTable.read"); luaFunction.Call(); luaFunction.Release(); }
private void OnClick() { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaDel.lua"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("decoder"); luaFunction.Call(new object[] { base.gameObject }); base.gameObject.GetComponent("LuaTestDel"); if (this.onClick != null) { this.onClick(); } else { Debug.Log("onClick is null"); } if (this.onEvClick != null) { this.onEvClick(base.gameObject); } else { Debug.Log("oneveclick is null"); } }
private void Start() { LuaScriptMgr luaScriptMgr = new LuaScriptMgr(); luaScriptMgr.Start(); luaScriptMgr.DoFile("debugger"); }
void Awake() { luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("Test.Lua"); }
void Start () { if (!Util.CheckEnvironment()) return; luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("System.Test"); }
void Start() { //if (!Util.CheckEnvironment()) return; luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("System.Test"); }
// Use this for initialization void Start () { //LuaState l = new LuaState(); //LuaDLL.luaopen_socket_core(l.L); //l.DoFile("C:/Users/Administrator/Documents/New Unity Project/Assets/uLua/Lua/debugger.lua"); LuaScriptMgr mgr = new LuaScriptMgr(); mgr.Start(); mgr.DoFile("debugger"); }
public static object[] FetchRegistID() { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaNotifyProcess.lua"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("LuaNotifyProcess.FetchRegistedID"); return(luaFunction.Call()); }
public void DoFile(string filename) { string fullName = Util.LuaPath(filename); if (File.Exists(fullName)) { UITools.Compile(fullName); } luaMgr.DoFile(filename); }
static int DoFile(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); LuaScriptMgr obj = LuaScriptMgr.GetNetObject <LuaScriptMgr>(L, 1); string arg0 = LuaScriptMgr.GetLuaString(L, 2); object[] o = obj.DoFile(arg0); LuaScriptMgr.PushArray(L, o); return(1); }
// Use this for initialization void Start() { //LuaState l = new LuaState(); //LuaDLL.luaopen_socket_core(l.L); //l.DoFile("C:/Users/Administrator/Documents/New Unity Project/Assets/uLua/Lua/main.lua"); LuaScriptMgr mgr = new LuaScriptMgr(); mgr.Start(); mgr.DoFile("main"); }
/// <summary> /// 资源初始化结束 /// </summary> public void OnResourceInited() { uluaManager = new LuaScriptMgr(); uluaManager.Start(); uluaManager.DoFile("logic/game"); //加载游戏 uluaManager.DoFile("logic/network"); //加载网络 ioo.networkManager.OnInit(); //初始化网络 object[] panels = CallMethod("LuaScriptPanel"); //---------------------Lua面板--------------------------- foreach (object o in panels) { string name = o.ToString().Trim(); if (string.IsNullOrEmpty(name)) continue; name += "Panel"; //添加 uluaManager.DoFile("logic/" + name); Debug.LogWarning("LoadLua---->>>>" + name + ".lua"); } //------------------------------------------------------------ CallMethod("OnInitOK"); //初始化完成 }
public static void CallOnline(uint index, bool canclaim) { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaSystemActivityDlg.lua"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("LuaSystemActivityDlg.OnXkcbOnline"); luaFunction.Call(new object[] { index, canclaim }); }
public static void CallNextDay(uint status, uint time) { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaSystemActivityDlg.lua"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("LuaSystemActivityDlg.OnXkcbStatus"); luaFunction.Call(new object[] { status, time }); }
public static void NotifyRoute(uint _type, byte[] bytes, int length) { LuaScriptMgr luaScriptMgr = HotfixManager.Instance.GetLuaScriptMgr(); luaScriptMgr.DoFile("LuaNotifyProcess.lua"); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("LuaNotifyProcess.Process"); luaFunction.Call(new object[] { _type, Hotfix.LuaProtoBuffer(bytes, length), length }); }
private void Start() { LuaScriptMgr luaScriptMgr = new LuaScriptMgr(); luaScriptMgr.Start(); TestProtolWrap.Register(luaScriptMgr.GetL()); luaScriptMgr.DoFile("3rd/pblua/person_pb.lua"); luaScriptMgr.DoString(this.script); LuaFunction luaFunction = luaScriptMgr.GetLuaFunction("encoder"); luaFunction.Call(); luaFunction.Release(); luaFunction = luaScriptMgr.GetLuaFunction("decoder"); luaFunction.Call(); luaFunction.Release(); }
//实际应用如Socket.Send(LuaStringBuffer lsb)函数(功能发送lsb.buffer) , 在lua中调用Socket.Send(pb_data) //读取协议 Socket.PeekMsgPacket() {return MsgPacket}; lua 中,取协议字节流 MsgPacket.data void Start() { LuaScriptMgr mgr = new LuaScriptMgr(); mgr.Start(); TestProtolWrap.Register(mgr.GetL()); mgr.DoFile("3rd/pblua/person_pb.lua"); mgr.DoString(script); LuaFunction func = mgr.GetLuaFunction("encoder"); func.Call(); func.Release(); func = mgr.GetLuaFunction("decoder"); func.Call(); func.Release(); }
/// <summary> /// 释放资源 /// </summary> public void CheckExtractResource() { string path = Application.persistentDataPath + "/Game/"; bool isExists = Directory.Exists(path) && Directory.Exists(path + "lua/") && File.Exists(path + "files.txt"); if (isExists) { luaMgr = new LuaScriptMgr(); luaMgr.DoFile("Game/Login"); luaMgr.Start(); luaMgr.CallLuaFunction("GetUI", this.gameObject); print("-----------文件已经解压过了-----------"); return; //文件已经解压过了,自己可添加检查文件列表逻辑 } StartCoroutine(OnExtractResource()); //启动释放协成 }
/// <summary> /// 资源初始化结束,现在是在VersionManager的自动更新过程结束后被调用 /// </summary> public void OnResourceInited() { ioo.resourceManager.initialize(); //因为声音管理初始化资源有依赖于ResourceManager的部分,所以推迟到这里初始化 Lorry //Util.AddComponent<AudioManager>(gameObject); uluaMgr = new LuaScriptMgr(); uluaMgr.Start(); uluaMgr.DoFile("start"); //加载游戏 //------------------------------------------------------------ //GameObject inputRootGO = Instantiate(Resources.Load("Prefabs/InputRoot", typeof(GameObject))) as GameObject; //inputManager = inputRootGO.GetComponent<InputRoot>(); //ioo.networkManager.SendConnect (); //gameObject.AddComponent<Fight>(); CallMethod("OnInitOK"); //初始化完成 Log.PrintMsg("Call OnInitOK! "); }
protected override void Init() { Screen.sleepTimeout = SleepTimeout.NeverSleep; LuaScriptMgr umgr = new LuaScriptMgr(); umgr.Start(); umgr.DoFile("game"); //object[] tem = uluaMgr.CallLuaFunction("Map.New"); //LuaTable table = tem[0] as LuaTable; //table[1] = 22; //table[2] = 33; umgr.CallLuaFunction("GameManager.OnInit"); //LuaMessageTransmitter lt = (LuaMessageTransmitter)GTLib.NetManager.GetTransmitter("test"); //lt.Call("Connect"); }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 120, 50), "Test")) { lua.DoFile("Test.Lua"); float time = Time.realtimeSinceStartup; for (int i = 0; i < 10000; i++) { transform.position = Vector3.one; } Debug.Log("c# cost time: " + (Time.realtimeSinceStartup - time)); time = Time.realtimeSinceStartup; lua.CallLuaFunction("Test", transform); Debug.Log("lua cost time: " + (Time.realtimeSinceStartup - time)); } }
/// <summary> /// 加载所有的LUA文件 /// </summary> private void LoadLuaFiles() { m_dicLuaFiles = new Dictionary <string, string>(); IEnumerator enumerator = XMLManager.LuaScripts.Data.Keys.GetEnumerator(); while (enumerator.MoveNext()) { string path = (string)enumerator.Current; if (path.EndsWith(".lua") == false) { path += ".lua"; } m_luaMgr.DoFile(path); string moduleName = Path.GetFileNameWithoutExtension(path); m_dicLuaFiles.Add(moduleName, path); } }
// Use this for initialization void Start () { luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("Logic.MyTest2"); luaFunc = luaMgr.GetLuaFunction("Test2"); }
//非反射调用 void Start () { mgr = new LuaScriptMgr(); mgr.Start(); mgr.DoFile("Logic.MyTest"); func = mgr.GetLuaFunction("Test"); }
void Start() { luaMgr.DoFile("Test.Lua"); }
void Start() { luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("System.Test"); }
private void Awake() { _lsm = getLuaScriptMgr(); _lsm.DoFile("Game.GameStart"); Debug.Log(File.ReadAllText(GameConfig.getBundlePath() + "/qixinpiaochong.manifest.meta")); }
void Start () { luaMgr = new LuaScriptMgr(); luaMgr.Start(); luaMgr.DoFile("System.Test"); }
/// <summary> /// 资源初始化结束 /// </summary> private IEnumerator OnResourceInited() { // 先加载AssetBundleManifest yield return StartCoroutine(ioo.resourceManager.LoadAssetBundleManifest()); uluaMgr = new LuaScriptMgr(); uluaMgr.Start(); uluaMgr.DoFile("logic/game"); //加载游戏 uluaMgr.DoFile("logic/network"); //加载网络 ioo.networkManager.OnInit(); //初始化网络 object[] panels = CallMethod("LuaScriptPanel"); //---------------------Lua面板--------------------------- foreach (object o in panels) { string name = o.ToString().Trim(); if (string.IsNullOrEmpty(name)) continue; name += "Panel"; //添加 uluaMgr.DoFile("logic/" + name); Debug.LogWarning("LoadLua---->>>>" + name + ".lua"); } //------------------------------------------------------------ CallMethod("OnInitOK"); //初始化完成*/ }