switch to changing Mod property

This commit is contained in:
mcendu 2020-01-14 20:11:32 +08:00
parent c08fc62e00
commit abdebcfddc
No known key found for this signature in database
GPG Key ID: FBCD5D45163D6364
2 changed files with 10 additions and 4 deletions

View File

@ -80,7 +80,7 @@ private bool changeSelectedIndex(int newIndex)
foregroundIcon.RotateTo(rotate_angle * direction, mod_switch_duration, mod_switch_easing);
backgroundIcon.RotateTo(-rotate_angle * direction, mod_switch_duration, mod_switch_easing);
backgroundIcon.Icon = modAfter.Icon;
backgroundIcon.Mod = modAfter;
using (BeginDelayedSequence(mod_switch_duration, true))
{
@ -218,8 +218,8 @@ public bool SelectAt(int index)
private void displayMod(Mod mod)
{
if (backgroundIcon != null)
backgroundIcon.Icon = foregroundIcon.Icon;
foregroundIcon.Icon = mod.Icon;
backgroundIcon.Mod = foregroundIcon.Mod;
foregroundIcon.Mod = mod;
text.Text = mod.Name;
Colour = mod.HasImplementation ? Color4.White : Color4.Gray;
}

View File

@ -34,7 +34,13 @@ public IconUsage Icon
public virtual string TooltipText { get; }
protected Mod Mod { get; set; }
private Mod mod;
public Mod Mod
{
get => mod;
set => mod = value;
}
public ModIcon(Mod mod)
{