feat(BuildCalc) Optimized the build calculator

This commit is contained in:
2022-04-13 15:13:06 -04:00
parent 656b914c6e
commit 39db0afbe5
22 changed files with 803 additions and 561 deletions
+18 -16
View File
@@ -9,6 +9,8 @@ public class BuildOrderModel
{
public string Name { get; set; } = "";
public string Color { get; set; } = "red";
public int CurrentSupplyUsed { get; set; } = 0;
public Dictionary<int, List<EntityModel>> StartedOrders { get; set; } = new()
{
@@ -33,28 +35,28 @@ public class BuildOrderModel
}
}
};
public Dictionary<string, int> UniqueCompletedTimes { get; set; } = new()
{
{
DataType.STARTING_Bastion, 0
}
};
public Dictionary<int, int> SupplyCountTimes { get; set; } = new()
{
{
0, 0
}
};
public string Notes { get; set; } = @"";
public List<string> BuildTypes { get; set; } = new();
public List<EntityModel> GetOrdersAt(int interval)
{
return (from ordersAtTime in StartedOrders
from orders in ordersAtTime.Value
where ordersAtTime.Key == interval
select orders).ToList();
}
public List<EntityModel> GetCompletedAt(int interval)
{
return (from ordersAtTime in StartedOrders
from orders in ordersAtTime.Value
where ordersAtTime.Key + (orders.Production() == null ? 0 : orders.Production().BuildTime) == interval
select orders).ToList();
}
public List<EntityModel> GetCompletedBefore(int interval)
{
return (from ordersAtTime in StartedOrders