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
+1 -1
View File
@@ -1,5 +1,5 @@
using System.Net.Http.Json;
using Model.Development.Git;
using Model.Git;
#if NO_SQL
+2 -2
View File
@@ -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);
+12 -2
View File
@@ -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 {
+2 -1
View File
@@ -33,7 +33,8 @@ public class ToastService : IToastService
public void AddToast(ToastModel toast)
{
toasts.Add(toast);
toasts.Insert(0, toast);
NotifyDataChanged();
}