public void StartUpgrade(UpgradeableFacility facilityToUpgrade) { Upgrade = new FacilityUpgradeEvent(facilityToUpgrade.id, this); Upgrading = true; ScreenMessages.PostScreenMessage("[Bureaucracy]: Upgrade of " + Name + " requested"); Debug.Log("[Bureaucracy]: Upgrade of " + Name + " requested for " + Upgrade.OriginalCost); }
public void CancelUpgrade() { Upgrade = null; Upgrading = false; IsPriority = false; Debug.Log("[Bureaucracy]: Upgrade of " + Name + " cancelled"); ScreenMessages.PostScreenMessage("[Bureaucracy]: " + Name + " - Upgrade cancelled"); }
public void OnUpgradeCompleted() { Upgrading = false; Upgrade = null; recentlyUpgraded = true; IsPriority = false; Debug.Log("[Bureaucracy]: Upgrade of " + Name + " completed"); }
public string GetProgressReport(FacilityUpgradeEvent upgrade) { // ReSharper disable once BuiltInTypeReferenceStyleForMemberAccess if (!Upgrading && !recentlyUpgraded) { return(String.Empty); } if (!recentlyUpgraded) { return(Name + ": $" + (upgrade.OriginalCost - upgrade.RemainingInvestment) + " / " + upgrade.OriginalCost); } recentlyUpgraded = false; return(Name + ": Upgrade completed successfully"); }
public void OnLoad(ConfigNode[] facilityNodes) { for (int i = 0; i < facilityNodes.Length; i++) { ConfigNode cn = facilityNodes.ElementAt(i); if (cn.GetValue("Name") != Name) { continue; } bool.TryParse(cn.GetValue("RecentlyUpgraded"), out recentlyUpgraded); bool.TryParse(cn.GetValue("Closed"), out isClosed); bool.TryParse(cn.GetValue("isPriority"), out IsPriority); int.TryParse(cn.GetValue("LaunchesThisMonth"), out LaunchesThisMonth); SetCosts(); ConfigNode upgradeNode = cn.GetNode("UPGRADE"); if (upgradeNode == null) { return; } Upgrading = true; Upgrade = new FacilityUpgradeEvent(upgradeNode.GetValue("ID"), this); Upgrade.OnLoad(upgradeNode); } }