feat(Storage) Storage feature done
This commit is contained in:
@@ -68,8 +68,8 @@
|
||||
var hotkey = KeyService.GetHotkey();
|
||||
var hotkeyGroup = KeyService.GetHotkeyGroup();
|
||||
var isHoldSpace = KeyService.IsHoldingSpace();
|
||||
var faction = FilterService.GetFactionType();
|
||||
var immortal = FilterService.GetImmortalType();
|
||||
var faction = FilterService.GetFaction();
|
||||
var immortal = FilterService.GetImmortal();
|
||||
|
||||
var foundEntity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
|
||||
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
@inject IJSRuntime jsRuntime;
|
||||
@inject IImmortalSelectionService filterService
|
||||
@inject IJSRuntime JsRuntime;
|
||||
@inject IImmortalSelectionService FilterService
|
||||
|
||||
<FormLayoutComponent>
|
||||
<FormSelectComponent OnChange="@OnFactionChanged">
|
||||
<FormLabelComponent>Faction</FormLabelComponent>
|
||||
<ChildContent>
|
||||
<option value="@FactionType.Aru">Aru</option>
|
||||
<option value="@FactionType.QRath" selected>Q'Rath</option>
|
||||
<option value="@DataType.FACTION_Aru"
|
||||
selected="@(FilterService.GetFaction().Equals(DataType.FACTION_Aru))">Aru</option>
|
||||
<option value="@DataType.FACTION_QRath"
|
||||
selected="@(FilterService.GetFaction().Equals(DataType.FACTION_QRath))">Q'Rath</option>
|
||||
</ChildContent>
|
||||
</FormSelectComponent>
|
||||
|
||||
<FormSelectComponent OnChange="@OnImmortalChanged">
|
||||
<FormLabelComponent>Immortal</FormLabelComponent>
|
||||
<ChildContent>
|
||||
@if (filterService.GetFactionType() == FactionType.QRath)
|
||||
@if (FilterService.GetFaction() == DataType.FACTION_QRath)
|
||||
{
|
||||
<option value="@DataType.IMMORTAL_Orzum" selected>Orzum</option>
|
||||
<option value="@DataType.IMMORTAL_Ajari">Ajari</option>
|
||||
<option value="@DataType.IMMORTAL_Orzum"
|
||||
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Orzum))">Orzum</option>
|
||||
<option value="@DataType.IMMORTAL_Ajari"
|
||||
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Ajari))">Ajari</option>
|
||||
}
|
||||
@if (filterService.GetFactionType() == FactionType.Aru)
|
||||
@if (FilterService.GetFaction() == DataType.FACTION_Aru)
|
||||
{
|
||||
<option value="@DataType.IMMORTAL_Mala" selected>Mala</option>
|
||||
<option value="@DataType.IMMORTAL_Xol">Xol</option>
|
||||
<option value="@DataType.IMMORTAL_Mala"
|
||||
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Mala))">Mala</option>
|
||||
<option value="@DataType.IMMORTAL_Xol"
|
||||
selected="@(FilterService.GetImmortal().Equals(DataType.IMMORTAL_Xol))">Xol</option>
|
||||
}
|
||||
</ChildContent>
|
||||
</FormSelectComponent>
|
||||
@@ -31,18 +37,18 @@
|
||||
|
||||
void OnFactionChanged(ChangeEventArgs e)
|
||||
{
|
||||
filterService.SelectFactionType(e.Value!.ToString()!);
|
||||
FilterService.SelectFaction(e.Value!.ToString()!);
|
||||
}
|
||||
|
||||
void OnImmortalChanged(ChangeEventArgs e)
|
||||
{
|
||||
filterService.SelectImmortalType(e.Value!.ToString()!);
|
||||
FilterService.SelectImmortal(e.Value!.ToString()!);
|
||||
}
|
||||
|
||||
protected override bool ShouldRender()
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.time", "FilterComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.time", "FilterComponent");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -51,7 +57,7 @@
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.timeEnd", "FilterComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.timeEnd", "FilterComponent");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
// Move to Filter Service
|
||||
bool InvalidFaction(EntityModel entity)
|
||||
{
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != filterService.GetFactionType() && filterService.GetFactionType() != FactionType.Any)
|
||||
if (entity.Faction() != null && entity.Faction()?.Faction != filterService.GetFaction() && filterService.GetFaction() != DataType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -176,8 +176,8 @@
|
||||
bool InvalidVanguard(EntityModel entity)
|
||||
{
|
||||
if (entity.VanguardAdded() != null
|
||||
&& entity.VanguardAdded()?.ImmortalId != filterService.GetImmortalType()
|
||||
&& filterService.GetImmortalType() != ImmortalType.Any)
|
||||
&& entity.VanguardAdded()?.ImmortalId != filterService.GetImmortal()
|
||||
&& filterService.GetImmortal() != DataType.Any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -192,7 +192,7 @@
|
||||
{
|
||||
foreach (var replaced in entity.Replaceds())
|
||||
{
|
||||
if (filterService.GetImmortalType() == replaced.ImmortalId)
|
||||
if (filterService.GetImmortal() == replaced.ImmortalId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -319,8 +319,8 @@
|
||||
|
||||
var hotkeyGroup = keyService.GetHotkeyGroup();
|
||||
var isHoldSpace = keyService.IsHoldingSpace();
|
||||
var faction = filterService.GetFactionType();
|
||||
var immortal = filterService.GetImmortalType();
|
||||
var faction = filterService.GetFaction();
|
||||
var immortal = filterService.GetImmortal();
|
||||
|
||||
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
@inject IJSRuntime jsRuntime;
|
||||
@inject IJSRuntime JsRuntime;
|
||||
|
||||
@inject IBuildOrderService buildOrderService
|
||||
@inject IEconomyService economyService
|
||||
@inject IToastService toastService
|
||||
@inject ITimingService timingService
|
||||
@inject IBuildOrderService BuildOrderService
|
||||
@inject IEconomyService EconomyService
|
||||
@inject IToastService ToastService
|
||||
@inject ITimingService TimingService
|
||||
|
||||
@using System.Data
|
||||
@implements IDisposable
|
||||
|
||||
<FormLayoutComponent>
|
||||
<FormNumberComponent Max="600"
|
||||
Min="0"
|
||||
Value="@buildOrderService.BuildingInputDelay"
|
||||
Value="BuildDelay"
|
||||
OnChange="@OnBuildingInputDelayChanged">
|
||||
<FormLabelComponent>Building Input Delay</FormLabelComponent>
|
||||
<FormInfoComponent>Add a input delay to constructing buildings for simulating worker movement and player micro.</FormInfoComponent>
|
||||
@@ -17,7 +20,7 @@
|
||||
<FormLayoutComponent>
|
||||
<FormNumberComponent Max="600"
|
||||
Min="1"
|
||||
Value="@WaitTime"
|
||||
Value="WaitTime"
|
||||
OnChange="@OnWaitTimeChanged">
|
||||
<FormLabelComponent>Wait Time</FormLabelComponent>
|
||||
</FormNumberComponent>
|
||||
@@ -26,7 +29,7 @@
|
||||
<FormLayoutComponent>
|
||||
<FormNumberComponent Max="2048"
|
||||
Min="1"
|
||||
Value="@WaitTo"
|
||||
Value="WaitTo"
|
||||
OnChange="@OnWaitToChanged">
|
||||
<FormLabelComponent>Wait To</FormLabelComponent>
|
||||
</FormNumberComponent>
|
||||
@@ -43,45 +46,69 @@
|
||||
</style>
|
||||
|
||||
@code {
|
||||
private int BuildDelay { get; set; } = 2;
|
||||
private int WaitTime { get; set; } = 30;
|
||||
private int WaitTo { get; set; } = 30;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
TimingService.Subscribe(RefreshDefaults);
|
||||
|
||||
RefreshDefaults();
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
TimingService.Unsubscribe(RefreshDefaults);
|
||||
}
|
||||
|
||||
void RefreshDefaults()
|
||||
{
|
||||
BuildDelay = TimingService.BuildingInputDelay;
|
||||
WaitTime = TimingService.WaitTime;
|
||||
WaitTo = TimingService.WaitTo;
|
||||
|
||||
StateHasChanged();
|
||||
|
||||
}
|
||||
|
||||
void OnBuildingInputDelayChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
buildOrderService.BuildingInputDelay = int.Parse(changeEventArgs.Value!.ToString()!);
|
||||
TimingService.BuildingInputDelay = int.Parse(changeEventArgs.Value!.ToString()!);
|
||||
}
|
||||
|
||||
void OnWaitTimeChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
TimingService.WaitTime = (int)changeEventArgs.Value!;
|
||||
WaitTime = (int)changeEventArgs.Value!;
|
||||
}
|
||||
|
||||
void OnWaitToChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
TimingService.WaitTo = (int)changeEventArgs.Value!;
|
||||
WaitTo = (int)changeEventArgs.Value!;
|
||||
}
|
||||
|
||||
private void OnWaitClicked()
|
||||
{
|
||||
if (buildOrderService.AddWait(WaitTime))
|
||||
if (BuildOrderService.AddWait(WaitTime))
|
||||
{
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWaitToClicked()
|
||||
{
|
||||
if (buildOrderService.AddWaitTo(WaitTo))
|
||||
if (BuildOrderService.AddWaitTo(WaitTo))
|
||||
{
|
||||
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
|
||||
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool ShouldRender()
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.time", "TimingComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.time", "TimingComponent");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -90,9 +117,8 @@
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
#if DEBUG
|
||||
jsRuntime.InvokeVoidAsync("console.timeEnd", "TimingComponent");
|
||||
JsRuntime.InvokeVoidAsync("console.timeEnd", "TimingComponent");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
@inject IEconomyService economyService
|
||||
@inject IToastService toastService
|
||||
@inject ITimingService timingService
|
||||
@implements IDisposable
|
||||
|
||||
<FormLayoutComponent>
|
||||
<FormNumberComponent Max="2048"
|
||||
@@ -30,6 +31,16 @@
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
timingService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
timingService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void OnAttackTimeChanged(ChangeEventArgs changeEventArgs)
|
||||
{
|
||||
timingService.SetAttackTime(int.Parse(changeEventArgs.Value!.ToString()!));
|
||||
|
||||
Reference in New Issue
Block a user