示例#1
0
    public override void OnRootUpdate(float diff)
    {
        if (m_delayCall != null)
        {
            var dc = m_delayCall;
            m_delayCall = null;
            dc.Invoke(this);
        }

        if (FightRecordManager.IsRecovering)
        {
            var ps = FightRecordManager.SimulateUpdate(diff);
            if (ps != null && ps.Count > 0)
            {
                foreach (var p in ps)
                {
                    HandlePacket(p);
                }
                ps.Clear();
            }
        }
        else if (m_receiver != null)
        {
            var ps = m_receiver.ReceivedPackets();

            foreach (var p in ps)
            {
                FightRecordManager.Record(p);

                HandlePacket(p);
            }
            ps.Clear();
        }

        if (m_lastState == SessionState.CONNECTED && (m_socket == null || !m_socket.Connected))  // we lost connection!
        {
            Disconnect();
            OnLostConnection();

            DispatchEvent(Events.SESSION_LOST_CONNECTION);
            DispatchModuleEvent(EventLostConnection);
        }
        m_lastState = state;

        if (m_lastState == SessionState.CONNECTED && m_waitPing > 0 && (m_waitPing -= diff) <= 0)
        {
            SendPing();
        }
        localTimeOffset += diff;
        if (localTimeOffset >= 1)
        {
            localTimeOffset      -= 1;
            serverLocalTimeStamp += 1;
            serverTimeStamp      += 1;
        }
    }
示例#2
0
    void _Packet(ScRoomOver p)
    {
        // Clear team data if battle ended
        ResetTeamData();

        FightRecordManager.Record(p);

        FightRecordManager.EndRecord(false, false);
        #region NetStat statistic
#if NETSTAT
        var r = modulePVP.useGameSession ? session.receiver : modulePVP.receiver;
        if (r != null)
        {
            r.pauseNetStatistic = true;
        }
#endif
        #endregion
    }