mirror of
https://github.com/kwsch/PKHeX
synced 2025-01-10 19:48:53 +00:00
c505b5a49d
Adds a new primary Hover Preview tooltip form. Users can change setting to use the old tooltip if they want. When the user hovers over a slot in their Box / Party, PKHeX displays a tooltip indicating details about the Pokémon. This text tooltip shows the Showdown text (with some localization based on program setting), and includes details about the encounter the legality check matched it to.
44 lines
1.3 KiB
C#
44 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, 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)
|
|
{
|
|
type = (byte)pk.HPType;
|
|
name = $"{name} ({GameInfo.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.GetTypeSpriteIcon(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;
|
|
}
|
|
}
|