This commit is contained in:
2026-06-04 12:29:33 -04:00
parent 0c820ac973
commit 9323e7a1a6
17 changed files with 39 additions and 39 deletions
+1 -1
View File
@@ -157,7 +157,7 @@
void OnUpdate() void OnUpdate()
{ {
entity = EntityData.Get()[entityDialogService.GetEntityId()]; entity = EntityData.Get()[entityDialogService.GetEntityId() ?? string.Empty];
refresh++; refresh++;
StateHasChanged(); StateHasChanged();
-2
View File
@@ -135,8 +135,6 @@
@code { @code {
private ElementReference searchBox;
private string SearchText { get; set; } = ""; private string SearchText { get; set; } = "";
protected override void OnInitialized() protected override void OnInitialized()
@@ -131,9 +131,10 @@
armyCount[entity.Info().Name]++; armyCount[entity.Info().Name]++;
} }
if (entity.Production() != null && entity.Production().BuildTime + entitiesAtTime.Key > lastInterval) var production = entity.Production();
if (production != null && production.BuildTime + entitiesAtTime.Key > lastInterval)
{ {
lastInterval = entity.Production().BuildTime + entitiesAtTime.Key; lastInterval = production.BuildTime + entitiesAtTime.Key;
} }
} }
} }
@@ -110,15 +110,17 @@
_supplyTaken = (from ordersAtInterval in ordersOverTime _supplyTaken = (from ordersAtInterval in ordersOverTime
from order in ordersAtInterval.Value from order in ordersAtInterval.Value
where order.Supply() != null let supply = order.Supply()
where order.Supply().Takes > 0 where supply != null
select order.Supply().Takes).Sum(); where supply.Takes > 0
select supply.Takes).Sum();
_supplyGranted = (from ordersAtInterval in ordersOverTime _supplyGranted = (from ordersAtInterval in ordersOverTime
from order in ordersAtInterval.Value from order in ordersAtInterval.Value
where order.Supply() != null let supply = order.Supply()
where order.Supply().Grants > 0 where supply != null
select order.Supply().Grants).Sum(); where supply.Grants > 0
select supply.Grants).Sum();
_extraBuildings = 0; _extraBuildings = 0;
if (_supplyGranted > 160) if (_supplyGranted > 160)
@@ -205,7 +205,9 @@ else
var armyValue = 0; var armyValue = 0;
foreach (var unit in army) foreach (var unit in army)
{ {
armyValue += unit.Production().Alloy + unit.Production().Ether; var unitProduction = unit.Production();
if (unitProduction != null)
armyValue += unitProduction.Alloy + unitProduction.Ether;
} }
+2 -1
View File
@@ -202,7 +202,8 @@
else else
{ {
immortals = (from entity in factions immortals = (from entity in factions
where entity.VanguardAdded() == null || entity.VanguardAdded().ImmortalId == selectedImmortalType let vanguardAdded = entity.VanguardAdded()
where vanguardAdded == null || vanguardAdded.ImmortalId == selectedImmortalType
select entity).ToList(); select entity).ToList();
} }
@@ -211,9 +211,9 @@
[CascadingParameter] public string StyleType { get; set; } = "Detailed"; [CascadingParameter] public string StyleType { get; set; } = "Detailed";
private EntityProductionModel Production => Entity!.Production(); private EntityProductionModel? Production => Entity!.Production();
private List<EntityRequirementModel> Requirements => Entity!.Requirements(); private List<EntityRequirementModel> Requirements => Entity!.Requirements();
private EntitySupplyModel Supply => Entity!.Supply(); private EntitySupplyModel? Supply => Entity!.Supply();
protected override void OnParametersSet() protected override void OnParametersSet()
@@ -38,6 +38,7 @@
var requirements = entity.Requirements(); var requirements = entity.Requirements();
var vanguard = entity.VanguardAdded(); var vanguard = entity.VanguardAdded();
if (vanguard == null) continue;
var productionBuilding = (from building in requirements var productionBuilding = (from building in requirements
where building.Requirement == RequirementType.Production_Building where building.Requirement == RequirementType.Production_Building
select building).First().Id; select building).First().Id;
@@ -71,8 +71,6 @@
} }
int lastRequestedRefreshIndex;
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
economyComparisonService.Unsubscribe(OnBuilderOrderChanged); economyComparisonService.Unsubscribe(OnBuilderOrderChanged);
+2 -2
View File
@@ -168,8 +168,8 @@
private string? _faction; private string? _faction;
private string? _immortal; private string? _immortal;
private string? Faction => _faction == null ? DataType.FACTION_QRath : _faction; private string Faction => _faction ?? DataType.FACTION_QRath;
private string? Immortal => _immortal == null ? DataType.IMMORTAL_Orzum : _immortal; private string Immortal => _immortal ?? DataType.IMMORTAL_Orzum;
private int? _buildingInputDelay; private int? _buildingInputDelay;
-2
View File
@@ -6,8 +6,6 @@
<SearchDialogComponent></SearchDialogComponent> <SearchDialogComponent></SearchDialogComponent>
@code { @code {
private string test = "Q";
protected override void OnInitialized() protected override void OnInitialized()
{ {
searchService.Subscribe(OnUpdate); searchService.Subscribe(OnUpdate);
+7 -8
View File
@@ -290,15 +290,14 @@ public class BuildOrderService : IBuildOrderService
{ {
return (from ordersAtTime in _buildOrder.StartedOrders return (from ordersAtTime in _buildOrder.StartedOrders
from orders in ordersAtTime.Value from orders in ordersAtTime.Value
where orders.Harvest() != null let production = orders.Production()
where ordersAtTime.Key + (orders.Production() == null let harvest = orders.Harvest()
? 0 where harvest != null
: orders.Production().BuildTime) <= interval let buildTime = production?.BuildTime ?? 0
&& !orders.Harvest().IsDepleted( where ordersAtTime.Key + buildTime <= interval
&& !harvest.IsDepleted(
interval, interval,
ordersAtTime.Key + (orders.Production() == null ordersAtTime.Key + buildTime)
? 0
: orders.Production().BuildTime))
select orders).ToList(); select orders).ToList();
} }
+3 -2
View File
@@ -11,7 +11,7 @@ public class EconomyService : IEconomyService
public List<EconomyModel> GetOverTime() public List<EconomyModel> GetOverTime()
{ {
return buildEconomyOverTime; return buildEconomyOverTime ?? [];
} }
public void Subscribe(Action action) public void Subscribe(Action action)
@@ -67,6 +67,7 @@ public class EconomyService : IEconomyService
public EconomyModel GetEconomy(int atInterval) public EconomyModel GetEconomy(int atInterval)
{ {
if (buildEconomyOverTime == null) return new EconomyModel();
return atInterval >= buildEconomyOverTime.Count return atInterval >= buildEconomyOverTime.Count
? buildEconomyOverTime.Last() ? buildEconomyOverTime.Last()
: buildEconomyOverTime[atInterval]; : buildEconomyOverTime[atInterval];
@@ -218,7 +219,7 @@ public class EconomyService : IEconomyService
private void CarryOverEconomyFromPreviousInterval(int interval, EconomyModel economyAtSecond) private void CarryOverEconomyFromPreviousInterval(int interval, EconomyModel economyAtSecond)
{ {
if (interval <= 0) return; if (interval <= 0 || buildEconomyOverTime == null) return;
economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy; economyAtSecond.Alloy = buildEconomyOverTime[interval - 1].Alloy;
economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether; economyAtSecond.Ether = buildEconomyOverTime[interval - 1].Ether;
+4 -4
View File
@@ -4,16 +4,16 @@ namespace Services.Website;
public class DialogContents public class DialogContents
{ {
public string Title { get; set; } public string Title { get; set; } = string.Empty;
public string Message { get; set; } public string Message { get; set; } = string.Empty;
public string ConfirmButtonLabel { get; set; } public string ConfirmButtonLabel { get; set; } = string.Empty;
public EventCallback<EventArgs> OnConfirm { get; set; } public EventCallback<EventArgs> OnConfirm { get; set; }
public EventCallback<EventArgs> OnCancel { get; set; } public EventCallback<EventArgs> OnCancel { get; set; }
} }
public class MyDialogService : IMyDialogService public class MyDialogService : IMyDialogService
{ {
private DialogContents _dialogContents; private DialogContents _dialogContents = null!;
public bool IsVisible { get; set; } public bool IsVisible { get; set; }
+1 -2
View File
@@ -7,8 +7,7 @@ public class PermissionService : IPermissionService, IDisposable
private readonly IStorageService _storageService; private readonly IStorageService _storageService;
private IJSRuntime _jsRuntime; private IJSRuntime _jsRuntime;
private IToastService _toastService; private IToastService _toastService;
private bool isLoaded;
private bool isStorageEnabled = false;
public PermissionService(IJSRuntime jsRuntime, IToastService toastService, IStorageService storageService) public PermissionService(IJSRuntime jsRuntime, IToastService toastService, IStorageService storageService)
{ {
+1 -1
View File
@@ -50,7 +50,7 @@ public class StorageService : IStorageService
public void SetValue<T>(string key, T value) public void SetValue<T>(string key, T value)
{ {
if (key.Equals(StorageKeys.EnabledStorage) && value.Equals(true)) if (value != null && key.Equals(StorageKeys.EnabledStorage) && value.Equals(true))
{ {
_localStorageService.SetItem(key, value); _localStorageService.SetItem(key, value);
NotifyDataChanged(); NotifyDataChanged();
+1 -1
View File
@@ -68,7 +68,7 @@
@code { @code {
private bool _isDarkMode = true; private bool _isDarkMode = true;
private MudThemeProvider _mudThemeProvider; private MudThemeProvider _mudThemeProvider = null!;
bool _drawerOpen = true; bool _drawerOpen = true;