mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-13 06:02:36 +00:00
8fa951bcd7
Catch_Rate => CatchRate Make Location* classes public Extract a few methods, make public Merge EncounterUtil & EncounterUtil1 add xmldoc add missing deferral for Nest8 templates improve binlinker span fetch to a single read (-1)
32 lines
889 B
C#
32 lines
889 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
public partial class CatchRate : UserControl
|
|
{
|
|
private PK1? Entity;
|
|
public CatchRate() => InitializeComponent();
|
|
|
|
public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (Entity = pk).CatchRate;
|
|
|
|
private void ChangeValue(object sender, EventArgs e)
|
|
{
|
|
if (Entity is null)
|
|
return;
|
|
Entity.CatchRate = (byte)NUD_CatchRate.Value;
|
|
}
|
|
|
|
private void Clear(object sender, EventArgs e) => NUD_CatchRate.Value = 0;
|
|
|
|
private void Reset(object sender, EventArgs e)
|
|
{
|
|
if (Entity is null)
|
|
return;
|
|
var sav = WinFormsUtil.FindFirstControlOfType<IMainEditor>(this)?.RequestSaveFile;
|
|
if (sav == null)
|
|
return;
|
|
NUD_CatchRate.Value = CatchRateApplicator.GetSuggestedCatchRate(Entity, sav);
|
|
}
|
|
}
|