Ejemplo n.º 1
0
        public void SetListMode(PokedexListMode listMode)
        {
            ListMode = listMode;
            if (ListMode == PokedexListMode.Regional)
            {
                _entries = PokedexEntry.GetRegional();
            }
            else
            {
                _entries = PokedexEntry.GetRegionalAtoZ();
            }

            PresetSelection();
        }
Ejemplo n.º 2
0
        public static PokedexEntry[] GetTypeFiltered(PokemonType type1, PokemonType type2, PokedexListMode listMode)
        {
            var entries = GetMany(PokedexEntryData.GetAll());

            // get all caught
            var caught        = Controller.ActivePlayer.PokedexCaught;
            var caughtEntries = entries.Where(e => caught.Contains(e.Id));

            // filter by input type(s)
            var filtered = caughtEntries.Where(e =>
            {
                var data = PokemonData.Get(e.Id);
                if (type2 == PokemonType.None) // only filter by first input type
                {
                    return(type1 == DataHelper.ParseEnum <PokemonType>(data.type1) ||
                           type1 == DataHelper.ParseEnum <PokemonType>(data.type2));
                }
                else // filter by both input types
                {
                    var ptype1 = DataHelper.ParseEnum <PokemonType>(data.type1);
                    var ptype2 = DataHelper.ParseEnum <PokemonType>(data.type2);
                    return((type1 == ptype1 ||
                            type1 == ptype2) &&
                           (type2 == ptype1 ||
                            type2 == ptype2));
                }
            });

            switch (listMode)
            {
            case PokedexListMode.National:
                // order by national id
                return(filtered.OrderBy(e => e.Id).ToArray());

            case PokedexListMode.Regional:
                // order by regional id
                return(filtered.OrderBy(e => e.NewId).ToArray());

            case PokedexListMode.AtoZ:
                // order by name a-z
                return(filtered.OrderBy(e => e.Name).ToArray());
            }

            throw new InvalidOperationException("Invalid list mode provided to filter.");
        }
Ejemplo n.º 3
0
 public PokedexResultScreen(Screen preScreen, PokemonType type1, PokemonType type2, PokedexListMode listMode)
     : base(preScreen, listMode)
 {
     _type1 = type1;
     _type2 = type2;
 }
Ejemplo n.º 4
0
 public RegionalPokedexListScreen(Screen preScreen, PokedexListMode listMode)
     : base(preScreen, listMode)
 {
 }
Ejemplo n.º 5
0
 public PokedexSearchScreen(Screen preScreen, Screen prePokedexScreen, PokedexListMode listMode)
 {
     _preScreen        = preScreen;
     _prePokedexScreen = prePokedexScreen;
     _listMode         = listMode;
 }
Ejemplo n.º 6
0
 public PokedexListScreen(Screen preScreen, PokedexListMode listMode)
 {
     _preScreen = preScreen;
     ListMode   = listMode;
 }