Beispiel #1
0
        public void RemovePlayer(GamePlayer player)
        {
            _processor.OnRemovingPlayer(this, player);
            lock (Data._syncStop)
            {
                if (_userList[player.CurrentGameIndex] == player)
                {
                    _userList[player.CurrentGameIndex] = null;
                    _count--;

                    int        offer = DeductOffer(player);
                    GSPacketIn pkg   = player.Out.SendGamePlayerLeave(player, offer, this);
                    SendToPlayerExceptSelf(pkg, player);

                    if (player == _player)
                    {
                        if (Count > 0)
                        {
                            for (byte i = 0; i < _userList.Length; i++)
                            {
                                if (_userList[i] != null)
                                {
                                    Player = _userList[i];
                                    GSPacketIn msgHost = player.Out.SendRoomHost(_player);
                                    SendToRoomPlayer(msgHost);
                                    break;
                                }
                            }
                        }
                    }


                    if (GameState == eGameState.PAIRUP)
                    {
                        SendPairUpCancel();
                        PairUpMgr.RemovefromPairUpMgr(this);
                        GSPacketIn msg = _player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed"));
                        SendToPlayerExceptSelf(msg, _player);
                    }

                    OperateGameClass();
                    SendRoomInfo();
                    _processor.OnRemovedPlayer(this, player);


                    player.CurrentGame = null;
                }
            }

            //if (_isChangeStyle)
            //{
            //    player.UpdateStyle();
            //}
        }