コード例 #1
0
 public void AddEvolution(EvolutionData evolution)
 {
     if (evolutions == null)
     {
         evolutions = new List <EvolutionData>();
     }
     evolutions.Add(evolution);
 }
コード例 #2
0
        private static void LoadEvolutions(SQLiteConnection connection)
        {
            SQLiteCommand command;
            SQLiteDataReader reader;
            DataTable table;

            // Load Pokemon Evolutions, we need to read it again since we didn't have all the pokemon names before
            command = new SQLiteCommand("SELECT * FROM Pokemon", connection);
            reader = command.ExecuteReader();
            table = new DataTable("Pokemon");
            table.Load(reader);
            foreach (DataRow row in table.Rows) {
                ushort id = (ushort)(long)row["ID"];
                if (id != 412) {
                    PokemonData pokemon = GetPokemonFromID(id);
                    string evoScript = row["Evolutions"] as string;
                    if (evoScript != null) {
                        string[] evoStrings = evoScript.Split(new string[] { ", ", "," }, StringSplitOptions.None);
                        foreach (string evoString in evoStrings) {
                            EvolutionData evolution = new EvolutionData(evoString);
                            pokemon.AddEvolution(evolution);
                        }
                    }
                }
            }

            foreach (PokemonData pokemonData in gen3PokemonDexList) {
                pokemonData.FamilyDexID = GetStartingEvolutionDexID(pokemonData.DexID);
            }
        }