private void ActivationChanged(bool activated) { #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPaused) { return; } #endif if (activated) { if (!m_activated) { m_activated = true; TimeUtil.Update(); DispatchLuaEvent(EVENT_ACTIVATED); } } else { if (m_activated) { m_activated = false; TimeUtil.Update(); DispatchLuaEvent(EVENT_DEACTIVATED); } } }
void FixedUpdate() { TimeUtil.Update(); m_luaLoopHandler.BeginPCall(); m_luaLoopHandler.Push(EVENT_FIXED_UPDATE); m_luaLoopHandler.Push(TimeUtil.timeSec); m_luaLoopHandler.PCall(); m_luaLoopHandler.EndPCall(); }
void LateUpdate() { TimeUtil.Update(); m_luaLoopHandler.BeginPCall(); m_luaLoopHandler.Push(EVENT_LATE_UPDATE); m_luaLoopHandler.Push(TimeUtil.timeSec); m_luaLoopHandler.PCall(); m_luaLoopHandler.EndPCall(); }
void FixedUpdate() { #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPaused) { return; } #endif TimeUtil.Update(); DispatchLuaEvent(EVENT_FIXED_UPDATE); }
void Update() { TimeUtil.Update(); Timer.Update(); UdpSocket.Update(); // 执行需要在主线程运行的 Action lock (LOCK_OBJECT) { if (m_threadActions.Count > 0) { m_tempActions.AddRange(m_threadActions); m_threadActions.Clear(); } } if (m_tempActions.Count > 0) { foreach (Action action in m_tempActions) { try { action(); } catch (Exception e) { Logger.LogException(e); } } m_tempActions.Clear(); } // 执行网络相关回调 lock (LOCK_OBJECT) { if (m_netActions.Count > 0) { m_tempActions.AddRange(m_netActions); m_netActions.Clear(); } } if (m_tempActions.Count > 0) { foreach (Action action in m_tempActions) { try { action(); } catch (Exception e) { Logger.LogException(e); } } m_tempActions.Clear(); } // 屏幕尺寸有改变 if (Screen.width != m_screenSize.x || Screen.height != m_screenSize.y) { m_screenSize.Set(Screen.width, Screen.height); List <Action> removes = new List <Action> (); foreach (Action handler in resizeHandler) { try { handler(); } catch (Exception e) { removes.Add(handler); Logger.LogException(e); } } // 移除执行时报错的 action foreach (Action handler in removes) { resizeHandler.Remove(handler); } // lua Resize m_luaLoopHandler.BeginPCall(); m_luaLoopHandler.Push(EVENT_RESIZE); m_luaLoopHandler.Push(TimeUtil.timeSec); m_luaLoopHandler.PCall(); m_luaLoopHandler.EndPCall(); } StageTouchEventDispatcher.Update(); // lua Update m_luaLoopHandler.BeginPCall(); m_luaLoopHandler.Push(EVENT_UPDATE); m_luaLoopHandler.Push(TimeUtil.timeSec); m_luaLoopHandler.PCall(); m_luaLoopHandler.EndPCall(); }
void Update() { #if UNITY_EDITOR // Unity2018 FrameDebugger 窗口会更新内容,导致无法查看数据 if (UnityEditor.EditorApplication.isPaused) { return; } #endif TimeUtil.Update(); Timer.Update(); UdpSocket.Update(); NetHelper.Update(); lock (LOCK_OBJECT) { // 需要在主线程运行的 Action if (m_threadActions.Count > 0) { m_tempActions.AddRange(m_threadActions); m_threadActions.Clear(); } // 网络相关回调 if (m_netActions.Count > 0) { m_tempActions.AddRange(m_netActions); m_netActions.Clear(); } } if (m_tempActions.Count > 0) { foreach (Action action in m_tempActions) { try { action(); } catch (Exception e) { Logger.LogException(e); } } m_tempActions.Clear(); } // 设备方向有变化 if (DeviceHelper.Update()) { ScreenOrientationHandler.Call(); } // 屏幕尺寸有改变 if (Screen.width != m_screenSize.x || Screen.height != m_screenSize.y) { m_screenSize.Set(Screen.width, Screen.height); ResizeHandler.Call(); DispatchLuaEvent(EVENT_RESIZE); } // 全局屏幕 Touch 相关 StageTouchEventDispatcher.Update(); // lua Update DispatchLuaEvent(EVENT_UPDATE); }