2018-09-30 17:16:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.WinForms.Controls
|
|
|
|
|
{
|
|
|
|
|
public partial class CatchRate : UserControl
|
|
|
|
|
{
|
2020-12-22 07:37:07 +00:00
|
|
|
|
private PK1 pk1 = new();
|
2018-09-30 17:16:45 +00:00
|
|
|
|
public CatchRate() => InitializeComponent();
|
|
|
|
|
|
|
|
|
|
public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (pk1 = pk).Catch_Rate;
|
|
|
|
|
private void ChangeValue(object sender, EventArgs e) => pk1.Catch_Rate = (int)NUD_CatchRate.Value;
|
|
|
|
|
private void Clear(object sender, EventArgs e) => NUD_CatchRate.Value = 0;
|
|
|
|
|
|
2019-01-22 04:06:02 +00:00
|
|
|
|
private void Reset(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-10-18 18:02:39 +00:00
|
|
|
|
var sav = WinFormsUtil.FindFirstControlOfType<IMainEditor>(this)?.RequestSaveFile;
|
|
|
|
|
if (sav == null)
|
|
|
|
|
return;
|
2020-07-19 01:07:55 +00:00
|
|
|
|
NUD_CatchRate.Value = CatchRateApplicator.GetSuggestedCatchRate(pk1, sav);
|
2018-09-30 17:16:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|