Пример #1
0
        private void B_Save_Click(object sender, EventArgs e)
        {
            if (tabControl1.Controls.Contains(TAB_Joyful) && SAV is IGen3Joyful j)
            {
                SaveJoyful(j);
            }
            if (tabControl1.Controls.Contains(TAB_Ferry))
            {
                SaveFerry();
            }
            if (tabControl1.Controls.Contains(TAB_BF))
            {
                SaveBattleFrontier();
            }
            if (SAV is SAV3FRLG frlg)
            {
                frlg.RivalName = TB_RivalName.Text;
                ComboBox[] cba = { CB_TCM1, CB_TCM2, CB_TCM3, CB_TCM4, CB_TCM5, CB_TCM6 };
                for (int i = 0; i < cba.Length; i++)
                {
                    var species   = (ushort)WinFormsUtil.GetIndex(cba[i]);
                    var g3Species = SpeciesConverter.GetG3Species(species);
                    SAV.SetEventConst(0x43 + i, (ushort)g3Species);
                }
            }

            if (SAV is SAV3E se)
            {
                se.BP = (ushort)NUD_BP.Value;
            }
            SAV.Coin = (ushort)NUD_Coins.Value;

            Origin.CopyChangesFrom(SAV);
            Close();
        }
Пример #2
0
        public SAV_Misc3(SaveFile sav)
        {
            InitializeComponent();
            WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
            SAV = (SAV3)(Origin = sav).Clone();

            LoadRecords();

            if (SAV is IGen3Joyful j)
            {
                ReadJoyful(j);
            }
            else
            {
                tabControl1.Controls.Remove(TAB_Joyful);
            }

            if (SAV is SAV3E)
            {
                ReadFerry();
                ReadBattleFrontier();
            }
            else
            {
                tabControl1.Controls.Remove(TAB_Ferry);
                tabControl1.Controls.Remove(TAB_BF);
            }

            if (SAV is SAV3FRLG frlg)
            {
                TB_RivalName.Text = frlg.RivalName;

                // Trainer Card Species
                ComboBox[] cba         = { CB_TCM1, CB_TCM2, CB_TCM3, CB_TCM4, CB_TCM5, CB_TCM6 };
                var        legal       = GameInfo.SpeciesDataSource.Where(v => v.Value <= SAV.MaxSpeciesID);
                var        speciesList = legal.Select(v => new ComboItem(v.Text, SpeciesConverter.GetG3Species(v.Value))).ToList();
                for (int i = 0; i < cba.Length; i++)
                {
                    cba[i].Items.Clear();
                    cba[i].InitializeBinding();
                    cba[i].DataSource    = new BindingSource(speciesList, null);
                    cba[i].SelectedValue = SAV.GetEventConst(0x43 + i);
                }
            }
            else
            {
                TB_RivalName.Visible = L_TrainerName.Visible = GB_TCM.Visible = false;
            }

            NUD_Coins.Value = Math.Min(NUD_Coins.Maximum, SAV.Coin);
        }