public void SetView(ColonizationController controller, PlayerController gameController)
        {
            this.controller     = controller;
            this.gameController = gameController;

            this.title.Text = LocalizationMethods.PlanetName(this.controller.PlanetBody);

            this.resetView();
        }
 private void setName()
 {
     if (controller.SiteType == SiteType.Colony)
     {
         var colonyController = controller as ColonyController;
         this.nameLabel.Text = LocalizationMethods.PlanetName(colonyController.PlanetBody);
     }
     else
     {
         this.nameLabel.Text = controller.HostStar.Name.ToText(LocalizationManifest.Get.CurrentLanguage);
     }
 }
Exemple #3
0
        public void SetView(AConstructionSiteController siteController)
        {
            this.controller = siteController;
            if (this.controller.SiteType == SiteType.Colony)
            {
                var colonyController = this.controller as ColonyController;
                this.title.Text = LocalizationMethods.PlanetName(colonyController.PlanetBody);
                this.investmentSlider.ReadOnly = true;
            }
            else
            {
                this.title.Text = this.controller.HostStar.Name.ToText(LocalizationManifest.Get.CurrentLanguage);
                this.investmentSlider.ReadOnly = false;
            }

            this.investmentSlider.Value = (float)siteController.DesiredSpendingRatio;

            this.policyToggle.Items     = siteController.Policies;
            this.policyToggle.Selection = siteController.Policy;

            this.resetView();
        }
Exemple #4
0
        public ColonizationTargetView(ColonizationController controller, PlayerController gameController) : this()
        {
            this.controller     = controller;
            this.gameController = gameController;
            var context = LocalizationManifest.Get.CurrentLanguage["FormColonization"];

            var infoFormatter = new ThousandsFormatter(controller.PopulationMax);
            var infoVars      = new TextVar("pop", infoFormatter.Format(controller.Population)).
                                And("max", infoFormatter.Format(controller.PopulationMax));

            this.targetName.Text = LocalizationMethods.PlanetName(controller.PlanetBody);
            this.targetInfo.Text = context["population"].Text(infoVars.Get);

            var enrouteShips      = gameController.EnrouteColonizers(controller.PlanetBody).SelectMany(x => x.Ships).ToArray();
            var enroutePopulation = enrouteShips.Length > 0 ?
                                    enrouteShips.Sum(x => x.Quantity * x.Design.ColonizerPopulation) :
                                    0;

            this.enrouteInfo.Text = context["enroute"].Text(
                new TextVar("count", new ThousandsFormatter().Format(enroutePopulation)).Get
                );
        }
Exemple #5
0
 private void setName()
 {
     this.nameLabel.Text = LocalizationMethods.PlanetName(controller.PlanetBody);
 }
        public FormColonyDetails(ColonyController controller) : this()
        {
            this.controller = controller;

            switch (controller.PlanetBody.Type)
            {
            case PlanetType.Asteriod:
                this.planetImage.Image = Resources.asteroids;
                break;

            case PlanetType.GasGiant:
                this.planetImage.Image = Resources.gasGiant;
                break;

            case PlanetType.Rock:
                this.planetImage.Image = Resources.rockPlanet;
                break;
            }

            Context context = LocalizationManifest.Get.CurrentLanguage["FormColony"];

            this.Text = LocalizationMethods.PlanetName(controller.PlanetBody);
            this.Font = SettingsWinforms.Get.FormFont;

            var popFormat     = new ThousandsFormatter(controller.PopulationMax, controller.Population);
            var decimalFormat = new DecimalsFormatter(0, 1);
            var prefixFormat  = new ThousandsFormatter();

            Func <string, double, string> statText  = (label, x) => context[label].Text() + ": " + decimalFormat.Format(x);
            Func <string, double, string> perPop    = (label, x) => context[label].Text() + ": " + decimalFormat.Format(x) + " / " + context["perPop"].Text();
            Func <string, double, string> totalText = (label, x) => context[label].Text() + ": " + prefixFormat.Format(x);

            buildingsGroup.Text    = context["buildingsGroup"].Text();
            planetInfoGroup.Text   = context["planetGroup"].Text();
            popInfoGroup.Text      = context["popGroup"].Text();
            productivityGroup.Text = context["productivityGroup"].Text();

            populationInfo.Text     = popFormat.Format(controller.Population) + " / " + popFormat.Format(controller.PopulationMax);
            growthInfo.Text         = context["growthInfo"].Text() + ": " + DecimalsFormatter.Sign(controller.PopulationGrowth) + popFormat.Format(controller.PopulationGrowth);
            infrastructureInfo.Text = statText("infrastructureInfo", controller.Organization * 100) + "%";

            sizeInfo.Text        = statText("sizeInfo", controller.PlanetSize);
            environmentInfo.Text = statText("environmentInfo", controller.PlanetEnvironment * 100) + "%";

            foodInfo.Text             = perPop("foodInfo", controller.FoodPerPop);
            miningInfo.Text           = perPop("miningInfo", controller.OrePerPop);
            industryInfo.Text         = perPop("industryInfo", controller.IndustryPerPop);
            developmentInfo.Text      = perPop("developmentInfo", controller.DevelopmentPerPop);
            industryTotalInfo.Text    = totalText("industryTotalInfo", controller.IndustryTotal);
            developmentTotalInfo.Text = totalText("developmentTotalInfo", controller.DevelopmentTotal);

            foreach (var trait in controller.Traits)
            {
                var thumbnail = new PictureBox();
                thumbnail.Size     = new Size(32, 32);
                thumbnail.SizeMode = PictureBoxSizeMode.Zoom;
                thumbnail.Image    = ImageCache.Get[trait.ImagePath];
                this.traitList.Controls.Add(thumbnail);
            }

            foreach (var data in controller.Buildings)
            {
                var itemView = new BuildingItem();
                itemView.Data = data;
                buildingsList.Controls.Add(itemView);
            }
        }