Add public atom bomb and gps timers to RA
This commit is contained in:
@@ -410,6 +410,7 @@
|
|||||||
<Compile Include="Widgets\OrderButtonWidget.cs" />
|
<Compile Include="Widgets\OrderButtonWidget.cs" />
|
||||||
<Compile Include="Widgets\RadarWidget.cs" />
|
<Compile Include="Widgets\RadarWidget.cs" />
|
||||||
<Compile Include="Widgets\StrategicProgressWidget.cs" />
|
<Compile Include="Widgets\StrategicProgressWidget.cs" />
|
||||||
|
<Compile Include="Widgets\SupportPowerTimerWidget.cs" />
|
||||||
<Compile Include="Widgets\SupportPowerBinWidget.cs" />
|
<Compile Include="Widgets\SupportPowerBinWidget.cs" />
|
||||||
<Compile Include="Widgets\WorldCommandWidget.cs" />
|
<Compile Include="Widgets\WorldCommandWidget.cs" />
|
||||||
<Compile Include="Widgets\WorldTooltipWidget.cs" />
|
<Compile Include="Widgets\WorldTooltipWidget.cs" />
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string SelectTargetSound = null;
|
public readonly string SelectTargetSound = null;
|
||||||
public readonly string LaunchSound = null;
|
public readonly string LaunchSound = null;
|
||||||
|
|
||||||
|
public readonly bool DisplayTimer = false;
|
||||||
|
|
||||||
public readonly string OrderName;
|
public readonly string OrderName;
|
||||||
public abstract object Create(ActorInitializer init);
|
public abstract object Create(ActorInitializer init);
|
||||||
|
|
||||||
|
|||||||
65
OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs
Normal file
65
OpenRA.Mods.RA/Widgets/SupportPowerTimerWidget.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Widgets
|
||||||
|
{
|
||||||
|
public class SupportPowerTimerWidget : Widget
|
||||||
|
{
|
||||||
|
public readonly string Font = "Bold";
|
||||||
|
public readonly string Format = "{0}: {1}";
|
||||||
|
public readonly TimerOrder Order = TimerOrder.Descending;
|
||||||
|
|
||||||
|
readonly IEnumerable<SupportPowerInstance> powers;
|
||||||
|
Pair<string, Color>[] texts;
|
||||||
|
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public SupportPowerTimerWidget(World world)
|
||||||
|
{
|
||||||
|
powers = world.ActorsWithTrait<SupportPowerManager>()
|
||||||
|
.Where(p => !p.Actor.IsDead() && !p.Actor.Owner.NonCombatant)
|
||||||
|
.SelectMany(s => s.Trait.Powers.Values)
|
||||||
|
.Where(p => p.Instances.Any() && p.Info.DisplayTimer && !p.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Tick()
|
||||||
|
{
|
||||||
|
texts = powers.Select(p =>
|
||||||
|
{
|
||||||
|
var time = WidgetUtils.FormatTime(p.RemainingTime, false);
|
||||||
|
var text = Format.F(p.Info.Description, time);
|
||||||
|
var color = !p.Ready || Game.LocalTick % 50 < 25 ? p.Instances[0].self.Owner.Color.RGB : Color.White;
|
||||||
|
return Pair.New(text, color);
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
if (!IsVisible() || texts == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var y = 0;
|
||||||
|
foreach (var t in texts)
|
||||||
|
{
|
||||||
|
var font = Game.Renderer.Fonts[Font];
|
||||||
|
font.DrawTextWithContrast(t.First, new float2(Bounds.Location) + new float2(0, y), t.Second, Color.Black, 1);
|
||||||
|
y += (font.Measure(t.First).Y + 5) * (int)Order;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TimerOrder { Ascending = -1, Descending = 1 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,6 +52,10 @@ Container@INGAME_ROOT:
|
|||||||
Width:170
|
Width:170
|
||||||
Height:40
|
Height:40
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
SupportPowerTimer@SUPPORT_POWER_TIMER:
|
||||||
|
X:15
|
||||||
|
Y:WINDOW_BOTTOM-30
|
||||||
|
Order:Ascending
|
||||||
|
|
||||||
Container@PLAYER_WIDGETS:
|
Container@PLAYER_WIDGETS:
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ MSLO:
|
|||||||
LaunchSound: alaunch1.aud
|
LaunchSound: alaunch1.aud
|
||||||
MissileWeapon: atomic
|
MissileWeapon: atomic
|
||||||
SpawnOffset: 0,427,0
|
SpawnOffset: 0,427,0
|
||||||
|
DisplayTimer: True
|
||||||
CanPowerDown:
|
CanPowerDown:
|
||||||
RequiresPower:
|
RequiresPower:
|
||||||
SupportPowerChargeBar:
|
SupportPowerChargeBar:
|
||||||
@@ -849,9 +850,10 @@ ATEK:
|
|||||||
OneShot: yes
|
OneShot: yes
|
||||||
ChargeTime: 480
|
ChargeTime: 480
|
||||||
Description: GPS Satellite
|
Description: GPS Satellite
|
||||||
LongDesc: Reveals the entire map
|
LongDesc: Reveals the entire map.
|
||||||
RevealDelay: 15
|
RevealDelay: 15
|
||||||
LaunchSound: satlnch1.aud
|
LaunchSound: satlnch1.aud
|
||||||
|
DisplayTimer: True
|
||||||
SupportPowerChargeBar:
|
SupportPowerChargeBar:
|
||||||
|
|
||||||
WEAP:
|
WEAP:
|
||||||
|
|||||||
Reference in New Issue
Block a user