Exemplo n.º 1
0
        /// <summary>
        /// Проверка ввода базовых данных игрока
        /// </summary>
        /// <returns></returns>
        private bool CheckInputBasicData(string name, string keyName, FootballPosition basicPosition)
        {
            bool error = false;

            //проверяем имя
            if (name == null || name.Trim() == "")
            {
                _managingMessages.NotCorrectName();
                error = true;
            }

            // проверяем корректность keyName
            if (keyName == null || keyName.Trim() == "")
            {
                _managingMessages.NotCorrectKeyName();
                error = true;
            }
            else
            {
                // проверяем на совпадение по keyName
                if (_playerList.Present(keyName))
                {
                    _managingMessages.KeyNameExists(keyName);
                    error = true;
                }


                for (byte i = 0; i < keyName.Trim().Length; i++)
                {
                    if (!((keyName[i] >= 65 & keyName[i] <= 90) | (keyName[i] >= 97 & keyName[i] <= 122) | (keyName[i] >= 48 & keyName[i] <= 57)) & keyName[i] != '_')
                    {
                        _managingMessages.NotCorrectKeyName();
                        error = true;
                        break;
                    }
                }
            }

            // проверяем наличие базовой позиции
            if (basicPosition == FootballPosition.Default)
            {
                _managingMessages.NoPosition();
                error = true;
            }

            //проверка максимума активных игроков
            if (_playerList.CountActivePlayers > 44)
            {
                _managingMessages.MaxActivePlayers();
                error = true;
            }


            if (_managingMessages.CheckMessages)
            {
                _managingMessages.ShowMessageNotification(TitleMessage.NotCorrectInput);
            }

            return((error) ? false : true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Расчитать эффектавность игрока на позиции
        /// </summary>
        /// <param name="player"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        public byte CalculationEfiiciencyPosition(IFootballPlayer player, FootballPosition position)
        {
            IList <IParameterPlayer> playerStatsInfoList = player.ParameterPlayerList;

            IdentifyDataStatistics(playerStatsInfoList);

            PlayerProfile plProfile = IdentifyProfile(position);

            return((byte)ExecuteCalculatuon(plProfile));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Инициализация расположения игровой позиции на поле
        /// </summary>
        /// <param name="column"></param>
        /// <param name="row"></param>
        /// <param name="vPos"></param>
        /// <param name="hPos"></param>
        /// <param name="playPos"></param>
        public LocationPosition(byte numberLocation, ILocCellToField locCell, ILocInCell locInCell, FootballPosition playPos)
        {
            _position       = playPos;
            _numberLocation = numberLocation;
            _locCell        = locCell;
            _locInCell      = locInCell;

            //IdentifyLocCell(locCell);
            //IdentifyLocInCell(locInCell);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Добавить нового игрока в список
 /// </summary>
 /// <param name="name"></param>
 /// <param name="keyName"></param>
 /// <param name="basicPosition"></param>
 public void AddNewPlayer(string name, string keyName, FootballPosition basicPosition)
 {
     //тут проверка базовых значений
     if (CheckInputBasicData(name, keyName, basicPosition))
     {
         IFootballPlayer pl = new FootballPlayer {
             Name = name, KeyName = keyName, BasicPlayPosition = basicPosition, IsActive = true
         };
         (_playerList as FootballPlayerList).Add(pl);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Установить текущую позицию
        /// </summary>
        /// <param name="player"></param>
        /// <param name="position"></param>
        public void EditCurrentPosition(IFootballPlayer player, FootballPosition position)
        {
            (player as FootballPlayer).CurrentPlayPosition = position;

            if (position != FootballPosition.Default)
            {
                //перерасчёт эффективности на текущей позиции
                FootballPlayerCalculator calculator = new FootballPlayerCalculator();
                (player as FootballPlayer).CurrentPlayPositionEff = calculator.CalculationEfiiciencyPosition(player, position);
            }

            _loader.SavePlayer(player);
        }
Exemplo n.º 6
0
        private Dictionary <string, byte> Filter(IDataPlayerForChart allData, short countDay, FootballPosition positon)
        {
            DateTime date = (DateTime.Now).Subtract(new TimeSpan(countDay - 1, 0, 0, 0));

            Data data = allData.GetDataFromCurrentToSpecifiedDate(date);

            Dictionary <string, byte> filteredData = new Dictionary <string, byte>();


            foreach (var d in data)
            {
                filteredData.Add(d.Key.ToString("dd/MM/yy"), d.Value[positon]);
            }

            return(filteredData);
        }
Exemplo n.º 7
0
        public IReadOnlyDictionary <string, byte> GetData(IFootballPlayer player, short countDay, FootballPosition positon)
        {
            if (positon != FootballPosition.Default)
            {
                ChartsDataLoader loader = new ChartsDataLoader();

                IDataPlayerForChart allData = loader.LoadDataForChart(player);

                if (allData == null)
                {
                    return(null);
                }

                return(Filter(allData, countDay, positon));
            }

            return(null);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Редактировать имя и базовую позицию игрока
 /// </summary>
 /// <param name="playerName"></param>
 /// <param name="position"></param>
 public void EditBasicProperties(string playerName, FootballPosition position)
 {
     _editablePlayer.Name = playerName;
     _editablePlayer.BasicPlayPosition = position;
     CheckChanges();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Идентификация профиля
 /// </summary>
 /// <param name="position"></param>
 /// <returns></returns>
 private PlayerProfile IdentifyProfile(FootballPosition position)
 {
     return(_profiles[position]);
 }