feat(Toasts) Adding toasts

This commit is contained in:
2022-04-10 17:32:22 -04:00
parent 8c06fdd120
commit 4322be0053
29 changed files with 478 additions and 100 deletions
-1
View File
@@ -1,6 +1,5 @@
@layout PageLayout
@page "/about"
<LayoutMediumContentComponent>
+7 -5
View File
@@ -5,7 +5,13 @@
@page "/agile"
@if (AgileService.IsLoaded())
@if (!AgileService.IsLoaded())
{
<LoadingComponent/>
}
else
{
<LayoutMediumContentComponent>
@@ -69,10 +75,6 @@
</PaperComponent>
</LayoutMediumContentComponent>
}
else
{
<LoadingComponent/>
}
@code {
@@ -13,7 +13,7 @@
<LayoutLargeContentComponent>
<WebsiteTitleComponent>Build Calculator</WebsiteTitleComponent>
<AlertComponent Type="SeverityType.Warning">
<AlertComponent Type="@SeverityType.Warning">
<Title>Work In Progress and Not Fully Tested</Title>
<Message>
Currently not considering training queue times. Lacking error toasts for invalid actions. Performance needs to be optimized. Calculations haven't been thoroughly compared against real gameplay. Added a 2 second delay to actions to account for casual micro (will probably tweak later).
+5 -51
View File
@@ -38,13 +38,13 @@
<FormNumberComponent Min="0"
Value="@((int)NumberOfTownHallsExisting)"
OnChange="@(e => { NumberOfTownHallsExisting = int.Parse(e.Value!.ToString()!); Calculate();})">
<FormLabelComponent>Number of townhalls existing</FormLabelComponent>
<FormLabelComponent>Number of townhalls you have</FormLabelComponent>
</FormNumberComponent>
<FormNumberComponent Min="0"
Value="@((int)TravelTime)"
OnChange="@(e => { TravelTime = int.Parse(e.Value!.ToString()!); Calculate();})">
<FormLabelComponent>Travel time</FormLabelComponent>
<FormLabelComponent>Worker travel time to alloy</FormLabelComponent>
</FormNumberComponent>
<FormDisplayComponent Label="Total alloy lost">
@@ -93,9 +93,9 @@
<InfoAnswerComponent>
Well, let's assume you lost a full alloy line of workers, and have to take that 741 alloy cost (300 to rebuy the workers, and 441 in lost mining time.)
<br/><br/>
If you were to set the <b>Number of townhalls existing</b> to 2, the calculator will consider worker transfer micro. Allowing you to cut the total cost by roughly 315 alloy. However, that number isn't entirely accurate, you are also going to have to bump up the <b>Travel time</b> to account for the time it takes the transferred workers to arrive at the decimated alloy line.
If you were to set the <b>Number of townhalls you have</b> to 2, the calculator will consider worker transfer micro. Allowing you to cut the total cost by roughly 315 alloy. However, that number isn't entirely accurate, you are also going to have to bump up the <b>Worker travel time to alloy</b> to account for the time it takes the transferred workers to arrive at the decimated alloy line.
<br/><br/>
Let's say it takes 10 seconds for workers to transfer from your second base. We can divide that number by 2, to represent our bases, and add those 5 additional seconds to <b>Travel time</b>, for the more accurate loss of 456 alloy (saving you 285 alloy.) <i>Which is much better than not transferring workers!</i>
Let's say it takes 10 seconds for workers to transfer from your second base. We can divide that number by 2, to represent our bases, and add those 5 additional seconds to <b>Worker travel time to alloy</b>, for the more accurate loss of 456 alloy (saving you 285 alloy.) <i>Which is much better than not transferring workers!</i>
</InfoAnswerComponent>
</InfoBodyComponent>
@@ -146,53 +146,7 @@
Can I see the code for the calculation?
</InfoQuestionComponent>
<InfoAnswerComponent>
<CodeComponent>
<div style="color: green;">//TotalAlloyHarassment is set after Calculate() function is called</div>
<div>
float TotalAlloyHarassment;
float CostOfWorker = 50;
float AlloyMinedPerSecondByWorker = 1;
float TimeToProduceWorker = 20;
float TravelTime = 1;
float NumberOfWorkersLostToHarass = 1;
float NumberOfTownHallsExisting = 1;
float SimultaneousProductionFloor() {
if (NumberOfTownHallsExisting &lt;= 0 || NumberOfWorkersLostToHarass &lt;= 0) {
return 0;
}
return (float)Math.Floor(NumberOfWorkersLostToHarass / Math.Min(NumberOfTownHallsExisting, NumberOfWorkersLostToHarass));
}
float LeftOverWorkersToProduceCount() {
return NumberOfWorkersLostToHarass % (Math.Min(NumberOfTownHallsExisting, NumberOfWorkersLostToHarass));
}
float WorkerReplacementCost() {
return CostOfWorker * NumberOfWorkersLostToHarass;
}
float DelayedMiningCost() {
return TotalAlloyHarassment - WorkerReplacementCost();
}
void Calculate() {
TotalAlloyHarassment = WorkerReplacementCost();
for (var workerProductionIndex = 0; workerProductionIndex &lt; SimultaneousProductionFloor(); workerProductionIndex++) {
TotalAlloyHarassment += AlloyMinedPerSecondByWorker * (TimeToProduceWorker + TravelTime) * (workerProductionIndex + 1);
}
TotalAlloyHarassment += LeftOverWorkersToProduceCount() * (TimeToProduceWorker + TravelTime) * AlloyMinedPerSecondByWorker;
}
</div>
</CodeComponent>
<CodeLinkComponent Href="https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/blob/main/IGP/Pages/HarassCalculatorPage.razor#L223-L281"/>
</InfoAnswerComponent>
</InfoBodyComponent>
+1 -1
View File
@@ -5,7 +5,7 @@
<LayoutLargeContentComponent>
<WebsiteTitleComponent>Making Of</WebsiteTitleComponent>
<AlertComponent Type="SeverityType.Warning">
<AlertComponent Type="@SeverityType.Warning">
<Title>Under Construction</Title>
<Message>This page is still being worked on. It will list the tech and design choices made for this website. It's is strictly for educational and reference purposes, and it has nothing to do with IMMORTAL: Gates of Pyre.</Message>
</AlertComponent>
@@ -28,19 +28,19 @@
<Title>Alert Message</Title>
<Description>Used to convey important information to the viewer. Comes in Yellow (Warning), Blue (Information), Red (Error), and Green (Success). Mostly used to warn viewers of pre-alpha or incomplete content being viewed.</Description>
<Example>
<AlertComponent Type="SeverityType.Warning">
<AlertComponent Type="@SeverityType.Warning">
<Title>Warning Alert Title</Title>
<Message>Warning Alert Message</Message>
</AlertComponent>
<AlertComponent Type="SeverityType.Information">
<AlertComponent Type="@SeverityType.Information">
<Title>Information Alert Title</Title>
<Message>Information Alert Message</Message>
</AlertComponent>
<AlertComponent Type="SeverityType.Error">
<AlertComponent Type="@SeverityType.Error">
<Title>Error Alert Title</Title>
<Message>Error Alert Message</Message>
</AlertComponent>
<AlertComponent Type="SeverityType.Success">
<AlertComponent Type="@SeverityType.Success">
<Title>Succsess Alert Title</Title>
<Message>Succsess Alert Message</Message>
</AlertComponent>