fixed broken build palette hotkeys
support modifiers for build palette hotkeys
This commit is contained in:
@@ -98,6 +98,7 @@ NEW:
|
|||||||
Added new traits to world: ScreenMap, ActorMap.
|
Added new traits to world: ScreenMap, ActorMap.
|
||||||
Removed traits from World: SpatialBins.
|
Removed traits from World: SpatialBins.
|
||||||
Added InvalidTargets property to weapons.
|
Added InvalidTargets property to weapons.
|
||||||
|
Added modifier support for build palette hotkeys.
|
||||||
|
|
||||||
20130915:
|
20130915:
|
||||||
All mods:
|
All mods:
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ namespace OpenRA
|
|||||||
public struct Hotkey
|
public struct Hotkey
|
||||||
{
|
{
|
||||||
public static Hotkey Invalid = new Hotkey(Keycode.UNKNOWN, Modifiers.None);
|
public static Hotkey Invalid = new Hotkey(Keycode.UNKNOWN, Modifiers.None);
|
||||||
|
public bool IsValid()
|
||||||
|
{
|
||||||
|
return Key != Keycode.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
public readonly Keycode Key;
|
public readonly Keycode Key;
|
||||||
public readonly Modifiers Modifiers;
|
public readonly Modifiers Modifiers;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
// TODO: UI fluff; doesn't belong here
|
// TODO: UI fluff; doesn't belong here
|
||||||
public readonly int BuildPaletteOrder = 9999;
|
public readonly int BuildPaletteOrder = 9999;
|
||||||
public readonly string Hotkey = null;
|
public readonly Hotkey Hotkey = Hotkey.Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Buildable { }
|
public class Buildable { }
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.Renderer.Resolution.Width - 300, pos.Y, 300, longDescSize + 65));
|
WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.Renderer.Resolution.Width - 300, pos.Y, 300, longDescSize + 65));
|
||||||
|
|
||||||
Game.Renderer.Fonts["Bold"].DrawText(
|
Game.Renderer.Fonts["Bold"].DrawText(
|
||||||
tooltip.Name + ((buildable.Hotkey != null) ? " ({0})".F(buildable.Hotkey.ToUpper()) : ""),
|
tooltip.Name + (buildable.Hotkey.IsValid() ? " ({0})".F(buildable.Hotkey.DisplayString()) : ""),
|
||||||
p.ToInt2() + new int2(5, 5), Color.White);
|
p.ToInt2() + new int2(5, 5), Color.White);
|
||||||
|
|
||||||
var resources = pl.PlayerActor.Trait<PlayerResources>();
|
var resources = pl.PlayerActor.Trait<PlayerResources>();
|
||||||
@@ -502,7 +502,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (!paletteOpen) return false;
|
if (!paletteOpen) return false;
|
||||||
if (CurrentQueue == null) return false;
|
if (CurrentQueue == null) return false;
|
||||||
|
|
||||||
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == KeycodeExts.DisplayString(e.Key));
|
var toBuild = CurrentQueue.BuildableItems().FirstOrDefault(b => b.Traits.Get<BuildableInfo>().Hotkey == Hotkey.FromKeyInput(e));
|
||||||
|
|
||||||
if (toBuild != null)
|
if (toBuild != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
public OrderButtonWidget()
|
public OrderButtonWidget()
|
||||||
{
|
{
|
||||||
GetImage = () => Enabled() ? Pressed() ? "pressed" : "normal" : "disabled";
|
GetImage = () => Enabled() ? Pressed() ? "pressed" : "normal" : "disabled";
|
||||||
GetDescription = () => Key != Hotkey.Invalid ? "{0} ({1})".F(Description, Key.DisplayString()) : Description;
|
GetDescription = () => Key.IsValid() ? "{0} ({1})".F(Description, Key.DisplayString()) : Description;
|
||||||
GetLongDesc = () => LongDesc;
|
GetLongDesc = () => LongDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user