Ejemplo n.º 1
0
        async Task INotificationHandler <TeamUpdated> .Handle(TeamUpdated e, CancellationToken t)
        {
            var result =
                await db.Teams
                .SingleAsync(u => u.InternalId == e.Id);

            result.CommonName       = e.CommonName;
            result.UniqueIdentifier = e.UniqueIdentifier;

            await db.SaveChangesAsync();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
 private void Apply(TeamUpdated e)
 {
     this.CommonName = e.CommonName ?? throw new ArgumentNullException(nameof(e.CommonName));
     this.IsActive   = e.IsActive;
 }