Ejemplo n.º 1
0
        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(", "));
                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();


                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 (FactoryType.getAllInventedTypes(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";
                }
            }
        }
Ejemplo n.º 2
0
        public List <IInvestable> getAllInvestmentsProjects(Predicate <IInvestable> predicate)
        {
            //Factory.conditionsUpgrade.isAllTrue // don't change it to Modifier  - it would prevent loan takes
            //FactoryType.conditionsBuild.isAllTrue
            List <IInvestable> res = new List <IInvestable>();

            getAllFactories(x => canUpgradeFactory(x.getType()) && predicate(x)).PerformAction(x => res.Add(x));
            FactoryType.getAllInventedTypes(getCountry(), x => x.canBuildNewFactory(this) && predicate(x)).PerformAction(x => res.Add(x));
            return(res);
        }