コード例 #1
0
 public void RemoveAllPlayer()
 {
     for (int i = 0; i < 8; i++)
     {
         if (this.m_places[i] != null)
         {
             RoomMgr.AddAction(new ExitRoomAction(this, this.m_places[i]));
             RoomMgr.AddAction(new EnterWaitingRoomAction(this.m_places[i], 1));
         }
     }
 }
コード例 #2
0
 public void Execute()
 {
     if (this.m_room.IsPlaying && this.m_room.Game == null)
     {
         this.m_room.IsPlaying    = false;
         this.m_room.BattleServer = null;
         this.m_room.OldRoomType  = this.m_room.RoomType;
         this.m_room.PickUpNPC    = true;
         this.m_room.RoomType     = eRoomType.Treasure;
         this.m_room.MapId        = 105;
         this.m_room.GameType     = eGameType.Treasure;
         foreach (GamePlayer p in this.m_room.GetPlayers())
         {
             p.Out.SendRoomChange(this.m_room);
         }
         RoomMgr.AddAction(new StartGameAction(this.m_room));
         this.m_room.Host.GameOver += new GamePlayer.PlayerGameOverEventHandle(this.Host_GameOver);
     }
 }
コード例 #3
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void ExitWaitingRoom(GamePlayer player)
 {
     RoomMgr.AddAction(new ExitWaitRoomAction(player));
 }
コード例 #4
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void EnterWaitingRoom(GamePlayer player, int hallType)
 {
     RoomMgr.AddAction(new EnterWaitingRoomAction(player, hallType));
 }
コード例 #5
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void KickPlayer(BaseRoom baseRoom, byte index)
 {
     RoomMgr.AddAction(new KickPlayerAction(baseRoom, (int)index));
 }
コード例 #6
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void UpdateRoomPos(BaseRoom room, int pos, bool isOpened)
 {
     RoomMgr.AddAction(new UpdateRoomPosAction(room, pos, isOpened));
 }
コード例 #7
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void StopProxyGame(BaseRoom room)
 {
     RoomMgr.AddAction(new StopProxyGameAction(room));
 }
コード例 #8
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 internal static void SwitchTeam(GamePlayer gamePlayer)
 {
     RoomMgr.AddAction(new SwitchTeamAction(gamePlayer));
 }
コード例 #9
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void CreateRoom(GamePlayer player, string name, string password, eRoomType roomType, byte timeType)
 {
     RoomMgr.AddAction(new CreateRoomAction(player, name, password, roomType, timeType));
 }
コード例 #10
0
        /// <summary>
        /// 请不要直接调用,使用RoomMgr.ExitRoom
        /// </summary>
        /// <param name="player"></param>
        public bool RemovePlayerUnsafe(GamePlayer player, bool isKick)
        {
            int index = -1;

            lock (m_places)
            {
                for (int i = 0; i < 10; i++)
                {
                    if (m_places[i] == player)
                    {
                        m_places[i]      = null;
                        m_playerState[i] = 0;
                        m_placesState[i] = -1;
                        m_playerCount--;
                        index = i;
                        break;
                    }
                }
            }

            if (index != -1)
            {
                UpdatePosUnsafe(index, false, -1, -100);
                player.CurrentRoom = null;
                player.TempBag.ClearBag();
                GSPacketIn pkg = player.Out.SendRoomPlayerRemove(player);
                SendToAll(pkg);

                //发送踢人信息
                if (isKick)
                {
                    player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.KickRoom"));
                }

                //从新挑选房主
                bool isChangeHost = false;
                if (m_host == player)
                {
                    if (m_playerCount > 0)
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            if (m_places[i] != null)
                            {
                                SetHost(m_places[i]);
                                isChangeHost = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        m_host = null;
                    }
                }

                //游戏中移除人物
                if (IsPlaying)
                {
                    if (m_game != null)
                    {
                        //如果关卡中,房主退出,重置新房主的ready状态
                        if (isChangeHost && m_game is PVEGame)
                        {
                            PVEGame pveGame = m_game as PVEGame;
                            foreach (Player p in pveGame.Players.Values)
                            {
                                if (p.PlayerDetail == m_host)
                                {
                                    p.Ready = false;
                                }
                            }
                        }
                        m_game.RemovePlayer(player, isKick);
                    }
                    if (BattleServer != null)
                    {
                        if (m_game != null)
                        {
                            BattleServer.Server.SendPlayerDisconnet(Game.Id, player.GamePlayerId, RoomId);
                            if (PlayerCount == 0)
                            {
                                BattleServer.RemoveRoom(this);
                            }
                        }
                        else
                        {
                            SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed"));
                            RoomMgr.AddAction(new CancelPickupAction(BattleServer, this));
                            BattleServer.RemoveRoom(this);
                            IsPlaying = false;
                        }
                    }
                }
                else
                {
                    UpdateGameStyle();
                    if (isChangeHost)
                    {
                        //if (RoomType == eRoomType.Dungeon)
                        //{
                        //    HardLevel = eHardLevel.Normal;
                        //}
                        //else
                        //{
                        //    HardLevel = eHardLevel.Simple;
                        //}
                        foreach (GamePlayer gp in GetPlayers())
                        {
                            gp.Out.SendRoomChange(this);
                        }
                    }
                }
            }
            return(index != -1);
        }
コード例 #11
0
 public static void UpdateRoomGameType(BaseRoom room, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, string password, string roomname, bool isCrosszone, bool isOpenBoss)
 {
     RoomMgr.AddAction(new RoomSetupChangeAction(room, roomType, timeMode, hardLevel, levelLimits, mapId, password, roomname, isCrosszone, isOpenBoss));
 }
コード例 #12
0
 public static void StartGameMission(BaseRoom room)
 {
     RoomMgr.AddAction(new StartGameMissionAction(room));
 }
コード例 #13
0
 public static void EnterRoom(GamePlayer player, int roomId, string pwd, int type)
 {
     RoomMgr.AddAction(new EnterRoomAction(player, roomId, pwd, type));
 }
コード例 #14
0
        public bool RemovePlayerUnsafe(GamePlayer player, bool isKick)
        {
            int index = -1;

            GamePlayer[] places;
            Monitor.Enter(places = this.m_places);
            try
            {
                for (int i = 0; i < 8; i++)
                {
                    if (this.m_places[i] == player)
                    {
                        this.m_places[i]      = null;
                        this.m_playerState[i] = 0;
                        this.m_placesState[i] = -1;
                        this.m_playerCount--;
                        index = i;
                        break;
                    }
                }
            }
            finally
            {
                Monitor.Exit(places);
            }
            if (index != -1)
            {
                this.UpdatePosUnsafe(index, true);
                player.CurrentRoom = null;
                GSPacketIn pkg = player.Out.SendRoomPlayerRemove(player);
                this.SendToAll(pkg);
                if (isKick)
                {
                    player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.KickRoom", new object[0]));
                }
                bool isChangeHost = false;
                if (this.m_host == player)
                {
                    if (this.m_playerCount > 0)
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            if (this.m_places[i] != null)
                            {
                                this.SetHost(this.m_places[i]);
                                isChangeHost = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.m_host = null;
                    }
                }
                if (this.IsPlaying)
                {
                    if (this.m_game != null)
                    {
                        if (isChangeHost && this.m_game is PVEGame)
                        {
                            PVEGame pveGame = this.m_game as PVEGame;
                            foreach (Player p in pveGame.Players.Values)
                            {
                                if (p.PlayerDetail == this.m_host)
                                {
                                    p.Ready = false;
                                }
                            }
                        }
                        this.m_game.RemovePlayer(player, isKick);
                    }
                    if (this.BattleServer != null)
                    {
                        if (this.m_game != null)
                        {
                            this.BattleServer.Server.SendPlayerDisconnet(this.Game.Id, player.GamePlayerId, this.RoomId);
                            if (this.PlayerCount == 0)
                            {
                                this.BattleServer.RemoveRoom(this);
                            }
                            player.RemoveGP(player.PlayerCharacter.Grade * 12);
                            if (this.GameType == eGameType.Guild)
                            {
                                player.RemoveOffer(15);
                            }
                            else
                            {
                                if (this.GameType == eGameType.Free)
                                {
                                    player.RemoveOffer(5);
                                }
                            }
                        }
                        else
                        {
                            this.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed", new object[0]));
                            RoomMgr.AddAction(new CancelPickupAction(this.BattleServer, this));
                            this.BattleServer.RemoveRoom(this);
                            this.IsPlaying = false;
                        }
                    }
                }
                this.UpdateGameStyle();
                if (isChangeHost)
                {
                    if (!(this.m_game is PVEGame) || !this.IsPlaying)
                    {
                        this.ResetRoomSetting();
                    }
                }
            }
            return(index != -1);
        }
コード例 #15
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void CancelPickup(BattleServer server, BaseRoom room)
 {
     RoomMgr.AddAction(new CancelPickupAction(server, room));
 }
コード例 #16
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void UpdateRoomGameType(BaseRoom room, GSPacketIn packet, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, bool isArea)
 {
     RoomMgr.AddAction(new RoomSetupChangeAction(room, packet, roomType, timeMode, hardLevel, levelLimits, mapId, isArea));
 }
コード例 #17
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void EnterRoom(GamePlayer player, int roomId, string pwd, int type, int hallType, bool isInvite)
 {
     RoomMgr.AddAction(new EnterRoomAction(player, roomId, pwd, type, hallType, isInvite));
 }
コード例 #18
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void StartProxyGame(BaseRoom room, ProxyGame game)
 {
     RoomMgr.AddAction(new StartProxyGameAction(room, game));
 }
コード例 #19
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void ExitRoom(BaseRoom room, GamePlayer player)
 {
     RoomMgr.AddAction(new ExitRoomAction(room, player));
 }
コード例 #20
0
ファイル: BaseRoom.cs プロジェクト: changthai2540/DDTank-II
        public bool RemovePlayerUnsafe(GamePlayer player, bool isKick)
        {
            int num = -1;

            GamePlayer[] places;
            Monitor.Enter(places = this.m_places);
            try
            {
                for (int i = 0; i < 10; i++)
                {
                    if (this.m_places[i] == player)
                    {
                        this.m_places[i]      = null;
                        this.m_playerState[i] = 0;
                        this.m_placesState[i] = -1;
                        this.m_playerCount--;
                        num = i;
                        break;
                    }
                }
            }
            finally
            {
                Monitor.Exit(places);
            }
            if (num != -1)
            {
                this.UpdatePosUnsafe(num, false, -1, -100);
                player.CurrentRoom = null;
                player.TempBag.ClearBag();
                GSPacketIn pkg = player.Out.SendRoomPlayerRemove(player);
                this.SendToAll(pkg);
                if (isKick)
                {
                    player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.KickRoom", new object[0]));
                }
                bool flag = false;
                if (this.m_host == player)
                {
                    if (this.m_playerCount > 0)
                    {
                        for (int j = 0; j < 10; j++)
                        {
                            if (this.m_places[j] != null)
                            {
                                this.SetHost(this.m_places[j]);
                                flag = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.m_host = null;
                    }
                }
                if (this.IsPlaying)
                {
                    if (this.m_game != null)
                    {
                        if (flag && this.m_game is PVEGame)
                        {
                            PVEGame pVEGame = this.m_game as PVEGame;
                            foreach (Player current in pVEGame.Players.Values)
                            {
                                if (current.PlayerDetail == this.m_host)
                                {
                                    current.Ready = false;
                                }
                            }
                        }
                        this.m_game.RemovePlayer(player, isKick);
                    }
                    if (this.BattleServer != null)
                    {
                        if (this.m_game != null)
                        {
                            this.BattleServer.Server.SendPlayerDisconnet(this.Game.Id, player.GamePlayerId, this.RoomId);
                            if (this.PlayerCount == 0)
                            {
                                this.BattleServer.RemoveRoom(this);
                            }
                        }
                        else
                        {
                            this.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed", new object[0]));
                            RoomMgr.AddAction(new CancelPickupAction(this.BattleServer, this));
                            this.BattleServer.RemoveRoom(this);
                            this.IsPlaying = false;
                        }
                    }
                }
                else
                {
                    this.UpdateGameStyle();
                    if (flag)
                    {
                        foreach (GamePlayer current2 in this.GetPlayers())
                        {
                            current2.Out.SendRoomChange(this);
                        }
                    }
                }
            }
            return(num != -1);
        }
コード例 #21
0
ファイル: RoomMgr.cs プロジェクト: SkelletonX/DDTServer
 public static void UpdatePlayerState(GamePlayer player, byte state)
 {
     RoomMgr.AddAction(new UpdatePlayerStateAction(player, player.CurrentRoom, state));
 }