Пример #1
0
        public static void Dispose()
        {
            if (!_init)
            {
                return;
            }

            _init = false;

            _elapsed = 0;
            _elapsedSinceLastLogicUpdate = 0;
            _shouldSendActions           = false;
            _sendActionFrame             = 0;
            SERVER_KEYFRAMES.Clear();

            lBattle.Dispose();
            EventCenter.Sync();
            cBattle.Dispose();

            lBattle = null;
            cBattle = null;

            _logicThread.Join();
            _logicThread = null;

            NetModule.instance.RemoveACMDListener(Module.BATTLE, Command.ACMD_BATTLE_START, HandleBattleStart);
            NetModule.instance.RemoveACMDListener(Module.BATTLE, Command.ACMD_FRAME, HandleFrame);
            NetModule.instance.RemoveACMDListener(Module.BATTLE, Command.ACMD_BATTLE_END, HandleBattleEnd);
        }
Пример #2
0
        /// <summary>
        /// 更新
        /// </summary>
        public void Update()
        {
            foreach (var c in channels.Values)
            {
                c.Update();
            }

            foreach (var conv in removePool)
            {
                if (channels.ContainsKey(conv))
                {
                    channels.Remove(conv);
                    Debug.Log("断开一个链接,剩余链接" + channels.Count);
                }
            }
            removePool.Clear();

            recvQueue.Switch();
            while (!recvQueue.Empty())
            {
                if (OnReciveCallBack == null)
                {
                    recvQueue.Clear();
                }
                else
                {
                    OnReciveCallBack?.Invoke(0, recvQueue.Pop());
                }
            }
        }
Пример #3
0
    void reset_state()
    {
        mNeedUpdateFlag = false;
        mNextUpdateTime = 0;

        mInConnectStage      = false;
        mConnectSucceed      = false;
        mConnectStartTime    = 0;
        mLastSendConnectTime = 0;
        mRecvQueue.Clear();
        mKcp = null;
    }
Пример #4
0
 public void Clean()
 {
     kcp?.Dispose();
     kcp            = null;
     recvListener   = null;
     sendBufferTemp = null;
     recvBufferTemp = null;
     tempSendData   = null;
     recvBuffQueue.Clear();
     recvBuffQueue = null;
     Close();
 }
Пример #5
0
        void Clean()
        {
            status_ = Status.None;
            conv_   = 0;

            needUpdate_         = false;
            nextUpdateTime_     = 0;
            lastRecvTime_       = 0;
            connectStartTime_   = 0;
            lastConnectReqTime_ = 0;
            lastHearbeatTime_   = 0;
            recvQueue_.Clear();
            kcp_ = null;

            if (udpClient_ != null)
            {
                udpClient_.Close();
                udpClient_ = null;
            }

            ep_       = null;
            serverEp_ = null;
        }
Пример #6
0
 public static void Clear()
 {
     PENDING_LIST.Clear();
 }