Esempio n. 1
0
 public void selectFactoryType(FactoryType newSelection)
 {
     selectedFactoryType = newSelection;
 }
Esempio n. 2
0
 public override void Show()
 {
     selectedFactoryType = null; // changed province
     base.Show();
 }
Esempio n. 3
0
 //private readonly Artisans owner;
 public ArtisanProduction(FactoryType type, Province province, Artisans artisan) : base(type, province)
 {
     base.setOwner(artisan);
 }
Esempio n. 4
0
        /// <summary>
        /// Basic constructor for resource getting FactoryType
        /// </summary>
        internal FactoryType(string name, Storage basicProduction, bool shaft)
        {
            this.name = name;
            if (name == "Gold pit")
            {
                GoldMine = this;
            }
            if (name == "Furniture factory")
            {
                Furniture = this;
            }
            if (name == "Metal pit")
            {
                MetalDigging = this;
            }
            if (name == "Metal smelter")
            {
                MetalSmelter = this;
            }
            if (name == "Barnyard")
            {
                Barnyard = this;
            }
            allTypes.Add(this);
            this.basicProduction = basicProduction;

            //upgradeResource.Set(new Storage(Product.Wood, 10f));
            upgradeResourceLowTier = new StorageSet(new List <Storage> {
                new Storage(Product.Stone, 2f), new Storage(Product.Wood, 10f)
            });
            upgradeResourceMediumTier = new StorageSet(new List <Storage> {
                new Storage(Product.Stone, 10f), new Storage(Product.Lumber, 3f), new Storage(Product.Cement, 2f), new Storage(Product.Metal, 1f)
            });
            upgradeResourceHighTier = new StorageSet(new List <Storage> {
                new Storage(Product.Cement, 10f), new Storage(Product.Metal, 4f), new Storage(Product.Machinery, 2f)
            });

            enoughMoneyOrResourcesToBuild = new Condition(
                delegate(object forWhom)
            {
                var agent = forWhom as Agent;
                if (agent.getCountry().economy.getValue() == Economy.PlannedEconomy)
                {
                    return(agent.getCountry().countryStorageSet.has(this.getBuildNeeds()));
                }
                else
                {
                    //Value cost = Game.market.getCost(this.getBuildNeeds());
                    //cost.add(Options.factoryMoneyReservPerLevel);
                    Value cost = getInvestmentsCost();
                    return(agent.canPay(cost));
                }
            },
                delegate
            {
                var sb = new StringBuilder();
                //Value cost = Game.market.getCost(this.getBuildNeeds());
                //cost.add(Options.factoryMoneyReservPerLevel);
                Value cost = getInvestmentsCost();
                sb.Append("Have ").Append(cost).Append(" coins");
                sb.Append(" or (with ").Append(Economy.PlannedEconomy).Append(") have ").Append(this.getBuildNeeds());
                return(sb.ToString());
            }, true);

            conditionsBuild = new ConditionsListForDoubleObjects(new List <Condition>()
            {
                Economy.isNotLF, enoughMoneyOrResourcesToBuild, Province.doesCountryOwn
            });                                                                             // can build
            this.shaft = shaft;
        }
Esempio n. 5
0
        /// <summary>
        /// Basic constructor for resource getting FactoryType
        /// </summary>
        internal FactoryType(string name, Storage basicProduction, bool shaft)
        {
            this.name  = name;
            nameWeight = name.GetWeight();
            if (name == "Gold pit")
            {
                GoldMine = this;
            }
            if (name == "Furniture factory")
            {
                Furniture = this;
            }
            if (name == "Metal pit")
            {
                MetalDigging = this;
            }
            if (name == "Metal smelter")
            {
                MetalSmelter = this;
            }
            if (name == "Barnyard")
            {
                Barnyard = this;
            }
            allTypes.Add(this);
            this.basicProduction = basicProduction;



            enoughMoneyOrResourcesToBuild = new Condition(
                delegate(object forWhom)
            {
                var agent = forWhom as Agent;
                if (agent.GetCountry().economy.getValue() == Economy.PlannedEconomy)
                {
                    return(agent.GetCountry().countryStorageSet.has(this.GetBuildNeeds()));
                }
                else
                {
                    Value cost = GetBuildCost();
                    return(agent.canPay(cost));
                }
            },
                delegate
            {
                var sb     = new StringBuilder();
                Value cost = GetBuildCost();
                sb.Append("Have ").Append(cost).Append(" coins");
                sb.Append(" or (with ").Append(Economy.PlannedEconomy).Append(") have ").Append(this.GetBuildNeeds().getString(", "));
                return(sb.ToString());
            }, true);

            // Using: Country () , province, this <FactoryType>
            // used in BuildPanel only, only for Game.Player
            // Should be: de-facto Country, Investor, this <FactoryType> (change Economy.isNot..)
            // or put it in FactoryProject
            conditionsBuildThis = new DoubleConditionsList(new List <Condition> {
                Economy.isNotLF, Economy.isNotInterventionism, enoughMoneyOrResourcesToBuild,
                allowsForeignInvestments
            });                             //
            this.shaft = shaft;
        }
Esempio n. 6
0
 public NewFactoryProject(Province province, FactoryType type)
 {
     this.Type     = type;
     this.Province = province;
 }