public override StateControl nextPhaseForced()
 {
     if (nTanksRemain > 0)
     {
         nextPhaseLoad = this;
         view.showMessage("You have to deploy ALL your tanks !!!");
     }
     else
     {
         if (!data.isAllPlayerRunOutOfTanks())
         {
             recycle();
         }
         else
         {
             loadStart();
         }
     }
     if (controller.isLocalMode())
     {
         controller.setLocalMode();
     }
     return(nextPhaseLoad);
 }
Exemplo n.º 2
0
        // Button methods

        public void onClickAction()
        {
            Debug.Log("state : " + state);
            List <string> error = state.getMissingData();

            if (error.Count != 0)
            {
                int    count            = 0;
                string messageToDisplay = "You can't do that action because are missing some data : ";
                foreach (string missing in error)
                {
                    messageToDisplay += missing;
                    if (count != error.Count)
                    {
                        messageToDisplay += ", ";
                    }
                }
                view.showMessage(messageToDisplay);
            }
            else
            {
                string errorAction = state.action();
                if (errorAction.Equals("FORCE_NEXT_PHASE"))
                {
                    state = state.nextPhaseForced();
                }
                else if (!errorAction.Equals(""))
                {
                    view.showMessage(errorAction);
                }
            }
            view.updateTextPlayerData(model.getPlayerData(player));
            if (firstLand != null && !firstLand.Equals(""))
            {
                view.updateLandText(model.getLandData(firstLand));
            }

            if (model.hasWon(player))
            {
                view.showMessage(player + " has won!");
            }
        }