You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.5 KiB
92 lines
2.5 KiB
@inject IJSRuntime jsRuntime; |
|
|
|
|
|
@implements IDisposable |
|
|
|
<Virtualize Items="@EconomyService.GetOverTime()" Context="economyAtSecond" ItemSize="400" OverscanCount="4"> |
|
<div style="display: grid; gap: 8px; grid-template-columns: 1fr 1fr;"> |
|
<div> |
|
<div> |
|
@economyAtSecond.Interval |
|
</div> |
|
<div> |
|
T @Interval.ToTime(economyAtSecond.Interval) | A @economyAtSecond.Alloy | E @economyAtSecond.Ether |
|
</div> |
|
<div> |
|
Worker Count: @(economyAtSecond.WorkerCount) |
|
</div> |
|
<div> |
|
Free Worker Count: @(economyAtSecond.WorkerCount - economyAtSecond.BusyWorkerCount) |
|
</div> |
|
<div> |
|
Busy Worker Count: @economyAtSecond.BusyWorkerCount |
|
</div> |
|
<div> |
|
Creating Worker Count: @economyAtSecond.CreatingWorkerCount |
|
</div> |
|
<br/> |
|
</div> |
|
<div> |
|
|
|
@if (BuildOrderService.StartedOrders.TryGetValue(economyAtSecond.Interval, out var ordersAtTime)) |
|
{ |
|
@foreach (var order in ordersAtTime) |
|
{ |
|
<div> |
|
Requested: @order.Info().Name |
|
</div> |
|
} |
|
} |
|
|
|
|
|
@if (BuildOrderService.CompletedOrders.TryGetValue(economyAtSecond.Interval, out var ordersCompletedAtTime)) |
|
{ |
|
@foreach (var order in ordersCompletedAtTime) |
|
{ |
|
<div> |
|
New: @order.Info().Name |
|
</div> |
|
} |
|
} |
|
</div> |
|
</div> |
|
</Virtualize> |
|
|
|
|
|
@code { |
|
|
|
[Inject] |
|
IEconomyService EconomyService { get; set; } = default!; |
|
|
|
[Inject] |
|
IBuildOrderService BuildOrderService { get; set; } = default!; |
|
|
|
protected override void OnInitialized() |
|
{ |
|
EconomyService.Subscribe(StateHasChanged); |
|
BuildOrderService.Subscribe(StateHasChanged); |
|
} |
|
|
|
void IDisposable.Dispose() |
|
{ |
|
EconomyService.Unsubscribe(StateHasChanged); |
|
BuildOrderService.Unsubscribe(StateHasChanged); |
|
} |
|
|
|
protected override bool ShouldRender() |
|
{ |
|
#if DEBUG |
|
jsRuntime.InvokeVoidAsync("console.time", "TimelineComponent"); |
|
#endif |
|
|
|
return true; |
|
} |
|
|
|
protected override void OnAfterRender(bool firstRender) |
|
{ |
|
#if DEBUG |
|
jsRuntime.InvokeVoidAsync("console.timeEnd", "TimelineComponent"); |
|
#endif |
|
} |
|
|
|
} |