Пример #1
0
        /// <summary>
        /// Возвращает копию
        /// </summary>
        /// <returns></returns>
        public IFootballPlayer GetCopy()
        {
            FootballPlayer FP = new FootballPlayer();

            FP.BasicPlayPosition      = BasicPlayPosition;
            FP.BasicPlayPositionEff   = BasicPlayPositionEff;
            FP.CountGames             = CountGames;
            FP.CurrentPlayPosition    = CurrentPlayPosition;
            FP.CurrentPlayPositionEff = CurrentPlayPositionEff;
            FP.ID                  = ID;
            FP.IsActive            = IsActive;
            FP.KeyName             = KeyName;
            FP.Name                = Name;
            FP.ParameterPlayerList = GetCopyParameters();
            FP.PlayBox             = PlayBox;
            FP.Rating              = Rating;

            return(FP);
        }
Пример #2
0
        /// <summary>
        /// Создание копии для редактирования
        /// </summary>
        private void CreateEditableCopy()
        {
            if (_editedPlayers.ContainsKey(_player.KeyName))
            {
                _editablePlayer = _editedPlayers[_player.KeyName];
            }
            else
            {
                _editablePlayer            = (_player.GetCopy() as FootballPlayer);
                _editablePlayer.Rating     = 0;
                _editablePlayer.CountGames = 0;

                foreach (IParameterPlayer param in _editablePlayer.ParameterPlayerList)
                {
                    foreach (ISubParameterPlayer subParam in param.SubParameterList)
                    {
                        (subParam as SubParameterPlayer).Failed       = 0;
                        (subParam as SubParameterPlayer).SuccessFully = 0;
                    }
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Удалить игрока из редактора
 /// </summary>
 public void RemovePlayer()
 {
     _player         = null;
     _editablePlayer = null;
 }
Пример #4
0
 /// <summary>
 /// Установить игрока для редактирования
 /// </summary>
 /// <param name="player"></param>
 public void SetPlayer(IFootballPlayer player)
 {
     _player = (player as FootballPlayer);
     CreateEditableCopy();
 }
Пример #5
0
 /// <summary>
 /// Очистить редактор. Удаляет игрока, а также очищает всё изменения всех изменённых игроков
 /// </summary>
 public void Clear()
 {
     _player         = null;
     _editablePlayer = null;
     _editedPlayers.Clear();
 }