feat(BuildCalc) Waits now work
This commit is contained in:
@@ -307,14 +307,16 @@ public interface IBuildOrderService
|
||||
|
||||
public bool Add(EntityModel entity, IEconomyService withEconomy, IToastService toastService);
|
||||
public void Add(EntityModel entity, int atInterval);
|
||||
public bool AddWait(int forInterval);
|
||||
|
||||
public void SetName(string Name);
|
||||
|
||||
public void SetName(string name);
|
||||
public string GetName();
|
||||
|
||||
public void SetNotes(string Notes);
|
||||
public void SetNotes(string notes);
|
||||
public string GetNotes();
|
||||
|
||||
public void DeprecatedSetColor(string Color);
|
||||
public void DeprecatedSetColor(string color);
|
||||
public string GetColor();
|
||||
|
||||
public int? WillMeetRequirements(EntityModel entity);
|
||||
|
||||
@@ -87,6 +87,28 @@ public class BuildOrderService : IBuildOrderService
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public bool AddWait(int forInterval)
|
||||
{
|
||||
if (forInterval == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lastInterval += forInterval;
|
||||
|
||||
if (!buildOrder.StartedOrders.ContainsKey(lastInterval))
|
||||
buildOrder.StartedOrders.Add(lastInterval, new List<EntityModel>());
|
||||
|
||||
if (!buildOrder.CompletedOrders.ContainsKey(lastInterval))
|
||||
buildOrder.CompletedOrders.Add(lastInterval, new List<EntityModel>());
|
||||
|
||||
|
||||
NotifyDataChanged();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int? WillMeetRequirements(EntityModel entity)
|
||||
{
|
||||
@@ -139,6 +161,15 @@ public class BuildOrderService : IBuildOrderService
|
||||
{
|
||||
if (buildOrder.StartedOrders.Keys.Count > 1)
|
||||
{
|
||||
if (buildOrder.StartedOrders.Count == 0)
|
||||
{
|
||||
buildOrder.StartedOrders.Remove(buildOrder.StartedOrders.Last().Key);
|
||||
buildOrder.CompletedOrders.Remove(buildOrder.CompletedOrders.Last().Key);
|
||||
|
||||
lastInterval = buildOrder.StartedOrders.Last().Key;
|
||||
return;
|
||||
}
|
||||
|
||||
var lastStarted = buildOrder.StartedOrders.Keys.Last();
|
||||
var lastCompleted = buildOrder.CompletedOrders.Keys.Last();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user