public ArenaWindow(Window w, Arena_Impl arenaImpl, Fighter_Impl pImpl)
        {
            this.pImpl = pImpl;

            this.arenaImpl = arenaImpl;
            this.w         = w;

            //is triggered when coming from prefield window
            if (w is PreBattleFieldWindow)
            {
                backtrack = true;
            }

            InitializeComponent();

            //ALREADY CREATED ARENA IN PREARENA
            //Creates the playground (currently of 6,6)
            CreateArena();

            //Adds prefieldbattle team to list and adds them to their respective fields on the battleField
            InsertParticipantsToField();

            ListOfParticipants.SelectedIndex = 0;
            Fighter_DTO firstFighter = pImpl.GetParticipant(ListOfParticipants.SelectedValue.ToString()); //is allowed due to not otherwize being able to access it.

            if (firstFighter.TeamColorGS.Equals("blue"))                                                  //only triggered if the first fighter is Horde
            {
                xCoord.IsHitTestVisible = false;
                yCoord.IsHitTestVisible = false;
                PlayingDisplayBox.Text  = hordeTxt;
                CheckNextParticipant();
            }
        }
Example #2
0
        /// <summary>
        /// event triggered when player submitting a fighter to the pre-arena.
        /// "a combination of other methods primarily"
        /// ((Not used if pressing the "preset" button))
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubmitMove_Button(object sender, RoutedEventArgs e)
        {
            string      participantToMove = MemberListBox.SelectedItem.ToString();
            Fighter_DTO pDTO = pImpl.GetParticipant(participantToMove);

            pDTO.TeamColorGS = AllianceTeamColor;
            int x = int.Parse(txtXCoord.Text);
            int y = int.Parse(txtYCoord.Text);
            ArenaFieldPoint_DTO AFP_DTO = ArenaImpl.GetArenaField(x, y);

            /** MOVING **/
            bool run = ArenaImpl.CheckField(AFP_DTO, pDTO); //checks the field we are trying to go to

            if (run)
            {
                ClearsImage(pDTO); //removes image

                //updates the point we are leaving.
                ArenaImpl.UpdateLeavingArenaFieldPoint(pDTO, "preArena");  //Updating the fieldstatus since we are leaving to another field.

                pImpl.MoveParticipant(pDTO, ArenaImpl.GetArenaField(x, y));

                ArenaImpl.UpdateMovingToArenaFieldStatus(AFP_DTO, "preArena");

                SetsImage(pDTO);
            }
            /** MOVING ENDS **/
        }
        /*
         * MoveToSpot
         * ClearsImage
         * SetsImage
         * CreatePreField
         * InsertParticipantsToField
         */
        #region Methods
        //Moves participant in fieldDTO List
        //sets and clears images as well
        public void InitiateMovement(ArenaFieldPoint_DTO AFP_DTO)
        {
            //moves participant in storage and on field list
            //Updates participantDTO in storage
            string participantToMove = ListOfParticipants.SelectedItem.ToString(); //retrieves name

            Fighter_DTO pDTO = pImpl.GetParticipant(participantToMove);

            bool movementOkay = pImpl.CheckMovement(pDTO, AFP_DTO); //first checks if movement is okay

            if (movementOkay == true)
            {
                bool checkField = arenaImpl.CheckField(AFP_DTO, pDTO); //checks the field we are trying to go to

                if (checkField == true)
                {
                    ActivateMovement(pDTO, AFP_DTO);
                }
            }
        }