public override void DoUpdate() { if (!IsSocketValid()) { return; } removeKey = null; clearBool = false; PluginUtilities.ProfilerBegin("NetManager.DoUpdate"); foreach (var e in timeoutPacket.Keys) { timeoutPacket[e].remainTime -= Time.unscaledDeltaTime; if (timeoutPacket[e].remainTime <= 0) { if (OnProcessTimeout(e, timeoutPacket[e])) { clearBool = true; break; } else { removeKey = e; break; } } } if (clearBool) { timeoutPacket.Clear(); } else if (removeKey != null) { timeoutPacket.Remove(removeKey.Value); } NetPacket packet = null; while ((packet = recvPool.GetRecvPacket()) != null) { if (LaunchConfigManager.LogEnable("NetManager")) { //LogUtils.LogWarning("Net recv, cmd =", packet.msgid, "len = ", packet.data.Length); } DispatchCmdEvent(packet); } PluginUtilities.ProfilerEnd(); }
public override void DoUpdate() { PluginUtilities.ProfilerBegin("NetServerManager.DoUpdate"); foreach (var e in servers) { if (!e.Value.IsSocketValid()) { OnConnectionChange(e.Value, false); servers.Remove(e.Key); break; } } PluginUtilities.ProfilerEnd(); }
public override void DoUpdate() { PluginUtilities.ProfilerBegin("ConroutineManager.DoUpdate"); for (int i = 0; i < coroutineList.Count; i++) { var c = coroutineList[i]; c.DoUpdate(); if (c.IsFinish && coroutineList.IndexOf(c) != -1) { coroutineList.RemoveAt(i); i--; } } PluginUtilities.ProfilerEnd(); }
public override void DoUpdate() { PluginUtilities.ProfilerBegin("FrameServerManager.DoUpdate"); base.DoUpdate(); if (this.ElapseTime(deltaTime)) { frameInputList.Clear(); foreach (var server in servers.Values) { var list = server.receivePacketList; frameInputPlayerList.Clear(); for (int i = 0; i < list.Count; i++) { var frame = NetFrame.decoder(list[i].data); for (int j = 0; j < frame.inputDatas.Length; j++) { frameInputPlayerList.Add(frame.inputDatas[j]); } frameInputPlayerList.Sort((NetFrameInput a, NetFrameInput b) => { return(a.index - b.index); }); frameInputList.AddRange(frameInputPlayerList); LogUtils.Log("Net server recv frame, input =", frame.inputDatas); } list.Clear(); } NetFrameNotify notify = new NetFrameNotify(); notify.frameId = frameId; notify.inputDatas = frameInputList.ToArray(); Notify(notify); frameId += 1; } PluginUtilities.ProfilerEnd(); }
public override void DoUpdate() { PluginUtilities.ProfilerBegin("RoomServerManager.DoUpdate"); base.DoUpdate(); if (!hasResend) { hasResend = true; ipList.Clear(); ipList.Add(m_socket.GetAddressAndPort()); foreach (var v in servers.Keys) { ipList.Add(v); } var roomNotify = new RoomMessageNotify(); roomNotify.ipList = ipList.ToArray(); Notify(roomNotify); } PluginUtilities.ProfilerEnd(); }
public override void DoUpdate() { PluginUtilities.ProfilerBegin("TimerManager.DoUpdate"); for (int i = 0; i < timerList.Count; i++) { var t = timerList[i]; if (!t.IsRunning || t.DoUpdate(lastStartupTime)) { if (i < timerList.Count) { timerList.RemoveAt(i); i--; } } else { timerList[i] = t; } } lastStartupTime = Time.realtimeSinceStartup; // wheel timer PluginUtilities.ProfilerEnd(); }