Fix a time format bug. Fix subsequent gps bug.
This commit is contained in:
@@ -132,7 +132,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public static string FormatTime(int ticks)
|
public static string FormatTime(int ticks)
|
||||||
{
|
{
|
||||||
var seconds = ticks / 25;
|
var seconds = (int)Math.Ceiling(ticks / 25f);
|
||||||
var minutes = seconds / 60;
|
var minutes = seconds / 60;
|
||||||
|
|
||||||
if (minutes >= 60)
|
if (minutes >= 60)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
var key = (t.Info.AllowMultiple) ? t.Info.OrderName+"_"+a.ActorID : t.Info.OrderName;
|
var key = (t.Info.AllowMultiple) ? t.Info.OrderName+"_"+a.ActorID : t.Info.OrderName;
|
||||||
Powers[key].Instances.Remove(t);
|
Powers[key].Instances.Remove(t);
|
||||||
if (Powers[key].Instances.Count == 0)
|
if (Powers[key].Instances.Count == 0 && !Powers[key].Disabled)
|
||||||
Powers.Remove(key);
|
Powers.Remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,14 +96,14 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public class SupportPowerInstance
|
public class SupportPowerInstance
|
||||||
{
|
{
|
||||||
SupportPowerManager Manager;
|
readonly SupportPowerManager Manager;
|
||||||
string Key;
|
readonly string Key;
|
||||||
|
|
||||||
public List<SupportPower> Instances;
|
public List<SupportPower> Instances;
|
||||||
public int RemainingTime;
|
public int RemainingTime;
|
||||||
public int TotalTime;
|
public int TotalTime;
|
||||||
public bool Active;
|
public bool Active { get; private set; }
|
||||||
public bool Disabled;
|
public bool Disabled { get; private set; }
|
||||||
|
|
||||||
public SupportPowerInfo Info { get { return Instances.First().Info; } }
|
public SupportPowerInfo Info { get { return Instances.First().Info; } }
|
||||||
public bool Ready { get { return Active && RemainingTime == 0; } }
|
public bool Ready { get { return Active && RemainingTime == 0; } }
|
||||||
@@ -119,17 +119,16 @@ namespace OpenRA.Mods.RA
|
|||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
Active = !Disabled && Instances.Any(i => !i.self.TraitsImplementing<IDisable>().Any(d => d.Disabled));
|
Active = !Disabled && Instances.Any(i => !i.self.TraitsImplementing<IDisable>().Any(d => d.Disabled));
|
||||||
var power = Instances.First();
|
|
||||||
|
|
||||||
if (Active)
|
if (Active)
|
||||||
{
|
{
|
||||||
|
var power = Instances.First();
|
||||||
if (RemainingTime > 0) --RemainingTime;
|
if (RemainingTime > 0) --RemainingTime;
|
||||||
if (!notifiedCharging)
|
if (!notifiedCharging)
|
||||||
{
|
{
|
||||||
power.Charging(power.self, Key);
|
power.Charging(power.self, Key);
|
||||||
notifiedCharging = true;
|
notifiedCharging = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (RemainingTime == 0
|
if (RemainingTime == 0
|
||||||
&& !notifiedReady)
|
&& !notifiedReady)
|
||||||
@@ -138,6 +137,7 @@ namespace OpenRA.Mods.RA
|
|||||||
notifiedReady = true;
|
notifiedReady = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user