Exemplo n.º 1
0
        public static void CreateRandomPopulation()
        {
            foreach (Province province in allLandProvinces)
            {
                if (province.Country == UncolonizedLand)
                {
                    //1500-2000
                    //new Tribesmen(PopUnit.getRandomPopulationAmount(300, 400), province.Country.Culture, province);
                    //new Aristocrats(PopUnit.getRandomPopulationAmount(300, 400), province.Country.Culture, province);
                    new Tribesmen(PopUnit.getRandomPopulationAmount(1500, 2000), province.Country.Culture, province);
                    //new Tribesmen(PopUnit.getRandomPopulationAmount(2000, 2500), province.Country.Culture, province);
                }
                else
                {
                    PopUnit pop;
                    //if (Game.devMode)
                    //    pop = new Tribesmen(2000, province.Country.Culture, province);
                    //else
                    //new Tribesmen(PopUnit.getRandomPopulationAmount(11000, 12000), province.Country.Culture, province);
                    //new Tribesmen(PopUnit.getRandomPopulationAmount(3100, 3200), province.Country.Culture, province);
                    new Tribesmen(PopUnit.getRandomPopulationAmount(200, 300), province.Country.Culture, province);

                    //if (Game.devMode)
                    //    pop = new Aristocrats(1000, province.Country.Culture, province);
                    //else
                    pop = new Aristocrats(PopUnit.getRandomPopulationAmount(500, 1000), province.Country.Culture, province);

                    pop.GiveMoneyFromNoWhere(900m);
                    pop.storage.add(new Storage(Product.Grain, 60f));
                    //if (!Game.devMode)
                    //{
                    //pop = new Capitalists(PopUnit.getRandomPopulationAmount(500, 800), Country.Culture, province);
                    //pop.Cash.set(9000);

                    pop = new Artisans(PopUnit.getRandomPopulationAmount(400, 500), province.Country.Culture, province);
                    pop.GiveMoneyFromNoWhere(900m);

                    pop = new Farmers(PopUnit.getRandomPopulationAmount(8200, 9000), province.Country.Culture, province);
                    pop.GiveMoneyFromNoWhere(20m);

                    if (Game.IndustrialStart)
                    {
                        new Workers(PopUnit.getRandomPopulationAmount(4500, 5000), province.Country.Culture, province);
                        pop = new Capitalists(PopUnit.getRandomPopulationAmount(500, 800), province.Country.Culture, province);
                        pop.GiveMoneyFromNoWhere(9000);
                    }
                    else
                    {
                        new Workers(PopUnit.getRandomPopulationAmount(500, 800), province.Country.Culture, province);
                    }
                    //}
                    //province.allPopUnits.Add(new Workers(600, PopType.workers, Game.player.culture, province));
                    //break;
                }
            }
        }
Exemplo n.º 2
0
        static void сreateRandomPopulation()
        {
            foreach (Province province in Province.allProvinces)
            {
                if (province.GetCountry() == Country.NullCountry)
                {
                    Tribesmen f = new Tribesmen(PopUnit.getRandomPopulationAmount(500, 1000), province.GetCountry().getCulture(), province);
                }
                else
                {
                    PopUnit pop;
                    //if (Game.devMode)
                    //    pop = new Tribesmen(2000, province.getCountry().getCulture(), province);
                    //else
                    pop = new Tribesmen(PopUnit.getRandomPopulationAmount(1800, 2000), province.GetCountry().getCulture(), province);


                    if (province.GetCountry() == Game.Player)
                    {
                        //pop = new Tribesmen(20900, PopType.tribeMen, province.getOwner().culture, province);
                        //province.allPopUnits.Add(pop);
                    }
                    //if (Game.devMode)
                    //    pop = new Aristocrats(1000, province.getCountry().getCulture(), province);
                    //else
                    pop = new Aristocrats(PopUnit.getRandomPopulationAmount(800, 1000), province.GetCountry().getCulture(), province);


                    pop.cash.set(9000);
                    pop.storage.add(new Storage(Product.Grain, 60f));
                    //if (!Game.devMode)
                    //{
                    //pop = new Capitalists(PopUnit.getRandomPopulationAmount(500, 800), getCountry().getCulture(), province);
                    //pop.cash.set(9000);

                    pop = new Artisans(PopUnit.getRandomPopulationAmount(500, 800), province.GetCountry().getCulture(), province);
                    pop.cash.set(900);

                    pop = new Farmers(PopUnit.getRandomPopulationAmount(10000, 12000), province.GetCountry().getCulture(), province);
                    pop.cash.set(20);
                    //}
                    //province.allPopUnits.Add(new Workers(600, PopType.workers, Game.player.culture, province));
                }
            }
        }
Exemplo n.º 3
0
 public ArtisanProduction(ProductionType type, Province province, Artisans artisan) : base(type, province)
 {
     this.artisan = artisan;
 }
Exemplo n.º 4
0
        public override void Refresh()
        {
            if (pop != null)
            {
                var sb = new StringBuilder();
                caption.text = pop.ToString();
                //sb.Append(pop);
                sb.Append("Population: ").Append(pop.getPopulation());
                //if (Game.devMode)
                if (pop.storage.isNotZero())
                {
                    if (pop.Type == PopType.Aristocrats)
                    {
                        sb.Append("\nStorage: ").Append(pop.storage.ToString());
                    }
                    else
                    {
                        sb.Append("\nUnsold: ").Append(pop.storage.ToString());
                    }
                }
                Artisans isArtisan = pop as Artisans;
                if (isArtisan != null)
                {
                    sb.Append(", input products:  ").Append(isArtisan.getInputProducts());
                    sb.Append("\nProducing: ");
                    if (isArtisan.Type == null)
                    {
                        sb.Append("nothing");
                    }
                    else
                    {
                        sb.Append(isArtisan.Type.basicProduction.Product);
                    }
                }
                if (pop.Type == PopType.Aristocrats || pop.Type == PopType.Soldiers)
                {
                    sb.Append("\nGained: ").Append(pop.getGainGoodsThisTurn().ToString());
                }
                else
                {
                    sb.Append("\nProduced: ").Append(pop.getGainGoodsThisTurn().ToString());
                }
                sb.Append("\nSent to market: ").Append(pop.getSentToMarket());  // hide it



                //sb.Append("\nAssimilation: ");

                //if (pop.culture != pop.Country.getCulture() && pop.getAssimilationSize() > 0)
                //    sb.Append(pop.Country.getCulture()).Append(" ").Append(pop.getAssimilationSize());
                //else
                //    sb.Append("none");

                //sb.Append("\nGrowth: ").Append(pop.getGrowthSize());
                sb.Append("\nUnemployment: ").Append(pop.getUnemployment());
                sb.Append("\nLoyalty: ").Append(pop.loyalty);

                if (pop.loans.get() > 0f)
                {
                    sb.Append("\nLoan: ").Append(pop.loans.ToString());// hide it
                }
                if (pop.deposits.get() > 0f)
                {
                    sb.Append("\nDeposit: ").Append(pop.deposits.ToString());// hide it
                }
                if (Game.devMode)
                {
                    sb.Append("\nAge: ").Append(pop.getAge());
                }
                sb.Append("\nMobilized: ").Append(pop.getMobilized());
                if (pop.getMovement() != null)
                {
                    sb.Append("\nMember of ").Append(pop.getMovement());
                }
                sb.Append("\nConsumed: ").Append(pop.getConsumed());

                //if (Game.devMode)
                //    sb.Append("\nConsumedLT: ").Append(pop.getConsumedLastTurn()).Append(" cost: ").Append(Game.market.getCost(pop.getConsumedLastTurn())
                //        ).Append("\nConsumedIM: ").Append(pop.getConsumedInMarket()).Append(" cost: ").Append(Game.market.getCost(pop.getConsumedInMarket()));

                generaltext.text = sb.ToString();

                sb.Clear();
                sb.Append("Life needs: ").Append(pop.getLifeNeedsFullfilling().ToString()).Append(" fulfilled");
                lifeNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => " Life needs wants:\n" + pop.getRealLifeNeeds().getString("\n"));
                lifeNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Everyday needs: ").Append(pop.getEveryDayNeedsFullfilling().ToString()).Append(" fulfilled");
                everyDayNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Everyday needs wants:\n" + pop.getRealEveryDayNeeds().getString("\n"));
                everyDayNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Luxury needs: ").Append(pop.getLuxuryNeedsFullfilling().ToString()).Append(" fulfilled");
                luxuryNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Luxury needs wants:\n" + pop.getRealLuxuryNeeds().getString("\n"));
                luxuryNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Cash: ").Append(pop.Cash.ToString());
                money.text = sb.ToString();
                money.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Money income: " + pop.moneyIncomeThisTurn
                                                                     + "\nIncome tax (inc. foreign jurisdictions): " + pop.incomeTaxPayed
                                                                     + "\nConsumed cost: " + Game.market.getCost(pop.getConsumed()));

                if (pop.Type.isProducer())
                {
                    efficiencyText.gameObject.SetActive(true);
                    efficiencyText.text = "Efficiency: " + PopUnit.modEfficiency.getModifier(pop);
                    efficiencyText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Efficiency: " + PopUnit.modEfficiency.GetDescription(pop));
                }
                else
                {
                    efficiencyText.gameObject.SetActive(false);
                    //efficiencyText.GetComponent<ToolTipHandler>().SetText("");//it's disabled anyway
                }
                var thisInvestor = pop as Investor;
                if (thisInvestor != null)
                {
                    property.gameObject.SetActive(true);
                    var found = World.GetAllShares(thisInvestor).OrderByDescending(x => x.Value.get());
                    property.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Owns:\n" + found.getString(", ", "\n"));
                }
                else
                {
                    property.gameObject.SetActive(false);
                }

                issues.GetComponent <ToolTipHandler>().SetTextDynamic(
                    delegate()
                {
                    //var items = from pair in pop.getIssues()
                    //            orderby pair.Value descending
                    //            select pair;
                    var items = pop.getIssues().OrderByDescending(x => x.Value);
                    return("Issues:\n" + items.getString(" willing ", "\n"));
                }
                    );
                populationChange.text = "Population change: " + pop.getAllPopulationChanges().Sum(x => x.Value);
                populationChange.GetComponent <ToolTipHandler>().SetTextDynamic(() =>
                                                                                "Population change:\n" +
                                                                                pop.getAllPopulationChanges().getString("\n", pop, "Total change: "));
            }
        }
Exemplo n.º 5
0
        public override void Refresh()
        {
            if (pop != null)
            {
                var sb = new StringBuilder();
                caption.text = pop.ToString();
                //sb.Append(pop);
                Artisans isArtisan = pop as Artisans;
                sb.Append("Population: ").Append(pop.population.Get());
                if (isArtisan != null)
                {
                    sb.Append(", Producing: ");
                    if (isArtisan.Type == null)
                    {
                        sb.Append("nothing");
                    }
                    else
                    {
                        sb.Append(isArtisan.Type.basicProduction.Product);
                    }
                }
                //if (Game.devMode)
                if (pop.Type == PopType.Aristocrats || pop.Type == PopType.Soldiers)
                {
                    sb.Append("\nGained: ").Append(pop.getGainGoodsThisTurn());
                }
                else
                {
                    sb.Append("\nProduced: ").Append(pop.getGainGoodsThisTurn());
                }
                if (pop.storage.isNotZero())
                {
                    if (pop.Type == PopType.Aristocrats)
                    {
                        sb.Append(", Storage: ").Append(pop.storage);
                    }
                    else
                    {
                        sb.Append(", Unsold: ").Append(pop.storage);
                    }
                }

                if (isArtisan != null)
                {
                    sb.Append("\nInput required: ");
                    foreach (Storage next in isArtisan.GetResurceInput())
                    {
                        sb.Append(next.get() * isArtisan.population.Get() / Population.PopulationMultiplier).Append(" ").Append(next.Product).Append(";");
                    }

                    sb.Append("\nStockpile:  ").Append(isArtisan.getInputProducts()).Append(", Resource availability: ").Append(isArtisan.getInputFactor());
                }

                //sb.Append("\nSent to market: ").Append(pop.getSentToMarket());  // hide it
                sb.Append("\nConsumed: ").Append(pop.getConsumed().ToString(", "));


                // loyalty part
                sb.Append("\n\nCash: ").Append(pop.Cash);
                if (pop.loans.isNotZero())
                {
                    sb.Append("\nLoan: ").Append(pop.loans);// hide it
                }
                if (pop.deposits.isNotZero())
                {
                    sb.Append("\nDeposit: ").Append(pop.deposits);// hide it
                }
                sb.Append("\n\nNeeds fulfilled (total): ").Append(pop.needsFulfilled);
                sb.Append("\nLoyalty: ").Append(pop.loyalty);
                if (pop.getMovement() != null)
                {
                    sb.Append("\nMember of ").Append(pop.getMovement());
                }

                //rest part
                sb.Append("\n\nSeeks job: ").Append(pop.GetSeekingJob());
                sb.Append("\nEducation: ").Append(pop.Education);
                sb.Append("\nCulture: ").Append(pop.culture);
                if (!pop.isStateCulture())
                {
                    sb.Append(", minority");
                }

                if (Game.devMode)
                {
                    sb.Append("\n\nAge: ").Append(pop.getAge());
                }
                sb.Append("\nMobilized: ").Append(pop.getMobilized());



                //if (Game.devMode)
                //    sb.Append("\nConsumedLT: ").Append(pop.getConsumedLastTurn()).Append(" cost: ").Append(Country.market.getCost(pop.getConsumedLastTurn())
                //        ).Append("\nConsumedIM: ").Append(pop.getConsumedInMarket()).Append(" cost: ").Append(Country.market.getCost(pop.getConsumedInMarket()));

                generaltext.text = sb.ToString();

                sb.Clear();
                sb.Append("Life needs: ").Append(pop.getLifeNeedsFullfilling()).Append(" fulfilled");
                lifeNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => " Life needs wants:\n" + pop.population.getRealLifeNeeds().ToString("\n"));
                lifeNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Everyday needs: ").Append(pop.getEveryDayNeedsFullfilling()).Append(" fulfilled");
                everyDayNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Everyday needs wants:\n" + pop.population.getRealEveryDayNeeds().ToString("\n"));
                everyDayNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Luxury needs: ").Append(pop.getLuxuryNeedsFullfilling()).Append(" fulfilled");
                luxuryNeedsText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Luxury needs wants:\n" + pop.population.getRealLuxuryNeeds().ToString("\n"));
                luxuryNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Balance: ").Append(Money.DecimalToString(pop.Register.Balance));
                money.text = sb.ToString();
                money.GetComponent <ToolTipHandler>().SetTextDynamic(() =>
                                                                     pop.Register.ToString()
                                                                     //"Money income: " + pop.moneyIncomeThisTurn
                                                                     //+ "\nIncome tax (inc. foreign jurisdictions): " + pop.incomeTaxPayed
                                                                     //+ "\nConsumed cost: " + Game.Player.market.getCost(pop.getConsumed())
                                                                     );

                if (pop.Type.isProducer())
                {
                    efficiencyText.gameObject.SetActive(true);
                    efficiencyText.text = "Efficiency: " + PopUnit.modEfficiency.getModifier(pop);
                    efficiencyText.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Efficiency: " + PopUnit.modEfficiency.GetDescription(pop));
                }
                else
                {
                    efficiencyText.gameObject.SetActive(false);
                    //efficiencyText.GetComponent<ToolTipHandler>().SetText("");//it's disabled anyway
                }
                var thisInvestor = pop as Investor;
                if (thisInvestor != null)
                {
                    property.gameObject.SetActive(true);
                    var found = World.GetAllShares(thisInvestor).OrderByDescending(x => x.Value.get());
                    property.GetComponent <ToolTipHandler>().SetTextDynamic(() => "Owns:\n" + found.ToString(", ", "\n"));
                }
                else
                {
                    property.gameObject.SetActive(false);
                }

                issues.GetComponent <ToolTipHandler>().SetTextDynamic(
                    delegate
                {
                    //var items = from pair in pop.getIssues()
                    //            orderby pair.Value descending
                    //            select pair;
                    var items = pop.getIssues().OrderByDescending(x => x.Value);
                    return("Issues:\n" + items.ToString(" willing ", "\n"));
                }
                    );
                populationChange.text = "Population change: " + pop.getAllPopulationChanges().Sum(x => x.Value);
                populationChange.GetComponent <ToolTipHandler>().SetTextDynamic(() =>
                                                                                "Population change:\n" +
                                                                                pop.getAllPopulationChanges().ToString("\n", pop, "Total change: "));
            }
        }
Exemplo n.º 6
0
        public override void Refresh()
        {
            if (pop != null)
            {
                var sb = new StringBuilder();
                caption.text = pop.ToString();
                //sb.Append(pop);
                sb.Append("Population: ").Append(pop.getPopulation());
                //if (Game.devMode)
                sb.Append("\nStorage: ").Append(pop.storage.ToString());
                Artisans isArtisan = pop as Artisans;
                if (isArtisan != null)
                {
                    sb.Append(", input products:  ").Append(isArtisan.getInputProducts());
                    sb.Append("\nProducing: ");
                    if (isArtisan.getType() == null)
                    {
                        sb.Append("nothing");
                    }
                    else
                    {
                        sb.Append(isArtisan.getType().basicProduction.getProduct());
                    }
                }
                sb.Append("\nGain goods: ").Append(pop.getGainGoodsThisTurn().ToString());
                sb.Append("\nSent to market: ").Append(pop.getSentToMarket());  // hide it
                makeLine(sb, pop.getRichestPromotionTarget(), pop.getPromotionSize(), "Promotion: ", pop.wantsToPromote());

                if (pop.getLastEscapeSize() != 0)
                {
                    makeLineNew(sb, pop.getLastEscapeTarget(), pop.getLastEscapeSize());
                }
                else
                {
                    sb.Append("\nNo demotions\\migrations\\immigrations");
                }

                sb.Append("\nAssimilation: ");
                if (pop.culture != pop.getCountry().getCulture() && pop.getAssimilationSize() > 0)
                {
                    sb.Append(pop.getCountry().getCulture()).Append(" ").Append(pop.getAssimilationSize());
                }
                else
                {
                    sb.Append("none");
                }

                sb.Append("\nGrowth: ").Append(pop.getGrowthSize());
                sb.Append("\nUnemployment: ").Append(pop.getUnemployedProcent());
                sb.Append("\nLoyalty: ").Append(pop.loyalty);

                if (pop.loans.get() > 0f)
                {
                    sb.Append("\nLoan: ").Append(pop.loans.ToString());// hide it
                }
                if (pop.deposits.get() > 0f)
                {
                    sb.Append("\nDeposit: ").Append(pop.deposits.ToString());// hide it
                }
                sb.Append("\nAge: ").Append(pop.getAge());
                sb.Append("\nMobilized: ").Append(pop.getMobilized());
                if (pop.getMovement() != null)
                {
                    sb.Append("\nMember of ").Append(pop.getMovement());
                }
                sb.Append("\nConsumed: ").Append(pop.getConsumed());

                //if (Game.devMode)
                //    sb.Append("\nConsumedLT: ").Append(pop.getConsumedLastTurn()).Append(" cost: ").Append(Game.market.getCost(pop.getConsumedLastTurn())
                //        ).Append("\nConsumedIM: ").Append(pop.getConsumedInMarket()).Append(" cost: ").Append(Game.market.getCost(pop.getConsumedInMarket()));

                generaltext.text = sb.ToString();

                sb.Clear();
                sb.Append("Life needs: ").Append(pop.getLifeNeedsFullfilling().ToString()).Append(" fulfilled");
                lifeNeedsText.GetComponent <ToolTipHandler>().SetDynamicString(() => " Life needs wants:\n" + pop.getRealLifeNeeds().getString("\n"));
                lifeNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Everyday needs: ").Append(pop.getEveryDayNeedsFullfilling().ToString()).Append(" fulfilled");
                everyDayNeedsText.GetComponent <ToolTipHandler>().SetDynamicString(() => "Everyday needs wants:\n" + pop.getRealEveryDayNeeds().getString("\n"));
                everyDayNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Luxury needs: ").Append(pop.getLuxuryNeedsFullfilling().ToString()).Append(" fulfilled");
                luxuryNeedsText.GetComponent <ToolTipHandler>().SetDynamicString(() => "Luxury needs wants:\n" + pop.getRealLuxuryNeeds().getString("\n"));
                luxuryNeedsText.text = sb.ToString();

                sb.Clear();
                sb.Append("Cash: ").Append(pop.cash.ToString());
                money.text = sb.ToString();
                money.GetComponent <ToolTipHandler>().SetDynamicString(() => "Money income: " + pop.moneyIncomethisTurn
                                                                       + "\nIncome tax: " + pop.incomeTaxPayed
                                                                       + "\nConsumed cost: " + Game.market.getCost(pop.getConsumed()));

                if (pop.popType.isProducer())
                {
                    efficiencyText.enabled = true;
                    efficiencyText.text    = "Efficiency: " + PopUnit.modEfficiency.getModifier(pop);
                    efficiencyText.GetComponent <ToolTipHandler>().SetDynamicString(() => PopUnit.modEfficiency.GetDescription(pop));
                }
                else
                {
                    efficiencyText.enabled = false;
                    //efficiencyText.GetComponent<ToolTipHandler>().SetText("");//it's disabled anyway
                }


                issues.GetComponent <ToolTipHandler>().SetDynamicString(
                    delegate()
                {
                    var items = from pair in pop.getIssues()
                                orderby pair.Value descending
                                select pair;
                    return(items.getString(" willing ", "\n"));
                }
                    );
            }
        }
Exemplo n.º 7
0
 //private readonly Artisans owner;
 public ArtisanProduction(FactoryType type, Province province, Artisans artisan) : base(type, province)
 {
     base.setOwner(artisan);
 }