public override UpdateResult Update() { var arenaInfo = _gameDataProvider.GetArenaInfo(); if (arenaInfo == null) { return(UpdateResult.Continue); } var numCards = arenaInfo.Deck.Cards.Sum(x => x.Count); if (numCards == MaxDeckSize) { if (_prevSlot == MaxDeckSize) { OnCardPicked(arenaInfo); } DeckComplete?.Invoke(new ArenaDeckComlpeteEventArgs(arenaInfo)); if (arenaInfo.Rewards?.Any() ?? false) { RunComplete?.Invoke(new ArenaRunCompleteEventArgs(arenaInfo)); } return(UpdateResult.Break); } if (HasChanged(arenaInfo, arenaInfo.CurrentSlot)) { var choices = _gameDataProvider.GetDraftChoices(); if (choices == null || choices.Length == 0) { return(UpdateResult.Continue); } if (arenaInfo.CurrentSlot > _prevSlot) { if (ChoicesHaveChanged(choices) || _sameChoices) { _sameChoices = false; ChoicesChanged?.Invoke(new ArenaChoicesChangedEventArgs(choices, arenaInfo.Deck)); } else { _sameChoices = true; return(UpdateResult.Continue); } } if (_prevSlot == 0 && arenaInfo.CurrentSlot == 1) { OnHeroPicked(arenaInfo); } else if (_prevSlot > 0 && arenaInfo.CurrentSlot > _prevSlot) { OnCardPicked(arenaInfo); } _prevSlot = arenaInfo.CurrentSlot; _prevInfo = arenaInfo; _prevChoices = choices; } return(UpdateResult.Continue); }