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

This commit is contained in:
2022-04-10 19:15:41 -04:00
parent 4322be0053
commit 81659a9f84
29 changed files with 287 additions and 122 deletions
+2 -2
View File
@@ -7,11 +7,11 @@
@if (!AgileService.IsLoaded())
{
<LoadingComponent/>
<LoadingComponent/>
}
else
{
<LayoutMediumContentComponent>
@@ -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());
}
@@ -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!;
+4 -1
View File
@@ -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' ;">
@@ -38,6 +40,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());
}
+29 -1
View File
@@ -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";
}