Ejemplo n.º 1
0
        /// <summary>
        /// Полное редактирование игрока с сохранением
        /// </summary>
        /// <param name="editedPl"></param>
        /// <param name="pl"></param>
        private void FullPLayerEditing(IFootballPlayer editedPl, IFootballPlayer pl)
        {
            FootballPlayerCalculator calculator = new FootballPlayerCalculator();

            (pl as FootballPlayer).CountGames       += editedPl.CountGames;
            (pl as FootballPlayer).Rating            = calculator.CalculationRating(pl, editedPl.Rating);
            (pl as FootballPlayer).BasicPlayPosition = editedPl.BasicPlayPosition;
            (pl as FootballPlayer).Name = editedPl.Name;


            for (int i = 0; i < pl.ParameterPlayerList.Count; i++)
            {
                for (byte j = 0; j < pl.ParameterPlayerList[i].SubParameterList.Count; j++)
                {
                    SubParameterPlayer  subParamPL      = (pl.ParameterPlayerList[i].SubParameterList[j] as SubParameterPlayer);
                    ISubParameterPlayer subParamEditePl = editedPl.ParameterPlayerList[i].SubParameterList[j];

                    subParamPL.Failed       += subParamEditePl.Failed;
                    subParamPL.SuccessFully += subParamEditePl.SuccessFully;
                }
            }

            calculator.CalculationEfiiciencyParameters(pl);
            (pl as FootballPlayer).BasicPlayPositionEff = calculator.CalculationEfiiciencyPosition(pl, pl.BasicPlayPosition);
            _players.Loader.SavePlayer(pl);
            SaveDataForChart(pl, calculator);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Редактировать под параметер
        /// </summary>
        /// <param name="subParam"></param>
        /// <param name="successFully"></param>
        /// <param name="failed"></param>
        public void EditSubParameter(ref ISubParameterPlayer subParam, uint successFully, uint failed)
        {
            SubParameterPlayer sParam = (subParam as SubParameterPlayer);

            sParam.SuccessFully = successFully;
            sParam.Failed       = failed;
            CheckChanges();
        }
Ejemplo n.º 3
0
        void CalculationTopGameEff()
        {
            ISubParameterPlayer topGame = TopGameEff.SubParameterList[0];

            float maxValue  = topGame.Failed + topGame.SuccessFully;
            float factValue = topGame.SuccessFully;

            (TopGameEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
        }
Ejemplo n.º 4
0
        void CalculationBallControlEff()
        {
            ISubParameterPlayer possessionBall = BallControlEff.SubParameterList[0];
            ISubParameterPlayer clearance      = BallControlEff.SubParameterList[1];

            float maxValue  = possessionBall.Failed + possessionBall.SuccessFully;
            float factValue = (float)possessionBall.SuccessFully + (float)clearance.SuccessFully / 2;

            (BallControlEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
        }
Ejemplo n.º 5
0
        void CalculationGollkiperEff()
        {
            ISubParameterPlayer missedGoals         = GollkiperEff.SubParameterList[0];
            ISubParameterPlayer rescue              = GollkiperEff.SubParameterList[1];
            ISubParameterPlayer interceptedCanopies = GollkiperEff.SubParameterList[2];
            ISubParameterPlayer shotBalls           = GollkiperEff.SubParameterList[3];

            float maxValue  = (interceptedCanopies.SuccessFully + shotBalls.SuccessFully) / 2 + missedGoals.Failed + rescue.SuccessFully;
            float factValue = (interceptedCanopies.SuccessFully + shotBalls.SuccessFully) / 2 + rescue.SuccessFully;

            (GollkiperEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
        }
Ejemplo n.º 6
0
        void CalculationPassesEff()
        {
            ISubParameterPlayer assistsPasses   = PassesEff.SubParameterList[0];
            ISubParameterPlayer passes          = PassesEff.SubParameterList[1];
            ISubParameterPlayer importantPasses = PassesEff.SubParameterList[2];
            ISubParameterPlayer canopies        = PassesEff.SubParameterList[3];

            float maxValue  = passes.SuccessFully + passes.Failed + canopies.SuccessFully + canopies.Failed;
            float factValue = (float)(assistsPasses.SuccessFully * 1.2 + importantPasses.SuccessFully * 1.1) +
                              (passes.SuccessFully + canopies.SuccessFully - assistsPasses.SuccessFully - importantPasses.SuccessFully);

            (PassesEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
        }
Ejemplo n.º 7
0
        void CalculationKicksEff()
        {
            ISubParameterPlayer goals  = KicksEff.SubParameterList[0];
            ISubParameterPlayer target = KicksEff.SubParameterList[1];

            float maxValue  = target.SuccessFully + target.Failed;
            float factValue = (float)(goals.SuccessFully * 1.2) + (target.SuccessFully - goals.SuccessFully);

            if (factValue > 0)
            {
                (KicksEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
            }
            else
            {
                (KicksEff as ParameterPlayer).ValueParameter = 0;
            }
        }
Ejemplo n.º 8
0
        void CalculationTacklingEff()
        {
            ISubParameterPlayer tackling     = TacklingEff.SubParameterList[0];
            ISubParameterPlayer foulTackling = TacklingEff.SubParameterList[1];
            ISubParameterPlayer penaltyFoul  = TacklingEff.SubParameterList[2];

            float maxValue  = tackling.SuccessFully + tackling.Failed;
            float factValue = maxValue - foulTackling.Failed - tackling.Failed - (float)(penaltyFoul.Failed * 1.2);

            if (factValue > 0)
            {
                (TacklingEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
            }
            else
            {
                (TacklingEff as ParameterPlayer).ValueParameter = 0;
            }
        }
Ejemplo n.º 9
0
        void CalculationPositionalPlayEff()
        {
            ISubParameterPlayer interceptions     = PositionalPlayEff.SubParameterList[0];
            ISubParameterPlayer block             = PositionalPlayEff.SubParameterList[1];
            ISubParameterPlayer IncorrectPosition = PositionalPlayEff.SubParameterList[2];

            float maxValue  = interceptions.SuccessFully + block.SuccessFully;
            float factValue = maxValue - IncorrectPosition.Failed;

            if (factValue > 0)
            {
                (PositionalPlayEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
            }
            else
            {
                (PositionalPlayEff as ParameterPlayer).ValueParameter = 0;
            }
        }
Ejemplo n.º 10
0
        void CalculationDribblingEff()
        {
            ISubParameterPlayer ImportantDribbling = DribblingEff.SubParameterList[0];
            ISubParameterPlayer Foul = DribblingEff.SubParameterList[1];
            ISubParameterPlayer CompletedDribbling = DribblingEff.SubParameterList[2];

            float maxValue  = (ImportantDribbling.SuccessFully * 2 + Foul.SuccessFully / 2) + CompletedDribbling.SuccessFully;
            float factValue = maxValue - BallControlEff.SubParameterList[0].Failed / 2;

            if (factValue < 0)
            {
                factValue = 0;
            }

            if (maxValue < factValue)
            {
                (DribblingEff as ParameterPlayer).ValueParameter = 0;
            }
            else
            {
                (DribblingEff as ParameterPlayer).ValueParameter = GetPercentEff(maxValue, factValue);
            }
        }
 /// <summary>
 /// Инициализация ViewModel'и сдвоенного значения подпараметра
 /// </summary>
 /// <param name="edirableSubParameter"></param>
 /// <param name="currentSubParameter"></param>
 /// <param name="editor"></param>
 public DualSubParameterViewModel(ISubParameterPlayer currentSubParameter, ISubParameterPlayer edirableSubParameter, IPlayerEditor editor)
 {
     _editableSubParameter = edirableSubParameter;
     _currentSubParameter  = currentSubParameter;
     _editor = editor;
 }