ColorBlockWidget tweaks + Widget Refactoring
This commit is contained in:
@@ -25,19 +25,17 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
class ColorBlockWidget : Widget
|
class ColorBlockWidget : Widget
|
||||||
{
|
{
|
||||||
public int PaletteIndex = 0;
|
|
||||||
public Func<int> GetPaletteIndex;
|
public Func<int> GetPaletteIndex;
|
||||||
|
|
||||||
public ColorBlockWidget()
|
public ColorBlockWidget()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
GetPaletteIndex = () => { return PaletteIndex; };
|
GetPaletteIndex = () => 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorBlockWidget(Widget widget)
|
public ColorBlockWidget(Widget widget)
|
||||||
:base(widget)
|
:base(widget)
|
||||||
{
|
{
|
||||||
PaletteIndex = (widget as ColorBlockWidget).PaletteIndex;
|
|
||||||
GetPaletteIndex = (widget as ColorBlockWidget).GetPaletteIndex;
|
GetPaletteIndex = (widget as ColorBlockWidget).GetPaletteIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,15 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public int2 DrawPosition()
|
public int2 DrawPosition()
|
||||||
{
|
{
|
||||||
return new int2(Bounds.X, Bounds.Y) + ((Parent == null) ? int2.Zero : Parent.DrawPosition());
|
return new int2(Bounds.X, Bounds.Y) + ParentPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int2 ParentPosition()
|
||||||
|
{
|
||||||
|
return (Parent == null) ? int2.Zero : Parent.DrawPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
// Parse the YAML equations to find the widget bounds
|
// Parse the YAML equations to find the widget bounds
|
||||||
|
|||||||
@@ -323,7 +323,6 @@ Container:
|
|||||||
Y:7
|
Y:7
|
||||||
Width:PARENT_RIGHT-10
|
Width:PARENT_RIGHT-10
|
||||||
Height:PARENT_BOTTOM-12
|
Height:PARENT_BOTTOM-12
|
||||||
PaletteIndex:0
|
|
||||||
Button@FACTION:
|
Button@FACTION:
|
||||||
Id:FACTION
|
Id:FACTION
|
||||||
Text:Faction
|
Text:Faction
|
||||||
@@ -372,7 +371,6 @@ Container:
|
|||||||
Y:7
|
Y:7
|
||||||
Width:55
|
Width:55
|
||||||
Height:13
|
Height:13
|
||||||
PaletteIndex:0
|
|
||||||
Label@FACTION:
|
Label@FACTION:
|
||||||
Id:FACTION
|
Id:FACTION
|
||||||
Text:Faction
|
Text:Faction
|
||||||
|
|||||||
Reference in New Issue
Block a user