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.
68 lines
1.9 KiB
68 lines
1.9 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> |
|
|
|
<FormNumberComponent Max="600" |
|
Min="0" |
|
Value="@WaitTime" |
|
OnChange="@OnWaitTimeChanged"> |
|
<FormLabelComponent>Wait Time</FormLabelComponent> |
|
<FormInfoComponent>Not implemented</FormInfoComponent> |
|
</FormNumberComponent> |
|
|
|
|
|
<ButtonComponent OnClick="OnWaitClicked">Add Wait</ButtonComponent> |
|
|
|
</FormLayoutComponent> |
|
|
|
@code { |
|
|
|
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()); |
|
} |
|
} |
|
|
|
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 |
|
} |
|
|
|
public int WaitTime { get; set; } = 30; |
|
|
|
} |