public override void Refresh() { if (Game.previoslySelectedProvince != Game.selectedProvince) { selectFactoryType(null); } table.Refresh(); if (selectedFactoryType != null) { sb.Clear(); sb.Append("Build ").Append(selectedFactoryType); sb.Append("\n\nResources to build: ").Append(selectedFactoryType.GetBuildNeeds().getString(", ")); sb.Append("."); if (Game.Player.economy.getValue() != Economy.PlannedEconomy) { var cost = selectedFactoryType.GetBuildCost(); sb.Append(" cost: ").Append(cost); } sb.Append("\nEveryday resource input: "); if (selectedFactoryType.resourceInput == null) { sb.Append("none"); } else { sb.Append(selectedFactoryType.resourceInput); } descriptionText.text = sb.ToString(); // fix that duplicate: buildButton.interactable = selectedFactoryType.conditionsBuildThis.isAllTrue(Game.Player, Game.selectedProvince, out buildButton.GetComponent <ToolTipHandler>().text); if (!selectedFactoryType.canBuildNewFactory(Game.selectedProvince, Game.Player)) { buildButton.interactable = false; } if (buildButton.interactable) { buildButton.GetComponentInChildren <Text>().text = "Build " + selectedFactoryType; } } else { buildButton.interactable = false; buildButton.GetComponentInChildren <Text>().text = "Select building"; if (Game.selectedProvince == null) { descriptionText.text = "Select province where to build"; } else if (ProductionType.getAllInventedFactories(Game.Player).Where(x => x.canBuildNewFactory(Game.selectedProvince, Game.Player)).Count() == 0) { descriptionText.text = "Nothing to build now"; } else { descriptionText.text = "Select building from left"; } } }
private static void IndustrialStart() { foreach (var item in AllExistingCountries()) { item.Science.Invent(Invention.Universities); item.Science.Invent(Invention.Manufactures); item.Science.Invent(Invention.Metal); item.Science.Invent(Invention.Gunpowder); var resurceEnterprise = ProductionType.whoCanProduce(item.Capital.getResource()); var aristocrats = item.Capital.AllPops.Where(x => x.Type == PopType.Aristocrats).First() as Aristocrats; if (resurceEnterprise != null && item.Science.IsInvented(resurceEnterprise.basicProduction.Product)) { item.Capital.BuildFactory(aristocrats, resurceEnterprise, resurceEnterprise.GetBuildCost(item.market), true); } var processingEnterprises = ProductionType.getAllInventedFactories(item).Where(x => x.hasInput() || x == ProductionType.University); var capitalists = item.Capital.AllPops.Where(x => x.Type == PopType.Capitalists).First() as Capitalists; for (int i = 0; i < 3; i++) { var processingEnterprise = processingEnterprises.Random(); if (processingEnterprise.canBuildNewFactory(item.Capital, capitalists)) { item.Capital.BuildFactory(capitalists, processingEnterprise, processingEnterprise.GetBuildCost(item.market), true); } } //ProductionType.getAllInventedFactories(Country).Where(x=>x.canBuildNewFactory); //var res = new Factory(this, investor, type, cost); //allFactories.Add(res); } }