Esempio n. 1
0
 // User Interactions
 public override void OnOkSelected()
 {
     if (gameState == GameState.TurnSelectingNumber && localPlayer == currentTurnPlayer)
     {
         if (selectedCards.Count > 0)
         {
             netCode.NotifyHostPlayerRankSelected((int)selectedCards[0].Rank);   //TODO fix == not correct way
         }
     }
     else if (gameState == GameState.TurnConfirmedSelectedNumber && localPlayer == currentTurnTargetPlayer)
     {
         netCode.NotifyHostPlayerOpponentConfirmed();
     }
     else if (gameState == GameState.GameFinished)
     {
         netCode.LeaveRoom();
     }
 }
Esempio n. 2
0
 //****************** User Interaction *********************//
 public override void OnOkSelected()
 {
     if (gameState == GameState.TurnSelectingNumber && localPlayer == currentTurnPlayer)
     {
         if (selectedCard != null)
         {
             netCode.NotifyHostPlayerRankSelected((int)selectedCard.Rank);
         }
     }
     else if (gameState == GameState.TurnWaitingForOpponentConfirmation && localPlayer == currentTurnTargetPlayer)
     {
         netCode.NotifyHostPlayerOpponentConfirmed();
     }
     else if (gameState == GameState.GameFinished)
     {
         netCode.LeaveRoom();
     }
 }
Esempio n. 3
0
 //****************** User Interaction *********************//
 public override void OnBetSelected(float sliderVal)
 {
     if (gameState == GameState.Bet && localPlayer == currentTurnPlayer)
     {
         if (betSlider != null)
         {
             currentBet = sliderVal;
             gameState  = GameState.ConfirmBet;
             netCode.NotifyHostPlayerRankSelected((int)selectedCard.Rank);
         }
     }
     else if (gameState == GameState.WaitingForOpponent && localPlayer == currentTurnTargetPlayer)
     {
         netCode.NotifyHostPlayerOpponentConfirmed();
     }
     else if (gameState == GameState.GameFinished)
     {
         netCode.LeaveRoom();
     }
 }
Esempio n. 4
0
        //*********************** User Interaction *************************//
        //ovde ce se mozda morat overrideat onbuttonselected isto

        public override void OnOkSelected()
        {
            //NISAN SIGURAN KAKO BI OVO RJESIJA PA CU KOPIRAT SA TUTORIALA I KASNIJE PRIKO TESTIRANJA USKLADIT

            if (gameState == GameState.TurnSelectingPlayer && localPlayer == currentTurnPlayer)
            {
                if (selectedCard != null && currentTurnTargetPlayer != null)
                {
                    gameState = GameState.TurnConfirmedSelectedNumber;      //dodano za test 1.8
                    netCode.NotifyOtherPlayersGameStateChanged();

                    netCode.NotifyHostPlayerRankSelected((int)selectedCard.Rank);
                    netCode.NotifyHostPlayerTargetPlayerSelected(currentTurnTargetPlayer.PlayerId);
                }

                else
                {
                    Debug.Log("Logic error in MultiplayerGame :: OnOkSelected()!");
                }
            }

            else
            {   //moguce da je ovde bude problem, sta ako host klikne ok a nije jos izabra kartu
                netCode.NotifyHostPlayerOpponentConfirmed();
            }



            /*
             * //kometano zbog testiranja maknit kasnije i priradit
             * if (selectedCard != null && currentTurnTargetPlayer != null)
             * {
             *  gameState = GameState.TurnConfirmedSelectedNumber;
             *  //ResetSelectedPlayer();    //mozda triba mozda ne      takoder triba maknit chose panel ako nije local player
             *  GameFlow();
             * }
             *
             * if (selectedCard != null && currentTurnTargetPlayer == null)
             * {
             *  ChoseThePlayerCardButtonPanel.SetActive(true);
             *  gameState = GameState.TurnSelectingPlayer;
             *  GameFlow();
             * }
             *
             * if (currentTurnTargetPlayer == localPlayer && currentTurnPlayer != localPlayer && gameState != GameState.TurnSelectingPlayer && gameState != GameState.TurnConfirmedSelectedNumber)
             * {   //testing
             *  List<byte> cardValuesFromTargetPlayer = gameDataManager.TakeCardValuesWithRankFromPlayer(currentTurnTargetPlayer, selectedRank);
             *
             *  if (cardValuesFromTargetPlayer.Count > 0)
             *  {
             *      gameDataManager.AddCardValuesToPlayer(currentTurnPlayer, cardValuesFromTargetPlayer);
             *
             *      bool senderIsLocalPlayer = currentTurnTargetPlayer == localPlayer;
             *      currentTurnTargetPlayer.SendDisplayingCardToPlayer(currentTurnPlayer, cardAnimator, cardValuesFromTargetPlayer, senderIsLocalPlayer);
             *      ResetSelectedPlayer();  //testing
             *      ResetSelectedCard();    //testing
             *      gameState = GameState.TurnSelectingNumber;
             *  }
             *  else
             *  {
             *      ResetSelectedPlayer();  //testing
             *      ResetSelectedCard();    //testing
             *      gameState = GameState.TurnGoFish;
             *      GameFlow();
             *  }
             * }
             *
             * //ovaj dio ce ja mis ostat zakomentiran(ovo je original, ne koristin ga u 4igraca
             * //if (gameState == GameState.TurnSelectingNumber && localPlayer == currentTurnPlayer)
             * //{
             * //    if (selectedCard != null)
             * //    {
             * //        gameState = GameState.TurnConfirmedSelectedNumber;
             * //        GameFlow();
             * //    }
             * //}
             * //else if (gameState == GameState.TurnWaitingForOpponentConfirmation && localPlayer == currentTurnTargetPlayer)
             * //{
             * //    gameState = GameState.TurnOpponentConfirmed;
             * //    GameFlow();
             * //}*/
        }