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. 51
      IGP/Localizations.resx
  9. 29
      IGP/Pages/BuildCalculator/BuildCalculatorPage.razor
  10. 23
      IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor
  11. 5
      IGP/Pages/Comparision/ComparisionPage.razor
  12. 30
      IGP/Pages/MakingOf/Parts/MakingOfColours.razor
  13. 8
      IGP/Portals/ToastPortal.razor
  14. 4
      IGP/Program.cs
  15. 2
      IGP/_Imports.razor
  16. 3
      IGP/wwwroot/css/app.css
  17. 2
      IGP/wwwroot/generated/AgileTaskModels.json
  18. 2
      IGP/wwwroot/generated/GitChangeModels.json
  19. 2
      IGP/wwwroot/generated/GitPatchModels.json
  20. 2
      IGP/wwwroot/index.html
  21. 49
      Model/Entity/EntityModel.cs
  22. 2
      Model/Git/CommitType.cs
  23. 3
      Model/Git/GitChangeModel.cs
  24. 2
      Model/Git/GitPatchModel.cs
  25. 2
      Services/Development/GitService.cs
  26. 4
      Services/IServices.cs
  27. 14
      Services/Immortal/BuildOrderService.cs
  28. 3
      Services/Website/ToastService.cs

12
Components/Display/InfoTooltipComponent.razor

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

2
Contexts/DatabaseContext.cs

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

BIN
IGP/Database.db

Binary file not shown.

38
IGP/IGP.csproj

@ -20,10 +20,10 @@
</PropertyGroup>
<ItemGroup>
<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.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="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.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.EntityFrameworkCore.Sqlite" 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>
<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>
<ProjectReference Include="..\Components\Components.csproj" />
<ProjectReference Include="..\Contexts\Contexts.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Services\Services.csproj" />
<ProjectReference Include="..\Components\Components.csproj"/>
<ProjectReference Include="..\Contexts\Contexts.csproj"/>
<ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\generated" />
<Folder Include="wwwroot\generated"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Localizations.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localizations.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localizations.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localizations.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Localizations.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Example.resx</DependentUpon>
</Compile>
<Compile Update="Localizations.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Example.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

11
IGP/Index.razor

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

54
IGP/Localizations.Designer.cs generated

@ -50,5 +50,59 @@ namespace IGP {
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);
}
}
}
}

51
IGP/Localizations.resx

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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>
@ -13,12 +14,56 @@
<value>1.3</value>
</resheader>
<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 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>
<data name="Greeting" xml:space="preserve">
<value>Hello</value>
</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>

29
IGP/Pages/BuildCalculator/BuildCalculatorPage.razor

@ -1,11 +1,15 @@
@implements IDisposable
@using Microsoft.Extensions.Localization
@implements IDisposable
@layout PageLayout
@inject IStringLocalizer<Localizations> locale
@inject IKeyService keyService
@inject IImmortalSelectionService filterService
@inject IBuildOrderService buildOrderService
@inject IEconomyService economyService
@inject IToastService toastService
@inject ITimingService timingService
@page "/build-calculator"
@ -26,7 +30,7 @@
<div class="calculatorGrid">
<div style="grid-area: timing;" class="gridItem">
<InfoTooltipComponent InfoText="">
<InfoTooltipComponent InfoText="@locale["Tooltip Timing Info"]" >
<TimingComponent></TimingComponent>
</InfoTooltipComponent>
@ -36,35 +40,35 @@
@if (true)
{
<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>
</InfoTooltipComponent>
</div>
}
<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>
</InfoTooltipComponent>
</div>
<div style="grid-area: view;" class="gridItem">
<InfoTooltipComponent InfoText="Summary of the entity you just selected.">
<EntityClickViewComponent></EntityClickViewComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Entity Info"]">
<EntityClickViewComponent/>
</InfoTooltipComponent>
</div>
<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>
</InfoTooltipComponent>
</div>
<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>
</InfoTooltipComponent>
</div>
@ -72,7 +76,7 @@
<div class="gridItem gridKeys">
<InfoTooltipComponent InfoText="">
<InfoTooltipComponent InfoText="@locale["Tooltip Hotkey Info"]">
<HotkeyViewerComponent Size="80"></HotkeyViewerComponent>
</InfoTooltipComponent>
@ -87,13 +91,13 @@
}
<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>
</InfoTooltipComponent>
</div>
<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>
</InfoTooltipComponent>
</div>
@ -215,6 +219,7 @@
@code {
protected override void OnInitialized()
{
keyService.Subscribe(HandleClick);
@ -265,7 +270,7 @@
{
return;
}
if (buildOrderService.Add(entity, economyService))
if (buildOrderService.Add(entity, economyService, toastService))
{
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval());
}

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

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

5
IGP/Pages/Comparision/ComparisionPage.razor

@ -1,6 +1,8 @@
@layout PageLayout
@implements IDisposable
@inject IToastService toastService
<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-areas: 'loader sand compare compare' ;">
@ -39,6 +41,7 @@ grid-template-areas: 'loader sand compare compare' ;">
[Inject]
IEconomyService EconomyService { get; set; } = default!;
[Inject]
ITimingService TimingService { get; set; } = default!;
@ -92,7 +95,7 @@ grid-template-areas: 'loader sand compare compare' ;">
{
return;
}
if (BuildOrderService.Add(entity, EconomyService))
if (BuildOrderService.Add(entity, EconomyService, toastService))
{
EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
}

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

@ -15,6 +15,8 @@
--paper-border: @paper_border;
--info: @info;
--info-border: @info_border;
--info-secondary: @info_secondary;
--info-secondary-border: @info_secondary_border;
</CodeComponent>
<br/>
<div class="color accent">
@ -71,7 +73,20 @@
<div>
Base: <input type="color" value="@info" @onchange="e => info = e.Value!.ToString()!"/>
</div>
<div>
Border: <input type="color" value="@info_border" @onchange="e => info_border = e.Value!.ToString()!"/>
</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>
<style>
@ -89,6 +104,9 @@
--paper-border: @paper_border;
--info: @info;
--info-border: @info_border;
--info-secondary: @info_secondary;
--info-secondary-border: @info_secondary_border;
}
.colorContainer {
@ -139,6 +157,12 @@
.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>
@ -156,5 +180,9 @@
string paper = "#252526";
string paper_border = "#151516";
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())
{
<div class="toastsContainer">
@foreach (var toast in toastService.GetToasts())
@foreach( var toast in toastService.GetToasts())
{
<ToastComponent Toast="toast"/>
}
@ -18,12 +17,14 @@
position: fixed;
top: 64px;
right: 64px;
display: flex;
flex-direction: column;
gap: 8px;
}
</style>
@code {
protected override void OnInitialized()
{
toastService.Subscribe(OnUpdate);
@ -38,5 +39,4 @@
{
StateHasChanged();
}
}

4
IGP/Program.cs

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

2
IGP/_Imports.razor

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

3
IGP/wwwroot/css/app.css

@ -31,6 +31,9 @@
--info: #451376;
--info-border: #210b36;
--info-secondary: #4c3e59;
--info-secondary-border: #7e58a2;
--info-hover: #451376;
--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 style="width: 100vw; height: 100vh; background-color: black;"></div>
</div>
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script autostart="false" src="_framework/blazor.webassembly.js"></script>
<script crossorigin="anonymous"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
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.Text;
using Model.Entity.Data;
@ -12,19 +13,15 @@ public class EntityModel
{
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)
{
DataType = data;
@ -90,57 +87,59 @@ public class EntityModel
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()
{
if (entityModelsOnlyHotkey == null)
if (_entityModelsOnlyHotkey == null)
{
entityModelsOnlyHotkey = new List<EntityModel>();
_entityModelsOnlyHotkey = new List<EntityModel>();
foreach (var entity in DATA.Get().Values)
if (entity.Hotkey() != null)
entityModelsOnlyHotkey.Add(entity);
_entityModelsOnlyHotkey.Add(entity);
}
return entityModelsOnlyHotkey;
return _entityModelsOnlyHotkey;
}
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())
{
var entityHotkey = entity.Hotkey();
if (entityHotkey != null)
{
if (!entityModelsByHotkey.ContainsKey(entityHotkey.Hotkey))
entityModelsByHotkey[entityHotkey.Hotkey] = new List<EntityModel>();
if (!_entityModelsByHotkey.ContainsKey(entityHotkey.Hotkey))
_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)
{
if (hotkey == null || hotkey == "") return null;
if (string.IsNullOrEmpty(hotkey)) return null;
if (!GetEntitiesByHotkey().ContainsKey(hotkey)) return null;
//TODO
var foundList = from entity in GetEntitiesByHotkey()[hotkey]
where entity.Hotkey()?.HotkeyGroup == hotkeyGroup
&& entity.Hotkey()?.HoldSpace == holdSpace
@ -151,7 +150,7 @@ public class EntityModel
select replace).ToList().Count == 0)
select entity;
if (foundList == null || foundList.Count() == 0) return null;
if (foundList != null && !foundList.Any()) return null;
var found = foundList.First();

2
Model/Git/CommitType.cs

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

3
Model/Git/GitChangeModel.cs

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

2
Model/Git/GitPatchModel.cs

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

2
Services/Development/GitService.cs

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

4
Services/IServices.cs

@ -14,7 +14,7 @@ using Model.MemoryTester;
using Model.Notes;
using Model.Website;
using Model.Website.Enums;
using Model.Development.Git;
using Model.Git;
using Model.Feedback;
using Model.Work.Tasks;
using Services.Immortal;
@ -263,7 +263,7 @@ public interface IMemoryTesterService {
}
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 SetName(string Name);

14
Services/Immortal/BuildOrderService.cs

@ -3,6 +3,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using Model.BuildOrders;
using Model.Entity;
using Model.Feedback;
using Model.Types;
using YamlDotNet.Serialization;
@ -39,7 +40,7 @@ public class BuildOrderService : IBuildOrderService {
if (atInterval > lastInterval) lastInterval = atInterval;
}
public bool Add(EntityModel entity, IEconomyService withEconomy) {
public bool Add(EntityModel entity, IEconomyService withEconomy, IToastService withToasts) {
if (entity != null) {
var production = entity.Production();
@ -49,7 +50,7 @@ public class BuildOrderService : IBuildOrderService {
if (economyAtSecond.Alloy >= production.Alloy && economyAtSecond.Ether >= production.Ether &&
economyAtSecond.Pyre >= production.Pyre) {
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;
}
@ -68,6 +69,15 @@ public class BuildOrderService : IBuildOrderService {
NotifyDataChanged();
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 {

3
Services/Website/ToastService.cs

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

Loading…
Cancel
Save