Example #1
0
        public void EndGame(GamePlayer gamePlayer, HandleGamePacket hanelGamePacketPram)
        {
            if (gamePlayer.PlayerIndex == 1)
            {
                HandleGamePacket player2GamePacket = new HandleGamePacket();
                player2GamePacket.startGame = hanelGamePacketPram.startGame;
                SendGameStartMessage(Header.Game, player2GamePacket, player2.owner);
            }
            else
            {
                HandleGamePacket player1GamePacket = new HandleGamePacket();
                player1GamePacket.startGame = hanelGamePacketPram.startGame;
                SendGameStartMessage(Header.Game, player1GamePacket, player1.owner);
            }

            player1.owner.ExitGameRoom();
            player2.owner.ExitGameRoom();

            GameRoomManager gameroomManager = new GameRoomManager();

            gameroomManager.DestroyGameRoom(gameRoomNumber, this);
        }
        /********************************************************************************/

        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this;

            indianPokerServer           = new IndianPokerServer();
            indianPokerServer.printText = new IndianPokerServer.PrintTextDelegate(PrintText);

            clientManagement = new ClientManagement();
            gameRoomManager  = new GameRoomManager();

            //clientInfoListView = new List<ClientInfo>();
            ListView_ClientListView.ItemsSource = clientInfoListView;

            //클라이언트로부터 Login Message를 받았을 때
            DataHandler.EventManager.Instance.LoginPacketEvent += Instance_LoginPacketEvent;
            //클라이언트로부터 GameMatching요청 Message를 받았을 때
            DataHandler.EventManager.Instance.MatchingPacketEvent += Instance_MatchingPacketEvent;
            //클라이언트로부터 게임로딩 및 시작 Message를 받았을 때
            DataHandler.EventManager.Instance.HandleGamePacketEvent += Instance_HandleGamePacketEvent;
            //클라이언트로부터 IndianPoker게임 베팅 Message를 받았을 때
            DataHandler.EventManager.Instance.IndianPokerGamePacketEvent += Instance_IndianPokerGamePacketEvent;
        }