Esempio n. 1
0
        public _RPCRetHandler(_NetRPCComponent rpcComponent
                              , NetRPCCall message
                              , long timeoutTime
                              , Action <_NetRPCReturn, Exception> callback)
        {
            _netRPCComponent = rpcComponent;
            _CallMessage     = message;
            _bIsDone         = false;

            _timer = TimerMgr.AddTimer();
            _timer.Handler(_onTimeout);
            _timer.Interval(timeoutTime).Start();

            _OnCallback = callback;
            _error      = null;
        }
Esempio n. 2
0
        void StartMonsterCreateDone()
        {
            TimerMgr.AddTimer("Monster Create", 2, delegate()
            {
                if (mNpcs.Count == 0)
                {
                    var spawnPoint = ConfigMgr.MonsterSpawnPoints;
                    var list       = spawnPoint.ToList();
                    var index      = AppUtil.Random(0, list.Count);

                    var npcid     = DateTime.UtcNow.Ticks;
                    var view      = new NPCView(npcid, NpcType.Monster);
                    view.position = list[index].Value;
                    mNpcs.Add(npcid, view);

                    Log.Info("Check Monster OnScene Count:>" + mNpcs.Count);
                }
            });
        }
Esempio n. 3
0
    public ConnectionOld(IConnectionHost pConnectionHost = null)
    {
        _connectionState = ConnectionState.DISCONNECTED;

        _tcpClient = null;

        __bIsReceivingHeader = true;
        __bInWriting         = false;

        _networkStream = null;

        _sessionKey          = null;
        _encryptedSessionKey = null;

        __receiveBuffer  = new byte[RECEIVE_BUFFER_SIZE];
        __nBytesReceived = 0;

        __sendMsgQueue    = new Queue <MsgBase>();
        __receiveMsgQueue = new QuickList <MsgBase>();

        __lock = new object();

        _pAESMgr = new RijndaelManaged();

        _heartBeatTimer = TimerMgr.AddTimer();
        _heartBeatTimer.LoopCount(MathEx.INFINITE).Interval(HEART_BEAT_INTERVAL).Handler(_onHeartBeat);

        _bInUpdateSessionKey = false;
        _nLastSvrTime        = 0;
        _nLastLocalTime      = 0;
        __nMsgLength         = 0;

        if (pConnectionHost != null)
        {
            _pConnectionHost = pConnectionHost;
        }
        else
        {
            _pConnectionHost = new _DefaultConnectionHost();
        }
    }