示例#1
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");
 }
示例#2
0
 public StateDeploy(ControllGameMap controller, DataManager data, MessageManager manageMessage, ViewGameMap view)
 {
     this.controller    = controller;
     this.data          = data;
     this.manageMessage = manageMessage;
     this.view          = view;
     land   = null;
     nTanks = -1;
     controller.resetMemoryBuffer();
     data.giveTanks();
     view.updatePhase(data.getPlayer(), data.getPhase());
     view.updateDeploySelected("Selecet a state !!!");
     view.changeCanvasOption("Deployment phase");
     view.updateTanksRemain(data.getPlayerTanksReinforcement(data.getPlayer()));
     Debug.Log("Data phase: " + data.getPhase() + " - State : Deploy");
 }
示例#3
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);
        }