mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Add GUI for Capture Records
Accessible from Pokedex window ur welcome matt
This commit is contained in:
parent
559ec76812
commit
9d21e5acdd
5 changed files with 536 additions and 11 deletions
|
@ -29,10 +29,10 @@ namespace PKHeX.Core
|
|||
private int GetTransferredOffset(int index) => Offset + TransferredOffset + (index * 4);
|
||||
public uint GetCapturedCountIndex(int index) => BitConverter.ToUInt32(Data, GetCapturedOffset(index));
|
||||
public uint GetTransferredCountIndex(int index) => BitConverter.ToUInt32(Data, GetTransferredOffset(index));
|
||||
public void SetCapturedCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, Offset + GetCapturedOffset(index));
|
||||
public void SetTransferredCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, Offset + GetTransferredOffset(index));
|
||||
public void SetCapturedCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, GetCapturedOffset(index));
|
||||
public void SetTransferredCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, GetTransferredOffset(index));
|
||||
|
||||
private static int GetSpeciesIndex(int species)
|
||||
public static int GetSpeciesIndex(int species)
|
||||
{
|
||||
if (species <= (int)Species.Mew)
|
||||
return species - 1;
|
||||
|
@ -41,6 +41,13 @@ namespace PKHeX.Core
|
|||
return -1;
|
||||
}
|
||||
|
||||
public static int GetIndexSpecies(int index)
|
||||
{
|
||||
if (index < (int) Species.Mew)
|
||||
return index + 1;
|
||||
return index + 657;
|
||||
}
|
||||
|
||||
public uint GetCapturedCount(int species)
|
||||
{
|
||||
int index = GetSpeciesIndex(species);
|
||||
|
@ -101,12 +108,18 @@ namespace PKHeX.Core
|
|||
return total;
|
||||
}
|
||||
|
||||
public void SetAllCaptured(uint count = MAX_COUNT_ENTRY)
|
||||
public void SetAllCaptured(uint count = MAX_COUNT_ENTRY, Zukan7b? dex = null)
|
||||
{
|
||||
uint total = 0;
|
||||
count = Math.Min(count, MAX_COUNT_ENTRY);
|
||||
for (int i = 0; i < ENTRY_COUNT; i++)
|
||||
{
|
||||
int species = GetIndexSpecies(i);
|
||||
if (count != 0 && dex?.GetCaught(species) == false)
|
||||
{
|
||||
total += GetCapturedCountIndex(i);
|
||||
continue;
|
||||
}
|
||||
SetCapturedCountIndex(i, count);
|
||||
total += count;
|
||||
}
|
||||
|
@ -114,12 +127,18 @@ namespace PKHeX.Core
|
|||
TotalCaptured = total;
|
||||
}
|
||||
|
||||
public void SetAllTransferred(uint count = MAX_COUNT_ENTRY)
|
||||
public void SetAllTransferred(uint count = MAX_COUNT_ENTRY, Zukan7b? dex = null)
|
||||
{
|
||||
uint total = 0;
|
||||
count = Math.Min(count, MAX_COUNT_ENTRY);
|
||||
for (int i = 0; i < ENTRY_COUNT; i++)
|
||||
{
|
||||
int species = GetIndexSpecies(i);
|
||||
if (count != 0 && dex?.GetCaught(species) == false)
|
||||
{
|
||||
total += GetTransferredCountIndex(i);
|
||||
continue;
|
||||
}
|
||||
SetTransferredCountIndex(i, count);
|
||||
total += count;
|
||||
}
|
||||
|
|
340
PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Capture7GG.Designer.cs
generated
Normal file
340
PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Capture7GG.Designer.cs
generated
Normal file
|
@ -0,0 +1,340 @@
|
|||
namespace PKHeX.WinForms
|
||||
{
|
||||
partial class SAV_Capture7GG
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.B_Cancel = new System.Windows.Forms.Button();
|
||||
this.LB_Species = new System.Windows.Forms.ListBox();
|
||||
this.L_goto = new System.Windows.Forms.Label();
|
||||
this.CB_Species = new System.Windows.Forms.ComboBox();
|
||||
this.B_Save = new System.Windows.Forms.Button();
|
||||
this.B_Modify = new System.Windows.Forms.Button();
|
||||
this.mnuFormNone = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuForm1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuFormAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NUD_SpeciesCaptured = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_SpeciesTransferred = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_TotalTransferred = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_TotalCaptured = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_SpeciesCaptured = new System.Windows.Forms.Label();
|
||||
this.L_SpeciesTransferred = new System.Windows.Forms.Label();
|
||||
this.L_TotalTransferred = new System.Windows.Forms.Label();
|
||||
this.L_TotalCaptured = new System.Windows.Forms.Label();
|
||||
this.GB_Species = new System.Windows.Forms.GroupBox();
|
||||
this.B_SumTotal = new System.Windows.Forms.Button();
|
||||
this.GB_Total = new System.Windows.Forms.GroupBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_SpeciesCaptured)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_SpeciesTransferred)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TotalTransferred)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TotalCaptured)).BeginInit();
|
||||
this.GB_Species.SuspendLayout();
|
||||
this.GB_Total.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// B_Cancel
|
||||
//
|
||||
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Cancel.Location = new System.Drawing.Point(231, 296);
|
||||
this.B_Cancel.Name = "B_Cancel";
|
||||
this.B_Cancel.Size = new System.Drawing.Size(80, 23);
|
||||
this.B_Cancel.TabIndex = 0;
|
||||
this.B_Cancel.Text = "Cancel";
|
||||
this.B_Cancel.UseVisualStyleBackColor = true;
|
||||
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
|
||||
//
|
||||
// LB_Species
|
||||
//
|
||||
this.LB_Species.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.LB_Species.FormattingEnabled = true;
|
||||
this.LB_Species.Location = new System.Drawing.Point(12, 40);
|
||||
this.LB_Species.Name = "LB_Species";
|
||||
this.LB_Species.Size = new System.Drawing.Size(160, 277);
|
||||
this.LB_Species.TabIndex = 2;
|
||||
this.LB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeLBSpecies);
|
||||
//
|
||||
// L_goto
|
||||
//
|
||||
this.L_goto.AutoSize = true;
|
||||
this.L_goto.Location = new System.Drawing.Point(12, 16);
|
||||
this.L_goto.Name = "L_goto";
|
||||
this.L_goto.Size = new System.Drawing.Size(31, 13);
|
||||
this.L_goto.TabIndex = 20;
|
||||
this.L_goto.Text = "goto:";
|
||||
//
|
||||
// CB_Species
|
||||
//
|
||||
this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||
this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.CB_Species.DropDownWidth = 95;
|
||||
this.CB_Species.FormattingEnabled = true;
|
||||
this.CB_Species.Items.AddRange(new object[] {
|
||||
"0"});
|
||||
this.CB_Species.Location = new System.Drawing.Point(50, 13);
|
||||
this.CB_Species.Name = "CB_Species";
|
||||
this.CB_Species.Size = new System.Drawing.Size(122, 21);
|
||||
this.CB_Species.TabIndex = 21;
|
||||
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeCBSpecies);
|
||||
this.CB_Species.SelectedValueChanged += new System.EventHandler(this.ChangeCBSpecies);
|
||||
//
|
||||
// B_Save
|
||||
//
|
||||
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Save.Location = new System.Drawing.Point(317, 296);
|
||||
this.B_Save.Name = "B_Save";
|
||||
this.B_Save.Size = new System.Drawing.Size(80, 23);
|
||||
this.B_Save.TabIndex = 24;
|
||||
this.B_Save.Text = "Save";
|
||||
this.B_Save.UseVisualStyleBackColor = true;
|
||||
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
|
||||
//
|
||||
// B_Modify
|
||||
//
|
||||
this.B_Modify.Location = new System.Drawing.Point(143, 17);
|
||||
this.B_Modify.Name = "B_Modify";
|
||||
this.B_Modify.Size = new System.Drawing.Size(64, 41);
|
||||
this.B_Modify.TabIndex = 25;
|
||||
this.B_Modify.Text = "Set All";
|
||||
this.B_Modify.UseVisualStyleBackColor = true;
|
||||
this.B_Modify.Click += new System.EventHandler(this.B_Modify_Click);
|
||||
//
|
||||
// mnuFormNone
|
||||
//
|
||||
this.mnuFormNone.Name = "mnuFormNone";
|
||||
this.mnuFormNone.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mnuForm1
|
||||
//
|
||||
this.mnuForm1.Name = "mnuForm1";
|
||||
this.mnuForm1.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mnuFormAll
|
||||
//
|
||||
this.mnuFormAll.Name = "mnuFormAll";
|
||||
this.mnuFormAll.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// NUD_SpeciesCaptured
|
||||
//
|
||||
this.NUD_SpeciesCaptured.Location = new System.Drawing.Point(92, 17);
|
||||
this.NUD_SpeciesCaptured.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_SpeciesCaptured.Name = "NUD_SpeciesCaptured";
|
||||
this.NUD_SpeciesCaptured.Size = new System.Drawing.Size(45, 20);
|
||||
this.NUD_SpeciesCaptured.TabIndex = 53;
|
||||
this.NUD_SpeciesCaptured.Value = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NUD_SpeciesTransferred
|
||||
//
|
||||
this.NUD_SpeciesTransferred.Location = new System.Drawing.Point(92, 40);
|
||||
this.NUD_SpeciesTransferred.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_SpeciesTransferred.Name = "NUD_SpeciesTransferred";
|
||||
this.NUD_SpeciesTransferred.Size = new System.Drawing.Size(45, 20);
|
||||
this.NUD_SpeciesTransferred.TabIndex = 54;
|
||||
this.NUD_SpeciesTransferred.Value = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NUD_TotalTransferred
|
||||
//
|
||||
this.NUD_TotalTransferred.Location = new System.Drawing.Point(92, 42);
|
||||
this.NUD_TotalTransferred.Maximum = new decimal(new int[] {
|
||||
999999999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_TotalTransferred.Name = "NUD_TotalTransferred";
|
||||
this.NUD_TotalTransferred.Size = new System.Drawing.Size(75, 20);
|
||||
this.NUD_TotalTransferred.TabIndex = 56;
|
||||
this.NUD_TotalTransferred.Value = new decimal(new int[] {
|
||||
123456789,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NUD_TotalCaptured
|
||||
//
|
||||
this.NUD_TotalCaptured.Location = new System.Drawing.Point(92, 19);
|
||||
this.NUD_TotalCaptured.Maximum = new decimal(new int[] {
|
||||
999999999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_TotalCaptured.Name = "NUD_TotalCaptured";
|
||||
this.NUD_TotalCaptured.Size = new System.Drawing.Size(75, 20);
|
||||
this.NUD_TotalCaptured.TabIndex = 55;
|
||||
this.NUD_TotalCaptured.Value = new decimal(new int[] {
|
||||
123456789,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// L_SpeciesCaptured
|
||||
//
|
||||
this.L_SpeciesCaptured.Location = new System.Drawing.Point(6, 17);
|
||||
this.L_SpeciesCaptured.Name = "L_SpeciesCaptured";
|
||||
this.L_SpeciesCaptured.Size = new System.Drawing.Size(80, 20);
|
||||
this.L_SpeciesCaptured.TabIndex = 61;
|
||||
this.L_SpeciesCaptured.Text = "Captured";
|
||||
this.L_SpeciesCaptured.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.L_SpeciesCaptured.Click += new System.EventHandler(this.ClickSpeciesLabel);
|
||||
//
|
||||
// L_SpeciesTransferred
|
||||
//
|
||||
this.L_SpeciesTransferred.Location = new System.Drawing.Point(6, 38);
|
||||
this.L_SpeciesTransferred.Name = "L_SpeciesTransferred";
|
||||
this.L_SpeciesTransferred.Size = new System.Drawing.Size(80, 20);
|
||||
this.L_SpeciesTransferred.TabIndex = 62;
|
||||
this.L_SpeciesTransferred.Text = "Transferred";
|
||||
this.L_SpeciesTransferred.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.L_SpeciesTransferred.Click += new System.EventHandler(this.ClickSpeciesLabel);
|
||||
//
|
||||
// L_TotalTransferred
|
||||
//
|
||||
this.L_TotalTransferred.Location = new System.Drawing.Point(6, 40);
|
||||
this.L_TotalTransferred.Name = "L_TotalTransferred";
|
||||
this.L_TotalTransferred.Size = new System.Drawing.Size(80, 20);
|
||||
this.L_TotalTransferred.TabIndex = 64;
|
||||
this.L_TotalTransferred.Text = "Transferred";
|
||||
this.L_TotalTransferred.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.L_TotalTransferred.Click += new System.EventHandler(this.ClickTotalLabel);
|
||||
//
|
||||
// L_TotalCaptured
|
||||
//
|
||||
this.L_TotalCaptured.Location = new System.Drawing.Point(6, 19);
|
||||
this.L_TotalCaptured.Name = "L_TotalCaptured";
|
||||
this.L_TotalCaptured.Size = new System.Drawing.Size(80, 20);
|
||||
this.L_TotalCaptured.TabIndex = 63;
|
||||
this.L_TotalCaptured.Text = "Captured";
|
||||
this.L_TotalCaptured.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.L_TotalCaptured.Click += new System.EventHandler(this.ClickTotalLabel);
|
||||
//
|
||||
// GB_Species
|
||||
//
|
||||
this.GB_Species.Controls.Add(this.NUD_SpeciesCaptured);
|
||||
this.GB_Species.Controls.Add(this.NUD_SpeciesTransferred);
|
||||
this.GB_Species.Controls.Add(this.L_SpeciesTransferred);
|
||||
this.GB_Species.Controls.Add(this.B_Modify);
|
||||
this.GB_Species.Controls.Add(this.L_SpeciesCaptured);
|
||||
this.GB_Species.Location = new System.Drawing.Point(178, 40);
|
||||
this.GB_Species.Name = "GB_Species";
|
||||
this.GB_Species.Size = new System.Drawing.Size(216, 71);
|
||||
this.GB_Species.TabIndex = 65;
|
||||
this.GB_Species.TabStop = false;
|
||||
this.GB_Species.Text = "Species Info";
|
||||
//
|
||||
// B_SumTotal
|
||||
//
|
||||
this.B_SumTotal.Location = new System.Drawing.Point(170, 19);
|
||||
this.B_SumTotal.Name = "B_SumTotal";
|
||||
this.B_SumTotal.Size = new System.Drawing.Size(37, 43);
|
||||
this.B_SumTotal.TabIndex = 66;
|
||||
this.B_SumTotal.Text = "Σ";
|
||||
this.B_SumTotal.UseVisualStyleBackColor = true;
|
||||
this.B_SumTotal.Click += new System.EventHandler(this.B_SumTotal_Click);
|
||||
//
|
||||
// GB_Total
|
||||
//
|
||||
this.GB_Total.Controls.Add(this.B_SumTotal);
|
||||
this.GB_Total.Controls.Add(this.NUD_TotalTransferred);
|
||||
this.GB_Total.Controls.Add(this.L_TotalCaptured);
|
||||
this.GB_Total.Controls.Add(this.L_TotalTransferred);
|
||||
this.GB_Total.Controls.Add(this.NUD_TotalCaptured);
|
||||
this.GB_Total.Location = new System.Drawing.Point(178, 117);
|
||||
this.GB_Total.Name = "GB_Total";
|
||||
this.GB_Total.Size = new System.Drawing.Size(216, 71);
|
||||
this.GB_Total.TabIndex = 68;
|
||||
this.GB_Total.TabStop = false;
|
||||
this.GB_Total.Text = "Totals";
|
||||
//
|
||||
// SAV_Capture7GG
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(404, 326);
|
||||
this.Controls.Add(this.GB_Total);
|
||||
this.Controls.Add(this.GB_Species);
|
||||
this.Controls.Add(this.B_Save);
|
||||
this.Controls.Add(this.CB_Species);
|
||||
this.Controls.Add(this.L_goto);
|
||||
this.Controls.Add(this.LB_Species);
|
||||
this.Controls.Add(this.B_Cancel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SAV_Capture7GG";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Capture Record Editor";
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_SpeciesCaptured)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_SpeciesTransferred)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TotalTransferred)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TotalCaptured)).EndInit();
|
||||
this.GB_Species.ResumeLayout(false);
|
||||
this.GB_Total.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button B_Cancel;
|
||||
private System.Windows.Forms.ListBox LB_Species;
|
||||
private System.Windows.Forms.Label L_goto;
|
||||
private System.Windows.Forms.ComboBox CB_Species;
|
||||
private System.Windows.Forms.Button B_Save;
|
||||
private System.Windows.Forms.Button B_Modify;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuFormNone;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuForm1;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuFormAll;
|
||||
private System.Windows.Forms.NumericUpDown NUD_SpeciesCaptured;
|
||||
private System.Windows.Forms.NumericUpDown NUD_SpeciesTransferred;
|
||||
private System.Windows.Forms.NumericUpDown NUD_TotalTransferred;
|
||||
private System.Windows.Forms.NumericUpDown NUD_TotalCaptured;
|
||||
private System.Windows.Forms.Label L_SpeciesCaptured;
|
||||
private System.Windows.Forms.Label L_SpeciesTransferred;
|
||||
private System.Windows.Forms.Label L_TotalTransferred;
|
||||
private System.Windows.Forms.Label L_TotalCaptured;
|
||||
private System.Windows.Forms.GroupBox GB_Species;
|
||||
private System.Windows.Forms.Button B_SumTotal;
|
||||
private System.Windows.Forms.GroupBox GB_Total;
|
||||
}
|
||||
}
|
147
PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Capture7GG.cs
Normal file
147
PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Capture7GG.cs
Normal file
|
@ -0,0 +1,147 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
|
||||
namespace PKHeX.WinForms
|
||||
{
|
||||
public partial class SAV_Capture7GG : Form
|
||||
{
|
||||
private readonly SaveFile Origin;
|
||||
private readonly SAV7b SAV;
|
||||
|
||||
private readonly Zukan7b Dex;
|
||||
private readonly CaptureRecords Captured;
|
||||
private int Index = -1;
|
||||
private bool Loading = true;
|
||||
|
||||
public SAV_Capture7GG(SaveFile sav)
|
||||
{
|
||||
InitializeComponent();
|
||||
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
||||
SAV = (SAV7b)(Origin = sav).Clone();
|
||||
Dex = SAV.Blocks.Zukan;
|
||||
Captured = SAV.Blocks.Captured;
|
||||
|
||||
// Clear Listbox and ComboBox
|
||||
LB_Species.Items.Clear();
|
||||
CB_Species.Items.Clear();
|
||||
|
||||
// Fill List
|
||||
var list = GetLegalSpecies().ToArray();
|
||||
var species = GameInfo.SpeciesDataSource.Where(z => list.Contains(z.Value)).ToList();
|
||||
CB_Species.InitializeBinding();
|
||||
CB_Species.DataSource = new BindingSource(species, null);
|
||||
foreach (var entry in species.OrderBy(z => z.Value))
|
||||
LB_Species.Items.Add($"{entry.Value:000}: {entry.Text}");
|
||||
|
||||
GetTotals();
|
||||
CB_Species.KeyDown += WinFormsUtil.RemoveDropCB;
|
||||
LB_Species.SelectedIndex = Index = 0;
|
||||
GetEntry();
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private static IEnumerable<int> GetLegalSpecies()
|
||||
{
|
||||
foreach (var z in Enumerable.Range(1, 151))
|
||||
yield return z;
|
||||
yield return 808;
|
||||
yield return 809;
|
||||
}
|
||||
|
||||
private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
SetEntry();
|
||||
|
||||
Index = CaptureRecords.GetSpeciesIndex((int)CB_Species.SelectedValue);
|
||||
Loading = true;
|
||||
LB_Species.SelectedIndex = Index;
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private void ChangeLBSpecies(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
SetEntry();
|
||||
|
||||
Index = LB_Species.SelectedIndex;
|
||||
Loading = true;
|
||||
CB_Species.SelectedValue = CaptureRecords.GetIndexSpecies(Index);
|
||||
GetEntry();
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private void GetEntry()
|
||||
{
|
||||
var index = Index;
|
||||
if (index < 0)
|
||||
return;
|
||||
NUD_SpeciesCaptured.Value = Captured.GetCapturedCountIndex(index);
|
||||
NUD_SpeciesTransferred.Value = Captured.GetTransferredCountIndex(index);
|
||||
}
|
||||
|
||||
private void SetEntry()
|
||||
{
|
||||
var index = Index;
|
||||
if (index < 0)
|
||||
return;
|
||||
Captured.SetCapturedCountIndex(index, (uint)NUD_SpeciesCaptured.Value);
|
||||
Captured.SetTransferredCountIndex(index, (uint)NUD_SpeciesTransferred.Value);
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetEntry();
|
||||
SetTotals();
|
||||
|
||||
Origin.CopyChangesFrom(SAV);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void GetTotals()
|
||||
{
|
||||
NUD_TotalCaptured.Value = Captured.TotalCaptured;
|
||||
NUD_TotalTransferred.Value = Captured.TotalTransferred;
|
||||
}
|
||||
|
||||
private void SetTotals()
|
||||
{
|
||||
Captured.TotalCaptured = (uint)NUD_TotalCaptured.Value;
|
||||
Captured.TotalTransferred = (uint)NUD_TotalTransferred.Value;
|
||||
}
|
||||
|
||||
private void B_Modify_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetTotals();
|
||||
Captured.SetAllCaptured((uint)NUD_SpeciesCaptured.Value, Dex);
|
||||
Captured.SetAllTransferred((uint)NUD_SpeciesTransferred.Value, Dex);
|
||||
|
||||
GetEntry();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_SumTotal_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetEntry();
|
||||
NUD_TotalCaptured.Value = Captured.CalculateTotalCaptured();
|
||||
NUD_TotalTransferred.Value = Captured.CalculateTotalTransferred();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private static void ToggleMax(NumericUpDown nud) => nud.Value = (nud.Value != nud.Maximum) ? nud.Maximum : 0;
|
||||
private void ClickSpeciesLabel(object sender, EventArgs e) => ToggleMax(sender == L_SpeciesCaptured ? NUD_SpeciesCaptured : NUD_SpeciesTransferred);
|
||||
private void ClickTotalLabel(object sender, EventArgs e) => ToggleMax(sender == L_TotalCaptured ? NUD_TotalCaptured : NUD_TotalTransferred);
|
||||
}
|
||||
}
|
|
@ -87,6 +87,7 @@
|
|||
this.NUD_RWeightMinHeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_RHeightMax = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_RHeightMin = new System.Windows.Forms.NumericUpDown();
|
||||
this.B_Counts = new System.Windows.Forms.Button();
|
||||
this.GB_Language.SuspendLayout();
|
||||
this.GB_Encountered.SuspendLayout();
|
||||
this.GB_Owned.SuspendLayout();
|
||||
|
@ -429,40 +430,40 @@
|
|||
this.mnuCaughtAll,
|
||||
this.mnuComplete});
|
||||
this.modifyMenu.Name = "modifyMenu";
|
||||
this.modifyMenu.Size = new System.Drawing.Size(149, 114);
|
||||
this.modifyMenu.Size = new System.Drawing.Size(150, 114);
|
||||
//
|
||||
// mnuSeenNone
|
||||
//
|
||||
this.mnuSeenNone.Name = "mnuSeenNone";
|
||||
this.mnuSeenNone.Size = new System.Drawing.Size(148, 22);
|
||||
this.mnuSeenNone.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuSeenNone.Text = "Seen none";
|
||||
this.mnuSeenNone.Click += new System.EventHandler(this.ModifyAll);
|
||||
//
|
||||
// mnuSeenAll
|
||||
//
|
||||
this.mnuSeenAll.Name = "mnuSeenAll";
|
||||
this.mnuSeenAll.Size = new System.Drawing.Size(148, 22);
|
||||
this.mnuSeenAll.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuSeenAll.Text = "Seen all";
|
||||
this.mnuSeenAll.Click += new System.EventHandler(this.ModifyAll);
|
||||
//
|
||||
// mnuCaughtNone
|
||||
//
|
||||
this.mnuCaughtNone.Name = "mnuCaughtNone";
|
||||
this.mnuCaughtNone.Size = new System.Drawing.Size(148, 22);
|
||||
this.mnuCaughtNone.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuCaughtNone.Text = "Caught none";
|
||||
this.mnuCaughtNone.Click += new System.EventHandler(this.ModifyAll);
|
||||
//
|
||||
// mnuCaughtAll
|
||||
//
|
||||
this.mnuCaughtAll.Name = "mnuCaughtAll";
|
||||
this.mnuCaughtAll.Size = new System.Drawing.Size(148, 22);
|
||||
this.mnuCaughtAll.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuCaughtAll.Text = "Caught all";
|
||||
this.mnuCaughtAll.Click += new System.EventHandler(this.ModifyAll);
|
||||
//
|
||||
// mnuComplete
|
||||
//
|
||||
this.mnuComplete.Name = "mnuComplete";
|
||||
this.mnuComplete.Size = new System.Drawing.Size(148, 22);
|
||||
this.mnuComplete.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuComplete.Text = "Complete Dex";
|
||||
this.mnuComplete.Click += new System.EventHandler(this.ModifyAll);
|
||||
//
|
||||
|
@ -751,11 +752,22 @@
|
|||
0,
|
||||
0});
|
||||
//
|
||||
// B_Counts
|
||||
//
|
||||
this.B_Counts.Location = new System.Drawing.Point(244, 11);
|
||||
this.B_Counts.Name = "B_Counts";
|
||||
this.B_Counts.Size = new System.Drawing.Size(97, 23);
|
||||
this.B_Counts.TabIndex = 53;
|
||||
this.B_Counts.Text = "Counts";
|
||||
this.B_Counts.UseVisualStyleBackColor = true;
|
||||
this.B_Counts.Click += new System.EventHandler(this.B_Counts_Click);
|
||||
//
|
||||
// SAV_PokedexGG
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(417, 423);
|
||||
this.Controls.Add(this.B_Counts);
|
||||
this.Controls.Add(this.GB_SizeRecords);
|
||||
this.Controls.Add(this.LB_Forms);
|
||||
this.Controls.Add(this.GB_Displayed);
|
||||
|
@ -860,5 +872,6 @@
|
|||
private System.Windows.Forms.NumericUpDown NUD_RWeightMinHeight;
|
||||
private System.Windows.Forms.NumericUpDown NUD_RHeightMax;
|
||||
private System.Windows.Forms.NumericUpDown NUD_RHeightMin;
|
||||
private System.Windows.Forms.Button B_Counts;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,12 @@ namespace PKHeX.WinForms
|
|||
private readonly CheckBox[] RecordUsed;
|
||||
private readonly NumericUpDown[] RecordHeight, RecordWeight;
|
||||
|
||||
private void B_Counts_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetEntry();
|
||||
new SAV_Capture7GG(SAV).ShowDialog();
|
||||
}
|
||||
|
||||
private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
{
|
||||
if (editing) return;
|
||||
|
|
Loading…
Reference in a new issue