feat(EconomyComparison) Added new WIP Feature
This commit is contained in:
+21
-3
@@ -45,6 +45,24 @@ public interface ISearchService
|
||||
void Hide();
|
||||
}
|
||||
|
||||
public interface IEconomyComparisonService
|
||||
{
|
||||
public List<BuildToCompareModel> BuildsToCompare { get; set; }
|
||||
public void ChangeNumberOfTownHalls(int forPlayer, int toCount);
|
||||
public void ChangeTownHallTiming(int forPlayer, int forTownHall, int toTiming);
|
||||
public int GetTownHallCount(int forPlayer);
|
||||
public int GetTownHallBuildTime(int forPlayer, int forTownHall);
|
||||
|
||||
public List<int> GetTownHallBuildTimes(int forPlayer);
|
||||
public void ChangeFaction(int forPlayer, string toFaction);
|
||||
public string GetFaction(int forPlayer);
|
||||
|
||||
public void ChangeColor(int forPlayer, string toColor);
|
||||
public string GetColor(int forPlayer);
|
||||
public void Subscribe(Action action);
|
||||
public void Unsubscribe(Action action);
|
||||
}
|
||||
|
||||
public interface IEntityDialogService
|
||||
{
|
||||
public void Subscribe(Action action);
|
||||
@@ -164,8 +182,8 @@ public interface INavigationService
|
||||
|
||||
public interface IBuildComparisonService
|
||||
{
|
||||
public void SetBuilds(BuildComparisonModel buildComparisonModel);
|
||||
public BuildComparisonModel Get();
|
||||
public void SetBuilds(BuildToCompareModel buildToCompareModel);
|
||||
public BuildToCompareModel Get();
|
||||
public string BuildOrderAsYaml();
|
||||
public string AsJson();
|
||||
public bool LoadJson(string data);
|
||||
@@ -289,7 +307,7 @@ public interface IBuildOrderService
|
||||
public void SetNotes(string Notes);
|
||||
public string GetNotes();
|
||||
|
||||
public void SetColor(string Color);
|
||||
public void DeprecatedSetColor(string Color);
|
||||
public string GetColor();
|
||||
|
||||
public int? WillMeetRequirements(EntityModel entity);
|
||||
|
||||
@@ -241,71 +241,20 @@ public class BuildOrderService : IBuildOrderService
|
||||
return buildOrder.Notes;
|
||||
}
|
||||
|
||||
public void SetColor(string color)
|
||||
public void DeprecatedSetColor(string color)
|
||||
{
|
||||
buildOrder.Color = color;
|
||||
NotifyDataChanged();
|
||||
|
||||
}
|
||||
|
||||
public string GetColor()
|
||||
{
|
||||
return buildOrder.Color;
|
||||
return "";
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
lastInterval = 0;
|
||||
|
||||
buildOrder = new BuildOrderModel
|
||||
{
|
||||
StartedOrders = new Dictionary<int, List<EntityModel>>
|
||||
{
|
||||
{
|
||||
0,
|
||||
new List<EntityModel>
|
||||
{
|
||||
EntityModel.Get(DataType.STARTING_Bastion),
|
||||
EntityModel.Get(DataType.STARTING_TownHall_Aru)
|
||||
}
|
||||
}
|
||||
},
|
||||
CompletedOrders = new Dictionary<int, List<EntityModel>>
|
||||
{
|
||||
{
|
||||
0,
|
||||
new List<EntityModel>
|
||||
{
|
||||
EntityModel.Get(DataType.STARTING_Bastion),
|
||||
EntityModel.Get(DataType.STARTING_TownHall_Aru)
|
||||
}
|
||||
}
|
||||
},
|
||||
UniqueCompletedTimes = new Dictionary<string, int>
|
||||
{
|
||||
{
|
||||
DataType.STARTING_Bastion, 0
|
||||
},
|
||||
{
|
||||
DataType.STARTING_TownHall_Aru, 0
|
||||
}
|
||||
},
|
||||
UniqueCompletedCount = new Dictionary<string, int>
|
||||
{
|
||||
{
|
||||
DataType.STARTING_Bastion, 1
|
||||
},
|
||||
{
|
||||
DataType.STARTING_TownHall_Aru, 1
|
||||
}
|
||||
},
|
||||
SupplyCountTimes = new Dictionary<int, int>
|
||||
{
|
||||
{
|
||||
0, 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
buildOrder.Initialize(DataType.FACTION_Aru);
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
+9
-13
@@ -7,9 +7,9 @@ using YamlDotNet.Serialization;
|
||||
|
||||
namespace Services.Immortal;
|
||||
|
||||
public class BuildComparisionService : IBuildComparisonService
|
||||
public class DeprecatedBuildComparisionService : IBuildComparisonService
|
||||
{
|
||||
private BuildComparisonModel buildComparison = new();
|
||||
private BuildToCompareModel buildToCompare = new();
|
||||
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
@@ -21,15 +21,15 @@ public class BuildComparisionService : IBuildComparisonService
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public void SetBuilds(BuildComparisonModel buildComparisonModel)
|
||||
public void SetBuilds(BuildToCompareModel buildToCompareModel)
|
||||
{
|
||||
buildComparison = buildComparisonModel;
|
||||
buildToCompare = buildToCompareModel;
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public BuildComparisonModel Get()
|
||||
public BuildToCompareModel Get()
|
||||
{
|
||||
return buildComparison;
|
||||
return buildToCompare;
|
||||
}
|
||||
|
||||
public string AsJson()
|
||||
@@ -39,7 +39,7 @@ public class BuildComparisionService : IBuildComparisonService
|
||||
WriteIndented = true
|
||||
};
|
||||
options.Converters.Add(new JsonStringEnumConverter());
|
||||
return JsonSerializer.Serialize(buildComparison, options);
|
||||
return JsonSerializer.Serialize(buildToCompare, options);
|
||||
}
|
||||
|
||||
public bool LoadJson(string data)
|
||||
@@ -51,7 +51,7 @@ public class BuildComparisionService : IBuildComparisonService
|
||||
WriteIndented = true
|
||||
};
|
||||
options.Converters.Add(new JsonStringEnumConverter());
|
||||
buildComparison = JsonSerializer.Deserialize<BuildComparisonModel>(data, options)!;
|
||||
buildToCompare = JsonSerializer.Deserialize<BuildToCompareModel>(data, options)!;
|
||||
|
||||
// Must Hydrate because not loaded with Parts
|
||||
HydratedLoadedJson();
|
||||
@@ -69,7 +69,7 @@ public class BuildComparisionService : IBuildComparisonService
|
||||
{
|
||||
var stringBuilder = new StringBuilder();
|
||||
var serializer = new Serializer();
|
||||
stringBuilder.AppendLine(serializer.Serialize(buildComparison));
|
||||
stringBuilder.AppendLine(serializer.Serialize(buildToCompare));
|
||||
var buildOrderText = stringBuilder.ToString();
|
||||
return buildOrderText;
|
||||
}
|
||||
@@ -84,9 +84,5 @@ public class BuildComparisionService : IBuildComparisonService
|
||||
|
||||
public void HydratedLoadedJson()
|
||||
{
|
||||
foreach (var build in buildComparison.Builds)
|
||||
foreach (var orders in build.StartedOrders.Values)
|
||||
foreach (var order in orders)
|
||||
order.Copy(EntityModel.Get(order.DataType));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
using Model.BuildOrders;
|
||||
using Model.Economy;
|
||||
using Model.Entity;
|
||||
using Model.Entity.Data;
|
||||
using Model.Types;
|
||||
|
||||
namespace Services.Immortal;
|
||||
|
||||
public class EconomyComparisionService : IEconomyComparisonService
|
||||
{
|
||||
public List<BuildToCompareModel> BuildsToCompare { get; set; }
|
||||
|
||||
public EconomyComparisionService()
|
||||
{
|
||||
BuildsToCompare = new List<BuildToCompareModel>()
|
||||
{
|
||||
new BuildToCompareModel { NumberOfTownHallExpansions = 0, Faction = DataType.FACTION_Aru, ChartColor = "green"},
|
||||
new BuildToCompareModel { NumberOfTownHallExpansions = 0, Faction = DataType.FACTION_Aru, ChartColor = "red"}
|
||||
};
|
||||
|
||||
BuildsToCompare[0].EconomyOverTimeModel = CalculateEconomy(BuildsToCompare[0], 0);
|
||||
BuildsToCompare[1].EconomyOverTimeModel = CalculateEconomy(BuildsToCompare[1], 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CalculateBuildOrder(BuildToCompareModel buildToCompare)
|
||||
{
|
||||
buildToCompare.BuildOrderModel = new BuildOrderModel(buildToCompare.Faction);
|
||||
|
||||
foreach (var time in buildToCompare.TimeToBuildTownHall)
|
||||
{
|
||||
var townHall = buildToCompare.GetTownHallEntity;
|
||||
var townHallMining2 = buildToCompare.GetTownHallMining2Entity;
|
||||
var townHallMining3 = buildToCompare.GetTownHallMining3Entity;
|
||||
|
||||
Add(townHall, buildToCompare, time);
|
||||
Add(townHallMining2, buildToCompare, time + townHall.Production()!.BuildTime);
|
||||
Add(townHallMining3, buildToCompare, time + townHall.Production()!.BuildTime + townHallMining2.Production()!.BuildTime);
|
||||
}
|
||||
|
||||
CalculateEconomy(buildToCompare, 0);
|
||||
}
|
||||
|
||||
public void Add(EntityModel entityModel, BuildToCompareModel buildToCompare, int atInterval)
|
||||
{
|
||||
BuildOrderModel buildOrder = buildToCompare.BuildOrderModel;
|
||||
|
||||
|
||||
if (!buildOrder.StartedOrders.ContainsKey(atInterval))
|
||||
buildOrder.StartedOrders.Add(atInterval, new List<EntityModel>());
|
||||
|
||||
var production = entityModel.Production();
|
||||
|
||||
var completedTime = atInterval;
|
||||
if (production != null) completedTime += production.BuildTime;
|
||||
|
||||
if (!buildOrder.CompletedOrders.ContainsKey(completedTime))
|
||||
buildOrder.CompletedOrders.Add(completedTime, new List<EntityModel>());
|
||||
|
||||
buildOrder.StartedOrders[atInterval].Add(entityModel.Clone());
|
||||
buildOrder.CompletedOrders[completedTime].Add(entityModel.Clone());
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private int IntervalMax = 1024;
|
||||
|
||||
private List<EconomyModel> CalculateEconomy(BuildToCompareModel buildToCompare, int fromInterval = 0)
|
||||
{
|
||||
BuildOrderModel buildOrder = buildToCompare.BuildOrderModel;
|
||||
|
||||
List<EconomyModel> buildEconomyOverTime = buildToCompare.EconomyOverTimeModel;
|
||||
|
||||
while (buildEconomyOverTime.Count < IntervalMax)
|
||||
buildEconomyOverTime.Add(new EconomyModel { Interval = buildEconomyOverTime.Count - 1 });
|
||||
|
||||
for (var interval = fromInterval; interval < IntervalMax; interval++)
|
||||
{
|
||||
var economyAtSecond = buildEconomyOverTime[interval];
|
||||
if (interval > 0)
|
||||
{
|
||||
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy;
|
||||
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether;
|
||||
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre;
|
||||
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount;
|
||||
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount;
|
||||
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount;
|
||||
economyAtSecond.Harvesters = buildEconomyOverTime[interval - 1].Harvesters.ToList();
|
||||
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||
}
|
||||
|
||||
economyAtSecond.Interval = interval;
|
||||
|
||||
// Add funds
|
||||
float freeWorkers = economyAtSecond.WorkerCount - economyAtSecond.BusyWorkerCount;
|
||||
var workersNeeded = 0;
|
||||
|
||||
economyAtSecond.Harvesters =
|
||||
(from harvester in buildOrder.GetHarvestersCompletedBefore(interval)
|
||||
select harvester).ToList();
|
||||
|
||||
// Add funds
|
||||
economyAtSecond.Pyre += 1;
|
||||
|
||||
// Add funds
|
||||
foreach (var entity in economyAtSecond.Harvesters)
|
||||
{
|
||||
var harvester = entity.Harvest();
|
||||
if (harvester.RequiresWorker)
|
||||
if (harvester.Resource == ResourceType.Alloy)
|
||||
{
|
||||
var usedWorkers = Math.Min(harvester.Slots, freeWorkers);
|
||||
economyAtSecond.Alloy += harvester.HarvestedPerInterval * usedWorkers;
|
||||
freeWorkers -= usedWorkers;
|
||||
|
||||
if (usedWorkers < harvester.Slots) workersNeeded += 1;
|
||||
}
|
||||
|
||||
if (harvester.RequiresWorker == false)
|
||||
{
|
||||
if (harvester.Resource == ResourceType.Ether)
|
||||
economyAtSecond.Ether += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
|
||||
if (harvester.Resource == ResourceType.Alloy)
|
||||
economyAtSecond.Alloy += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new worker
|
||||
if (economyAtSecond.CreatingWorkerCount > 0)
|
||||
for (var i = 0; i < economyAtSecond.CreatingWorkerDelays.Count; i++)
|
||||
if (economyAtSecond.CreatingWorkerDelays[i] > 0)
|
||||
{
|
||||
if (economyAtSecond.Alloy > 2.5f)
|
||||
{
|
||||
economyAtSecond.Alloy -= 2.5f;
|
||||
economyAtSecond.CreatingWorkerDelays[i]--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
economyAtSecond.CreatingWorkerCount -= 1;
|
||||
economyAtSecond.WorkerCount += 1;
|
||||
economyAtSecond.CreatingWorkerDelays.Remove(i);
|
||||
i--;
|
||||
}
|
||||
|
||||
if (workersNeeded > economyAtSecond.CreatingWorkerCount)
|
||||
{
|
||||
economyAtSecond.CreatingWorkerCount += 1;
|
||||
economyAtSecond.CreatingWorkerDelays.Add(50);
|
||||
}
|
||||
|
||||
// Remove Funds from Build Order
|
||||
|
||||
if (buildOrder.StartedOrders.TryGetValue(interval, out var ordersAtTime))
|
||||
foreach (var order in ordersAtTime)
|
||||
{
|
||||
var foundEntity = EntityModel.GetDictionary()[order.DataType];
|
||||
var production = foundEntity.Production();
|
||||
|
||||
if (production != null)
|
||||
{
|
||||
economyAtSecond.Alloy -= production.Alloy;
|
||||
economyAtSecond.Ether -= production.Ether;
|
||||
economyAtSecond.Pyre -= production.Pyre;
|
||||
var finishedAt = interval + production.BuildTime;
|
||||
|
||||
if (production.RequiresWorker) economyAtSecond.BusyWorkerCount += 1;
|
||||
|
||||
if (production.ConsumesWorker) economyAtSecond.WorkerCount -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle new entities
|
||||
if (buildOrder.CompletedOrders.TryGetValue(interval, out var completedAtInterval))
|
||||
foreach (var newEntity in completedAtInterval)
|
||||
{
|
||||
var harvest = newEntity;
|
||||
if (harvest != null) economyAtSecond.Harvesters.Add(harvest);
|
||||
|
||||
var production = newEntity.Production();
|
||||
if (production != null && production.RequiresWorker) economyAtSecond.BusyWorkerCount -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return buildEconomyOverTime;
|
||||
}
|
||||
|
||||
|
||||
public void ChangeNumberOfTownHalls(int forPlayer, int toCount)
|
||||
{
|
||||
if (BuildsToCompare[forPlayer].NumberOfTownHallExpansions == toCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BuildsToCompare[forPlayer].NumberOfTownHallExpansions = toCount;
|
||||
|
||||
CalculateBuildOrder(BuildsToCompare[forPlayer]);
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public void ChangeTownHallTiming(int forPlayer, int forTownHall, int toTiming)
|
||||
{
|
||||
if (BuildsToCompare[forPlayer].TimeToBuildTownHall[forTownHall] == toTiming)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BuildsToCompare[forPlayer].TimeToBuildTownHall[forTownHall] = toTiming;
|
||||
|
||||
CalculateBuildOrder(BuildsToCompare[forPlayer]);
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public int GetTownHallCount(int forPlayer)
|
||||
{
|
||||
return BuildsToCompare[forPlayer].NumberOfTownHallExpansions;
|
||||
}
|
||||
|
||||
public int GetTownHallBuildTime(int forPlayer, int forTownHall)
|
||||
{
|
||||
return BuildsToCompare[forPlayer].TimeToBuildTownHall[forTownHall];
|
||||
}
|
||||
|
||||
public List<int> GetTownHallBuildTimes(int forPlayer)
|
||||
{
|
||||
return BuildsToCompare[forPlayer].TimeToBuildTownHall;
|
||||
}
|
||||
|
||||
public void ChangeFaction(int forPlayer, string toFaction)
|
||||
{
|
||||
if (BuildsToCompare[forPlayer].Faction.Equals(toFaction))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BuildsToCompare[forPlayer].Faction = toFaction;
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public string GetFaction(int forPlayer)
|
||||
{
|
||||
return BuildsToCompare[forPlayer].Faction;
|
||||
}
|
||||
|
||||
public void ChangeColor(int forPlayer, string toColor)
|
||||
{
|
||||
if (BuildsToCompare[forPlayer].ChartColor.Equals(toColor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BuildsToCompare[forPlayer].ChartColor = toColor;
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
public string GetColor(int forPlayer)
|
||||
{
|
||||
return BuildsToCompare[forPlayer].ChartColor;
|
||||
}
|
||||
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
|
||||
private event Action OnChange = null!;
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Model.Economy;
|
||||
using Model.BuildOrders;
|
||||
using Model.Economy;
|
||||
using Model.Entity;
|
||||
using Model.Types;
|
||||
|
||||
@@ -6,12 +7,13 @@ namespace Services.Immortal;
|
||||
|
||||
public class EconomyService : IEconomyService
|
||||
{
|
||||
private List<EconomyModel> economyOverTime = null!;
|
||||
|
||||
private List<EconomyModel> buildEconomyOverTime = null!;
|
||||
|
||||
private Dictionary<string, List<EconomyModel>> specficEconomiesOverTime = null!;
|
||||
|
||||
public List<EconomyModel> GetOverTime()
|
||||
{
|
||||
return economyOverTime;
|
||||
return buildEconomyOverTime;
|
||||
}
|
||||
|
||||
public void Subscribe(Action action)
|
||||
@@ -27,33 +29,33 @@ public class EconomyService : IEconomyService
|
||||
public void Calculate(IBuildOrderService buildOrder, ITimingService timing, int fromInterval)
|
||||
{
|
||||
//TODO Break all this up
|
||||
if (economyOverTime == null)
|
||||
if (buildEconomyOverTime == null)
|
||||
{
|
||||
economyOverTime = new List<EconomyModel>();
|
||||
buildEconomyOverTime = new List<EconomyModel>();
|
||||
for (var interval = 0; interval < timing.GetAttackTime(); interval++)
|
||||
economyOverTime.Add(new EconomyModel { Interval = interval });
|
||||
buildEconomyOverTime.Add(new EconomyModel { Interval = interval });
|
||||
}
|
||||
|
||||
|
||||
if (economyOverTime.Count > timing.GetAttackTime())
|
||||
economyOverTime.RemoveRange(timing.GetAttackTime(), economyOverTime.Count - timing.GetAttackTime());
|
||||
if (buildEconomyOverTime.Count > timing.GetAttackTime())
|
||||
buildEconomyOverTime.RemoveRange(timing.GetAttackTime(), buildEconomyOverTime.Count - timing.GetAttackTime());
|
||||
|
||||
while (economyOverTime.Count < timing.GetAttackTime())
|
||||
economyOverTime.Add(new EconomyModel { Interval = economyOverTime.Count - 1 });
|
||||
while (buildEconomyOverTime.Count < timing.GetAttackTime())
|
||||
buildEconomyOverTime.Add(new EconomyModel { Interval = buildEconomyOverTime.Count - 1 });
|
||||
|
||||
for (var interval = fromInterval; interval < timing.GetAttackTime(); interval++)
|
||||
{
|
||||
var economyAtSecond = economyOverTime[interval];
|
||||
var economyAtSecond = buildEconomyOverTime[interval];
|
||||
if (interval > 0)
|
||||
{
|
||||
economyAtSecond.Alloy = economyOverTime[interval - 1].Alloy;
|
||||
economyAtSecond.Ether = economyOverTime[interval - 1].Ether;
|
||||
economyAtSecond.Pyre = economyOverTime[interval - 1].Pyre;
|
||||
economyAtSecond.WorkerCount = economyOverTime[interval - 1].WorkerCount;
|
||||
economyAtSecond.BusyWorkerCount = economyOverTime[interval - 1].BusyWorkerCount;
|
||||
economyAtSecond.CreatingWorkerCount = economyOverTime[interval - 1].CreatingWorkerCount;
|
||||
economyAtSecond.Harvesters = economyOverTime[interval - 1].Harvesters.ToList();
|
||||
economyAtSecond.CreatingWorkerDelays = economyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy;
|
||||
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether;
|
||||
economyAtSecond.Pyre = buildEconomyOverTime[interval - 1].Pyre;
|
||||
economyAtSecond.WorkerCount = buildEconomyOverTime[interval - 1].WorkerCount;
|
||||
economyAtSecond.BusyWorkerCount = buildEconomyOverTime[interval - 1].BusyWorkerCount;
|
||||
economyAtSecond.CreatingWorkerCount = buildEconomyOverTime[interval - 1].CreatingWorkerCount;
|
||||
economyAtSecond.Harvesters = buildEconomyOverTime[interval - 1].Harvesters.ToList();
|
||||
economyAtSecond.CreatingWorkerDelays = buildEconomyOverTime[interval - 1].CreatingWorkerDelays.ToList();
|
||||
}
|
||||
|
||||
economyAtSecond.Interval = interval;
|
||||
@@ -155,11 +157,13 @@ public class EconomyService : IEconomyService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public EconomyModel GetEconomy(int atInterval)
|
||||
{
|
||||
if (atInterval >= economyOverTime.Count) return economyOverTime.Last();
|
||||
if (atInterval >= buildEconomyOverTime.Count) return buildEconomyOverTime.Last();
|
||||
|
||||
return economyOverTime[atInterval];
|
||||
return buildEconomyOverTime[atInterval];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1"/>
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Model\Model.csproj"/>
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user