mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-22 07:18:18 -05:00
* Localization capability for each language, import & export * Lines with stat names (IVs/EVs) can be configured to many representations (X/X/X/X/X/X, HABCDS, etc). * Add nonstandard localizations * Add token types for Showdown's new set format * Add new program settings for hover & export styles. Allows users to select which presentation format they want for the hover previews, as well as the set export format. * Revises preview hover GUI to use new settings * Revises export events to use new settings * Moves no longer indicate end of set * Enhance robustness of stat parsing * Expand all settings in settings editor on form load * Extract clipboard -> sets operation to api for maintainability & reusability
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
using PKHeX.Drawing.Misc;
|
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
public partial class MoveDisplay : UserControl
|
|
{
|
|
public MoveDisplay() => InitializeComponent();
|
|
|
|
public int Populate(PKM pk, GameStrings strings, ushort move, EntityContext context, ReadOnlySpan<string> moves, bool valid = true)
|
|
{
|
|
if (move == 0 || move >= moves.Length)
|
|
{
|
|
Visible = false;
|
|
return 0;
|
|
}
|
|
Visible = true;
|
|
|
|
byte type = MoveInfo.GetType(move, context);
|
|
var name = moves[move];
|
|
if (move == (int)Core.Move.HiddenPower && pk.Context is not EntityContext.Gen8a)
|
|
{
|
|
if (HiddenPower.TryGetTypeIndex(pk.HPType, out type))
|
|
name = $"{name} ({strings.types[type]}) [{pk.HPPower}]";
|
|
}
|
|
|
|
var size = PokePreview.MeasureSize(name, L_Move.Font);
|
|
var ctrlWidth = PB_Type.Width + PB_Type.Margin.Horizontal + size.Width + L_Move.Margin.Horizontal;
|
|
|
|
PB_Type.Image = TypeSpriteUtil.GetTypeSpriteIconSmall(type);
|
|
L_Move.Text = name;
|
|
if (valid)
|
|
L_Move.ResetForeColor();
|
|
else
|
|
L_Move.ForeColor = Color.Red;
|
|
L_Move.Width = size.Width;
|
|
Width = ctrlWidth;
|
|
|
|
return ctrlWidth;
|
|
}
|
|
}
|