Exemplo n.º 1
0
 public void GoToPokemon(PokemonId pokemon)
 {
     if (pokemon != PokemonId.Missingno)
     {
         SelectedItem = PokedexItems.First(t => t.Id == pokemon);
     }
 }
Exemplo n.º 2
0
        public void Load(PokemonId loadedId = PokemonId.Missingno)
        {
            var pokedexItems      = GameClient.PokedexInventory;
            var lastPokemonIdSeen = pokedexItems == null || pokedexItems.Count == 0 ? 0 : pokedexItems.Max(x => (int)x.PokemonId);

            if (lastPokemonIdSeen > 0)
            {
                IEnumerable <PokemonId> listAllPokemon = Enum.GetValues(typeof(PokemonId)).Cast <PokemonId>();

                foreach (PokemonId id in listAllPokemon.Where(t => t != PokemonId.Missingno && pokedexItems.Any(y => y.PokemonId == t)))
                {
                    var pokemonModel = new PokemonModel(id);

                    PokedexItems.Add(pokemonModel);
                }

                CapturedPokemons = pokedexItems.Count(x => x.TimesCaptured > 0);
                if (pokedexItems != null)
                {
                    SeenPokemons = pokedexItems.Count;
                }
            }
            else
            {
                CapturedPokemons = 0;
                SeenPokemons     = 0;
            }

            if (loadedId != PokemonId.Missingno)
            {
                GoToPokemon(loadedId);
            }

            Debug.WriteLine("Loaded!");
        }