Пример #1
0
        private void OnPokemonTeam(string[] data)
        {
            string[] teamData = data[1].Split(new string[] { "\r\n" }, StringSplitOptions.None);

            _team = new List <Pokemon>();
            foreach (string line in teamData)
            {
                if (line.Length > 0)
                {
                    _team.Add(new Pokemon(line.Split('|')));
                }
            }

            _reorderTimeout.Set(0);
            TeamUpdated?.Invoke();
        }
Пример #2
0
        private void OnBattleData(string[] data)
        {
            _battleTimeout.Set(Rand.Next(5000, 8000));

            string[] messages = data[5].Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string message in messages)
            {
                if (!Battle.ProcessMessage(_team, message))
                {
                    BattleMessage?.Invoke(message);
                }
            }

            TeamUpdated?.Invoke();

            if (Battle.IsFinished)
            {
                _sendBattleRefresh = true;
                IsInBattle         = false;
                Battle             = null;
                BattleEnded?.Invoke();
            }
        }