Example #1
0
        public void onBuildClick()
        {
            bool    buildSomething = false;
            Factory factory;

            if (Economy.isMarket.checkIfTrue(Game.Player))
            {
                MoneyView cost = selectedFactoryType.GetBuildCost();
                if (Game.Player.CanPay(cost))
                {
                    factory = Game.selectedProvince.BuildFactory(Game.Player, selectedFactoryType, cost);
                    Game.Player.PayWithoutRecord(factory, cost);
                    buildSomething = true;
                    MainCamera.factoryPanel.show(factory);
                    if (Game.Player != factory.Country)
                    {
                        factory.Country.changeRelation(Game.Player, Options.RelationImpactOnGovernmentInvestment.get());
                    }
                }
            }
            else // non market
            {
                //todo remove grain connection
                var     resourceToBuild = selectedFactoryType.GetBuildNeeds();
                Storage needFood        = resourceToBuild.GetFirstSubstituteStorage(Product.Grain);
                if (Game.Player.countryStorageSet.has(needFood))
                {
                    factory = Game.selectedProvince.BuildFactory(Game.Player, selectedFactoryType, World.market.getCost(resourceToBuild));
                    Game.Player.countryStorageSet.Subtract(needFood);
                    buildSomething = true;
                    MainCamera.factoryPanel.show(factory);
                    if (Game.Player != factory.Country)
                    {
                        factory.Country.changeRelation(Game.Player, Options.RelationImpactOnGovernmentInvestment.get());
                    }
                }
            }

            if (buildSomething)
            {
                selectedFactoryType = null;
                MainCamera.refreshAllActive();
            }
        }
 public MoneyView GetInvestmentCost()
 {
     return(Type.GetBuildCost());
 }
Example #3
0
 public MoneyView GetInvestmentCost(Market market)
 {
     return(Type.GetBuildCost(market));
 }