Пример #1
0
        public override string needSaving(string land)
        {
            string field = "";

            Debug.Log(controller.getPlayer() + " == " + data.getPlayer());
            if (data.getPlayerByLand(land).Equals(data.getPlayer()))//checking if the player owned that land
            {
                controller.resetMemoryBuffer();
                field = "firstLand";
                view.updateTwoSelected(land, "Select a state !!!");
            }
            else
            {
                if (controller.getFirstLand() != null && data.areNeighbor(controller.getFirstLand(), land))
                { // checking the lands are neghbor
                    field = "secondLand";
                    view.updateTwoSelected(controller.getFirstLand(), land);
                }
            }

            return(field);
        }
        public override string needSaving(string land)
        {
            string field = "";

            if (data.getPlayerByLand(land).Equals(data.getPlayer()))
            {
                if (controller.getFirstLand() == null ||                                           //there is no land selected
                    controller.getFirstLand().Equals(land) ||                                      //the first land is the same selected
                    controller.getSecondLand() != null && controller.getSecondLand().Equals(land)) //the second land is the same selected
                {
                    controller.resetMemoryBuffer();
                    field = "firstLand";
                    view.updateTwoSelected(land, "Selected a state !!!");
                }
                else if (data.areNeighbor(controller.getFirstLand(), land))
                {
                    field = "secondLand";
                    view.updateTwoSelected(controller.getFirstLand(), land);
                }
            }
            return(field);
        }
Пример #3
0
 public StateAttack(ControllGameMap controller, DataManager data, MessageManager manageMessage, ViewGameMap view)
 {
     this.controller    = controller;
     this.data          = data;
     this.view          = view;
     this.manageMessage = manageMessage;
     nextPhaseLoad      = this;
     firstLand          = "";
     secondLand         = "";
     nTanks             = -1;
     controller.resetMemoryBuffer();
     view.updatePhase(data.getPlayer(), data.getPhase());
     view.changeCanvasOption("Attack phase");
     view.updateTwoSelected("", "");
     Debug.Log("Data phase: " + data.getPhase() + " - State : Attack");
 }
Пример #4
0
 private void DefendMessage()
 {
     view.updateLogEvent(manageMessage.readDefend(messageData));
     data.setAttackPhase(manageMessage.getLandStart());
     view.updatePhase(data.getPlayer(), data.getPhase());
     if (!data.getPlayer().Equals(controller.getPlayer()))//check if the player is NOT the one who engaged the battle
     {
         nextPhaseLoad = this;
     }
     else
     {
         view.changeCanvasOption("Attack phase");
         view.updateTwoSelected(null, null);
         nextPhaseLoad = new StateAttack(controller, data, manageMessage, view);
     }
 }