Skip to content

Commit

Permalink
3.0.57.1
Browse files Browse the repository at this point in the history
Something broke with appsettings so reverting to have its values typed into each page, not great but will work at least.
  • Loading branch information
DefieSm1 committed Jul 14, 2024
1 parent 3166d21 commit a2ab300
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: touch release/wwwroot/.nojekyll

- name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
Expand Down
23 changes: 0 additions & 23 deletions Data/AssemblyConfig.cs

This file was deleted.

32 changes: 0 additions & 32 deletions Data/FacilityConfig.cs

This file was deleted.

27 changes: 0 additions & 27 deletions Data/FactoryConfig.cs

This file was deleted.

2 changes: 1 addition & 1 deletion FoxholeLogiSheet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.0.57.0</Version>
<Version>3.0.57.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
37 changes: 23 additions & 14 deletions Pages/Assembly.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@inject HttpClient Http
@inject IJSRuntime JsRuntime
@inject Blazored.LocalStorage.ILocalStorageService localStorage
@inject IConfiguration AppConfig
@using FoxholeLogiSheet.Data

<PageHeader>Assembly Sheet</PageHeader>
Expand Down Expand Up @@ -109,17 +108,31 @@
MaterialKeys=@MaterialKeys />

@code {
public AssemblyConfig Config { get; set; } = new();

public Dictionary<string, ProductionItem> AssemblyBuildings = new();

public Dictionary<string, ProductionItem> AssemblyBuildingUpgrades = new();

public Dictionary<string, Dictionary<string, ProductionItem>> AssemblyCategories { get; set; } = new();

public List<string> MaterialKeys { get => Config.MaterialKeys; }

public List<List<string>> MaterialOutputRows { get => Config.MaterialOutputRows; }
public List<string> CategoryKeys { get; set; } = [
"Vehicles",
"AssemblyStation", "AssemblyStationMotorPool","AssemblyStationRocket", "AssemblyStationBatteryLine", "AssemblyStationNavalWorks", "AssemblyStationField", "AssemblyStationTank", "AssemblyStationWeapons",
"AssemblyLarge", "AssemblyLargeTrain", "AssemblyLargeHeavyTank",
"DryDock"
];

public List<string> MaterialKeys { get; set; } = [
"Time",
"MaterialBasic", "MaterialConstruction", "MaterialProcessedConstruction", "MaterialSteel", "MaterialRareAlloys",
"MaterialThermalShielding", "MaterialUnstableSubstances", "NavalHullSegments", "NavalShellPlating", "NavalTurbineComponents",
"AssemblyMaterialsT1", "AssemblyMaterialsT2", "AssemblyMaterialsT3", "AssemblyMaterialsT4", "AssemblyMaterialsT5"
];

public List<List<string>> MaterialOutputRows { get; set; } = [
[ "MaterialBasic", "MaterialConstruction", "MaterialProcessedConstruction", "MaterialSteel", "MaterialRareAlloys" ],
[ "MaterialThermalShielding", "MaterialUnstableSubstances", "NavalHullSegments", "NavalShellPlating", "NavalTurbineComponents" ],
[ "AssemblyMaterialsT1", "AssemblyMaterialsT2", "AssemblyMaterialsT3", "AssemblyMaterialsT4", "AssemblyMaterialsT5" ]
];

Dictionary<string, List<string>> SelectedItems = new();

Expand Down Expand Up @@ -149,31 +162,27 @@
{
await localStorage.SetItemAsync("lastPage", "assembly");

Config = AppConfig.GetSection("assembly").Get<AssemblyConfig>() ?? throw new InvalidOperationException("Could not find requested configuration");

AssemblyBuildings = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>("data/BuildingData/AssemblyBuildings.json") ?? throw new FileNotFoundException();

AssemblyBuildingUpgrades = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>("data/BuildingData/AssemblyUpgrades.json") ?? throw new FileNotFoundException();

List<string> categoriesToLoad = Config.LoadedCategories;

Dictionary<string, ProductionItem> category;
foreach (string categoryName in categoriesToLoad)
foreach (string categoryName in CategoryKeys)
{
category = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>($"data/ProductionData/{categoryName}.json") ?? throw new FileNotFoundException();
AssemblyCategories.Add(categoryName, category);
}

SelectedBuilding = Config.DefaultBuilding;
SelectedUpgrade = Config.DefaultUpgrade;
SelectedBuilding = "AssemblyStation";
SelectedUpgrade = "";

ResetSelectedItems();
}

public void ResetSelectedItems()
{
SelectedItems.Clear();
foreach (string category in Config.LoadedCategories)
foreach (string category in CategoryKeys)
SelectedItems.Add(category, new());
}

Expand Down
19 changes: 8 additions & 11 deletions Pages/Facility.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@inject HttpClient Http
@inject IJSRuntime JsRuntime
@inject Blazored.LocalStorage.ILocalStorageService localStorage
@inject IConfiguration AppConfig
@using FoxholeLogiSheet.Data

<PageHeader>Facility Sheet</PageHeader>
Expand All @@ -14,7 +13,7 @@
<CalculatorContainer Width="@((FacilityBuildingSet.Count() * 100).ToString() + "px")">
<CalculatorHeader Text="SELECT STRUCTURE">
<HeaderButton Text="@($"Switch to {(BuildingSet == "Gathering" ? "Manufacturing" : "Gathering")}")"
ParentMethod="@(() => { BuildingSet = BuildingSet == "Gathering" ? "Manufacturing" : "Gathering"; SelectedBuilding = BuildingSet == "Gathering" ? "HarvesterSalvage" : Config.DefaultBuilding; } )" />
ParentMethod="@(() => { BuildingSet = BuildingSet == "Gathering" ? "Manufacturing" : "Gathering"; SelectedBuilding = BuildingSet == "Gathering" ? "HarvesterSalvage" : "MaterialsFactory"; } )" />
</CalculatorHeader>
<ItemGrid Columns=@(FacilityBuildingSet.Count()) Rows=1>
@foreach (KeyValuePair<string, ProductionItem> building in FacilityBuildingSet)
Expand Down Expand Up @@ -107,15 +106,15 @@
</CustomTooltip>

@code {
public FacilityConfig Config { get; set; } = new();

public Dictionary<string, ProductionItem> FacilityBuildings = new();

public Dictionary<string, ProductionItem> FacilityBuildingUpgrades = new();

public Dictionary<string, ProductionItem> FacilityItems { get; set; } = new();

public List<string> MaterialKeys { get => Config.MaterialKeys; }
public List<string> LoadedCategories { get; set; } = ["Facility"];

public List<string> MaterialKeys { get; set; } = ["MaterialBasic", "MaterialConstruction", "MaterialProcessedConstruction", "MaterialSteel", "MaterialRareAlloys"];

public string SelectedBuilding { get; set; } = "";

Expand Down Expand Up @@ -147,19 +146,17 @@
{
await localStorage.SetItemAsync("lastPage", "facility");

Config = AppConfig.GetSection("facility").Get<FacilityConfig>() ?? throw new InvalidOperationException("Could not find requested configuration");

FacilityBuildings = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>("data/BuildingData/FacilityBuildings.json") ?? throw new FileNotFoundException();

FacilityBuildingUpgrades = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>("data/BuildingData/FacilityUpgrades.json") ?? throw new FileNotFoundException();

List<string> categoriesToLoad = Config.LoadedCategories;
List<string> categoriesToLoad = LoadedCategories;

FacilityItems = await Http.GetFromJsonAsync<Dictionary<string, ProductionItem>>("data/ProductionData/Facility.json") ?? throw new FileNotFoundException();

SelectedBuilding = Config.DefaultBuilding;
SelectedUpgrade = Config.DefaultUpgrade;
BuildingSet = Config.DefaultBuildingSet;
SelectedBuilding = "MaterialsFactory";
SelectedUpgrade = "";
BuildingSet = "Manufacturing";
}

public void HighlightBuildings()
Expand Down
18 changes: 8 additions & 10 deletions Pages/Factory.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@inject HttpClient Http
@inject IJSRuntime JsRuntime
@inject Blazored.LocalStorage.ILocalStorageService localStorage
@inject IConfiguration AppConfig
@using FoxholeLogiSheet.Data

<PageHeader>@ProductionMode Sheet</PageHeader>
Expand Down Expand Up @@ -64,15 +63,15 @@
<ItemTooltip Item=@HoveredItem CurrentBuilding=@ProductionMode SelectedCategory=@SelectedCategory Visibility=@TooltipVisibility Simplified=@TooltipSimplified MaterialKeys=@MaterialKeys />

@code {
public FactoryConfig Config { get; set; } = new();

public Dictionary<string, Dictionary<string, ProductionItem>> ItemCategories { get; set; } = new();

public List<string> FactoryCategories { get => Config.FactoryCategories; }
public List<string> LoadedCategories { get; set; } = ["SmallArms", "HeavyArms", "HeavyMunitions", "Utility", "Supplies", "Medical", "Uniforms", "Vehicles", "Structures"];

public List<string> FactoryCategories { get; set; } = ["SmallArms", "HeavyArms", "HeavyMunitions", "Utility", "Supplies", "Medical", "Uniforms"];

public List<string> MPFCategories { get => Config.MPFCategories; }
public List<string> MPFCategories { get; set; } = ["SmallArms", "HeavyArms", "HeavyMunitions", "Supplies", "Uniforms", "Vehicles", "Structures"];

public List<string> MaterialKeys { get => Config.MaterialKeys; }
public List<string> MaterialKeys { get; set; } = ["Time", "MaterialBasic", "MaterialExplosive", "MaterialRefined", "MaterialHeavyExplosive"];

Dictionary<string, List<string>> SelectedItems = new();

Expand All @@ -94,8 +93,7 @@
{
await localStorage.SetItemAsync("lastPage", "factory");

Config = AppConfig.GetSection("factory").Get<FactoryConfig>() ?? throw new InvalidOperationException("Could not find requested configuration");
List<string> categoriesToLoad = Config.LoadedCategories;
List<string> categoriesToLoad = LoadedCategories;

Dictionary<string, ProductionItem> category;
foreach (string categoryName in categoriesToLoad)
Expand All @@ -104,8 +102,8 @@
ItemCategories.Add(categoryName, category);
}

ProductionMode = Config.DefaultMode;
SelectedCategory = Config.DefaultCategory;
ProductionMode = "Factory";
SelectedCategory = "SmallArms";

ResetSelectedItems();
}
Expand Down
3 changes: 1 addition & 2 deletions Shared/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<div class="changelog">
<p>Version @version</p>
<ul>
<li>Updated items/buildings and item/building descriptions for Update 56</li>
<li>Cleaned up data and icons a bit, removed unused icons I somehow forgot to after their corresponding items got removed from game</li>
<li>Updated items/buildings and item/building descriptions for Update 57</li>
</ul>
</div>
<hr />
Expand Down
41 changes: 0 additions & 41 deletions wwwroot/appsettings.json

This file was deleted.

0 comments on commit a2ab300

Please sign in to comment.