示例#1
0
        protected override void OnCommitMission()
        {
            if (this._selectedPlanetForColonize == 0)
            {
                foreach (int starSystemPlanet in this.App.GameDatabase.GetStarSystemPlanets(this.TargetSystem))
                {
                    if (this.App.GameDatabase.CanColonizePlanet(this.App.LocalPlayer.ID, starSystemPlanet, this.App.GetStratModifier <int>(StratModifiers.MaxColonizableHazard, this.App.LocalPlayer.ID)))
                    {
                        this._selectedPlanetForColonize = starSystemPlanet;
                        break;
                    }
                }
            }
            if (this._selectedPlanetForColonize == 0)
            {
                return;
            }
            if (this._app.LocalPlayer.Faction.Name == "loa")
            {
                Kerberos.Sots.StarFleet.StarFleet.ConvertFleetIntoLoaCubes(this._app.Game, this._selectedFleet);
                Kerberos.Sots.StarFleet.StarFleet.BuildFleetFromComposition(this._app.Game, this._selectedFleet, MissionType.COLONIZATION);
                this.RebuildShipLists(this.SelectedFleet);
            }
            Kerberos.Sots.StarFleet.StarFleet.SetColonizationMission(this.App.Game, this.SelectedFleet, this.TargetSystem, this._useDirectRoute, this._selectedPlanetForColonize, this.GetDesignsToBuild(), this.RebaseTarget);
            AdmiralInfo admiralInfo = this.App.GameDatabase.GetAdmiralInfo(this.App.GameDatabase.GetFleetInfo(this._selectedFleet).AdmiralID);

            if (admiralInfo != null)
            {
                this.App.PostRequestSpeech(string.Format("STRAT_002-01_{0}_{1}ColonizationMissionConfirmation", (object)this.App.GameDatabase.GetFactionName(this.App.GameDatabase.GetPlayerFactionID(this.App.LocalPlayer.ID)), (object)admiralInfo.GetAdmiralSoundCueContext(this.App.AssetDatabase)), 50, 120, 0.0f);
            }
            FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
            this.App.GetGameState <StarMapState>().RefreshMission();
        }
示例#2
0
        protected override void OnCommitMission()
        {
            if (this._selectedPlanetToEvacuate == 0)
            {
                double num1 = 0.0;
                foreach (int num2 in this.App.GameDatabase.GetStarSystemPlanets(this.TargetSystem).ToList <int>())
                {
                    ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(num2);
                    if (colonyInfoForPlanet != null && colonyInfoForPlanet.PlayerID == this.App.LocalPlayer.ID)
                    {
                        double civilianPopulation = this.App.GameDatabase.GetCivilianPopulation(num2, 0, false);
                        if (civilianPopulation > num1)
                        {
                            this._selectedPlanetToEvacuate = num2;
                            num1 = civilianPopulation;
                        }
                    }
                }
            }
            if (this._selectedPlanetToEvacuate == 0)
            {
                return;
            }
            Kerberos.Sots.StarFleet.StarFleet.SetEvacuationMission(this.App.Game, this.SelectedFleet, this.TargetSystem, this._useDirectRoute, this._selectedPlanetToEvacuate, this.GetDesignsToBuild());
            AdmiralInfo admiralInfo = this.App.GameDatabase.GetAdmiralInfo(this.App.GameDatabase.GetFleetInfo(this._selectedFleet).AdmiralID);

            if (admiralInfo != null)
            {
                this.App.PostRequestSpeech(string.Format("STRAT_002-01_{0}_{1}EvacuationMissionConfirmation", (object)this.App.GameDatabase.GetFactionName(this.App.GameDatabase.GetPlayerFactionID(this.App.LocalPlayer.ID)), (object)admiralInfo.GetAdmiralSoundCueContext(this.App.AssetDatabase)), 50, 120, 0.0f);
            }
            FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
            this.App.GetGameState <StarMapState>().RefreshStarmap(StarMapState.StarMapRefreshType.REFRESH_NORMAL);
        }
示例#3
0
        protected override void OnRefreshMissionDetails(MissionEstimate estimate)
        {
            this.AddCommonMissionTimes(estimate);
            string hint1 = App.Localize("@MISSIONWIDGET_TOOLTIP_COLONIZATION_TIME");

            this.AddMissionTime(2, App.Localize("@MISSIONWIDGET_COLONIZATION_TIME"), estimate.TurnsAtTarget, hint1);
            string hint2 = App.Localize("@COLONIZEMISSION_HINT");

            this.AddMissionTime(6, App.Localize("@MISSIONWIDGET_SUPPORT_TIME"), estimate.TurnsColonySupport, hint2);
            this.AddMissionCost(estimate);
            int num = estimate.TurnsTillPhase1Completion;

            if (num < 1)
            {
                num = 1;
            }
            string str = num == 1 ? App.Localize("@UI_GENERAL_TURN") : App.Localize("@UI_GENERAL_TURNS");

            this.AddMissionNote(string.Format(App.Localize("@MISSIONWIDGET_PHASE_ONE"), (object)num, (object)str));
            if (!this._fleetCentric)
            {
                return;
            }
            FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
        }
示例#4
0
        protected override void OnEnter()
        {
            base.OnEnter();
            this._planetWidget = new PlanetWidget(this.App, this.App.UI.Path(this.ID, "planetDetailsCard"));
            IEnumerable <int> missionTargetPlanets = this.GetMissionTargetPlanets();

            FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), missionTargetPlanets);
            this.App.UI.SetEnabled("gameConfirmMissionButton", false);
            if (missionTargetPlanets.Count <int>() <= 0)
            {
                return;
            }
            this.SetSelectedPlanet(missionTargetPlanets.First <int>(), "");
        }
示例#5
0
 public static void SyncFleetAndPlanetListWidget(
     GameSession game,
     string panelName,
     int systemId,
     bool show = true)
 {
     if (systemId == 0)
     {
         game.UI.SetVisible(panelName, false);
     }
     else
     {
         bool               flag1 = game.GameDatabase.IsSurveyed(game.LocalPlayer.ID, systemId);
         List <FleetInfo>   list1 = game.GameDatabase.GetFleetInfoBySystemID(systemId, FleetType.FL_NORMAL | FleetType.FL_RESERVE | FleetType.FL_GATE | FleetType.FL_ACCELERATOR).ToList <FleetInfo>();
         List <StationInfo> list2 = game.GameDatabase.GetStationForSystemAndPlayer(systemId, game.LocalPlayer.ID).ToList <StationInfo>();
         bool               flag2 = true;
         if (!game.SystemHasPlayerColony(systemId, game.LocalPlayer.ID) && !StarMap.IsInRange(game.GameDatabase, game.LocalPlayer.ID, game.GameDatabase.GetStarSystemInfo(systemId), (Dictionary <int, List <ShipInfo> >)null))
         {
             flag2 = false;
         }
         List <int> list3 = game.GameDatabase.GetStarSystemPlanets(systemId).ToList <int>();
         if (list1.Count == 0 && list2.Count == 0 && !flag1 || !flag2 && !flag1)
         {
             game.UI.SetVisible(panelName, false);
         }
         else
         {
             bool flag3 = FleetUI.ShowFleetListDefault;
             bool flag4 = (list1.Count <FleetInfo>() != 0 && flag2 || list2.Count != 0) && show;
             bool flag5 = list3.Count <int>() != 0 && flag1 && show;
             if (flag3 && !flag4)
             {
                 flag3 = false;
             }
             else if (!flag3 && !flag5)
             {
                 flag3 = true;
             }
             game.UI.SetEnabled("planetsTab", flag5);
             game.UI.SetVisible("partSystemPlanets", flag5 && !flag3);
             game.UI.SetChecked("planetsTab", flag5 && !flag3);
             game.UI.SetEnabled("fleetsTab", flag4);
             game.UI.SetChecked("fleetsTab", flag4 && flag3);
             game.UI.SetVisible("partSystemFleets", flag4 && flag3);
             game.UI.SetVisible(panelName, show);
             FleetUI.SyncPlanetListControl(game, "partSystemPlanets", systemId, (IEnumerable <int>)list3);
         }
     }
 }
示例#6
0
 public static void SyncFleetAndPlanetListWidget(
     GameSession game,
     string panelName,
     int systemId,
     IEnumerable <FleetInfo> fleets,
     IEnumerable <int> orbitalObjectIds,
     bool show = true)
 {
     if (systemId == 0 || fleets.Count <FleetInfo>() == 0 && orbitalObjectIds.Count <int>() == 0)
     {
         game.UI.SetVisible(panelName, false);
     }
     else
     {
         if (fleets.Count <FleetInfo>() == 0)
         {
             game.UI.SetVisible("fleetsTab", false);
         }
         else
         {
             game.UI.SetVisible("fleetsTab", show);
         }
         if (orbitalObjectIds.Count <int>() == 0)
         {
             game.UI.SetVisible("planetsTab", false);
             game.UI.SetPropertyInt("fleetsTab", "left", 30);
         }
         else
         {
             game.UI.SetVisible("planetsTab", show);
             game.UI.SetPropertyInt("fleetsTab", "left", 115);
         }
         game.UI.AutoSize("fleetsTab");
         game.UI.SetVisible(panelName, show);
         FleetUI.SyncPlanetListControl(game, "partSystemPlanets", systemId, orbitalObjectIds);
     }
 }
 protected override void OnRefreshMissionDetails(MissionEstimate estimate)
 {
     this.AddCommonMissionTimes(estimate);
     this.AddMissionCost(estimate);
     FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
 }