feat(Localization) Adding localization text. Fixing bugs in toasts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Net.Http.Json;
|
||||
using Model.Development.Git;
|
||||
using Model.Git;
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -33,7 +33,8 @@ public class ToastService : IToastService
|
||||
|
||||
public void AddToast(ToastModel toast)
|
||||
{
|
||||
toasts.Add(toast);
|
||||
toasts.Insert(0, toast);
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user