Browse Source

feat(Localization) Adding localization text. Fixing bugs in toasts

main
Jonathan McCaffrey 4 years ago
parent
commit
81659a9f84
  1. 12
      Components/Display/InfoTooltipComponent.razor
  2. 44
      Components/Feedback/ToastComponent.razor
  3. 2
      Contexts/DatabaseContext.cs
  4. BIN
      IGP/Database.db
  5. 38
      IGP/IGP.csproj
  6. 11
      IGP/Index.razor
  7. 54
      IGP/Localizations.Designer.cs
  8. 53
      IGP/Localizations.resx
  9. 4
      IGP/Pages/Agile/AgilePage.razor
  10. 29
      IGP/Pages/BuildCalculator/BuildCalculatorPage.razor
  11. 23
      IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor
  12. 5
      IGP/Pages/Comparision/ComparisionPage.razor
  13. 30
      IGP/Pages/MakingOf/Parts/MakingOfColours.razor
  14. 8
      IGP/Portals/ToastPortal.razor
  15. 4
      IGP/Program.cs
  16. 2
      IGP/_Imports.razor
  17. 3
      IGP/wwwroot/css/app.css
  18. 2
      IGP/wwwroot/generated/AgileTaskModels.json
  19. 2
      IGP/wwwroot/generated/GitChangeModels.json
  20. 2
      IGP/wwwroot/generated/GitPatchModels.json
  21. 2
      IGP/wwwroot/index.html
  22. 49
      Model/Entity/EntityModel.cs
  23. 2
      Model/Git/CommitType.cs
  24. 3
      Model/Git/GitChangeModel.cs
  25. 2
      Model/Git/GitPatchModel.cs
  26. 2
      Services/Development/GitService.cs
  27. 4
      Services/IServices.cs
  28. 14
      Services/Immortal/BuildOrderService.cs
  29. 3
      Services/Website/ToastService.cs

12
Components/Display/InfoTooltipComponent.razor

@ -10,8 +10,6 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 100%; width: 100%;
} }
.tooltipContent { .tooltipContent {
@ -25,17 +23,19 @@
margin-left: -60px; margin-left: -60px;
margin-bottom: 36px; margin-bottom: 36px;
background-color: #363636;
color: #fff;
border-radius: 6px;
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
padding-bottom: 20px; padding-bottom: 20px;
padding-top: 20px; padding-top: 20px;
border: 2px solid black;
white-space: break-spaces; white-space: break-spaces;
z-index: 2147483647; z-index: 2147483647;
background-color: var(--info-secondary);
border: 1px solid var(--info-secondary-border);
border-radius: 2px;
box-shadow: 0 3px 8px rgba(0,0,0,0.5);
} }

44
Components/Feedback/ToastComponent.razor

@ -9,10 +9,10 @@
} }
else else
{ {
<div class="toastContainer @Toast.SeverityType.ToLower() @FadeoutStyle"> <div onclick="@Dismiss" class="toastContainer @FadeoutStyle @Toast.SeverityType.ToLower()">
<div class="toastTitle"> <div class="toastTitle">
@Toast.Title @Toast.Title
</div> </div>
<div> <div>
@Toast.Message @Toast.Message
</div> </div>
@ -27,9 +27,9 @@ else
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-items: stretch; justify-items: stretch;
width: 100%; width: 250px;
opacity: 1; opacity: 1;
cursor: pointer;
} }
.fadeout { .fadeout {
@ -37,22 +37,22 @@ else
opacity: 0; opacity: 0;
} }
.toastContainer.@SeverityType.Warning.ToLower() { .@SeverityType.Warning.ToLower() {
background-color: var(--severity-warning-color); background-color: var(--severity-warning-color);
border-color: var(--severity-warning-border-color); border-color: var(--severity-warning-border-color);
} }
.toastContainer.@SeverityType.Error.ToLower() { .@SeverityType.Error.ToLower() {
background-color: var(--severity-error-color); background-color: var(--severity-error-color);
border-color: var(--severity-error-border-color); border-color: var(--severity-error-border-color);
} }
.toastContainer.@SeverityType.Information.ToLower() { .@SeverityType.Information.ToLower() {
background-color: var(--severity-information-color); background-color: var(--severity-information-color);
border-color: var(--severity-information-border-color); border-color: var(--severity-information-border-color);
} }
.toastContainer.@SeverityType.Success.ToLower() { .@SeverityType.Success.ToLower() {
background-color: var(--severity-success-color); background-color: var(--severity-success-color);
border-color: var(--severity-success-border-color); border-color: var(--severity-success-border-color);
} }
@ -64,6 +64,7 @@ else
</style> </style>
@code { @code {
[Parameter] [Parameter]
public ToastModel? Toast { get; set; } = default!; public ToastModel? Toast { get; set; } = default!;
@ -72,9 +73,7 @@ else
private string FadeoutStyle => isFadingOut ? "fadeout" : ""; private string FadeoutStyle => isFadingOut ? "fadeout" : "";
private int removalTime = 150000; private int removalTime = 150000;
private int fadeoutTime = 4000; private int fadeoutTime = 1000;
//private int fade
private Timer removalTimer = null!; private Timer removalTimer = null!;
private Timer fadeoutTimer = null!; private Timer fadeoutTimer = null!;
@ -82,7 +81,7 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
#if DEBUG #if DEBUG
removalTime = 5000; removalTime = 8000;
#endif #endif
removalTimer = new Timer(removalTime); removalTimer = new Timer(removalTime);
@ -92,23 +91,34 @@ else
fadeoutTimer = new Timer(removalTime - fadeoutTime); fadeoutTimer = new Timer(removalTime - fadeoutTime);
fadeoutTimer.Elapsed += OnFadeout!; fadeoutTimer.Elapsed += OnFadeout!;
fadeoutTimer.Enabled = true; fadeoutTimer.Enabled = true;
toastService.Subscribe(StateHasChanged);
} }
void OnFadeout(object source, ElapsedEventArgs eventArgs) void OnFadeout(object source, ElapsedEventArgs eventArgs)
{ {
isFadingOut = true; // isFadingOut = true;
StateHasChanged(); StateHasChanged();
} }
void OnRemoval(object source, ElapsedEventArgs eventArgs) void OnRemoval(object source, ElapsedEventArgs eventArgs)
{
//toastService.RemoveToast(Toast!);
StateHasChanged();
}
void Dismiss()
{ {
toastService.RemoveToast(Toast!); toastService.RemoveToast(Toast!);
} }
public void Dispose() public void Dispose()
{ {
removalTimer.Dispose(); removalTimer.Elapsed -= OnRemoval!;
fadeoutTimer.Dispose(); fadeoutTimer.Elapsed -= OnFadeout!;
toastService.Unsubscribe(StateHasChanged);
} }
} }

2
Contexts/DatabaseContext.cs

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore;
using Model.Doc; using Model.Doc;
using Model.Notes; using Model.Notes;
using Model.Website; using Model.Website;
using Model.Development.Git; using Model.Git;
using Model.Work.Tasks; using Model.Work.Tasks;
namespace Contexts; namespace Contexts;

BIN
IGP/Database.db

Binary file not shown.

38
IGP/IGP.csproj

@ -20,10 +20,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.28.1" /> <PackageReference Include="Markdig" Version="0.28.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all"/>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2"/>
<!-- <!--
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
@ -32,33 +32,33 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" /> <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Components\Components.csproj" /> <ProjectReference Include="..\Components\Components.csproj"/>
<ProjectReference Include="..\Contexts\Contexts.csproj" /> <ProjectReference Include="..\Contexts\Contexts.csproj"/>
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj" /> <ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\generated" /> <Folder Include="wwwroot\generated"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="Localizations.resx"> <EmbeddedResource Update="Localizations.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localizations.Designer.cs</LastGenOutput> <LastGenOutput>Localizations.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Localizations.Designer.cs"> <Compile Update="Localizations.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Example.resx</DependentUpon> <DependentUpon>Example.resx</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
</Project> </Project>

11
IGP/Index.razor

@ -4,17 +4,16 @@
@layout PageLayout @layout PageLayout
@inject IStringLocalizer<Localizations> Loc @inject IStringLocalizer<Localizations> locale
<DevOnlyComponent> <DevOnlyComponent>
<DocumentationIndexPage></DocumentationIndexPage> <DocumentationIndexPage></DocumentationIndexPage>
@Loc["Greeting"].Value @locale["Greeting"].Value
@Loc["Greeting"] @locale["Greeting"]
@Loc["Greeting"].Name @locale["Greeting"].Name
@Loc["Greeting"].ResourceNotFound @locale["Greeting"].ResourceNotFound
</DevOnlyComponent> </DevOnlyComponent>
<HomePage></HomePage> <HomePage></HomePage>

54
IGP/Localizations.Designer.cs generated

@ -50,5 +50,59 @@ namespace IGP {
return ResourceManager.GetString("Greeting", resourceCulture); return ResourceManager.GetString("Greeting", resourceCulture);
} }
} }
internal static string Tooltip_Chart_Info {
get {
return ResourceManager.GetString("Tooltip Chart Info", resourceCulture);
}
}
internal static string Tooltip_Filter_Info {
get {
return ResourceManager.GetString("Tooltip Filter Info", resourceCulture);
}
}
internal static string Tooltip_Entity_Info {
get {
return ResourceManager.GetString("Tooltip Entity Info", resourceCulture);
}
}
internal static string Tooltip_Bank_Info {
get {
return ResourceManager.GetString("Tooltip Bank Info", resourceCulture);
}
}
internal static string Tooltip_Army_Info {
get {
return ResourceManager.GetString("Tooltip Army Info", resourceCulture);
}
}
internal static string Tooltip_Highlights_Info {
get {
return ResourceManager.GetString("Tooltip Highlights Info", resourceCulture);
}
}
internal static string Tooltip_BuildOrder_Info {
get {
return ResourceManager.GetString("Tooltip BuildOrder Info", resourceCulture);
}
}
internal static string Tooltip_Timing_Info {
get {
return ResourceManager.GetString("Tooltip Timing Info", resourceCulture);
}
}
internal static string Tooltip_Hotkey_Info {
get {
return ResourceManager.GetString("Tooltip Hotkey Info", resourceCulture);
}
}
} }
} }

53
IGP/Localizations.resx

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
@ -13,12 +14,56 @@
<value>1.3</value> <value>1.3</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader> </resheader>
<data name="Greeting" xml:space="preserve"> <data name="Greeting" xml:space="preserve">
<value>Hello</value> <value>Hello</value>
</data> </data>
<data name="Tooltip Chart Info" xml:space="preserve">
<value>Shows economy at each game interval. Use to determine if spending additional resources on harvesters will help or hinder overall timing attack.</value>
</data>
<data name="Tooltip Filter Info" xml:space="preserve">
<value>Select build details, such as Faction and Immortal.
Affects entities you can build.</value>
</data>
<data name="Tooltip Entity Info" xml:space="preserve">
<value>Summary of the entity you just selected.</value>
</data>
<data name="Tooltip Bank Info" xml:space="preserve">
<value>Bank at time of last requested action. Use this section to determine if your build is floating too much alloy or ether.</value>
</data>
<data name="Tooltip Army Info" xml:space="preserve">
<value>Overview of current army, and when it will be ready to begin an attack.</value>
</data>
<data name="Tooltip Highlights Info" xml:space="preserve">
<value>Timeline highlights of your build order. Shows when you start a new action and when the action is done.</value>
</data>
<data name="Tooltip BuildOrder Info" xml:space="preserve">
<value>Some raw JSON data to represent your build order.</value>
</data>
<data name="Tooltip Timing Info" xml:space="preserve">
<value>Enter build details.
&lt;b&gt;Timing Interval:&lt;/b&gt; set the max interval length for the build. &lt;i&gt;Ex. 240 (seconds) is 4 minutes, a possible timing for Thrum build order.&lt;/i&gt;
&lt;b&gt;Name:&lt;/b&gt; the name of the build for saving purposes. &lt;i&gt;Ex. 'Safe Thrum Opener'&lt;/i&gt;
&lt;b&gt;Notes:&lt;/b&gt; additional notes of the build for saving purposes. &lt;i&gt;Ex. 'Thrums are for harassing and defending against a ground Q'Rath army.'&lt;/i&gt;
&lt;b&gt;Color:&lt;/b&gt; value to color charts when comparing builds. Not currently implemented.</value>
</data>
<data name="Tooltip Hotkey Info" xml:space="preserve">
<value>Click on the desired entity to build it. &lt;i&gt;You cannot build entities you cannot afford, construct an ether extractor before spending ether.&lt;/i&gt;
You can also use the default Immortal hotkeys, but the above hotkey UI must have focus for this to work. &lt;i&gt;I.e. click on it if hotkeys aren't working, and a white border should appear after key input to indicate focus.&lt;/i&gt;
Additionally, more entities will appear as you build the required technology. You can click or press ` to remove the last made entity. &lt;i&gt;But you cannot remove the starting entities at interval 0.&lt;/i&gt;</value>
</data>
</root> </root>

4
IGP/Pages/Agile/AgilePage.razor

@ -7,11 +7,11 @@
@if (!AgileService.IsLoaded()) @if (!AgileService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
else else
{ {
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

29
IGP/Pages/BuildCalculator/BuildCalculatorPage.razor

@ -1,11 +1,15 @@
@implements IDisposable @using Microsoft.Extensions.Localization
@implements IDisposable
@layout PageLayout @layout PageLayout
@inject IStringLocalizer<Localizations> locale
@inject IKeyService keyService @inject IKeyService keyService
@inject IImmortalSelectionService filterService @inject IImmortalSelectionService filterService
@inject IBuildOrderService buildOrderService @inject IBuildOrderService buildOrderService
@inject IEconomyService economyService @inject IEconomyService economyService
@inject IToastService toastService
@inject ITimingService timingService @inject ITimingService timingService
@page "/build-calculator" @page "/build-calculator"
@ -26,7 +30,7 @@
<div class="calculatorGrid"> <div class="calculatorGrid">
<div style="grid-area: timing;" class="gridItem"> <div style="grid-area: timing;" class="gridItem">
<InfoTooltipComponent InfoText=""> <InfoTooltipComponent InfoText="@locale["Tooltip Timing Info"]" >
<TimingComponent></TimingComponent> <TimingComponent></TimingComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
@ -36,35 +40,35 @@
@if (true) @if (true)
{ {
<div style="grid-area: chart;" class="gridItem"> <div style="grid-area: chart;" class="gridItem">
<InfoTooltipComponent InfoText="Shows economy at each game interval. Use to determine if spending additional resourcses on harvesters will help or hinder overall timing attack."> <InfoTooltipComponent InfoText="@locale["Tooltip Chart Info"]">
<ChartComponent></ChartComponent> <ChartComponent></ChartComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
} }
<div style="grid-area: filter;" class="gridItem"> <div style="grid-area: filter;" class="gridItem">
<InfoTooltipComponent InfoText="Select build details, such as Faction and Immortal. Affects entities you can build."> <InfoTooltipComponent InfoText="@locale["Tooltip Filter Info"]">
<FilterComponent></FilterComponent> <FilterComponent></FilterComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
<div style="grid-area: view;" class="gridItem"> <div style="grid-area: view;" class="gridItem">
<InfoTooltipComponent InfoText="Summary of the entity you just selected."> <InfoTooltipComponent InfoText="@locale["Tooltip Entity Info"]">
<EntityClickViewComponent></EntityClickViewComponent> <EntityClickViewComponent/>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
<div style="grid-area: bank;" class="gridItem"> <div style="grid-area: bank;" class="gridItem">
<InfoTooltipComponent InfoText="Bank at time of last requested action. Use this section to determine if your build is floating too much alloy or ether."> <InfoTooltipComponent InfoText="@locale["Tooltip Bank Info"]">
<BankComponent></BankComponent> <BankComponent></BankComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
<div style="grid-area: army;" class="gridItem"> <div style="grid-area: army;" class="gridItem">
<InfoTooltipComponent InfoText="Overview of current army, and when it will be ready to begin an attack."> <InfoTooltipComponent InfoText="@locale["Tooltip Army Info"]">
<ArmyComponent></ArmyComponent> <ArmyComponent></ArmyComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
@ -72,7 +76,7 @@
<div class="gridItem gridKeys"> <div class="gridItem gridKeys">
<InfoTooltipComponent InfoText=""> <InfoTooltipComponent InfoText="@locale["Tooltip Hotkey Info"]">
<HotkeyViewerComponent Size="80"></HotkeyViewerComponent> <HotkeyViewerComponent Size="80"></HotkeyViewerComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
@ -87,13 +91,13 @@
} }
<div style="grid-area: highlights;" class="gridItem"> <div style="grid-area: highlights;" class="gridItem">
<InfoTooltipComponent InfoText="Timeline highlights of your build order. Shows when you start a new action and when the action is done."> <InfoTooltipComponent InfoText="@locale["Tooltip Highlights Info"]">
<HighlightsComponent></HighlightsComponent> <HighlightsComponent></HighlightsComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
<div style="grid-area: buildorder;" class="gridItem"> <div style="grid-area: buildorder;" class="gridItem">
<InfoTooltipComponent InfoText="Some raw JSON data to represent your build order."> <InfoTooltipComponent InfoText="@locale["Tooltip BuildOrder Info"]">
<BuildOrderComponent></BuildOrderComponent> <BuildOrderComponent></BuildOrderComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</div> </div>
@ -215,6 +219,7 @@
@code { @code {
protected override void OnInitialized() protected override void OnInitialized()
{ {
keyService.Subscribe(HandleClick); keyService.Subscribe(HandleClick);
@ -265,7 +270,7 @@
{ {
return; return;
} }
if (buildOrderService.Add(entity, economyService)) if (buildOrderService.Add(entity, economyService, toastService))
{ {
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
} }

23
IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor

@ -1,14 +1,25 @@
@implements IDisposable @implements IDisposable
<div style="overflow-y: scroll; width: 100%; overflow-x: hidden; height: 550px;"> @if (entity != null)
@if (entity != null) {
{ <div class="entityClickView">
<EntityViewComponent Entity=Entity></EntityViewComponent> <CascadingValue Value="entity">
<CascadingValue Value="@viewType">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue>
}
</div>
}
<style>
.entityClickView {
overflow-y: scroll; width: 100%; overflow-x: hidden; height: 550px;
} }
</div> </style>
@code { @code {
private EntityModel entity = default!; private EntityModel? entity = default!;
private string viewType = "Detailed";
[Inject] [Inject]
IKeyService KeyService { get; set; } = default!; IKeyService KeyService { get; set; } = default!;

5
IGP/Pages/Comparision/ComparisionPage.razor

@ -1,6 +1,8 @@
@layout PageLayout @layout PageLayout
@implements IDisposable @implements IDisposable
@inject IToastService toastService
<div style="display:grid; gap: 8px;padding: 16px; height: 94vh; width: 90vw; margin: auto; margin-top: 32px; <div style="display:grid; gap: 8px;padding: 16px; height: 94vh; width: 90vw; margin: auto; margin-top: 32px;
grid-template-columns: 27% 25% 25% 23%; grid-template-rows: auto; grid-template-columns: 27% 25% 25% 23%; grid-template-rows: auto;
grid-template-areas: 'loader sand compare compare' ;"> grid-template-areas: 'loader sand compare compare' ;">
@ -38,6 +40,7 @@ grid-template-areas: 'loader sand compare compare' ;">
[Inject] [Inject]
IEconomyService EconomyService { get; set; } = default!; IEconomyService EconomyService { get; set; } = default!;
[Inject] [Inject]
ITimingService TimingService { get; set; } = default!; ITimingService TimingService { get; set; } = default!;
@ -92,7 +95,7 @@ grid-template-areas: 'loader sand compare compare' ;">
{ {
return; return;
} }
if (BuildOrderService.Add(entity, EconomyService)) if (BuildOrderService.Add(entity, EconomyService, toastService))
{ {
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval()); EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
} }

30
IGP/Pages/MakingOf/Parts/MakingOfColours.razor

@ -15,6 +15,8 @@
--paper-border: @paper_border; --paper-border: @paper_border;
--info: @info; --info: @info;
--info-border: @info_border; --info-border: @info_border;
--info-secondary: @info_secondary;
--info-secondary-border: @info_secondary_border;
</CodeComponent> </CodeComponent>
<br/> <br/>
<div class="color accent"> <div class="color accent">
@ -71,7 +73,20 @@
<div> <div>
Base: <input type="color" value="@info" @onchange="e => info = e.Value!.ToString()!"/> Base: <input type="color" value="@info" @onchange="e => info = e.Value!.ToString()!"/>
</div> </div>
<div>
Border: <input type="color" value="@info_border" @onchange="e => info_border = e.Value!.ToString()!"/>
</div>
</div> </div>
<div class="color info_secondary">
<div>Info Secondary</div>
<div>
Base: <input type="color" value="@info_secondary" @onchange="e => info_secondary = e.Value!.ToString()!"/>
</div>
<div>
Border: <input type="color" value="@info_secondary_border" @onchange="e => info_secondary_border = e.Value!.ToString()!"/>
</div>
</div>
</div> </div>
<style> <style>
@ -89,6 +104,9 @@
--paper-border: @paper_border; --paper-border: @paper_border;
--info: @info; --info: @info;
--info-border: @info_border; --info-border: @info_border;
--info-secondary: @info_secondary;
--info-secondary-border: @info_secondary_border;
} }
.colorContainer { .colorContainer {
@ -139,6 +157,12 @@
.info { .info {
background-color: var(--info); background-color: var(--info);
border: 1px solid var(--info-border);
}
.info_secondary {
background-color: var(--info-secondary);
border: 1px solid var(--info-secondary-border);
} }
</style> </style>
@ -156,5 +180,9 @@
string paper = "#252526"; string paper = "#252526";
string paper_border = "#151516"; string paper_border = "#151516";
string info = "#451376"; string info = "#451376";
readonly string info_border = "#210b36"; string info_border = "#210b36";
string info_secondary = "#4c3e59";
string info_secondary_border = "#7e58a2";
} }

8
IGP/Portals/ToastPortal.razor

@ -5,8 +5,7 @@
@if (toastService.HasToasts()) @if (toastService.HasToasts())
{ {
<div class="toastsContainer"> <div class="toastsContainer">
@foreach( var toast in toastService.GetToasts())
@foreach (var toast in toastService.GetToasts())
{ {
<ToastComponent Toast="toast"/> <ToastComponent Toast="toast"/>
} }
@ -18,12 +17,14 @@
position: fixed; position: fixed;
top: 64px; top: 64px;
right: 64px; right: 64px;
display: flex;
flex-direction: column;
gap: 8px;
} }
</style> </style>
@code { @code {
protected override void OnInitialized() protected override void OnInitialized()
{ {
toastService.Subscribe(OnUpdate); toastService.Subscribe(OnUpdate);
@ -38,5 +39,4 @@
{ {
StateHasChanged(); StateHasChanged();
} }
} }

4
IGP/Program.cs

@ -1,10 +1,10 @@
using System.Globalization;
using IGP; using IGP;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
using Services; using Services;
using Services.Development; using Services.Development;
using Services.Immortal; using Services.Immortal;
using Services.Website; using Services.Website;
using System.Globalization;
#if NO_SQL #if NO_SQL
#else #else
@ -15,8 +15,6 @@ using Microsoft.EntityFrameworkCore;
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");
var builder = WebAssemblyHostBuilder.CreateDefault(args); var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Logging.SetMinimumLevel(LogLevel.Warning); builder.Logging.SetMinimumLevel(LogLevel.Warning);

2
IGP/_Imports.razor

@ -37,7 +37,7 @@
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using Model.Chart @using Model.Chart
@using Model.Development.Git @using Model.Git
@using Model.Doc @using Model.Doc
@using Model.Economy @using Model.Economy
@using Model.Entity @using Model.Entity

3
IGP/wwwroot/css/app.css

@ -31,6 +31,9 @@
--info: #451376; --info: #451376;
--info-border: #210b36; --info-border: #210b36;
--info-secondary: #4c3e59;
--info-secondary-border: #7e58a2;
--info-hover: #451376; --info-hover: #451376;
--info-border-hover: #210b36; --info-border-hover: #210b36;

2
IGP/wwwroot/generated/AgileTaskModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/GitChangeModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/GitPatchModels.json

@ -1 +1 @@
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"}] [{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"}]

2
IGP/wwwroot/index.html

@ -17,7 +17,7 @@
<div id="app"> <div id="app">
<div style="width: 100vw; height: 100vh; background-color: black;"></div> <div style="width: 100vw; height: 100vh; background-color: black;"></div>
</div> </div>
<script src="_framework/blazor.webassembly.js" autostart="false"></script> <script autostart="false" src="_framework/blazor.webassembly.js"></script>
<script crossorigin="anonymous" <script crossorigin="anonymous"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script> src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>

49
Model/Entity/EntityModel.cs

@ -1,4 +1,5 @@
using System.Collections.Generic; #nullable enable
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Model.Entity.Data; using Model.Entity.Data;
@ -12,19 +13,15 @@ public class EntityModel
{ {
public static readonly string GameVersion = "0.0.6.8900a"; public static readonly string GameVersion = "0.0.6.8900a";
private static Dictionary<string, EntityModel> _database; private static Dictionary<string, EntityModel> _database= null!;
private static List<EntityModel> entityModels; private static List<EntityModel> _entityModels= null!;
private static List<EntityModel> entityModelsOnlyHotkey; private static List<EntityModel> _entityModelsOnlyHotkey = null!;
private static Dictionary<string, List<EntityModel>> entityModelsByHotkey; private static Dictionary<string, List<EntityModel>> _entityModelsByHotkey= null!;
public EntityModel()
{
}
public EntityModel(string data, string entity, bool isSpeculative = false) public EntityModel(string data, string entity, bool isSpeculative = false)
{ {
DataType = data; DataType = data;
@ -90,57 +87,59 @@ public class EntityModel
public static List<EntityModel> GetList() public static List<EntityModel> GetList()
{ {
if (entityModels == null) entityModels = DATA.Get().Values.ToList(); if (_entityModels == null) _entityModels = DATA.Get().Values.ToList();
return entityModels; return _entityModels;
} }
public static List<EntityModel> GetListOnlyHotkey() public static List<EntityModel> GetListOnlyHotkey()
{ {
if (entityModelsOnlyHotkey == null) if (_entityModelsOnlyHotkey == null)
{ {
entityModelsOnlyHotkey = new List<EntityModel>(); _entityModelsOnlyHotkey = new List<EntityModel>();
foreach (var entity in DATA.Get().Values) foreach (var entity in DATA.Get().Values)
if (entity.Hotkey() != null) if (entity.Hotkey() != null)
entityModelsOnlyHotkey.Add(entity); _entityModelsOnlyHotkey.Add(entity);
} }
return entityModelsOnlyHotkey; return _entityModelsOnlyHotkey;
} }
public static Dictionary<string, List<EntityModel>> GetEntitiesByHotkey() public static Dictionary<string, List<EntityModel>> GetEntitiesByHotkey()
{ {
if (entityModelsByHotkey == null) if (_entityModelsByHotkey == null)
{ {
entityModelsByHotkey = new Dictionary<string, List<EntityModel>>(); _entityModelsByHotkey = new Dictionary<string, List<EntityModel>>();
foreach (var entity in GetList()) foreach (var entity in GetList())
{ {
var entityHotkey = entity.Hotkey(); var entityHotkey = entity.Hotkey();
if (entityHotkey != null) if (entityHotkey != null)
{ {
if (!entityModelsByHotkey.ContainsKey(entityHotkey.Hotkey)) if (!_entityModelsByHotkey.ContainsKey(entityHotkey.Hotkey))
entityModelsByHotkey[entityHotkey.Hotkey] = new List<EntityModel>(); _entityModelsByHotkey[entityHotkey.Hotkey] = new List<EntityModel>();
entityModelsByHotkey[entityHotkey.Hotkey].Add(entity); _entityModelsByHotkey[entityHotkey.Hotkey].Add(entity);
} }
} }
} }
return entityModelsByHotkey; return _entityModelsByHotkey;
} }
public static EntityModel GetFrom(string hotkey, string hotkeyGroup, bool holdSpace, string faction, public static EntityModel? GetFrom(string hotkey, string hotkeyGroup, bool holdSpace, string faction,
string immortal) string immortal)
{ {
if (hotkey == null || hotkey == "") return null; if (string.IsNullOrEmpty(hotkey)) return null;
//TODO if (!GetEntitiesByHotkey().ContainsKey(hotkey)) return null;
var foundList = from entity in GetEntitiesByHotkey()[hotkey] var foundList = from entity in GetEntitiesByHotkey()[hotkey]
where entity.Hotkey()?.HotkeyGroup == hotkeyGroup where entity.Hotkey()?.HotkeyGroup == hotkeyGroup
&& entity.Hotkey()?.HoldSpace == holdSpace && entity.Hotkey()?.HoldSpace == holdSpace
@ -151,7 +150,7 @@ public class EntityModel
select replace).ToList().Count == 0) select replace).ToList().Count == 0)
select entity; select entity;
if (foundList == null || foundList.Count() == 0) return null; if (foundList != null && !foundList.Any()) return null;
var found = foundList.First(); var found = foundList.First();

2
Model/Git/CommitType.cs

@ -1,4 +1,4 @@
namespace Model.Development.Git; namespace Model.Git;
public class CommitType public class CommitType
{ {

3
Model/Git/GitChangeModel.cs

@ -1,6 +1,6 @@
using System; using System;
namespace Model.Development.Git; namespace Model.Git;
public class GitChangeModel public class GitChangeModel
{ {
@ -9,6 +9,5 @@ public class GitChangeModel
public string Name { get; set; } = "Add name..."; public string Name { get; set; } = "Add name...";
public string Description { get; set; } = "Add desciption..."; public string Description { get; set; } = "Add desciption...";
public string Commit { get; set; } = CommitType.Feature; public string Commit { get; set; } = CommitType.Feature;
public DateTime Date { get; set; } = DateTime.Now;
public string Important { get; set; } = "False"; public string Important { get; set; } = "False";
} }

2
Model/Git/GitPatchModel.cs

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Model.Development.Git; namespace Model.Git;
public class GitPatchModel public class GitPatchModel
{ {

2
Services/Development/GitService.cs

@ -1,5 +1,5 @@
using System.Net.Http.Json; using System.Net.Http.Json;
using Model.Development.Git; using Model.Git;
#if NO_SQL #if NO_SQL

4
Services/IServices.cs

@ -14,7 +14,7 @@ using Model.MemoryTester;
using Model.Notes; using Model.Notes;
using Model.Website; using Model.Website;
using Model.Website.Enums; using Model.Website.Enums;
using Model.Development.Git; using Model.Git;
using Model.Feedback; using Model.Feedback;
using Model.Work.Tasks; using Model.Work.Tasks;
using Services.Immortal; using Services.Immortal;
@ -263,7 +263,7 @@ public interface IMemoryTesterService {
} }
public interface IBuildOrderService { public interface IBuildOrderService {
public bool Add(EntityModel entity, IEconomyService withEconomy); public bool Add(EntityModel entity, IEconomyService withEconomy, IToastService toastService);
public void Add(EntityModel entity, int atInterval); public void Add(EntityModel entity, int atInterval);
public void SetName(string Name); public void SetName(string Name);

14
Services/Immortal/BuildOrderService.cs

@ -3,6 +3,7 @@ using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Model.BuildOrders; using Model.BuildOrders;
using Model.Entity; using Model.Entity;
using Model.Feedback;
using Model.Types; using Model.Types;
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
@ -39,7 +40,7 @@ public class BuildOrderService : IBuildOrderService {
if (atInterval > lastInterval) lastInterval = atInterval; if (atInterval > lastInterval) lastInterval = atInterval;
} }
public bool Add(EntityModel entity, IEconomyService withEconomy) { public bool Add(EntityModel entity, IEconomyService withEconomy, IToastService withToasts) {
if (entity != null) { if (entity != null) {
var production = entity.Production(); var production = entity.Production();
@ -49,7 +50,7 @@ public class BuildOrderService : IBuildOrderService {
if (economyAtSecond.Alloy >= production.Alloy && economyAtSecond.Ether >= production.Ether && if (economyAtSecond.Alloy >= production.Alloy && economyAtSecond.Ether >= production.Ether &&
economyAtSecond.Pyre >= production.Pyre) { economyAtSecond.Pyre >= production.Pyre) {
if (!MeetsSupply(entity)) { if (!MeetsSupply(entity)) {
Console.WriteLine("More Supply Needed"); withToasts.AddToast(new ToastModel {Title = "Supply Cap Reached", Message = "Build more supply!", SeverityType = SeverityType.Error});
return false; return false;
} }
@ -68,6 +69,15 @@ public class BuildOrderService : IBuildOrderService {
NotifyDataChanged(); NotifyDataChanged();
return true; return true;
} }
else if(interval + 1 == withEconomy.GetOverTime().Count)
{
if (economyAtSecond.Ether < production.Ether)
{
withToasts.AddToast(new ToastModel {Title = "Not Enough Ether", Message = "Build more ether extractors!", SeverityType = SeverityType.Error});
}
}
} }
} }
else { else {

3
Services/Website/ToastService.cs

@ -33,7 +33,8 @@ public class ToastService : IToastService
public void AddToast(ToastModel toast) public void AddToast(ToastModel toast)
{ {
toasts.Add(toast); toasts.Insert(0, toast);
NotifyDataChanged(); NotifyDataChanged();
} }

Loading…
Cancel
Save