2022-08-27 06:43:36 +00:00
|
|
|
using System;
|
2016-08-30 00:48:05 +00:00
|
|
|
using System.Windows.Forms;
|
2017-01-08 07:54:09 +00:00
|
|
|
using PKHeX.Core;
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.WinForms;
|
|
|
|
|
|
|
|
public partial class SAV_SimplePokedex : Form
|
2016-08-30 00:48:05 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
private readonly SaveFile Origin;
|
|
|
|
private readonly SaveFile SAV;
|
|
|
|
|
|
|
|
public SAV_SimplePokedex(SaveFile sav)
|
2016-08-30 00:48:05 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
InitializeComponent();
|
|
|
|
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
|
|
|
SAV = (Origin = sav).Clone();
|
|
|
|
seen = new bool[SAV.MaxSpeciesID];
|
|
|
|
caught = new bool[SAV.MaxSpeciesID];
|
2018-07-22 02:20:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var speciesNames = GameInfo.Strings.specieslist;
|
|
|
|
for (int i = 0; i < seen.Length; i++)
|
2016-08-30 00:48:05 +00:00
|
|
|
{
|
2022-08-27 06:43:36 +00:00
|
|
|
ushort species = (ushort)(i + 1);
|
2022-06-18 18:04:24 +00:00
|
|
|
seen[i] = SAV.GetSeen(species);
|
|
|
|
caught[i] = SAV.GetCaught(species);
|
|
|
|
CLB_Seen.Items.Add(speciesNames[species]);
|
|
|
|
CLB_Caught.Items.Add(speciesNames[species]);
|
|
|
|
CLB_Seen.SetItemChecked(i, seen[i]);
|
|
|
|
CLB_Caught.SetItemChecked(i, caught[i]);
|
2016-08-30 00:48:05 +00:00
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
initialized = true;
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private readonly bool[] seen;
|
|
|
|
private readonly bool[] caught;
|
|
|
|
private readonly bool initialized;
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_Save_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < seen.Length; i++)
|
2016-08-30 00:48:05 +00:00
|
|
|
{
|
2022-08-27 06:43:36 +00:00
|
|
|
ushort species = (ushort)(i + 1);
|
2022-06-18 18:04:24 +00:00
|
|
|
SAV.SetSeen(species, seen[i]);
|
|
|
|
SAV.SetCaught(species, caught[i]);
|
2016-08-30 00:48:05 +00:00
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
Origin.CopyChangesFrom(SAV);
|
|
|
|
Close();
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_SeenAll_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
|
|
|
CLB_Seen.SetItemChecked(i, true);
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_SeenNone_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
|
|
|
CLB_Seen.SetItemChecked(i, false);
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_CaughtAll_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
|
|
|
CLB_Caught.SetItemChecked(i, true);
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void B_CaughtNone_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
|
|
|
CLB_Caught.SetItemChecked(i, false);
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void CLB_Seen_ItemCheck(object sender, ItemCheckEventArgs e)
|
|
|
|
{
|
|
|
|
if (!initialized) return;
|
|
|
|
seen[e.Index] = e.NewValue == CheckState.Checked;
|
|
|
|
}
|
2016-08-30 00:48:05 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void CLB_Caught_ItemCheck(object sender, ItemCheckEventArgs e)
|
|
|
|
{
|
|
|
|
if (!initialized) return;
|
|
|
|
caught[e.Index] = e.NewValue == CheckState.Checked;
|
2016-08-30 00:48:05 +00:00
|
|
|
}
|
|
|
|
}
|