Explicitly implement ISelectionBar

This commit is contained in:
Taryn Hill
2015-12-30 08:19:50 -06:00
parent e3229f4cd8
commit 25eddb9567
9 changed files with 18 additions and 19 deletions

View File

@@ -78,8 +78,7 @@ namespace OpenRA.Mods.Common.Traits
Color.FromArgb(96, Color.Black)); Color.FromArgb(96, Color.Black));
} }
// Selection bar float ISelectionBar.GetValue()
public float GetValue()
{ {
// Visible to player and allies // Visible to player and allies
if (!ValidRenderPlayer()) if (!ValidRenderPlayer())
@@ -92,6 +91,6 @@ namespace OpenRA.Mods.Common.Traits
return (float)progress / total; return (float)progress / total;
} }
public Color GetColor() { return Color.Purple; } Color ISelectionBar.GetColor() { return Color.Purple; }
} }
} }

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
capturable = self.Trait<ExternalCapturable>(); capturable = self.Trait<ExternalCapturable>();
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
// only show when building is being captured // only show when building is being captured
if (!capturable.CaptureInProgress) if (!capturable.CaptureInProgress)
@@ -37,6 +37,6 @@ namespace OpenRA.Mods.Common.Traits
return (float)capturable.CaptureProgressTime / (capturable.Info.CaptureCompleteTime * 25); return (float)capturable.CaptureProgressTime / (capturable.Info.CaptureCompleteTime * 25);
} }
public Color GetColor() { return Color.Orange; } Color ISelectionBar.GetColor() { return Color.Orange; }
} }
} }

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
playerPower = self.Owner.PlayerActor.Trait<PowerManager>(); playerPower = self.Owner.PlayerActor.Trait<PowerManager>();
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
if (playerPower.PowerOutageRemainingTicks <= 0) if (playerPower.PowerOutageRemainingTicks <= 0)
return 0; return 0;
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
return (float)playerPower.PowerOutageRemainingTicks / playerPower.PowerOutageTotalTicks; return (float)playerPower.PowerOutageRemainingTicks / playerPower.PowerOutageTotalTicks;
} }
public Color GetColor() Color ISelectionBar.GetColor()
{ {
return Color.Yellow; return Color.Yellow;
} }

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
value = current != null ? 1 - (float)current.RemainingCost / current.TotalCost : 0; value = current != null ? 1 - (float)current.RemainingCost / current.TotalCost : 0;
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
// only people we like should see our production status. // only people we like should see our production status.
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
return value; return value;
} }
public Color GetColor() { return info.Color; } Color ISelectionBar.GetColor() { return info.Color; }
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{ {

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
return 0; return 0;
@@ -46,6 +46,6 @@ namespace OpenRA.Mods.Common.Traits
return 1 - (float)power.RemainingTime / power.TotalTime; return 1 - (float)power.RemainingTime / power.TotalTime;
} }
public Color GetColor() { return info.Color; } Color ISelectionBar.GetColor() { return info.Color; }
} }
} }

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
value = remaining * 1f / duration; value = remaining * 1f / duration;
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
return 0; return 0;
@@ -57,6 +57,6 @@ namespace OpenRA.Mods.Common.Traits
return value; return value;
} }
public Color GetColor() { return info.Color; } Color ISelectionBar.GetColor() { return info.Color; }
} }
} }

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.D2k.Traits
changingOwner = null; // It was triggered by this trait: reset changingOwner = null; // It was triggered by this trait: reset
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
if (remaining <= 0) if (remaining <= 0)
return 0; return 0;
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.D2k.Traits
return (float)remaining / duration; return (float)remaining / duration;
} }
public Color GetColor() Color ISelectionBar.GetColor()
{ {
return info.BarColor; return info.BarColor;
} }

View File

@@ -114,7 +114,7 @@ namespace OpenRA.Mods.RA.Traits
} }
// Show the remaining time as a bar // Show the remaining time as a bar
public float GetValue() float ISelectionBar.GetValue()
{ {
if (!info.ReturnToOrigin) if (!info.ReturnToOrigin)
return 0f; return 0f;
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA.Traits
return (float)ReturnTicks / duration; return (float)ReturnTicks / duration;
} }
public Color GetColor() { return info.TimeBarColor; } Color ISelectionBar.GetColor() { return info.TimeBarColor; }
public void ModifyDeathActorInit(Actor self, TypeDictionary init) public void ModifyDeathActorInit(Actor self, TypeDictionary init)
{ {

View File

@@ -105,12 +105,12 @@ namespace OpenRA.Mods.RA.Traits
get { return chargeTick <= 0; } get { return chargeTick <= 0; }
} }
public float GetValue() float ISelectionBar.GetValue()
{ {
return (float)(Info.ChargeDelay - chargeTick) / Info.ChargeDelay; return (float)(Info.ChargeDelay - chargeTick) / Info.ChargeDelay;
} }
public Color GetColor() { return Color.Magenta; } Color ISelectionBar.GetColor() { return Color.Magenta; }
} }
class PortableChronoOrderTargeter : IOrderTargeter class PortableChronoOrderTargeter : IOrderTargeter