mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Update hovered slot on box change
using keyboard instead of mouse can change box without moving mouse outside the slot picturebox trigger an update when the box is changed, but only if the updating parent has the hovered child (ie a boxviewer changing box while hovering the main window won't re-cry the main window slot since it wasn't updated) Closes #1940 add some gender threshold properties to personalinfo
This commit is contained in:
parent
19f2420670
commit
28ef791014
3 changed files with 26 additions and 4 deletions
|
@ -144,6 +144,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Genderless => Gender == 255;
|
||||
public bool OnlyFemale => Gender == 254;
|
||||
public bool OnlyMale => Gender == 0;
|
||||
public bool HasFormes => FormeCount > 1;
|
||||
public int BST => HP + ATK + DEF + SPE + SPA + SPD;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Media;
|
||||
using System.Windows.Forms;
|
||||
using PKHeX.Core;
|
||||
|
||||
|
@ -208,6 +207,7 @@ namespace PKHeX.WinForms.Controls
|
|||
if (SAV.CurrentBox != CurrentBox)
|
||||
SAV.CurrentBox = CurrentBox;
|
||||
ResetSlots();
|
||||
M?.RefreshHoverSlot(this);
|
||||
}
|
||||
private void ClickBoxLeft(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -30,8 +30,9 @@ namespace PKHeX.WinForms.Controls
|
|||
public readonly List<BoxEditor> Boxes = new List<BoxEditor>();
|
||||
public readonly List<ISlotViewer<PictureBox>> OtherSlots = new List<ISlotViewer<PictureBox>>();
|
||||
public event DragEventHandler RequestExternalDragDrop;
|
||||
private readonly ToolTip ShowSet = new ToolTip {InitialDelay = 400, IsBalloon = false};
|
||||
private readonly ToolTip ShowSet = new ToolTip {InitialDelay = 200, IsBalloon = false};
|
||||
private readonly SoundPlayer Sounds = new SoundPlayer();
|
||||
private PictureBox HoveredSlot;
|
||||
|
||||
public SlotChangeManager(SAVEditor se)
|
||||
{
|
||||
|
@ -54,19 +55,36 @@ namespace PKHeX.WinForms.Controls
|
|||
return;
|
||||
OriginalBackground = pb.BackgroundImage;
|
||||
pb.BackgroundImage = CurrentBackground = pb.BackgroundImage == null ? Resources.slotHover : ImageUtil.LayerImage(pb.BackgroundImage, Resources.slotHover, 0, 0, 1);
|
||||
|
||||
BeginHoverSlot(pb);
|
||||
}
|
||||
private void BeginHoverSlot(PictureBox pb)
|
||||
{
|
||||
var view = WinFormsUtil.FindFirstControlOfType<ISlotViewer<PictureBox>>(pb);
|
||||
var data = view.GetSlotData(pb);
|
||||
var pk = SAV.GetStoredSlot(data.Offset);
|
||||
HoveredSlot = pb;
|
||||
|
||||
if (Settings.Default.HoverSlotShowText)
|
||||
ShowSimulatorSetTooltip(pb, pk);
|
||||
if (Settings.Default.HoverSlotPlayCry)
|
||||
PlayCry(pk);
|
||||
}
|
||||
private void EndHoverSlot()
|
||||
{
|
||||
HoveredSlot = null;
|
||||
ShowSet.RemoveAll();
|
||||
Sounds.Stop();
|
||||
}
|
||||
public void RefreshHoverSlot(ISlotViewer<PictureBox> parent)
|
||||
{
|
||||
if (HoveredSlot == null || !parent.SlotPictureBoxes.Contains(HoveredSlot))
|
||||
return;
|
||||
|
||||
BeginHoverSlot(HoveredSlot);
|
||||
}
|
||||
public void MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
Sounds.Stop();
|
||||
EndHoverSlot();
|
||||
var pb = (PictureBox)sender;
|
||||
if (pb.BackgroundImage != CurrentBackground)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue