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.
95 lines
2.8 KiB
95 lines
2.8 KiB
@inject IJSRuntime jsRuntime; |
|
|
|
@inject IBuildOrderService buildOrderService |
|
@inject IEconomyService economyService |
|
@inject IToastService toastService |
|
@inject ITimingService timingService |
|
|
|
<FormLayoutComponent> |
|
<FormNumberComponent Max="600" |
|
Min="0" |
|
Value="@buildOrderService.BuildingInputDelay" |
|
OnChange="@OnBuildingInputDelayChanged"> |
|
<FormLabelComponent>Building Input Delay</FormLabelComponent> |
|
<FormInfoComponent>Add a input delay to constructing buildings for simulating worker movement and player micro.</FormInfoComponent> |
|
</FormNumberComponent> |
|
|
|
<div class="optionRow"> |
|
<FormLayoutComponent> |
|
<FormNumberComponent Max="600" |
|
Min="0" |
|
Value="@WaitTime" |
|
OnChange="@OnWaitTimeChanged"> |
|
<FormLabelComponent>Wait Time</FormLabelComponent> |
|
</FormNumberComponent> |
|
<ButtonComponent OnClick="OnWaitClicked">Add Wait</ButtonComponent> |
|
</FormLayoutComponent> |
|
<FormLayoutComponent> |
|
<FormNumberComponent Max="600" |
|
Min="0" |
|
Value="@WaitTime" |
|
OnChange="@OnWaitTimeChanged"> |
|
<FormLabelComponent>Wait To</FormLabelComponent> |
|
</FormNumberComponent> |
|
<ButtonComponent OnClick="OnWaitClicked">Add Wait</ButtonComponent> |
|
</FormLayoutComponent> |
|
|
|
</div> |
|
</FormLayoutComponent> |
|
|
|
<style> |
|
.optionRow { |
|
display: flex; |
|
gap: 12px; |
|
} |
|
</style> |
|
|
|
@code { |
|
public int WaitTime { get; set; } = 30; |
|
public int WaitTo { get; set; } = 30; |
|
|
|
|
|
void OnBuildingInputDelayChanged(ChangeEventArgs changeEventArgs) |
|
{ |
|
buildOrderService.BuildingInputDelay = int.Parse(changeEventArgs.Value!.ToString()!); |
|
} |
|
|
|
void OnWaitTimeChanged(ChangeEventArgs changeEventArgs) |
|
{ |
|
WaitTime = (int)changeEventArgs.Value!; |
|
} |
|
|
|
public void OnWaitClicked() |
|
{ |
|
if (buildOrderService.AddWait(WaitTime)) |
|
{ |
|
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); |
|
} |
|
} |
|
|
|
public void OnWaitToClicked() |
|
{ |
|
if (buildOrderService.AddWait(WaitTime)) |
|
{ |
|
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); |
|
} |
|
} |
|
|
|
protected override bool ShouldRender() |
|
{ |
|
#if DEBUG |
|
jsRuntime.InvokeVoidAsync("console.time", "TimingComponent"); |
|
#endif |
|
|
|
return true; |
|
} |
|
|
|
protected override void OnAfterRender(bool firstRender) |
|
{ |
|
#if DEBUG |
|
jsRuntime.InvokeVoidAsync("console.timeEnd", "TimingComponent"); |
|
#endif |
|
} |
|
|
|
|
|
} |