Exemple #1
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);
                }
            }
        }