Beispiel #1
0
        public void SendClientQueueSuccess(PlayerConnect _this, QueueType type, ulong characterId)
        {
            var data = new QueueSuccessData();

            data.Type = (int)type;
            switch (type)
            {
            case QueueType.Login:
            {
                LoginServerControlDefaultImpl.NotifyGateClientState(LoginServer.Instance.ServerControl,
                                                                    _this.ClientId, 0, GateClientState.Login);
                data.LastServerId = _this.Player.DbData.LastServerId;

                _this.Player.DbData.LoginDay++;
                _this.Player.DbData.LoginTotal++;
            }
            break;

            case QueueType.EnterGame:
                data.CharacterId = characterId;
                break;
            }

            PlayerLog.WriteLog((int)LogType.SendClientQueueSuccess, "SendClientQueueSuccess type = {0}, name = {1}",
                               type, _this.Name);
            LoginServer.Instance.ServerControl.NotifyQueueSuccess(_this.ClientId, data);
        }
Beispiel #2
0
        public void TimeOver(PlayerConnect _this)
        {
            PlayerLog.WriteLog((int)LogType.PlayerConnect, "TimeOver -----State:{0}", _this.State);
            _this.trigger = null;
            switch (_this.State)
            {
            case ConnectState.Wait:
                break;

            case ConnectState.Landing:
            {
                //todo 选择角色时间太长
                if (_this.Player != null)
                {
                    _this.Player.Kick(_this.ClientId, KickClientType.LoginTimeOut);
                    CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                    .MoveNext();
                }
            }
            break;

            case ConnectState.EnterGame:
            {
                //todo 进入游戏时间太长
                if (_this.Player != null)
                {
                    _this.Player.Kick(_this.ClientId, KickClientType.LoginTimeOut);
                    CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                    .MoveNext();
                }
            }
            break;

            case ConnectState.InGame:
                break;

            case ConnectState.WaitReConnet:
            {
                if (null == _this.Player || null == _this.Player.DbData)
                {
                    _this.ClientId = 0;
                    Logger.Error("PlayerConnect TimeOver WaitReConnet InGame player is null");
                    break;
                }

                //var character = CharacterManager.Instance.GetCharacterControllerFromMemroy(_this.Player.DbData.SelectChar);
                //if (character != null)
                //{
                //    character.LostLine();
                //    CharacterManager.PopServerPlayer(character.mDbData.ServerId);
                //    CoroutineFactory.NewCoroutine(CharacterManager.Instance.RemoveCharacter,
                //        _this.Player.DbData.SelectChar).MoveNext();
                //}

                PlayerLog.PlayerLogger(_this.Player.DbData.Id, "WaitReConnet TimeOver ClientId={0}", _this.ClientId);
                PlayerConnect oldPlayer;
                if (QueueManager.InGamePlayerList.TryGetValue(_this.Player.DbData.Id, out oldPlayer))
                {
                    if (oldPlayer != null)
                    {
                        QueueManager.LeaverPlayer(oldPlayer);
                    }
                    QueueManager.InGamePlayerList.Remove(_this.Player.DbData.Id);
                }

                LoginServerControlDefaultImpl.CleanCharacterData(_this.ClientId, _this.Player.DbData.SelectChar);

                CoroutineFactory.NewCoroutine(LoginServer.Instance.ServerControl.PlayerLogout, _this.ClientId)
                .MoveNext();
            }
            break;

            case ConnectState.OffLine:
                QueueManager.CacheLost.Remove(_this.GetKey());
                break;

            case ConnectState.WaitOffLine:
                QueueManager.CacheLost.Remove(_this.GetKey());
                break;
            }
        }
Beispiel #3
0
 public void Kick(ulong clientId, KickClientType type)
 {
     LoginServerControlDefaultImpl.NotifyGateClientLost(LoginServer.Instance.ServerControl, clientId, type);
     //LoginServer.Instance.ServerControl.Kick(clientId, 0);
 }