Esempio n. 1
0
        public void Tick()
        {
            IServer.Instance.Tick();
            var time = IServer.timeGetTime();

            if (mDBConnect != null && mDBConnect.IsValidConnect() == false)
            {
                //这里发生数据断开的情况了!
                Log.Log.Common.Print("要命,数据库断开了!");
                //System.Diagnostics.Debug.Assert(false);
                mDBConnect.ReOpen();
                return;
            }

            if (mRegisterConnect.State != Iocp.NetState.Connect)
            {
                if (time - mTryRegServerReconnectTime > 3000)
                {
                    mTryRegServerReconnectTime = time;
                    mRegisterConnect.Reconnect();
                }
            }
            mRegisterConnect.Update();
            mTcpSrv.Update();
            RPC.RPCNetworkMgr.Instance.Tick(IServer.Instance.GetElapseMilliSecondTime());
        }
Esempio n. 2
0
        public void Tick()
        {
            IServer.Instance.Tick();
            var time = IServer.timeGetTime();

            mDBLoaderConnect.Tick();
            if (time - mTryRemoveLogoutPlayerTime > 3000)
            {//把已经完成数据存盘的玩家清理了
                mTryRemoveLogoutPlayerTime = time;
                mPlayerManager.Tick();
            }

            if (mLinkState == DataServerState.Working)
            {
                if (mRegisterConnect.State == Iocp.NetState.Disconnect || mRegisterConnect.State == Iocp.NetState.Invalid)
                {
                    if (time - mTryRegServerReconnectTime > 3000)
                    {
                        mTryRegServerReconnectTime = time;
                        mRegisterConnect.Reconnect();
                    }
                }
            }

            mRegisterConnect.Update();
            mTcpSrv.Update();
            RPC.RPCNetworkMgr.Instance.Tick(IServer.Instance.GetElapseMilliSecondTime());


            AllMapManager.Instance.Tick();
        }
Esempio n. 3
0
        public void Tick()
        {
            IServer.Instance.Tick();
            try
            {
                UserRoleManager.Tick();
            }
            catch (System.Exception ex)
            {
                Log.Log.Common.Print(ex.ToString());
                Log.Log.Common.Print(ex.StackTrace.ToString());
            }


            var time = IServer.timeGetTime();

            if (mLinkState == ComServerState.WaitRegServer)
            {
                //每过一段时间尝试连接一次
                if (mRegisterConnect.State != Iocp.NetState.Connect)
                {
                    if (time - mTryRegServerReconnectTime > 3000)
                    {
                        mTryRegServerReconnectTime = time;
                        mRegisterConnect.Reconnect();
                    }
                }
            }
            else if (mLinkState == ComServerState.Working)
            {
                if (mRegisterConnect.State == Iocp.NetState.Disconnect || mRegisterConnect.State == Iocp.NetState.Invalid)
                {
                    if (time - mTryRegServerReconnectTime > 3000)
                    {
                        mTryRegServerReconnectTime = time;
                        mRegisterConnect.Reconnect();
                    }
                }
            }
            this.UserRoleManager.DBConnect.Tick();
            mRegisterConnect.Update();
            mTcpSrv.Update();
            RPC.RPCNetworkMgr.Instance.Tick(IServer.Instance.GetElapseMilliSecondTime());
        }
Esempio n. 4
0
        public void _SyncDoCommand(Iocp.TcpClient cltConn, int timeout)
        {
            if (RPCManager == null)
            {
                RPCManager = RPCNetworkMgr.Instance;
            }
            PkgType = PackageType.PKGT_SendAndWait;
            RPCWaitHandle handle = RPCManager.NewWaitHandle(null);

            SendBuffer(cltConn);
            while (true)
            {
                cltConn.Update();
                if (null == RPCManager.GetWaitHandle(handle.CallID))
                {
                    break;
                }

                System.Threading.Thread.Sleep(1);
            }
        }
Esempio n. 5
0
        public void Tick()
        {
            IServer.Instance.Tick();

            #region 处理服务器连接
            var time = IServer.timeGetTime();
            if (mRegisterConnect.State == Iocp.NetState.Disconnect || mRegisterConnect.State == Iocp.NetState.Invalid)
            {
                if (time - mTryRegServerReconnectTime > 3000)
                {
                    mTryRegServerReconnectTime = time;
                    mRegisterConnect.Reconnect();
                }
            }

            if (mDataConnect.State == Iocp.NetState.Disconnect || mDataConnect.State == Iocp.NetState.Invalid)
            {
                if (time - mTryDataServerReconnectTime > 3000)
                {
                    mTryDataServerReconnectTime = time;
                    if (mRegisterConnect.State == Iocp.NetState.Connect)
                    {
                        ConnectDataServer();
                    }
                }
            }

            if (mComConnect.State == Iocp.NetState.Disconnect || mComConnect.State == Iocp.NetState.Invalid)
            {
                if (time - mTryDataServerReconnectTime > 3000)
                {
                    mTryDataServerReconnectTime = time;
                    if (mRegisterConnect.State == Iocp.NetState.Connect)
                    {
                        ConnectComServer();
                    }
                }
            }

            //if (mPathFindConnect.State != Iocp.NetState.Connect)
            //{
            //    if (time - mTryDataServerReconnectTime > 3000)
            //    {
            //        mTryDataServerReconnectTime = time;
            //        if (mRegisterConnect.State == Iocp.NetState.Connect)
            //        {
            //            ConnectPathFindServer();
            //        }
            //    }
            //}
            #endregion

            mRegisterConnect.Update();
            mDataConnect.Update();
            mComConnect.Update();
            //mPathFindConnect.Update();
            mTcpSrv.Update();

            RPC.RPCNetworkMgr.Instance.Tick(IServer.Instance.GetElapseMilliSecondTime());

            //Planes.PlanesManager.Instance.TickPlanesInstance();
        }