示例#1
0
        public static List <EvolutionSet> GetArray(byte[] data)
        {
            EvolutionSet[] evos = new EvolutionSet[Legal.MaxSpeciesID_3 + 1];
            evos[0] = new EvolutionSet3 {
                PossibleEvolutions = new EvolutionMethod[0]
            };
            for (int i = 0; i <= Legal.MaxSpeciesIndex_3; i++)
            {
                int g4species = SpeciesConverter.GetG4Species(i);
                if (g4species == 0)
                {
                    continue;
                }

                int offset = i * 40;
                var m_list = new List <EvolutionMethod>();
                for (int j = 0; j < 5; j++)
                {
                    EvolutionMethod m = GetMethod(data, offset);
                    if (m != null)
                    {
                        m_list.Add(m);
                    }
                    else
                    {
                        break;
                    }
                    offset += 8;
                }
                evos[g4species] = new EvolutionSet3 {
                    PossibleEvolutions = m_list.ToArray()
                };
            }
            return(evos.ToList());
        }
示例#2
0
        public static IReadOnlyList <EvolutionSet> GetArray(byte[] data)
        {
            var evos = new EvolutionSet[Legal.MaxSpeciesID_3 + 1];

            evos[0] = Blank;
            for (int i = 1; i <= Legal.MaxSpeciesIndex_3; i++)
            {
                int g4species = SpeciesConverter.GetG4Species(i);
                if (g4species == 0)
                {
                    continue;
                }

                const int maxCount = 5;
                const int size     = 8;

                int offset = i * (maxCount * size);
                int count  = 0;
                for (; count < maxCount; count++)
                {
                    if (data[offset + (count * size)] == 0)
                    {
                        break;
                    }
                }
                if (count == 0)
                {
                    evos[g4species] = Blank;
                    continue;
                }

                var set = new EvolutionMethod[count];
                for (int j = 0; j < set.Length; j++)
                {
                    set[j] = GetMethod(data, offset + (j * size));
                }
                evos[g4species] = new EvolutionSet3 {
                    PossibleEvolutions = set
                };
            }
            return(evos);
        }