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); }