static public int set_OnQuitEvent(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); GameFramework.MyClientThreadEventDelegate v; int op = LuaDelegation.checkDelegate(l, 2, out v); if (op == 0) { self.OnQuitEvent = v; } else if (op == 1) { self.OnQuitEvent += v; } else if (op == 2) { self.OnQuitEvent -= v; } pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_Thread(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); pushValue(l, true); pushValue(l, self.Thread); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int ClearPool(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); self.ClearPool(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int DebugPoolCount(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); GameFramework.MyAction <System.String> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.DebugPoolCount(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_ActionNumPerTick(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); int v; checkType(l, 2, out v); self.ActionNumPerTick = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int QueueAction(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); GameFramework.MyAction a1; LuaDelegation.checkDelegate(l, 2, out a1); self.QueueAction(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public void ClearPool(int clearOnSize) { if (m_IsPassive) { m_ActionQueue.ClearPool(clearOnSize); } else { for (int i = 0; i < m_ThreadNum; ++i) { MyClientThread thread = m_Threads[i]; thread.ClearPool(clearOnSize); } } }
public void DebugThreadActionCount(MyAction <string> output) { if (m_IsPassive) { output(string.Format("ActionCount {0}", m_ActionQueue.CurActionNum)); } else { for (int i = 0; i < m_ThreadNum; ++i) { MyClientThread t = m_Threads[i]; output(string.Format("ThreadActionCount {0} {1}", t.Thread.ManagedThreadId, t.CurActionNum)); } } }
static public int QueueActionWithDelegation(IntPtr l) { try { GameFramework.MyClientThread self = (GameFramework.MyClientThread)checkSelf(l); System.Delegate a1; checkType(l, 2, out a1); System.Object[] a2; checkParams(l, 3, out a2); self.QueueActionWithDelegation(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public void DebugPoolCount(MyAction <string> output) { if (m_IsPassive) { m_ActionQueue.DebugPoolCount((string msg) => { output(string.Format("ActionQueue {0}", msg)); }); } else { for (int i = 0; i < m_ThreadNum; ++i) { MyClientThread t = m_Threads[i]; t.DebugPoolCount((string msg) => { output(string.Format("ThreadActionQueue {0} {1}", t.Thread.ManagedThreadId, msg)); }); } } }
private void InitTaskThreads(int threadNum, bool isPassive, int tickSleepTime, int actionNumPerTick) { if (isPassive) { m_ActionQueue = new ClientAsyncActionProcessor(); } m_Threads = new MyClientThread[threadNum]; for (int i = 0; i < threadNum; ++i) { MyClientThread thread = null; if (isPassive) { thread = new MyClientThread(tickSleepTime, actionNumPerTick, m_ActionQueue);//线程主动取策略 } else { thread = new MyClientThread(tickSleepTime, actionNumPerTick);//dispatcher主动推策略 } m_Threads[i] = thread; thread.Start(); } }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); GameFramework.MyClientThread o; if (argc == 1) { o = new GameFramework.MyClientThread(); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int))) { System.Int32 a1; checkType(l, 2, out a1); o = new GameFramework.MyClientThread(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); o = new GameFramework.MyClientThread(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(GameFramework.ClientAsyncActionProcessor))) { GameFramework.ClientAsyncActionProcessor a1; checkType(l, 2, out a1); o = new GameFramework.MyClientThread(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(GameFramework.ClientAsyncActionProcessor))) { System.Int32 a1; checkType(l, 2, out a1); GameFramework.ClientAsyncActionProcessor a2; checkType(l, 3, out a2); o = new GameFramework.MyClientThread(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 4) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); GameFramework.ClientAsyncActionProcessor a3; checkType(l, 4, out a3); o = new GameFramework.MyClientThread(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }