public void init(Action<int> tick,Action complete,LuaSvrFlag flag=LuaSvrFlag.LSF_BASIC) { LuaState luaState = new LuaState(); IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); this.luaState = luaState; doinit(L, flag); complete(); checkTop(L); #else // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: // doBind(L); ThreadPool.QueueUserWorkItem(doBind, L); lgo.StartCoroutine(waitForBind(tick, () => { this.luaState = luaState; doinit(L,flag); complete(); checkTop(L); })); #endif }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { #if !SLUA_STANDALONE if (lgo == null #if UNITY_EDITOR && UnityEditor.EditorApplication.isPlaying #endif ) { lgo = new LuaSvrGameObject[luaState.Length]; for (int n = 0; n < luaState.Length; n++) { GameObject go = new GameObject("LuaStateProxy_" + n); lgo[n] = go.AddComponent <LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); } } #endif for (int n = 0; n < luaState.Length; n++) { IntPtr L = luaState[n].L; LuaObject.init(L); //#if SLUA_STANDALONE doBind(L); doinit(L, flag); complete(); checkTop(L); //#else // // be caurefull here, doBind Run in another thread // // any code access unity interface will cause deadlock. // // if you want to debug bind code using unity interface, need call doBind directly, like: // // doBind(L); //#if UNITY_EDITOR // if (!UnityEditor.EditorApplication.isPlaying) // { // doBind(L); // doinit(L, flag); // complete(); // checkTop(L); // } // else // { //#endif // ThreadPool.QueueUserWorkItem(doBind, L); // lgo[n].StartCoroutine(waitForBind(tick, () => // { // doinit(L, flag); // complete(); // checkTop(L); // })); //#if UNITY_EDITOR // } //#endif //#endif } }
// 必须在绑定完成后调用 public void onBindComplete(Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC | LuaSvrFlag.LSF_EXTLIB) { // lua状态 IntPtr L = this.luaState.L; doinit(L, flag); complete(); checkTop(L); }
public void reset(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { LuaTimer.delAll(); for (int n = 0; n < luaState.Length; n++) { luaState[n].Close(); luaState[n] = new LuaState(); } init(tick, complete, flag); }
public void reset(Action<int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { LuaTimer.delAll(); for (int i = 0; i < this.luaState.Length; i++) { this.luaState[i].Close(); this.luaState[i] = new LuaState(); } this.init(tick, complete, flag); }
/** * Initialize lua environment. * * @param Action<int> cProgress - The callback event for bind each C# classes, datatypes and functions. The parameter 'int' indicates the current progress. * @param Action cComplete - The callback event when all binding have beening completed. * @param LuaSvrFlag eFlag - The slua init flag, can be combined. * @return bool - true if lua can be initialized, otherwise false. */ public bool Initialize(Action <int> cProgress, Action cComplete, LuaSvrFlag eFlag = LuaSvrFlag.LSF_BASIC) { if (null == cComplete) { Debug.LogError("You should give a lua bind complete delegate!"); return(false); } init(cProgress, () => { OnBindLuaComplete(); cComplete(); }, eFlag); return(true); }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC | LuaSvrFlag.LSF_EXTLIB) { IntPtr L = luaState.L; LuaObject.init(L); luaState.lgo.StartCoroutine(doBind(L, tick, () => { doinit(luaState, flag); complete(); luaState.checkTop(); })); }
public void init(Action<int> tick,Action complete,LuaSvrFlag flag=LuaSvrFlag.LSF_BASIC) { #if !SLUA_STANDALONE if (lgo == null #if UNITY_EDITOR && UnityEditor.EditorApplication.isPlaying #endif ) { GameObject go = new GameObject("LuaSvrProxy"); lgo = go.AddComponent<LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); } #endif IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); doinit(L, flag); complete(); checkTop(L); #else // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: // doBind(L); #if UNITY_EDITOR if (!UnityEditor.EditorApplication.isPlaying) { doBind(L); doinit(L, flag); complete(); checkTop(L); } else { #endif ThreadPool.QueueUserWorkItem(doBind, L); lgo.StartCoroutine(waitForBind(tick, () => { doinit(L, flag); complete(); checkTop(L); })); #if UNITY_EDITOR } #endif #endif }
protected void doinit(LuaState L, LuaSvrFlag flag) { L.openSluaLib(); if ((flag & LuaSvrFlag.LSF_EXTLIB) != 0) { L.openExtLib(); } if ((flag & LuaSvrFlag.LSF_3RDDLL) != 0) { Lua3rdDLL.open(L.L); } }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { #if !SLUA_STANDALONE if (lgo == null #if UNITY_EDITOR && UnityEditor.EditorApplication.isPlaying #endif ) { GameObject go = new GameObject("LuaSvrProxy"); lgo = go.AddComponent <LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); } #endif IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); doinit(L, flag); complete(); checkTop(L); #else // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: // doBind(L); #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) { doBind(L); doinit(L, flag); complete(); checkTop(L); } else { #endif ThreadPool.QueueUserWorkItem(doBind, L); lgo.StartCoroutine(waitForBind(tick, () => { doinit(L, flag); complete(); checkTop(L); })); #if UNITY_EDITOR } #endif #endif }
protected void DoInit(LuaState state, LuaSvrFlag flag) { state.OpenLibrary(); LuaValueType.Register(state.StatePointer); if ((flag & LuaSvrFlag.LSF_EXTLIB) != 0) { state.OpenExternalLibrary(); } if ((flag & LuaSvrFlag.LSF_3RDDLL) != 0) { Lua3rdDLL.Open(state.StatePointer); } }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { #if !SLUA_STANDALONE if (lgo == null #if UNITY_EDITOR && UnityEditor.EditorApplication.isPlaying #endif ) { GameObject go = new GameObject("LuaSvrProxy"); lgo = go.AddComponent <LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); } #endif IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); doinit(L, flag); complete(); checkTop(L); #else #if UNITY_EDITOR if (!UnityEditor.EditorApplication.isPlaying) { doBind(L); doinit(L, flag); complete(); checkTop(L); } else { #endif lgo.StartCoroutine(doBind(L, tick, () => { doinit(L, flag); complete(); checkTop(L); })); #if UNITY_EDITOR } #endif #endif }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { LuaState luaState = new LuaState(); IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); this.luaState = luaState; doinit(L, flag); complete(); checkTop(L); #else lgo.openDebug = (flag & LuaSvrFlag.LSF_DEBUG) != 0; // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: // doBind(L); ThreadPool.QueueUserWorkItem(doBind, L); lgo.StartCoroutine(waitForBind(tick, () => { this.luaState = luaState; doinit(L, flag); if (lgo.openDebug) { lgo.StartCoroutine(waitForDebugConnection(() => { complete(); checkTop(L); })); } else { complete(); checkTop(L); } })); #endif }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { #if !SLUA_STANDALONE if (lgo == null && (!SLuaSetting.IsEditor || SLuaSetting.IsPlaying)) { GameObject go = new GameObject("LuaSvrProxy"); lgo = go.AddComponent <LuaSvrGameObject>(); GameObject.DontDestroyOnLoad(go); } #endif IntPtr L = luaState.L; LuaObject.init(L); #if SLUA_STANDALONE doBind(L); doinit(L, flag); complete(); checkTop(L); #else // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: // doBind(L); if (SLuaSetting.IsEditor && !SLuaSetting.IsPlaying) { doBind(L); doinit(L, flag); complete(); checkTop(L); } else { lgo.StartCoroutine(doBind(L, tick, () => { doinit(L, flag); complete(); checkTop(L); })); } #endif }
public void init(Action<int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { if (LuaSvr.lgo == null) { LuaSvr.lgo = new LuaSvrGameObject[this.luaState.Length]; for (int i = 0; i < this.luaState.Length; i++) { GameObject gameObject = new GameObject("LuaStateProxy_" + i); LuaSvr.lgo[i] = gameObject.AddComponent<LuaSvrGameObject>(); UnityEngine.Object.DontDestroyOnLoad(gameObject); } } for (int j = 0; j < this.luaState.Length; j++) { IntPtr l = this.luaState[j].L; LuaObject.init(l); this.doBind(l); this.doinit(l, flag); complete(); this.checkTop(l); } }
protected void doinit(IntPtr L, LuaSvrFlag flag) { #if !SLUA_STANDALONE LuaTimer.reg(L); #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) #endif LuaCoroutine.reg(L, lgo); #endif Lua_SLua_ByteArray.reg(L); Helper.reg(L); LuaValueType.reg(L); if ((flag & LuaSvrFlag.LSF_EXTLIB) != 0) { LuaDLL.luaS_openextlibs(L); LuaSocketMini.reg(L); } if ((flag & LuaSvrFlag.LSF_3RDDLL) != 0) { Lua3rdDLL.open(L); } #if !SLUA_STANDALONE #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) { #endif lgo.state = luaState; lgo.onUpdate = this.tick; lgo.init(); #if UNITY_EDITOR } #endif #endif inited = true; }
void doinit(IntPtr L, LuaSvrFlag flag) { #if !SLUA_STANDALONE LuaTimer.reg(L); #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) #endif LuaCoroutine.reg(L, lgo[0]); #endif Helper.reg(L); LuaValueType.reg(L); // if ((flag & LuaSvrFlag.LSF_EXTLIB) != 0) LuaDLL.puaS_openextlibs(L); if ((flag & LuaSvrFlag.LSF_3RDDLL) != 0) { Lua3rdDLL.open(L); } #if !SLUA_STANDALONE #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) { #endif for (int n = 0; n < luaState.Length; n++) { lgo[n].state = luaState[n]; lgo[n].onUpdate = this.tick; lgo[n].init(); } #if UNITY_EDITOR } #endif #endif inited = true; }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC | LuaSvrFlag.LSF_EXTLIB) { IntPtr L = mainState.L; LuaObject.init(L); if (SLuaSetting.IsEditor && !SLuaSetting.IsPlaying) { doBind(L); doinit(mainState, flag); complete(); mainState.checkTop(); } else { mainState.lgo.StartCoroutine(doBind(L, tick, () => { doinit(mainState, flag); complete(); mainState.checkTop(); })); } }
private void _doinit(IntPtr _luaState, LuaSvrFlag _flag) { //LuaTimer.reg( _luaState ); #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) #endif LuaCoroutine.reg(_luaState, this); SLua.Helper.reg(_luaState); if (SLuaSetting.Instance.useLuaValueType) { LuaValueType.reg(_luaState); } if ((_flag & LuaSvrFlag.LSF_EXTLIB) != 0) { LuaDLL.luaS_openextlibs(_luaState); } if ((_flag & LuaSvrFlag.LSF_3RDDLL) != 0) { Lua3rdDLL.open(_luaState); } Inited = true; }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC, bool useTick = true) { LuaState luaState = new LuaState(); IntPtr L = luaState.L; LuaObject.init(L); //#if SLUA_STANDALONE doBind(L); //LuaDLL.init_profiler(L); this.luaState = luaState; doinit(L, flag, useTick); if (complete != null) { complete(); } checkTop(L); //#else // be caurefull here, doBind Run in another thread // any code access unity interface will cause deadlock. // if you want to debug bind code using unity interface, need call doBind directly, like: //doBind(L); // ThreadPool.QueueUserWorkItem(doBind, L); // lgo.StartCoroutine(waitForBind(tick, () => // { // this.luaState = luaState; // doinit(L,flag); // complete(); // checkTop(L); // })); //#endif }
void doinit(IntPtr L,LuaSvrFlag flag) { #if !SLUA_STANDALONE LuaTimer.reg(L); LuaCoroutine.reg(L, lgo); #endif Helper.reg(L); LuaValueType.reg(L); if((flag&LuaSvrFlag.LSF_EXTLIB)!=0) LuaDLL.luaS_openextlibs(L); if((flag&LuaSvrFlag.LSF_3RDDLL)!=0) Lua3rdDLL.open(L); #if !SLUA_STANDALONE lgo.state = luaState; lgo.onUpdate = this.tick; lgo.init(); #endif inited = true; }
void doinit(IntPtr L,LuaSvrFlag flag) { LuaTimer.reg(L); LuaCoroutine.reg(L, lgo); Helper.reg(L); LuaValueType.reg(L); if((flag&LuaSvrFlag.LSF_DEBUG)!=0) SLuaDebug.reg(L); if((flag&LuaSvrFlag.LSF_EXTLIB)!=0) LuaDLL.luaS_openextlibs(L); if((flag&LuaSvrFlag.LSF_3RDDLL)!=0) Lua3rdDLL.open(L); lgo.state = luaState; lgo.onUpdate = this.tick; lgo.init(); inited = true; }
private Action <IntPtr>[] getBindList(Assembly assembly, string ns) => default; // 0x00C9DEB0-0x00C9E020 protected void doinit(IntPtr L, LuaSvrFlag flag) { } // 0x00C9E020-0x00C9E1F0
void doinit(IntPtr L,LuaSvrFlag flag) { #if !SLUA_STANDALONE LuaTimer.reg(L); LuaCMDHelper.reg(L); #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) #endif LuaCoroutine.reg(L, lgo); #endif Helper.reg(L); LuaValueType.reg(L); if((flag&LuaSvrFlag.LSF_EXTLIB)!=0) LuaDLL.luaS_openextlibs(L); if((flag&LuaSvrFlag.LSF_3RDDLL)!=0) Lua3rdDLL.open(L); #if !SLUA_STANDALONE #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying) { #endif lgo.state = luaState; lgo.onUpdate = this.tick; lgo.init(); #if UNITY_EDITOR } #endif #endif inited = true; }
} // 0x00C9F3F0-0x00C9F4D0 public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_EXTLIB /* Metadata: 0x00613F35 */) { } // 0x00C9F4D0-0x00C9F6E0
/** * Initialize lua environment. * * @param Action<int> cProgress - The callback event for bind each C# classes, datatypes and functions. The parameter 'int' indicates the current progress. * @param Action cComplete - The callback event when all binding have beening completed. * @param LuaSvrFlag eFlag - The slua init flag, can be combined. * @return bool - true if lua can be initialized, otherwise false. */ public bool Initialize(Action<int> cProgress, Action cComplete, LuaSvrFlag eFlag = LuaSvrFlag.LSF_BASIC) { if (null == cComplete) { Debug.LogError("You should give a lua bind complete delegate!"); return false; } init(cProgress, () => {OnBindLuaComplete(); cComplete();}, eFlag); return true; }