private void Button_ExitGameRoom_Click(object sender, RoutedEventArgs e) { HandleGamePacket handleGamePacket = new HandleGamePacket(); handleGamePacket.startGame = false; SendNewGameMessage(handleGamePacket); IsExitGame = true; CloseButtonEvent("SetSelectScreen"); }
private void SendNewGameThread() { this.IsPlayGame = false; Thread.Sleep(5000); if (myMoney <= 0) { Button_ExitGameRoom_Click(null, null); } HandleGamePacket tempHandleGamePacket = new HandleGamePacket(); tempHandleGamePacket.loadingComplete = true; tempHandleGamePacket.startGame = true; SendNewGameMessage(tempHandleGamePacket); }
public void SetGameStart(HandleGamePacket gamePacketParam) { StrMyBetting = ""; StrOtherPlayerBetting = ""; IsExitGame = false; //나가기 버튼 이벤트 발생 후, 다른 매칭상대와 게임을 시작 할경우 초기화 IsPlayGame = true; //나가기 버튼 비활성화 if (newGameStart != null) { newGameStart.Join(); newGameStart = null; } this.myIndex = gamePacketParam.MyIndex; this.myTurn = gamePacketParam.playerTurn; this.myCard = gamePacketParam.MyCard; this.otherPlayerCard = gamePacketParam.OtherPlayerCard; this.myMoney = gamePacketParam.MyMoney; this.otherPlayerMoney = gamePacketParam.OtherPlayerMoney; this.totalBettingMoney = gamePacketParam.TotalBettingMoney; Dispatcher.BeginInvoke(new Action(() => { //Button_MyCard.Content = this.myCard.ToString(); Button_OtherPlayerCard.Content = this.otherPlayerCard.ToString(); Label_MyMoney.Content = this.myMoney.ToString(); Label_OtherPlayerMoney.Content = this.otherPlayerMoney.ToString(); Label_BetTotalMoney.Content = this.totalBettingMoney.ToString(); if (myTurn == 1) { TextBox_UserLog.AppendText("게임이 시작되었습니다. 선턴입니다. 베팅 하세여 \n"); isFirstTurn = true; SetButtonsEnable(isFirstTurn); } else { TextBox_UserLog.AppendText("게임이 시작되었습니다. 후턴입니다. \n"); SetButtonsDisable(); } Button_MyCard.Content = "뒷면"; })); }
//서버에서 매칭 메시지 수신 시 게임 화면 표시 private void Instance_MatchingPacketEvent(DataHandler.EventManager.MatchingPacketReceivedArgs e) { if (e.Data.matchingComplete) { this.SetVisible(Screen.IndianPoker); if (isPlaying) { HandleGamePacket handleGamePakcet = new HandleGamePacket(); handleGamePakcet.clientID = this.ClientID; handleGamePakcet.loadingComplete = true; handleGamePakcet.startGame = false; handleGamePakcet.MyCard = 0; handleGamePakcet.playerTurn = 0; indianPokerClient.SendMessage(Header.Game, handleGamePakcet, indianPokerClient.ao.WorkingSocket); } } }
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 void GameStart() { if (playingGameCount >= 20) { ShuffleRandom(); playingGameCount = 0; } player1.isReadyForGame = false; player2.isReadyForGame = false; Random random = new Random(); HandleGamePacket player1GamePacket = new HandleGamePacket(); HandleGamePacket player2GamePacket = new HandleGamePacket(); totalBettingMoney = 10; /* ***************************************************************************** */ // Player1 세팅 player1GamePacket.startGame = true; player1GamePacket.MyIndex = player1.PlayerIndex; //player1GamePacket.MyCard = (short)random.Next(CARDMINNUM, CARDMAXNUM); if (victoryUser == 0) { player1.PlayerTurn = 1; player1GamePacket.MyCard = (short)card[playingGameCount]; } else if (victoryUser == 1) { player1.PlayerTurn = 1; player1GamePacket.MyCard = (short)card[playingGameCount]; } else { player1.PlayerTurn = 2; player1GamePacket.MyCard = (short)card[++playingGameCount]; } this.player1Card = player1GamePacket.MyCard; player1GamePacket.playerTurn = player1.PlayerTurn; player1GamePacket.TotalBettingMoney = totalBettingMoney; player1GamePacket.MyMoney = player1.PlayerMoney - 5; /* ***************************************************************************** */ /* ***************************************************************************** */ // Player2 세팅 player2GamePacket.startGame = true; player2GamePacket.MyIndex = player2.PlayerIndex; //player2GamePacket.MyCard = (short)random.Next(CARDMINNUM, CARDMAXNUM); if (victoryUser == 0) { player2.PlayerTurn = 2; player2GamePacket.MyCard = (short)card[++playingGameCount]; } else if (victoryUser == 2) { player2.PlayerTurn = 1; player2GamePacket.MyCard = (short)card[playingGameCount]; } else { player2.PlayerTurn = 2; player2GamePacket.MyCard = (short)card[++playingGameCount]; } this.player2Card = player2GamePacket.MyCard; player2GamePacket.playerTurn = player2.PlayerTurn; player2GamePacket.TotalBettingMoney = totalBettingMoney; player2GamePacket.MyMoney = player2.PlayerMoney - 5; /* ***************************************************************************** */ player1GamePacket.OtherPlayerCard = player2GamePacket.MyCard; player2GamePacket.OtherPlayerCard = player1GamePacket.MyCard; player1GamePacket.OtherPlayerMoney = player2GamePacket.MyMoney; player2GamePacket.OtherPlayerMoney = player1GamePacket.MyMoney; SendGameStartMessage(Header.Game, player1GamePacket, player1.owner); SendGameStartMessage(Header.Game, player2GamePacket, player2.owner); this.playingGameCount = this.playingGameCount + 1; }
private void StartNewGameMessage(HandleGamePacket handleGamePacketParam) { handleGamePacketParam.clientID = this.ClientID; indianPokerClient.SendMessage(Header.Game, handleGamePacketParam, indianPokerClient.ao.WorkingSocket); }