示例#1
0
 protected override void OnEnter()
 {
     base.OnEnter();
     this.App.UI.SetScreen("StarSystem");
     this._piechart = new BudgetPiechart(this.App.UI, "piechart", this.App.AssetDatabase);
     EmpireBarUI.SyncTitleBar(this.App, "gameEmpireBar", this._piechart);
     EmpireBarUI.SyncTitleFrame(this.App);
     this.InitializeClimateSlider(this.App.UI.Path("colonyControl", "partClimateSlider"));
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partTradeSlider"), "only_user_events", true);
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partTerraSlider"), "only_user_events", true);
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partInfraSlider"), "only_user_events", true);
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partShipConSlider"), "only_user_events", true);
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partCivSlider"), "only_user_events", true);
     this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partOverDevelopment"), "only_user_events", true);
     this.App.UI.SetPropertyBool("gameSystemContentsList", "only_user_events", true);
     this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partCivSlider"), 0, 100, 50);
     this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partTerraSlider"), 0, 100, 50);
     this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partInfraSlider"), 0, 100, 50);
     this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partShipConSlider"), 0, 100, 50);
     this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partOverDevelopment"), 0, 100, 50);
     this.InitializeClimateSlider(this.App.UI.Path("gamePlanetDetails", "partClimateSlider"));
     StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.CurrentSystem, false, true);
     StarSystemUI.SyncPlanetListWidget(this.App.Game, "planetListWidget", this.App.GameDatabase.GetStarSystemPlanets(this.CurrentSystem));
     StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, "");
     StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this.CurrentSystem, this.SelectedObject, this.GetPlanetViewGameObject(this.CurrentSystem, this.SelectedObject), this._planetView);
     this.App.HotKeyManager.AddListener((IKeyBindListener)this);
 }
示例#2
0
        public override void Initialize()
        {
            this._sky        = new Sky(this._app, SkyUsage.StarMap, 0);
            this._crits      = new GameObjectSet(this._app);
            this._planetView = this._crits.Add <PlanetView>();
            this._crits.Add((IGameObject)this._sky);
            OrbitalObjectInfo orbitalObjectInfo = this._app.GameDatabase.GetOrbitalObjectInfo(this._planetID);
            StarSystemInfo    starSystemInfo    = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo.StarSystemID);

            this._app.UI.SetText("gameColonyName", orbitalObjectInfo.Name);
            this._enteredColonyName = orbitalObjectInfo.Name;
            this._app.UI.SetVisible(this._app.UI.Path(this.ID, "btnAbandon"), false);
            this._app.UI.SetText(this._app.UI.Path("colonyCreateTitle"), (this._homeworld ? App.Localize("@UI_STARMAP_HOMEWORLD_ESTABLISHED") : App.Localize("@UI_STARMAP_COLONY_ESTABLISHED")) + " - " + starSystemInfo.Name);
            this._cameraReduced                 = new OrbitCameraController(this._app);
            this._cameraReduced.MinDistance     = 2.5f;
            this._cameraReduced.MaxDistance     = 100f;
            this._cameraReduced.DesiredDistance = 50f;
            this._cameraReduced.DesiredYaw      = MathHelper.DegreesToRadians(45f);
            this._cameraReduced.DesiredPitch    = -MathHelper.DegreesToRadians(25f);
            this._cameraReduced.SnapToDesiredPosition();
            this._starmapReduced = new StarMap(this._app, this._app.Game, this._sky);
            this._starmapReduced.Initialize(this._crits);
            this._starmapReduced.SetCamera(this._cameraReduced);
            this._starmapReduced.FocusEnabled = false;
            this._starmapReduced.SetFocus((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]);
            this._starmapReduced.Select((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]);
            this._starmapReduced.SelectEnabled = false;
            this._starmapReduced.PostSetProp("MissionTarget", (object)this._starmapReduced.Systems.Reverse[starSystemInfo.ID].ObjectID, (object)true);
            this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(starSystemInfo.ID).Origin);
            this._starmapReduced.PostSetProp("CullRadius", 15f);
            this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarMapViewport"), (object)this._starmapReduced.ObjectID);
            this.CachePlanet(this._app.GameDatabase.GetPlanetInfo(this._planetID));
            this._planetView.PostSetProp("Planet", this._cachedPlanet != null ? this._cachedPlanet.ObjectID : 0);
            this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "system_details.Planet_panel"), (object)this._planetView.ObjectID);
            StarSystemMapUI.Sync(this._app, orbitalObjectInfo.StarSystemID, this._app.UI.Path(this.ID, "system_map"), true);
            StarSystemUI.SyncSystemDetailsWidget(this._app, "colony_event_dialog.system_details", orbitalObjectInfo.StarSystemID, true, true);
            StarSystemUI.SyncPlanetDetailsControl(this._app.Game, this._app.UI.Path(this.ID, "system_details"), this._planetID);
            StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), orbitalObjectInfo.ID, "");
            this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true);
            this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarMapViewport"), false);
            this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP"));
            this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, App.Localize("@SYSTEMDETAILS_STAR_MAP"));
            this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0);
            this._crits.Activate();
        }
 protected void SetSelectedObject(int orbitalId, string trigger)
 {
     this.SelectedObject = orbitalId;
     if (trigger != "gameSystemContentsList")
     {
         if (this.SelectedObject == 0)
         {
             this.App.UI.ClearSelection("gameSystemContentsList");
         }
         else if (this.SelectedObject == StarSystemDetailsUI.StarItemID)
         {
             this.App.UI.SetSelection("gameSystemContentsList", this.SelectedObject);
         }
         else
         {
             OrbitalObjectInfo orbitalObjectInfo = this.App.GameDatabase.GetOrbitalObjectInfo(this.SelectedObject);
             if (!orbitalObjectInfo.ParentID.HasValue)
             {
                 this.App.UI.SetSelection("gameSystemContentsList", this.SelectedObject);
             }
             else
             {
                 IGameObject planetViewObject;
                 this._starsystem.PlanetMap.Reverse.TryGetValue(orbitalObjectInfo.ParentID.Value, out planetViewObject);
                 StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this._currentSystem, orbitalId, planetViewObject, this._planetView);
                 if (planetViewObject != null)
                 {
                     this.App.UI.SetSelection("gameSystemContentsList", orbitalObjectInfo.ParentID.Value);
                 }
                 else
                 {
                     this.App.UI.ClearSelection("gameSystemContentsList");
                 }
             }
         }
         this.Focus(this.SelectedObject);
     }
     StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this.CurrentSystem, this.SelectedObject, this.GetPlanetViewGameObject(this.CurrentSystem, this.SelectedObject), this._planetView);
     StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, "");
 }
示例#4
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (msgType == "edit_confirmed")
     {
         this.Confirm();
     }
     if (msgType == "button_clicked")
     {
         if (!(panelName == "event_dialog_close"))
         {
             return;
         }
         this.Confirm();
     }
     else if (msgType == "text_changed")
     {
         if (!(panelName == "gameColonyName"))
         {
             return;
         }
         this._enteredColonyName = msgParams[0];
     }
     else if (msgType == "slider_value")
     {
         if (StarSystemDetailsUI.IsOutputRateSlider(panelName))
         {
             StarSystemDetailsUI.SetOutputRate(this._app, this._planetID, panelName, msgParams[0]);
             StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName);
         }
         else if (panelName == "partOverharvestSlider")
         {
             ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID);
             colonyInfoForPlanet.OverharvestRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0]));
             this._app.GameDatabase.UpdateColony(colonyInfoForPlanet);
             StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName);
         }
         else if (panelName == "partCivSlider")
         {
             ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID);
             colonyInfoForPlanet.CivilianWeight = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0]));
             this._app.GameDatabase.UpdateColony(colonyInfoForPlanet);
             StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName);
         }
         else
         {
             if (!(panelName == "partWorkRate"))
             {
                 return;
             }
             ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID);
             colonyInfoForPlanet.SlaveWorkRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0]));
             this._app.GameDatabase.UpdateColony(colonyInfoForPlanet);
             StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName);
         }
     }
     else
     {
         if (!(msgType == "list_sel_changed") || !(panelName == "gameViewportList"))
         {
             return;
         }
         this.SetColonyViewMode(int.Parse(msgParams[0]));
     }
 }
示例#5
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (this._piechart.TryPanelMessage(panelName, msgType, msgParams, PanelBinding.PanelMessageTargetFlags.Self))
     {
         return;
     }
     if (msgType == "slider_value")
     {
         if (this.SelectedObject == StarSystemDetailsUI.StarItemID)
         {
             return;
         }
         if (StarSystemDetailsUI.IsOutputRateSlider(panelName))
         {
             StarSystemDetailsUI.SetOutputRate(this.App, this.SelectedObject, panelName, msgParams[0]);
             StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, "");
         }
         else if (panelName == "partOverharvestSlider")
         {
             ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(this.SelectedObject);
             colonyInfoForPlanet.OverharvestRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0]));
             this.App.GameDatabase.UpdateColony(colonyInfoForPlanet);
             StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, "");
         }
         else
         {
             if (!(panelName == "gameEmpireResearchSlider"))
             {
                 return;
             }
             StarMapState.SetEmpireResearchRate(this.App.Game, msgParams[0], this._piechart);
         }
     }
     else if (msgType == "button_clicked")
     {
         if (panelName == "gameEmpireSummaryButton")
         {
             this.App.SwitchGameState <EmpireSummaryState>();
         }
         else if (panelName == "btnAbandon")
         {
             this._confirmAbandon = this.App.UI.CreateDialog((Dialog) new GenericQuestionDialog(this.App, "@UI_DIALOGCONFIRMABANDON_TITLE", "@UI_DIALOGCONFIRMABANDON_DESC", "dialogGenericQuestion"), null);
         }
         else
         {
             if (!(panelName == "btnSystemOpen"))
             {
                 return;
             }
             bool isOpen = !this.App.GameDatabase.GetStarSystemInfo(this.CurrentSystem).IsOpen;
             this.App.GameDatabase.UpdateStarSystemOpen(this.CurrentSystem, isOpen);
             this.App.UI.SetVisible("SystemDetailsWidget.ClosedSystem", !isOpen);
             this.App.Game.OCSystemToggleData.SystemToggled(this.App.LocalPlayer.ID, this.CurrentSystem, isOpen);
         }
     }
     else
     {
         if (!(msgType == "dialog_closed") || !(panelName == this._confirmAbandon) || !bool.Parse(msgParams[0]))
         {
             return;
         }
         PlanetInfo planetInfo = this.App.GameDatabase.GetPlanetInfo(this.SelectedObject);
         if (planetInfo == null)
         {
             return;
         }
         GameSession.AbandonColony(this.App, this.App.GameDatabase.GetColonyInfoForPlanet(planetInfo.ID).ID);
     }
 }