public override void Refresh()
        {
            var sb = new StringBuilder("Province name: ").Append(Game.selectedProvince);

            if (Game.devMode)
            {
                sb.Append("\nID: ").Append(Game.selectedProvince.ID);
                sb.Append("\nNeighbors: ").Append(Game.selectedProvince.getAllNeighbors().getString(", "));
            }
            sb.Append("\nPopulation (with families): ").Append(Game.selectedProvince.getFamilyPopulation());

            sb.Append("\nAverage loyalty: ").Append(Game.selectedProvince.GetAllPopulation().GetAverageProcent(x => x.loyalty));
            //sb.Append("\nMajor culture: ").Append(Game.selectedProvince.getMajorCulture());
            //sb.Append("\nGDP: ").Append(Game.selectedProvince.getGDP());
            sb.Append("\nResource: ");
            if (Game.selectedProvince.getResource() == null)
            {
                sb.Append("none ");
            }
            else
            {
                sb.Append(Game.selectedProvince.getResource());
            }
            //sb.Append("\nTerrain: ").Append(Game.selectedProvince.getTerrain());
            //sb.Append("\nRural overpopulation: ").Append(Game.selectedProvince.GetOverpopulation());
            sb.Append("\nCores: ").Append(Game.selectedProvince.getCoresDescription());


            sb.Append("\nCultures: ").Append(Game.selectedProvince.GetAllPopulation().Group(x => x.culture, y => y.population.Get())
                                             .OrderByDescending(x => x.Value.get()).ToString(", ", 2));

            sb.Append("\nClasses: ").Append(Game.selectedProvince.GetAllPopulation().Group(x => x.Type, y => y.population.Get())
                                            .OrderByDescending(x => x.Value.get()).ToString(", ", 0));

            if (Game.selectedProvince.getModifiers().Count > 0)
            {
                sb.Append("\nModifiers: ").Append(GetStringExtensions.getString(Game.selectedProvince.getModifiers()));
            }

            Text text = btnOwner.GetComponentInChildren <Text>();

            text.text = "Owner: " + Game.selectedProvince.Country;

            btnBuild.interactable = ProductionType.allowsForeignInvestments.checkIftrue(Game.Player, Game.selectedProvince, out btnBuild.GetComponent <ToolTipHandler>().text);
            btnBuild.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "B" + " button");

            btMobilize.interactable = Province.doesCountryOwn.checkIftrue(Game.Player, Game.selectedProvince, out btMobilize.GetComponent <ToolTipHandler>().text);
            btMobilize.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "M" + " button");

            //if (Game.devMode)
            //    sb.Append("\nColor: ").Append(province.getColorID());
            btAttackThat.interactable = Country.canAttack.isAllTrue(Game.selectedProvince, Game.Player, out btAttackThat.GetComponent <ToolTipHandler>().text);
            btAttackThat.GetComponent <ToolTipHandler>().AddText("\nHotkey is " + "T" + " button");
            btGrandIndependence.interactable = Province.canGetIndependence.isAllTrue(Game.selectedProvince, Game.Player, out btGrandIndependence.GetComponent <ToolTipHandler>().text);
            generaltext.text = sb.ToString();
        }
Example #2
0
        public override void Refresh()
        {
            var sb = new StringBuilder("Province name: ").Append(Game.selectedProvince);

            // sb.Append("\nID: ").Append(Game.selectedProvince.getID());
            sb.Append("\nPopulation (with families): ").Append(Game.selectedProvince.getFamilyPopulation());
            sb.Append("\nAverage loyalty: ").Append(Game.selectedProvince.getAverageLoyalty());
            sb.Append("\nMajor culture: ").Append(Game.selectedProvince.getMajorCulture());
            sb.Append("\nGDP: ").Append(Game.selectedProvince.getGDP());
            sb.Append("\nResource: ");
            if (Game.selectedProvince.getResource() == null)
            {
                sb.Append("none ");
            }
            else
            {
                sb.Append(Game.selectedProvince.getResource());
            }
            sb.Append("\nTerrain: ").Append(Game.selectedProvince.getTerrain());
            sb.Append("\nRural overpopulation: ").Append(Game.selectedProvince.getOverpopulation() * 100).Append("%");
            sb.Append("\nCores: ").Append(Game.selectedProvince.getCoresDescription());
            if (Game.selectedProvince.getModifiers().Count > 0)
            {
                sb.Append("\nModifiers: ").Append(GetStringExtensions.getString(Game.selectedProvince.getModifiers()));
            }


            // "\nNeighbors " + province.getNeigborsList()
            ;
            Text text = btnOwner.GetComponentInChildren <Text>();

            text.text = "Owner: " + Game.selectedProvince.getCountry();


            btnBuild.interactable = Province.doesCountryOwn.checkIftrue(Game.Player, Game.selectedProvince, out btnBuild.GetComponent <ToolTipHandler>().text);

            btMobilize.GetComponent <ToolTipHandler>().SetText(btnBuild.GetComponent <ToolTipHandler>().text);
            btMobilize.interactable = btnBuild.interactable;


            //if (Game.devMode)
            //    sb.Append("\nColor: ").Append(province.getColorID());
            btAttackThat.interactable        = Country.canAttack.isAllTrue(Game.selectedProvince, Game.Player, out btAttackThat.GetComponent <ToolTipHandler>().text);
            btGrandIndependence.interactable = Province.canGetIndependence.isAllTrue(Game.selectedProvince, Game.Player, out btGrandIndependence.GetComponent <ToolTipHandler>().text);
            generaltext.text = sb.ToString();
        }