Ejemplo n.º 1
0
        public SAV_PokedexSWSH(SAV8SWSH sav)
        {
            InitializeComponent();
            WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
            SAV = (SAV8SWSH)(Origin = sav).Clone();
            Dex = SAV.Blocks.Zukan;
            var indexes      = Dex.GetRawIndexes(PersonalTable.SWSH, Dex.GetRevision());
            var speciesNames = GameInfo.Strings.Species;

            Indexes = indexes.OrderBy(z => z.GetEntryName(speciesNames)).ToArray();
            CL      = new[] { CHK_L1, CHK_L2, CHK_L3, CHK_L4, CHK_L5, CHK_L6, CHK_L7, CHK_L8, CHK_L9 };
            CHK     = new[] { CLB_1, CLB_2, CLB_3, CLB_4 };

            Loading = true;
            // Clear Listbox and ComboBox
            LB_Species.Items.Clear();
            CB_Species.Items.Clear();
            foreach (var c in CHK)
            {
                c.Items.Clear();
                for (int j = 0; j < 63; j++)
                {
                    c.Items.Add($"{j:00} - N/A");
                }
                c.Items.Add("Gigantamax (0)");
            }

            // Fill List
            CB_Species.InitializeBinding();
            var species = GameInfo.FilteredSources.Species.Where(z => Dex.DexLookup.ContainsKey(z.Value)).ToArray();

            CB_Species.DataSource = new BindingSource(species, null);

            var names = Indexes.Select(z => z.GetEntryName(speciesNames) + (Dex.DexLookup[z.Species].DexType == z.Entry.DexType ? string.Empty : "***"));

            foreach (var n in names)
            {
                LB_Species.Items.Add(n);
            }

            Loading = false;
            LB_Species.SelectedIndex = 0;
            CB_Species.KeyDown      += WinFormsUtil.RemoveDropCB;
            CanSave = true;
        }