Allow keeping empty selection bars visible

This commit is contained in:
reaperrr
2016-05-15 22:31:44 +02:00
parent af8bd461c7
commit 39034b0de9
11 changed files with 13 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Graphics
foreach (var extraBar in actor.TraitsImplementing<ISelectionBar>())
{
var value = extraBar.GetValue();
if (value != 0)
if (value != 0 || extraBar.DisplayWhenEmpty)
{
start.Y += (int)(4 / wr.Viewport.Zoom);
end.Y += (int)(4 / wr.Viewport.Zoom);

View File

@@ -280,7 +280,7 @@ namespace OpenRA.Traits
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
[RequireExplicitImplementation]
public interface ISelectionBar { float GetValue(); Color GetColor(); }
public interface ISelectionBar { float GetValue(); Color GetColor(); bool DisplayWhenEmpty { get; } }
public interface IPositionableInfo : ITraitInfoInterface { }
public interface IPositionable : IOccupySpace

View File

@@ -95,5 +95,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return Color.Purple; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
}
}

View File

@@ -39,5 +39,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return Color.Orange; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
}
}

View File

@@ -42,6 +42,8 @@ namespace OpenRA.Mods.Common.Traits
return Color.Yellow;
}
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
public int GetPowerModifier()
{
return playerPower.PowerOutageRemainingTicks > 0 ? 0 : 100;

View File

@@ -81,6 +81,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{

View File

@@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{

View File

@@ -57,5 +57,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
}
}

View File

@@ -79,5 +79,7 @@ namespace OpenRA.Mods.D2k.Traits
{
return info.BarColor;
}
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
}
}

View File

@@ -128,6 +128,7 @@ namespace OpenRA.Mods.RA.Traits
}
Color ISelectionBar.GetColor() { return info.TimeBarColor; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
{

View File

@@ -118,6 +118,7 @@ namespace OpenRA.Mods.RA.Traits
}
Color ISelectionBar.GetColor() { return Color.Magenta; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
}
class PortableChronoOrderTargeter : IOrderTargeter