public void init(Action <int> tick, Action complete, bool debug = false) { LuaState luaState = new LuaState(); IntPtr L = luaState.L; LuaObject.init(L); ThreadPool.QueueUserWorkItem(doBind, L); lgo.StartCoroutine(waitForBind(tick, () => { this.luaState = luaState; doinit(L); if (debug) { lgo.StartCoroutine(waitForDebugConnection(() => { complete(); checkTop(L); })); } else { complete(); checkTop(L); } })); }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC) { LuaState luaState = new LuaState(); IntPtr L = luaState.L; LuaObject.init(L); 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); } })); }
public void init(Action <int> tick, Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_3RDDLL) { 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 ) { 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 }
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) { #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 }