Ejemplo n.º 1
0
        public void GetUp()
        {
            ISeat seat = _inngeGame.GetSeatByPlayerId(player.Id);

            if (seat != null)
            {
                seat.PlayLeave();
            }
        }
Ejemplo n.º 2
0
        public void PlayerLeaveSeat()
        {
            ISeat seat = _ISeatCreator();

            seat.PlayerSitDown(_player);
            seat.PlayLeave();

            Assert.True(seat.IsEmpty == true);
            Assert.True(seat.IPlayer == null, "座位玩家Id=0");
        }
Ejemplo n.º 3
0
        public void PlayerLeave_beforEvent()
        {
            ISeat seat = _ISeatCreator();
            bool  beforPlayerLeave_ = false;
            bool  afterPlayerLeave_ = false;

            seat.BeforPlayerLeaveHandler += delegate { beforPlayerLeave_ = true; };
            seat.AfterPlayerLeaveHandler += delegate { afterPlayerLeave_ = true; };
            seat.PlayerSitDown(_player);
            seat.PlayLeave();

            Assert.True(beforPlayerLeave_);
            Assert.True(afterPlayerLeave_);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 玩家离开房间
        /// </summary>
        /// <param name="player_">玩家</param>
        public void RemovePlayer(IPlayerJoinRoom player_)
        {
            ISeat seat = InningGame.GetSeatByPlayerId(player_.Id);

            if (seat != null)
            {
                seat.PlayLeave();
            }
            var realPlayer = Players.Find(p => p.Id == player_.Id);

            Players.Remove(realPlayer);
            if (player_.Id == RoomManager.Id && Players.Count > 0)
            {
                ChanageManger(Players[0]);
            }
            RemovePlayer_SuccessEvent?.Invoke(this, new PlayerEventArgs(player_));
            CheckFull();
            InningGame.CheckSeatCountEnoughWhenRunning();
        }