Apply consistent widget method names. Semantic change: Widgets that want to tick when !Visible must override TickOuter() instead of Tick().

This commit is contained in:
Paul Chote
2011-07-04 03:21:39 +12:00
parent 193999a040
commit 1114293035
41 changed files with 96 additions and 109 deletions

View File

@@ -37,7 +37,7 @@ namespace OpenRA
{ {
Sync.CheckSyncUnchanged( world, () => Sync.CheckSyncUnchanged( world, () =>
{ {
Widget.HandleKeyPress( input ); Widget.DoHandleKeyPress( input );
} ); } );
} }
@@ -45,7 +45,7 @@ namespace OpenRA
{ {
Sync.CheckSyncUnchanged( world, () => Sync.CheckSyncUnchanged( world, () =>
{ {
Widget.HandleInput( input ); Widget.DoHandleInput( input );
} ); } );
} }
} }

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Widgets
public readonly string Background = "dialog"; public readonly string Background = "dialog";
public readonly bool ClickThrough = false; public readonly bool ClickThrough = false;
public override void DrawInner() public override void Draw()
{ {
WidgetUtils.DrawPanel(Background, RenderBounds); WidgetUtils.DrawPanel(Background, RenderBounds);
} }

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Widgets
return base.LoseFocus(mi); return base.LoseFocus(mi);
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.KeyName != Key || e.Event != KeyInputEvent.Down) if (e.KeyName != Key || e.Event != KeyInputEvent.Down)
return false; return false;
@@ -107,7 +107,7 @@ namespace OpenRA.Widgets
public override int2 ChildOrigin { get { return RenderOrigin + public override int2 ChildOrigin { get { return RenderOrigin +
((Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } } ((Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } }
public override void DrawInner() public override void Draw()
{ {
var rb = RenderBounds; var rb = RenderBounds;
var disabled = IsDisabled(); var disabled = IsDisabled();

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Widgets
: base(widget) { } : base(widget) { }
public override Rectangle EventBounds { get { return Rectangle.Empty; } } public override Rectangle EventBounds { get { return Rectangle.Empty; } }
public override void DrawInner() public override void Draw()
{ {
var pos = RenderOrigin; var pos = RenderOrigin;
var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height); var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Widgets
this.orderManager = orderManager; this.orderManager = orderManager;
} }
public override void DrawInner() public override void Draw()
{ {
if (composing) if (composing)
{ {
@@ -51,7 +51,7 @@ namespace OpenRA.Widgets
return composing ? false : base.LoseFocus(mi); return composing ? false : base.LoseFocus(mi);
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.Event == KeyInputEvent.Up) return false; if (e.Event == KeyInputEvent.Up) return false;
@@ -108,7 +108,7 @@ namespace OpenRA.Widgets
return false; return false;
} }
return base.HandleKeyPressInner(e); return false;
} }
} }
} }

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Widgets
HasPressedState = other.HasPressedState; HasPressedState = other.HasPressedState;
} }
public override void DrawInner() public override void Draw()
{ {
var disabled = IsDisabled(); var disabled = IsDisabled();
var font = Game.Renderer.Fonts[Font]; var font = Game.Renderer.Fonts[Font];

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Widgets
return new ColorBlockWidget(this); return new ColorBlockWidget(this);
} }
public override void DrawInner() public override void Draw()
{ {
WidgetUtils.FillRectWithColor(RenderBounds, GetColor()); WidgetUtils.FillRectWithColor(RenderBounds, GetColor());
} }

View File

@@ -30,9 +30,9 @@ namespace OpenRA.Widgets
{ {
} }
public override void DrawInner() public override void Draw()
{ {
base.DrawInner(); base.Draw();
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);
var image = ChromeProvider.GetImage("scrollbar", IsDisabled() ? "down_pressed" : "down_arrow"); var image = ChromeProvider.GetImage("scrollbar", IsDisabled() ? "down_pressed" : "down_arrow");
@@ -130,7 +130,6 @@ namespace OpenRA.Widgets
return true; return true;
} }
public override void DrawInner() { }
public override string GetCursor(int2 pos) { return null; } public override string GetCursor(int2 pos) { return null; }
public override Widget Clone() { return new MaskWidget(this); } public override Widget Clone() { return new MaskWidget(this); }
} }

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Widgets
public override Widget Clone() { return new ImageWidget(this); } public override Widget Clone() { return new ImageWidget(this); }
public override void DrawInner() public override void Draw()
{ {
var name = GetImageName(); var name = GetImageName();
var collection = GetImageCollection(); var collection = GetImageCollection();

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Widgets
GetContrastColor = other.GetContrastColor; GetContrastColor = other.GetContrastColor;
} }
public override void DrawInner() public override void Draw()
{ {
SpriteFont font = Game.Renderer.Fonts[Font]; SpriteFont font = Game.Renderer.Fonts[Font];
var text = GetText(); var text = GetText();

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Widgets
Rectangle MapRect; Rectangle MapRect;
float PreviewScale = 0; float PreviewScale = 0;
public override void DrawInner() public override void Draw()
{ {
var map = Map(); var map = Map();
if( map == null ) return; if( map == null ) return;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Widgets
{ {
public PerfGraphWidget() : base() { } public PerfGraphWidget() : base() { }
public override void DrawInner() public override void Draw()
{ {
var rect = RenderBounds; var rect = RenderBounds;
float2 origin = Game.viewport.Location + new float2(rect.Right, rect.Bottom); float2 origin = Game.viewport.Location + new float2(rect.Right, rect.Bottom);

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Widgets
Percentage = widget.Percentage; Percentage = widget.Percentage;
} }
public override void DrawInner() public override void Draw()
{ {
var rb = RenderBounds; var rb = RenderBounds;
WidgetUtils.DrawPanel("progressbar-bg", rb); WidgetUtils.DrawPanel("progressbar-bg", rb);

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Widgets
public Func<bool> IsSelected = () => false; public Func<bool> IsSelected = () => false;
public override void DrawInner() public override void Draw()
{ {
var state = IsSelected() ? "scrollitem-selected" : var state = IsSelected() ? "scrollitem-selected" :
RenderBounds.Contains(Viewport.LastMousePos) ? "scrollitem-hover" : RenderBounds.Contains(Viewport.LastMousePos) ? "scrollitem-hover" :

View File

@@ -56,8 +56,7 @@ namespace OpenRA.Widgets
base.AddChild(child); base.AddChild(child);
} }
public override void DrawInner() {} public override void DrawOuter()
public override void Draw()
{ {
if (!IsVisible()) if (!IsVisible())
return; return;
@@ -101,7 +100,7 @@ namespace OpenRA.Widgets
Game.Renderer.EnableScissor(backgroundRect.X + 1, backgroundRect.Y + 1, backgroundRect.Width - 2, backgroundRect.Height - 2); Game.Renderer.EnableScissor(backgroundRect.X + 1, backgroundRect.Y + 1, backgroundRect.Width - 2, backgroundRect.Height - 2);
foreach (var child in Children) foreach (var child in Children)
child.Draw(); child.DrawOuter();
Game.Renderer.DisableScissor(); Game.Renderer.DisableScissor();
} }

View File

@@ -96,7 +96,7 @@ namespace OpenRA.Widgets
Text = Text.Replace("\r", ""); Text = Text.Replace("\r", "");
} }
public override void DrawInner() public override void Draw()
{ {
var bg = GetBackground(); var bg = GetBackground();

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Widgets
Sprite sprite = null; Sprite sprite = null;
string cachedImage = null; string cachedImage = null;
int cachedFrame= -1; int cachedFrame= -1;
public override void DrawInner() public override void Draw()
{ {
var image = GetImage(); var image = GetImage();
var frame = GetFrame(); var frame = GetFrame();

View File

@@ -174,7 +174,7 @@ namespace OpenRA.Widgets
} }
} }
public override void DrawInner() public override void Draw()
{ {
if (!IsVisible()) if (!IsVisible())
return; return;

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Widgets
return minIndex; return minIndex;
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (IsDisabled()) if (IsDisabled())
return false; return false;
@@ -189,11 +189,9 @@ namespace OpenRA.Widgets
blinkCycle = 20; blinkCycle = 20;
showCursor ^= true; showCursor ^= true;
} }
base.Tick();
} }
public override void DrawInner() public override void Draw()
{ {
var apparentText = GetApparentText(); var apparentText = GetApparentText();
var font = Game.Renderer.Fonts[Font]; var font = Game.Renderer.Fonts[Font];

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Widgets
IsVisible = () => Game.Settings.Game.MatchTimer; IsVisible = () => Game.Settings.Game.MatchTimer;
} }
public override void DrawInner() public override void Draw()
{ {
var s = WidgetUtils.FormatTime(Game.LocalTick); var s = WidgetUtils.FormatTime(Game.LocalTick);
var size = Game.Renderer.Fonts["Title"].Measure(s); var size = Game.Renderer.Fonts["Title"].Measure(s);

View File

@@ -32,7 +32,6 @@ namespace OpenRA.Widgets
public ViewportScrollControllerWidget() : base() { } public ViewportScrollControllerWidget() : base() { }
protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {} protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {}
public override void DrawInner() {}
public override bool HandleMouseInput(MouseInput mi) public override bool HandleMouseInput(MouseInput mi)
{ {
@@ -114,7 +113,7 @@ namespace OpenRA.Widgets
return base.LoseFocus(mi); return base.LoseFocus(mi);
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
switch (e.KeyName) switch (e.KeyName)
{ {

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Widgets
overlaySprite.sheet.Texture.SetData(overlay); overlaySprite.sheet.Texture.SetData(overlay);
} }
public override void DrawInner() public override void Draw()
{ {
if (video == null) if (video == null)
return; return;
@@ -104,7 +104,7 @@ namespace OpenRA.Widgets
Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize); Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize);
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.Event == KeyInputEvent.Down) if (e.Event == KeyInputEvent.Down)
{ {

View File

@@ -29,33 +29,6 @@ namespace OpenRA.Widgets
static Stack<Widget> WindowList = new Stack<Widget>(); static Stack<Widget> WindowList = new Stack<Widget>();
public static Widget SelectedWidget; public static Widget SelectedWidget;
public static bool HandleInput(MouseInput mi)
{
bool handled = false;
if (SelectedWidget != null && SelectedWidget.HandleMouseInputOuter(mi))
handled = true;
if (!handled && RootWidget.HandleMouseInputOuter(mi))
handled = true;
if (mi.Event == MouseInputEvent.Move)
{
Viewport.LastMousePos = mi.Location;
Viewport.TicksSinceLastMove = 0;
}
return handled;
}
public static bool HandleKeyPress(KeyInput e)
{
if (SelectedWidget != null)
return SelectedWidget.HandleKeyPressOuter(e);
if (RootWidget.HandleKeyPressOuter(e))
return true;
return false;
}
public static void CloseWindow() public static void CloseWindow()
{ {
if (WindowList.Count > 0) if (WindowList.Count > 0)
@@ -85,12 +58,39 @@ namespace OpenRA.Widgets
public static void DoTick() public static void DoTick()
{ {
RootWidget.Tick(); RootWidget.TickOuter();
} }
public static void DoDraw() public static void DoDraw()
{ {
RootWidget.Draw(); RootWidget.DrawOuter();
}
public static bool DoHandleInput(MouseInput mi)
{
bool handled = false;
if (SelectedWidget != null && SelectedWidget.HandleMouseInputOuter(mi))
handled = true;
if (!handled && RootWidget.HandleMouseInputOuter(mi))
handled = true;
if (mi.Event == MouseInputEvent.Move)
{
Viewport.LastMousePos = mi.Location;
Viewport.TicksSinceLastMove = 0;
}
return handled;
}
public static bool DoHandleKeyPress(KeyInput e)
{
if (SelectedWidget != null)
return SelectedWidget.HandleKeyPressOuter(e);
if (RootWidget.HandleKeyPressOuter(e))
return true;
return false;
} }
public static void ResetAll() public static void ResetAll()
@@ -252,6 +252,7 @@ namespace OpenRA.Widgets
return EventBounds.Contains(pos) ? GetCursor(pos) : null; return EventBounds.Contains(pos) ? GetCursor(pos) : null;
} }
public virtual bool HandleMouseInput(MouseInput mi) { return false; }
public bool HandleMouseInputOuter(MouseInput mi) public bool HandleMouseInputOuter(MouseInput mi)
{ {
// Are we able to handle this event? // Are we able to handle this event?
@@ -266,8 +267,7 @@ namespace OpenRA.Widgets
return HandleMouseInput(mi); return HandleMouseInput(mi);
} }
public virtual bool HandleMouseInput(MouseInput mi) { return false; } public virtual bool HandleKeyPress(KeyInput e) { return false; }
public virtual bool HandleKeyPressInner(KeyInput e) { return false; }
public virtual bool HandleKeyPressOuter(KeyInput e) public virtual bool HandleKeyPressOuter(KeyInput e)
{ {
if (!IsVisible()) if (!IsVisible())
@@ -279,28 +279,31 @@ namespace OpenRA.Widgets
return true; return true;
// Do any widgety behavior (enter text etc) // Do any widgety behavior (enter text etc)
var handled = HandleKeyPressInner(e); var handled = HandleKeyPress(e);
return handled; return handled;
} }
public abstract void DrawInner(); public virtual void Draw() {}
public virtual void DrawOuter()
public virtual void Draw()
{ {
if (IsVisible()) if (IsVisible())
{ {
DrawInner(); Draw();
foreach (var child in Children) foreach (var child in Children)
child.Draw(); child.DrawOuter();
} }
} }
public virtual void Tick() public virtual void Tick() {}
public virtual void TickOuter()
{ {
if (IsVisible()) if (IsVisible())
{
Tick();
foreach (var child in Children) foreach (var child in Children)
child.Tick(); child.TickOuter();
}
} }
public virtual void AddChild(Widget child) public virtual void AddChild(Widget child)
@@ -308,25 +311,25 @@ namespace OpenRA.Widgets
child.Parent = this; child.Parent = this;
Children.Add(child); Children.Add(child);
} }
public virtual void RemoveChild(Widget child) public virtual void RemoveChild(Widget child)
{ {
Children.Remove(child); Children.Remove(child);
child.Removed(); child.Removed();
} }
public virtual void RemoveChildren() public virtual void RemoveChildren()
{ {
while (Children.Count > 0) while (Children.Count > 0)
RemoveChild(Children[Children.Count-1]); RemoveChild(Children[Children.Count-1]);
} }
public virtual void Removed() public virtual void Removed()
{ {
foreach (var c in Children.OfType<Widget>().Reverse()) foreach (var c in Children.OfType<Widget>().Reverse())
c.Removed(); c.Removed();
} }
public Widget GetWidget(string id) public Widget GetWidget(string id)
{ {
if (this.Id == id) if (this.Id == id)
@@ -354,7 +357,6 @@ namespace OpenRA.Widgets
public ContainerWidget(ContainerWidget other) public ContainerWidget(ContainerWidget other)
: base(other) { } : base(other) { }
public override void DrawInner() { }
public override string GetCursor(int2 pos) { return null; } public override string GetCursor(int2 pos) { return null; }
public override Widget Clone() { return new ContainerWidget(this); } public override Widget Clone() { return new ContainerWidget(this); }
} }

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Widgets
this.worldRenderer = worldRenderer; this.worldRenderer = worldRenderer;
} }
public override void DrawInner() public override void Draw()
{ {
var selbox = SelectionBox; var selbox = SelectionBox;
if (selbox == null) if (selbox == null)
@@ -128,7 +128,7 @@ namespace OpenRA.Widgets
} ); } );
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.Event == KeyInputEvent.Down) if (e.Event == KeyInputEvent.Down)
{ {

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Widgets
pm = world.LocalPlayer.PlayerActor.Trait<PowerManager>(); pm = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
} }
public override void DrawInner() public override void Draw()
{ {
float powerScaleBy = 100; float powerScaleBy = 100;
var maxPower = Math.Max(pm.PowerProvided, pm.PowerDrained); var maxPower = Math.Max(pm.PowerProvided, pm.PowerDrained);

View File

@@ -82,8 +82,6 @@ namespace OpenRA.Mods.Cnc.Widgets
if (CurrentQueue != null) if (CurrentQueue != null)
RefreshIcons(); RefreshIcons();
base.Tick();
} }
public override bool HandleMouseInput(MouseInput mi) public override bool HandleMouseInput(MouseInput mi)
@@ -171,7 +169,7 @@ namespace OpenRA.Mods.Cnc.Widgets
eventBounds = Icons.Keys.Aggregate(Rectangle.Union); eventBounds = Icons.Keys.Aggregate(Rectangle.Union);
} }
public override void DrawInner() public override void Draw()
{ {
if (CurrentQueue == null) if (CurrentQueue == null)
return; return;

View File

@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Widgets
IsVisible = () => queueGroup != null && Groups[queueGroup].Tabs.Count > 0; IsVisible = () => queueGroup != null && Groups[queueGroup].Tabs.Count > 0;
} }
public override void DrawInner() public override void Draw()
{ {
var rb = RenderBounds; var rb = RenderBounds;
leftButtonRect = new Rectangle(rb.X, rb.Y, ArrowWidth, rb.Height); leftButtonRect = new Rectangle(rb.X, rb.Y, ArrowWidth, rb.Height);
@@ -180,7 +180,6 @@ namespace OpenRA.Mods.Cnc.Widgets
{ {
if (leftPressed) Scroll(1); if (leftPressed) Scroll(1);
if (rightPressed) Scroll(-1); if (rightPressed) Scroll(-1);
base.Tick();
} }
public override bool LoseFocus(MouseInput mi) public override bool LoseFocus(MouseInput mi)
@@ -230,7 +229,7 @@ namespace OpenRA.Mods.Cnc.Widgets
return (leftPressed || rightPressed); return (leftPressed || rightPressed);
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.Event != KeyInputEvent.Down) return false; if (e.Event != KeyInputEvent.Down) return false;
if (e.KeyName == "tab") if (e.KeyName == "tab")

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Widgets
pr = world.LocalPlayer.PlayerActor.Trait<PlayerResources>(); pr = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
} }
public override void DrawInner() public override void Draw()
{ {
float scaleBy = 100; float scaleBy = 100;
var max = Math.Max(pr.OreCapacity, pr.Ore); var max = Math.Max(pr.OreCapacity, pr.Ore);

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Cnc.Widgets
eventBounds = (Icons.Count == 0) ? Rectangle.Empty : Icons.Keys.Aggregate(Rectangle.Union); eventBounds = (Icons.Count == 0) ? Rectangle.Empty : Icons.Keys.Aggregate(Rectangle.Union);
} }
public override void DrawInner() public override void Draw()
{ {
var overlayFont = Game.Renderer.Fonts["TinyBold"]; var overlayFont = Game.Renderer.Fonts["TinyBold"];
var holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2; var holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2;
@@ -101,7 +101,6 @@ namespace OpenRA.Mods.Cnc.Widgets
public override void Tick () public override void Tick ()
{ {
base.Tick();
RefreshIcons(); RefreshIcons();
} }

View File

@@ -101,8 +101,6 @@ namespace OpenRA.Mods.RA.Widgets
CurrentQueue = VisibleQueues.FirstOrDefault(); CurrentQueue = VisibleQueues.FirstOrDefault();
TickPaletteAnimation(world); TickPaletteAnimation(world);
base.Tick();
} }
void TickPaletteAnimation(World world) void TickPaletteAnimation(World world)
@@ -145,7 +143,7 @@ namespace OpenRA.Mods.RA.Widgets
CurrentQueue = queue; CurrentQueue = queue;
} }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (e.Event == KeyInputEvent.Up) return false; if (e.Event == KeyInputEvent.Up) return false;
if (e.KeyName == "tab") if (e.KeyName == "tab")
@@ -175,7 +173,7 @@ namespace OpenRA.Mods.RA.Widgets
return true; return true;
} }
public override void DrawInner() public override void Draw()
{ {
if (!IsVisible()) return; if (!IsVisible()) return;
// todo: fix // todo: fix

View File

@@ -21,7 +21,5 @@ namespace OpenRA.Mods.RA.Widgets
public string InstallMode = ""; public string InstallMode = "";
public string ResolvedPackagePath { get { return PackagePath.Replace("^", Platform.SupportDir); } } public string ResolvedPackagePath { get { return PackagePath.Replace("^", Platform.SupportDir); } }
public override void DrawInner() {}
} }
} }

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Widgets
this.world = world; this.world = world;
} }
public override void DrawInner() public override void Draw()
{ {
if( world.LocalPlayer == null ) return; if( world.LocalPlayer == null ) return;

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Widgets
GetLongDesc = () => LongDesc; GetLongDesc = () => LongDesc;
} }
public override void DrawInner() public override void Draw()
{ {
var image = ChromeProvider.GetImage(Image + "-button", GetImage()); var image = ChromeProvider.GetImage(Image + "-button", GetImage());
var rect = new Rectangle(RenderBounds.X, RenderBounds.Y, (int)image.size.X, (int)image.size.Y); var rect = new Rectangle(RenderBounds.X, RenderBounds.Y, (int)image.size.X, (int)image.size.Y);

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Widgets
this.world = world; this.world = world;
} }
public override void DrawInner() public override void Draw()
{ {
if( world.LocalPlayer == null ) return; if( world.LocalPlayer == null ) return;

View File

@@ -124,7 +124,7 @@ namespace OpenRA.Mods.RA.Widgets
get { return new Rectangle((int)mapRect.X, (int)mapRect.Y, (int)mapRect.Width, (int)mapRect.Height);} get { return new Rectangle((int)mapRect.X, (int)mapRect.Y, (int)mapRect.Width, (int)mapRect.Height);}
} }
public override void DrawInner() public override void Draw()
{ {
if( world == null || world.LocalPlayer == null ) return; if( world == null || world.LocalPlayer == null ) return;

View File

@@ -123,7 +123,7 @@ namespace OpenRA.Mods.RA.Widgets
get { return new Rectangle((int)mapRect.X, (int)mapRect.Y, (int)mapRect.Width, (int)mapRect.Height);} get { return new Rectangle((int)mapRect.X, (int)mapRect.Y, (int)mapRect.Width, (int)mapRect.Height);}
} }
public override void DrawInner() public override void Draw()
{ {
if( world == null || world.LocalPlayer == null ) return; if( world == null || world.LocalPlayer == null ) return;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
this.world = widget.world; this.world = widget.world;
} }
public override void DrawInner() public override void Draw()
{ {
var state = Depressed ? "pressed" : var state = Depressed ? "pressed" :
RenderBounds.Contains(Viewport.LastMousePos) ? "hover" : "normal"; RenderBounds.Contains(Viewport.LastMousePos) ? "hover" : "normal";

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA.Widgets
return false; return false;
} }
public override void DrawInner() public override void Draw()
{ {
buttons.Clear(); buttons.Clear();

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Widgets
b.Stances[a] == Stance.Ally; b.Stances[a] == Stance.Ally;
} }
public override void DrawInner() public override void Draw()
{ {
if (!Initialised) if (!Initialised)
Init(); Init();

View File

@@ -35,11 +35,9 @@ namespace OpenRA.Mods.RA.Widgets
OrderManager = orderManager; OrderManager = orderManager;
} }
public override void DrawInner() { }
public override string GetCursor(int2 pos) { return null; } public override string GetCursor(int2 pos) { return null; }
public override bool HandleKeyPressInner(KeyInput e) public override bool HandleKeyPress(KeyInput e)
{ {
if (World == null) return false; if (World == null) return false;
if (World.LocalPlayer == null) return false; if (World.LocalPlayer == null) return false;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Widgets
this.world = world; this.world = world;
} }
public override void DrawInner() public override void Draw()
{ {
if (Viewport.TicksSinceLastMove < TooltipDelay || world == null) if (Viewport.TicksSinceLastMove < TooltipDelay || world == null)
return; return;