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