From f43f6fe17d054f83c686b552201d6b4bfc83524d Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 3 Apr 2017 18:36:13 -0400 Subject: LOADS of optimizations and Pong fixes. --- ShiftOS_TheReturn/Shiftorium.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ShiftOS_TheReturn') diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 0bdd9f4..4556cd6 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -46,6 +46,23 @@ namespace ShiftOS.Engine Installed?.Invoke(); } + public static string GetCategory(string id) + { + var upg = GetDefaults().FirstOrDefault(x => x.ID == id); + if (upg == null) + return "Other"; + return (upg.Category == null) ? "Other" : upg.Category; + } + + public static IEnumerable GetAllInCategory(string cat) + { + return GetDefaults().Where(x => x.Category == cat); + } + + public static bool IsCategoryEmptied(string cat) + { + return GetDefaults().Where(x => x.Category == cat).FirstOrDefault(x => x.Installed == false) == null; + } public static bool Buy(string id, int cost) { @@ -278,8 +295,15 @@ namespace ShiftOS.Engine public string Description { get; set; } public int Cost { get; set; } public string ID { get { return (this.Id != null ? this.Id : (Name.ToLower().Replace(" ", "_"))); } } - public string Id { get; } - + public string Id { get; set; } + public string Category { get; set; } + public bool Installed + { + get + { + return Shiftorium.UpgradeInstalled(ID); + } + } public string Dependencies { get; set; } } } -- cgit v1.2.3