protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (this._piechart.TryPanelMessage(panelName, msgType, msgParams, PanelBinding.PanelMessageTargetFlags.Self) || !(msgType == "button_clicked"))
     {
         return;
     }
     if (panelName == StationPlacementState.UICancelButton)
     {
         this.App.GetGameState <StarMapState>().ShowInterface     = true;
         this.App.GetGameState <StarMapState>().RightClickEnabled = true;
         this.App.UI.Send((object)"SetWidthProp", (object)"OH_StarMap", (object)"parent:width");
         this.App.SwitchGameState <StarMapState>();
     }
     else
     {
         if (!(panelName == StationPlacementState.UICommitButton))
         {
             return;
         }
         OverlayConstructionMission.OnConstructionPlaced(this._sim, this._selectedFleetID, this._targetSystemID, this._useDirectRoute, this._selectedPlanetID, this._designsToBuild, this._stationType, this._rebase, true);
         this.App.GetGameState <StarMapState>().ShowInterface     = true;
         this.App.GetGameState <StarMapState>().RightClickEnabled = true;
         this.App.UI.Send((object)"SetWidthProp", (object)"OH_StarMap", (object)"parent:width");
         this.App.SwitchGameState <StarMapState>();
     }
 }
        protected override void OnEnter()
        {
            base.OnEnter();
            this._crits.Activate();
            this._dummies.Activate();
            this.App.UI.UnlockUI();
            this.App.UI.SetScreen("StationPlacement");
            this.App.UI.SetPropertyBool("gameCancelMissionButton", "lockout_button", true);
            this.App.UI.SetPropertyBool("gameConfirmMissionButton", "lockout_button", true);
            this.App.UI.SetPropertyBool("gameExitButton", "lockout_button", true);
            this._piechart = new BudgetPiechart(this.App.UI, "piechart", this.App.AssetDatabase);
            EmpireBarUI.SyncTitleFrame(this.App);
            EmpireBarUI.SyncTitleBar(this.App, "gameEmpireBar", this._piechart);
            this.Camera.DesiredPitch    = MathHelper.DegreesToRadians(-40f);
            this.Camera.DesiredDistance = 80000f;
            this.Camera.MinPitch        = MathHelper.DegreesToRadians(-60f);
            this.Camera.MaxPitch        = MathHelper.DegreesToRadians(-20f);
            this._manager.Active        = true;
            this._starsystem.SetAutoDrawEnabled(false);
            bool flag = false;

            if (this._stationType == StationType.MINING)
            {
                int?planetForStation = StarSystem.GetSuitablePlanetForStation(this.App.Game, this.App.LocalPlayer.ID, this._targetSystemID, this._stationType);
                if (planetForStation.HasValue)
                {
                    this.SetSelectedObject(planetForStation.Value, "");
                    flag = true;
                }
            }
            else
            {
                foreach (PlanetInfo planetInfo in this.App.GameDatabase.GetPlanetInfosOrbitingStar(this._targetSystemID))
                {
                    if (planetInfo != null)
                    {
                        ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(planetInfo.ID);
                        if (colonyInfoForPlanet != null && colonyInfoForPlanet.PlayerID == this.App.LocalPlayer.ID)
                        {
                            this.SetSelectedObject(planetInfo.ID, "");
                            flag = true;
                            break;
                        }
                    }
                }
            }
            if (!flag)
            {
                this.SetSelectedObject(-1, "");
            }
            StationPlacementState.RefreshFleetAdmiralDetails(this.App, this._selectedFleetID);
            OverlayConstructionMission.RefreshMissionUI(this.App, this._selectedPlanetID, this._targetSystemID);
            OverlayConstructionMission.ReRefreshMissionDetails(this.App, this._missionEstimate);
            this.App.UI.AutoSizeContents("gameMissionDetails");
        }