2022-11-25 01:42:17 +00:00
|
|
|
using System;
|
2017-06-25 17:57:35 +00:00
|
|
|
using System.Windows.Forms;
|
|
|
|
using PKHeX.Core;
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
|
2022-11-25 01:42:17 +00:00
|
|
|
public partial class ContestStat : UserControl, IContestStats
|
2017-06-25 17:57:35 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
public ContestStat()
|
2017-06-25 17:57:35 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
2017-06-25 17:57:35 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestCool
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Cool.Text);
|
|
|
|
set => TB_Cool.Text = value.ToString();
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestBeauty
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Beauty.Text);
|
|
|
|
set => TB_Beauty.Text = value.ToString();
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestCute
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Cute.Text);
|
|
|
|
set => TB_Cute.Text = value.ToString();
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestSmart
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Smart.Text);
|
|
|
|
set => TB_Smart.Text = value.ToString();
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestTough
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Tough.Text);
|
|
|
|
set => TB_Tough.Text = value.ToString();
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
2024-02-23 03:20:54 +00:00
|
|
|
public byte ContestSheen
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
get => (byte)Util.ToInt32(TB_Sheen.Text);
|
|
|
|
set => TB_Sheen.Text = value.ToString();
|
|
|
|
}
|
2021-01-01 21:39:08 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private void Update255_MTB(object sender, EventArgs e)
|
|
|
|
{
|
2022-11-25 01:42:17 +00:00
|
|
|
if (sender is not MaskedTextBox tb)
|
|
|
|
return;
|
2022-06-18 18:04:24 +00:00
|
|
|
if (Util.ToInt32(tb.Text) > byte.MaxValue)
|
|
|
|
tb.Text = "255";
|
|
|
|
}
|
2017-06-25 17:57:35 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
public void ToggleInterface(object o, EntityContext context)
|
|
|
|
{
|
2022-11-25 01:42:17 +00:00
|
|
|
if (o is not IContestStatsReadOnly)
|
2017-06-25 17:57:35 +00:00
|
|
|
{
|
2023-02-05 23:00:31 +00:00
|
|
|
Visible = TabStop = false;
|
2022-06-18 18:04:24 +00:00
|
|
|
return;
|
2017-06-25 17:57:35 +00:00
|
|
|
}
|
2022-04-11 18:57:55 +00:00
|
|
|
|
2023-02-05 23:00:31 +00:00
|
|
|
Visible = TabStop = true;
|
2022-06-18 18:04:24 +00:00
|
|
|
bool smart = context.Generation() < 6;
|
2023-12-04 04:13:20 +00:00
|
|
|
Label_Smart.Visible = smart; // show "Smart" for Gen3-5
|
|
|
|
Label_Clever.Visible = !smart; // show "Clever" for Gen6+
|
2022-06-18 18:04:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void ClickTextBox(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
var keys = ModifierKeys;
|
|
|
|
if (keys == Keys.None)
|
|
|
|
return;
|
2022-04-11 18:57:55 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
if (sender is not MaskedTextBox tb)
|
|
|
|
return;
|
2022-04-11 18:57:55 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
if (keys == Keys.Control)
|
|
|
|
tb.Text = "255";
|
|
|
|
else if (keys == Keys.Alt)
|
|
|
|
tb.Text = "0";
|
2017-06-25 17:57:35 +00:00
|
|
|
}
|
|
|
|
}
|