Beispiel #1
0
        private void GetDataFromServer(int count)
        {
            //Simulation of getting top players data
            for (int i = 0; i < count; i++)
            {
                System.Array      array  = System.Enum.GetValues(typeof(PlayerDTO.Avatars));
                PlayerDTO.Avatars avatar = (PlayerDTO.Avatars)array.GetValue(Random.Range(0, array.Length));
                array = System.Enum.GetValues(typeof(PlayerDTO.Statuses));
                PlayerDTO.Statuses status = (PlayerDTO.Statuses)array.GetValue(Random.Range(0, array.Length));
                array = System.Enum.GetValues(typeof(PlayerDTO.Names));
                PlayerDTO.Names nickname = (PlayerDTO.Names)array.GetValue(Random.Range(0, array.Length));

                _players.Add(new PlayerDTO(nickname.ToString(), Random.Range(0, 20000), Random.Range(0, 15000), Random.Range(0, 10000), avatar.ToString(), status.ToString()));
                if (status.ToString() == _mainUser.Data.Status)
                {
                    _sameStatusPlayers.Add(_players[i]);
                }
            }
            _players.Add(_mainUser.Data);

            _currentList = _players;
            SortPlayers();
            SetDataToUsers();
            SaveUsers();
            Initialize();
        }
Beispiel #2
0
 private void GetMainUserFromServer()
 {
     System.Array      array  = System.Enum.GetValues(typeof(PlayerDTO.Avatars));
     PlayerDTO.Avatars avatar = (PlayerDTO.Avatars)array.GetValue(Random.Range(0, array.Length));
     array = System.Enum.GetValues(typeof(PlayerDTO.Statuses));
     PlayerDTO.Statuses status = (PlayerDTO.Statuses)array.GetValue(Random.Range(0, array.Length));
     _ui.SetStatus(status.ToString());
     _mainUser.SetData(new PlayerDTO("Evgenius", Random.Range(0, 30000), Random.Range(0, 25000), Random.Range(0, 20000), avatar.ToString(), status.ToString()), _currentDifficulty, false);
 }