void setGUIElementsAccesability() { var economy = shownFactory.province.owner.economy; //upgradeButton.interactable = economy.allowsFactoryUpgradeByGovernment(); //setButtonTooltip(upgradeButton, shownFactory.whyCantUpgradeFactory(Game.player)); //upgradeButton.interactable = shownFactory.getConditionsForFactoryUpgrade(Game.player, out upgradeButton.GetComponentInChildren<ToolTipHandler>().tooltip); upgradeButton.interactable = shownFactory.conditionsUpgrade.isAllTrue(Game.player, out upgradeButton.GetComponentInChildren <ToolTipHandler>().tooltip); subidize.interactable = shownFactory.conditionsSubsidize.isAllTrue(Game.player, out subidize.GetComponentInChildren <ToolTipHandler>().tooltip); //subidize.interactable = shownFactory.con if (shownFactory.isWorking()) { reopenButtonflag = reopenButtonStatus.close; } else { reopenButtonflag = reopenButtonStatus.reopen; } if (reopenButtonflag == reopenButtonStatus.close) { //reopenButton.interactable = economy.allowsFactoryCloseByGovernment(); reopenButton.GetComponentInChildren <Text>().text = "Close"; //setButtonTooltip(reopenButton, shownFactory.whyCantCloseFactory()); reopenButton.interactable = shownFactory.conditionsClose.isAllTrue(Game.player, out reopenButton.GetComponentInChildren <ToolTipHandler>().tooltip); } else { //reopenButton.interactable = economy.allowsFactoryReopenByGovernment(); //setButtonTooltip(reopenButton, shownFactory.whyCantReopenFactory()); reopenButton.interactable = shownFactory.conditionsReopen.isAllTrue(Game.player, out reopenButton.GetComponentInChildren <ToolTipHandler>().tooltip); reopenButton.GetComponentInChildren <Text>().text = "Reopen"; } //destroyButton.interactable = economy.allowsFactoryDestroyByGovernment(); // hint = shownFactory.whyCantDestroyFactory(); //setButtonTooltip(destroyButton, shownFactory.whyCantDestroyFactory()); destroyButton.interactable = shownFactory.conditionsDestroy.isAllTrue(Game.player, out destroyButton.GetComponentInChildren <ToolTipHandler>().tooltip); sellButton.interactable = shownFactory.conditionsSell.isAllTrue(Game.player, out sellButton.GetComponentInChildren <ToolTipHandler>().tooltip); buyButton.interactable = shownFactory.conditionsBuy.isAllTrue(Game.player, out buyButton.GetComponentInChildren <ToolTipHandler>().tooltip); nationalizeButton.interactable = shownFactory.conditionsNatinalize.isAllTrue(Game.player, out nationalizeButton.GetComponentInChildren <ToolTipHandler>().tooltip); //sellButton.interactable = economy.allowsFactorySellByGovernment(); //buyButton.interactable = economy.allowsFactoryBuyByGovernment(); //nationalizeButton.interactable = economy.allowsFactoryNatonalizeByGovernment(); this.priority.interactable = shownFactory.conditionsChangePriority.isAllTrue(Game.player, out priority.GetComponentInChildren <ToolTipHandler>().tooltip); this.subidize.interactable = shownFactory.conditionsSubsidize.isAllTrue(Game.player, out subidize.GetComponentInChildren <ToolTipHandler>().tooltip); this.dontHireOnSubsidies.interactable = shownFactory.conditionsDontHireOnSubsidies.isAllTrue(Game.player, out dontHireOnSubsidies.GetComponentInChildren <ToolTipHandler>().tooltip); priority.value = shownFactory.getPriority(); subidize.isOn = shownFactory.isSubsidized(); dontHireOnSubsidies.isOn = shownFactory.isDontHireOnSubsidies(); }
void setGUIElementsAccesability() { string dynText; upgradeButton.interactable = Factory.conditionsUpgrade.isAllTrue(factory, Game.Player, out dynText); upgradeButton.GetComponent <ToolTipHandler>().SetTextDynamic(() => dynText + "\n\nUpgrade makes enterprise bigger"); subidize.interactable = Factory.conditionsSubsidize.isAllTrue(factory, Game.Player, out subidize.GetComponent <ToolTipHandler>().text); if (factory.IsOpen) { reopenButtonflag = reopenButtonStatus.close; } else { reopenButtonflag = reopenButtonStatus.reopen; } if (reopenButtonflag == reopenButtonStatus.close) { reopenButton.GetComponentInChildren <Text>().text = "Close enterprise"; reopenButton.interactable = Factory.conditionsClose.isAllTrue(factory, Game.Player, out reopenButton.GetComponent <ToolTipHandler>().text); } else { reopenButton.interactable = Factory.conditionsReopen.isAllTrue(factory, Game.Player, out reopenButton.GetComponent <ToolTipHandler>().text); reopenButton.GetComponentInChildren <Text>().text = "Reopen"; } destroyButton.interactable = Factory.conditionsDestroy.isAllTrue(factory, Game.Player, out destroyButton.GetComponent <ToolTipHandler>().text); nationalizeButton.interactable = Factory.conditionsNatinalize.isAllTrue(factory, Game.Player, out nationalizeButton.GetComponent <ToolTipHandler>().text); nationalizeButton.GetComponent <ToolTipHandler>().AddText("\nThat would make owners angry and would reduce your reputation"); this.priority.interactable = Factory.conditionsChangePriority.isAllTrue(factory, Game.Player, out priority.GetComponent <ToolTipHandler>().text); priority.GetComponent <ToolTipHandler>().text += "\n\nHighest priority enterprises get workforce first"; this.subidize.interactable = Factory.conditionsSubsidize.isAllTrue(factory, Game.Player, out subidize.GetComponent <ToolTipHandler>().text); this.dontHireOnSubsidies.interactable = Factory.conditionsDontHireOnSubsidies.isAllTrue(factory, Game.Player, out dontHireOnSubsidies.GetComponent <ToolTipHandler>().text); priority.value = factory.getPriority(); subidize.isOn = factory.isSubsidized(); dontHireOnSubsidies.isOn = factory.isDontHireOnSubsidies(); }
void setGUIElementsAccesability() { upgradeButton.interactable = Factory.conditionsUpgrade.isAllTrue(shownFactory, Game.Player, out upgradeButton.GetComponent <ToolTipHandler>().text); upgradeButton.GetComponent <ToolTipHandler>().text += "\n\nUpgrade makes enterprise bigger"; subidize.interactable = Factory.conditionsSubsidize.isAllTrue(shownFactory, Game.Player, out subidize.GetComponent <ToolTipHandler>().text); if (shownFactory.isWorking()) { reopenButtonflag = reopenButtonStatus.close; } else { reopenButtonflag = reopenButtonStatus.reopen; } if (reopenButtonflag == reopenButtonStatus.close) { reopenButton.GetComponentInChildren <Text>().text = "Close"; reopenButton.interactable = Factory.conditionsClose.isAllTrue(shownFactory, Game.Player, out reopenButton.GetComponent <ToolTipHandler>().text); } else { reopenButton.interactable = Factory.conditionsReopen.isAllTrue(shownFactory, Game.Player, out reopenButton.GetComponent <ToolTipHandler>().text); reopenButton.GetComponentInChildren <Text>().text = "Reopen"; } destroyButton.interactable = Factory.conditionsDestroy.isAllTrue(shownFactory, Game.Player, out destroyButton.GetComponent <ToolTipHandler>().text); sellButton.interactable = Factory.conditionsSell.isAllTrue(Game.Player, out sellButton.GetComponent <ToolTipHandler>().text); buyButton.interactable = Factory.conditionsBuy.isAllTrue(Game.Player, out buyButton.GetComponent <ToolTipHandler>().text); nationalizeButton.interactable = Factory.conditionsNatinalize.isAllTrue(shownFactory, Game.Player, out nationalizeButton.GetComponent <ToolTipHandler>().text); this.priority.interactable = Factory.conditionsChangePriority.isAllTrue(shownFactory, Game.Player, out priority.GetComponent <ToolTipHandler>().text); priority.GetComponent <ToolTipHandler>().text += "\n\nHighest priority enterprises get workforce first"; this.subidize.interactable = Factory.conditionsSubsidize.isAllTrue(shownFactory, Game.Player, out subidize.GetComponent <ToolTipHandler>().text); this.dontHireOnSubsidies.interactable = Factory.conditionsDontHireOnSubsidies.isAllTrue(shownFactory, Game.Player, out dontHireOnSubsidies.GetComponent <ToolTipHandler>().text); priority.value = shownFactory.getPriority(); subidize.isOn = shownFactory.isSubsidized(); dontHireOnSubsidies.isOn = shownFactory.isDontHireOnSubsidies(); }