Ejemplo n.º 1
0
 public static bool IsInRange(
     GameDatabase db,
     int playerid,
     StarSystemInfo ssi,
     Dictionary <int, List <ShipInfo> > cachedFleetShips = null)
 {
     return(StarMap.IsInRange(db, playerid, ssi.Origin, 1f, cachedFleetShips));
 }
Ejemplo n.º 2
0
        public SwarmerSpawnerControl(App game, Ship ship, int systemId)
        {
            this.m_Game           = game;
            this.m_SwarmerSpawner = ship;
            StarSystemInfo starSystemInfo = game.GameDatabase.GetStarSystemInfo(systemId);

            this.m_IsDeepSpace = starSystemInfo != (StarSystemInfo)null && starSystemInfo.IsDeepSpace;
        }
Ejemplo n.º 3
0
 public void SetMissionEffectTarget(StarSystemInfo sys, bool value)
 {
     if (!this.Systems.Reverse.Keys.Contains <int>(sys.ID))
     {
         return;
     }
     this.SetSystemIsMissionTarget(this.Systems.Reverse[sys.ID], value, this._db.GetPlayerInfo(this._sim.LocalPlayer.ID).PrimaryColor);
 }
Ejemplo n.º 4
0
        private void UpdateScoutMission(
            GameSession game,
            LocustSwarmInfo info,
            FleetInfo fleet,
            StarSystemInfo currentSystem,
            bool nestWaitingToGroupUp)
        {
            List <LocustSwarmScoutInfo> list1 = game.GameDatabase.GetLocustSwarmScoutsForLocustNest(info.Id).ToList <LocustSwarmScoutInfo>();

            if (list1.Count == 0)
            {
                return;
            }
            List <int> scoutedSystems = new List <int>();
            List <LocustSwarmScoutTargetInfo> list2 = game.GameDatabase.GetLocustSwarmScoutTargetInfos().ToList <LocustSwarmScoutTargetInfo>();
            List <LocustSwarmScoutInfo>       list3 = game.GameDatabase.GetLocustSwarmScoutInfos().ToList <LocustSwarmScoutInfo>();

            scoutedSystems.AddRange((IEnumerable <int>)list2.Select <LocustSwarmScoutTargetInfo, int>((Func <LocustSwarmScoutTargetInfo, int>)(x => x.SystemId)).ToList <int>());
            foreach (LocustSwarmScoutInfo locustSwarmScoutInfo in list3)
            {
                if (locustSwarmScoutInfo.TargetSystemId != 0 && !scoutedSystems.Contains(locustSwarmScoutInfo.TargetSystemId))
                {
                    scoutedSystems.Add(locustSwarmScoutInfo.TargetSystemId);
                }
            }
            int num1 = list1.Where <LocustSwarmScoutInfo>((Func <LocustSwarmScoutInfo, bool>)(x => x.TargetSystemId == currentSystem.ID)).Count <LocustSwarmScoutInfo>();

            foreach (LocustSwarmScoutInfo locustSwarmScoutInfo in list1)
            {
                ShipInfo shipInfo = game.GameDatabase.GetShipInfo(locustSwarmScoutInfo.ShipId, false);
                if (nestWaitingToGroupUp)
                {
                    if (shipInfo.FleetID != fleet.ID && game.GameDatabase.GetMissionByFleetID(shipInfo.FleetID) == null)
                    {
                        game.GameDatabase.TransferShip(locustSwarmScoutInfo.ShipId, fleet.ID);
                        Vector3 vector3 = new Vector3();
                        vector3.Y = 0.0f;
                        float num2 = (float)(((num1 + 1) % 5 + 1) / 2);
                        float num3 = (num1 + 1) % 2 == 0 ? 1f : -1f;
                        vector3.Z = -300f * num2;
                        vector3.X = num3 * 500f * num2;
                        game.GameDatabase.UpdateShipFleetPosition(locustSwarmScoutInfo.ShipId, new Vector3?(vector3));
                        locustSwarmScoutInfo.TargetSystemId = fleet.SystemID;
                        game.GameDatabase.UpdateLocustSwarmScoutInfo(locustSwarmScoutInfo);
                        game.GameDatabase.RemoveFleet(shipInfo.FleetID);
                        ++num1;
                    }
                }
                else if (shipInfo.FleetID == fleet.ID || game.GameDatabase.GetMissionByFleetID(shipInfo.FleetID) == null)
                {
                    int num2 = this.SetNextScoutTarget(game, info, currentSystem, locustSwarmScoutInfo, scoutedSystems);
                    if (!scoutedSystems.Contains(num2))
                    {
                        scoutedSystems.Add(num2);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected void SetSyncedSystem(StarSystemInfo system)
        {
            this.App.UI.ClearItems("system_list");
            this.App.UI.ClearDisabledItems("system_list");
            foreach (SystemWidget systemWidget in this._systemWidgets)
            {
                systemWidget.Terminate();
            }
            foreach (PlanetWidget planetWidget in this._planetWidgets)
            {
                planetWidget.Terminate();
            }
            this._planetWidgets.Clear();
            List <PlanetInfo> planetInfoList = this.FilteredPlanetList(system);

            this.App.UI.AddItem("system_list", "", system.ID, "", "systemTitleCard");
            this._systemWidgets.Add(new SystemWidget(this.App, this.App.UI.GetItemGlobalID("system_list", "", system.ID, "")));
            this._systemWidgets.Last <SystemWidget>().Sync(system.ID);
            PlayerInfo playerInfo = this.App.GameDatabase.GetPlayerInfo(this.App.LocalPlayer.ID);

            foreach (PlanetInfo planetInfo in planetInfoList)
            {
                PlanetInfo planet = planetInfo;
                if (this.App.AssetDatabase.IsPotentialyHabitable(planet.Type))
                {
                    this.App.UI.AddItem("system_list", "", planet.ID + 999999, "", "planetDetailsM_Card");
                    this._planetWidgets.Add(new PlanetWidget(this.App, this.App.UI.GetItemGlobalID("system_list", "", planet.ID + 999999, "")));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planet.ID, false, false);
                    string itemGlobalId = this.App.UI.GetItemGlobalID("system_list", "", planet.ID + 999999, "");
                    this.App.UI.SetPropertyString(this.UI.Path(itemGlobalId, "applyTrap"), "id", "applyTrap|" + planet.ID.ToString());
                    if (this._existingTraps.Any <ColonyTrapInfo>((Func <ColonyTrapInfo, bool>)(x => x.PlanetID == planet.ID)))
                    {
                        this.App.UI.SetChecked("applyTrap|" + planet.ID.ToString(), true);
                        this.App.UI.SetPropertyBool("applyTrap|" + planet.ID.ToString(), "input_enabled", false);
                    }
                    else
                    {
                        this.App.UI.SetChecked("applyTrap|" + planet.ID.ToString(), false);
                    }
                    if (this.App.GameDatabase.GetColonyInfoForPlanet(planet.ID) == null && this.App.AssetDatabase.GetFaction(playerInfo.FactionID).Name.ToLower() == "morrigi")
                    {
                        this.App.UI.SetVisible(this.UI.Path(itemGlobalId, "applyTrap|" + planet.ID.ToString()), true);
                    }
                }
                else if (this.App.AssetDatabase.IsGasGiant(planet.Type))
                {
                    this.App.UI.AddItem("system_list", "", planet.ID + 999999, "", "gasgiantDetailsM_Card");
                    this._planetWidgets.Add(new PlanetWidget(this.App, this.App.UI.GetItemGlobalID("system_list", "", planet.ID + 999999, "")));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planet.ID, false, false);
                }
                else if (this.App.AssetDatabase.IsMoon(planet.Type))
                {
                    this.App.UI.AddItem("system_list", "", planet.ID + 999999, "", "moonDetailsM_Card");
                    this._planetWidgets.Add(new PlanetWidget(this.App, this.App.UI.GetItemGlobalID("system_list", "", planet.ID + 999999, "")));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planet.ID, false, false);
                }
            }
        }
Ejemplo n.º 6
0
        public void Sync(int planetID, bool PopulationSliders = false, bool ShowColonizebuttons = false)
        {
            StarSystemUI.ClearColonyDetailsControl(this.App.Game, this._rootPanel);
            PlanetInfo planetInfo = this.App.GameDatabase.GetPlanetInfo(planetID);

            if (planetInfo == null)
            {
                return;
            }
            this._planetID = planetID;
            this.CachePlanet(planetInfo);
            StarSystemUI.SyncPlanetDetailsControlNew(this.App.Game, this._rootPanel, planetID);
            this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "systemName"), "text", this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(planetInfo.ID).StarSystemID).Name);
            ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(planetID);

            this.App.UI.SetVisible(this.App.UI.Path(this._rootPanel, "rebellionActive"), (colonyInfoForPlanet != null ? (colonyInfoForPlanet.PlayerID != this.App.LocalPlayer.ID ? 0 : (colonyInfoForPlanet.RebellionType != RebellionType.None ? 1 : 0)) : 0) != 0);
            int num1 = 0;

            if (colonyInfoForPlanet != null && colonyInfoForPlanet.PlayerID == this.App.LocalPlayer.ID)
            {
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partOverharvestSlider"), "id", "__partOverharvestSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partTradeSlider"), "id", "__partTradeSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partTerraSlider"), "id", "__partTerraSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partInfraSlider"), "id", "__partInfraSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partShipConSlider"), "id", "__partShipConSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partCivSlider"), "id", "__partCivSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString());
                StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfoForPlanet.ID, this._widgetID, "");
                this.App.UI.SetPropertyBool(this._rootPanel, "expanded", true);
                if (!PopulationSliders)
                {
                    return;
                }
                foreach (ColonyFactionInfo faction1 in colonyInfoForPlanet.Factions)
                {
                    this.App.UI.AddItem(this.App.UI.Path(this._rootPanel, "MoraleRow"), "", faction1.FactionID, "", "popItem");
                    string itemGlobalId = this.App.UI.GetItemGlobalID(this.App.UI.Path(this._rootPanel, "MoraleRow"), "", faction1.FactionID, "");
                    this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "partPopSlider"), "id", "__partPopSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString() + "|" + (object)faction1.FactionID);
                    Faction faction2 = this.App.AssetDatabase.GetFaction(faction1.FactionID);
                    this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "factionicon"), "sprite", "logo_" + faction2.Name.ToLower());
                    this.App.UI.SetSliderValue(this.App.UI.Path(itemGlobalId, "__partPopSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString() + "|" + (object)faction1.FactionID), (int)((double)faction1.CivPopWeight * 100.0));
                    this.App.UI.SetText(this.App.UI.Path(itemGlobalId, "gameMorale_human"), faction1.Morale.ToString());
                    double num2 = (colonyInfoForPlanet.CurrentStage == Kerberos.Sots.Data.ColonyStage.GemWorld ? Colony.GetMaxCivilianPop(this.App.GameDatabase, planetInfo) * (double)this.App.AssetDatabase.GemWorldCivMaxBonus : Colony.GetMaxCivilianPop(this.App.GameDatabase, planetInfo)) * (double)colonyInfoForPlanet.CivilianWeight * (double)faction1.CivPopWeight * (double)this.App.AssetDatabase.GetFaction(this.App.GameDatabase.GetPlayerFactionID(colonyInfoForPlanet.PlayerID)).GetImmigrationPopBonusValueForFaction(this.App.AssetDatabase.GetFaction(faction1.FactionID));
                    this.App.UI.SetText(this.App.UI.Path(itemGlobalId, "popRatio"), (faction1.CivilianPop / 1000000.0).ToString("0.0") + "M / " + (num2 / 1000000.0).ToString("0.0") + "M");
                    ++num1;
                }
                this.App.UI.SetShape(this._rootPanel, 0, 0, 360, 90 + 22 * (((IEnumerable <ColonyFactionInfo>)colonyInfoForPlanet.Factions).Count <ColonyFactionInfo>() > 1 ? ((IEnumerable <ColonyFactionInfo>)colonyInfoForPlanet.Factions).Count <ColonyFactionInfo>() : 0));
            }
            else
            {
                if (colonyInfoForPlanet != null || !ShowColonizebuttons || !(this.App.CurrentState.GetType() == typeof(StarMapState)))
                {
                    return;
                }
                StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(planetInfo.ID).StarSystemID);
                this.App.UI.SetVisible(this.App.UI.Path(this._rootPanel, "btnColoninzePlanet"), (Kerberos.Sots.StarFleet.StarFleet.CollectAvailableFleets(this.App.Game, this.App.LocalPlayer.ID, starSystemInfo.ID, MissionType.COLONIZATION, false).Any <FleetInfo>() && StarSystemDetailsUI.CollectPlanetListItemsForColonizeMission(this.App, starSystemInfo.ID, this.App.LocalPlayer.ID).Contains <int>(planetID) ? 1 : 0) != 0);
                this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "btnColoninzePlanet"), "id", "btnColoninzePlanet|" + starSystemInfo.ID.ToString() + "|" + planetInfo.ID.ToString());
            }
        }
Ejemplo n.º 7
0
        public static List <StarSystemInfo> GetClosestStars(
            GameDatabase game,
            StarSystemInfo systemInfo)
        {
            List <StarSystemInfo> list = game.GetStarSystemInfos().ToList <StarSystemInfo>().OrderBy <StarSystemInfo, float>((Func <StarSystemInfo, float>)(x => (x.Origin - systemInfo.Origin).LengthSquared)).ToList <StarSystemInfo>();

            list.RemoveAll((Predicate <StarSystemInfo>)(x => x.ID == systemInfo.ID));
            return(list);
        }
Ejemplo n.º 8
0
    public static GameObject CreateSystem(int seed)
    {
        GameObject newSystem = new GameObject("StarSystem");

        Random.InitState(seed);

        StarSystemInfo ssi = GetStarSystemInfo(seed);



        int numberOfBodies = ssi.numberOfPlanets;

        if (ssi.asteroidBelt)
        {
            numberOfBodies++;
        }



        GameObject newStar = CelestialBody.CreateStar(Vector3.zero, Random.Range(0, 99999), ssi.starType);

        newStar.transform.parent = newSystem.transform;



        for (int i = 0; i < numberOfBodies; i++)
        {
            if (ssi.asteroidBelt)
            {
                if (Random.Range(0, 100) > 50)
                {
                    AddAsteroidBelt(i).transform.parent = newSystem.transform;
                    ssi.asteroidBelt = false;
                }
                else if (i == (numberOfBodies - 1))
                {
                    AddAsteroidBelt(i).transform.parent = newSystem.transform;
                    ssi.asteroidBelt = false;
                }
                else
                {
                    AddPlanet(i).transform.parent = newSystem.transform;
                }
            }
            else
            {
                AddPlanet(i).transform.parent = newSystem.transform;
            }
        }



        CreateSystemEdgeRing(ssi.systemSize).transform.parent = newSystem.transform;


        return(newSystem);
    }
Ejemplo n.º 9
0
        public override void Initialize()
        {
            this._app.UI.SetText(this._app.UI.Path(this.ID, SuperWorldDialog.UIGemDesc), string.Format(App.Localize("@UI_DIALOGSUPERWORLD_GEM_DESC"), (object)this._app.AssetDatabase.GemWorldCivMaxBonus));
            this._app.UI.SetText(this._app.UI.Path(this.ID, SuperWorldDialog.UIForgeDesc), string.Format(App.Localize("@UI_DIALOGSUPERWORLD_FORGE_DESC"), (object)this._app.AssetDatabase.ForgeWorldImpMaxBonus, (object)this._app.AssetDatabase.ForgeWorldIOBonus));
            OrbitalObjectInfo orbitalObjectInfo = this._app.GameDatabase.GetOrbitalObjectInfo(this._app.GameDatabase.GetColonyInfo(this.colonyId).OrbitalObjectID);
            StarSystemInfo    starSystemInfo    = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo.StarSystemID);

            this._app.UI.SetText(this._app.UI.Path(this.ID, SuperWorldDialog.UILocation), string.Format(App.Localize("@UI_DIALOGSUPERWORLD_LOCATION"), (object)orbitalObjectInfo.Name, (object)starSystemInfo.Name));
        }
Ejemplo n.º 10
0
 private static void InsertIndependentSystem(
     Random random,
     StarSystemInfo system,
     OrbitalObjectInfo orbit,
     GameDatabase gamedb,
     AssetDatabase assetdb)
 {
     ScriptModules.GenerateIndependentRace(random, system, orbit, gamedb, assetdb);
 }
Ejemplo n.º 11
0
 private void CacheStar(StarSystemInfo systemInfo)
 {
     if (this._cachedStar != null)
     {
         this.App.ReleaseObject((IGameObject)this._cachedStar);
         this._cachedStar = (StarModel)null;
     }
     this._cachedStarReady = false;
     this._cachedStar      = Kerberos.Sots.GameStates.StarSystem.CreateStar(this.App, Vector3.Zero, systemInfo, 1f, false);
     this._cachedStar.PostSetProp("AutoDraw", false);
 }
Ejemplo n.º 12
0
        public void Process(App game, int systemId)
        {
            if (systemId == 0)
            {
                return;
            }
            GameDatabase   gameDatabase   = game.GameDatabase;
            StarSystemInfo starSystemInfo = gameDatabase.GetStarSystemInfo(systemId);

            gameDatabase.GetStarSystemOrbitalObjectInfos(systemId);
            if (this.OnStar != null)
            {
                this.OnStar(starSystemInfo);
            }
            if (this.OnPlanet != null)
            {
                foreach (PlanetInfo systemPlanetInfo in gameDatabase.GetStarSystemPlanetInfos(systemId))
                {
                    Matrix orbitalTransform = gameDatabase.GetOrbitalTransform(systemPlanetInfo.ID);
                    this.OnPlanet(systemPlanetInfo, orbitalTransform);
                }
            }
            if (this.OnFleet == null && this.OnShip == null)
            {
                return;
            }
            IEnumerable <FleetInfo> fleetInfoBySystemId = gameDatabase.GetFleetInfoBySystemID(systemId, FleetType.FL_NORMAL);

            if (this.OnFleet != null)
            {
                foreach (FleetInfo fleetInfo in fleetInfoBySystemId)
                {
                    Matrix translation = Matrix.CreateTranslation(this.GetSpawnPointForPlayer(fleetInfo.PlayerID, systemId));
                    this.OnFleet(fleetInfo, translation);
                }
            }
            if (this.OnShip == null)
            {
                return;
            }
            Vector3 vector3_1 = new Vector3(200f, 0.0f, 0.0f);

            foreach (FleetInfo fleetInfo in fleetInfoBySystemId)
            {
                Vector3 vector3_2 = this.GetSpawnPointForPlayer(fleetInfo.PlayerID, systemId) + vector3_1 * (float)fleetInfo.ID;
                foreach (ShipInfo shipInfo in gameDatabase.GetShipInfoByFleetID(fleetInfo.ID, false).ToList <ShipInfo>())
                {
                    Vector3 trans = vector3_2;
                    vector3_2 += vector3_1;
                    Matrix translation = Matrix.CreateTranslation(trans);
                    this.OnShip(fleetInfo, shipInfo, translation);
                }
            }
        }
Ejemplo n.º 13
0
        protected void SetSyncedSystem(StarSystemInfo system)
        {
            this._selectedSystem = system;
            if (this._app.CurrentState.Name == "StarMapState")
            {
                StarMapState currentState = (StarMapState)this._app.CurrentState;
                currentState.StarMap.SetFocus((IGameObject)currentState.StarMap.Systems.Reverse[system.ID]);
                currentState.StarMap.Select((IGameObject)currentState.StarMap.Systems.Reverse[system.ID]);
            }
            this.App.UI.ClearItems("system_list");
            foreach (SystemWidget systemWidget in this._systemWidgets)
            {
                systemWidget.Terminate();
            }
            this._systemWidgets.Clear();
            foreach (PlanetWidget planetWidget in this._planetWidgets)
            {
                planetWidget.Terminate();
            }
            this._planetWidgets.Clear();
            this.App.UI.ClearItems("system_list");
            List <PlanetInfo> planetInfoList = this.FilteredPlanetList(system);

            this.App.UI.AddItem("system_list", "", system.ID, "", "systemTitleCard");
            this._systemWidgets.Add(new SystemWidget(this.App, this.App.UI.GetItemGlobalID("system_list", "", system.ID, "")));
            this._systemWidgets.Last <SystemWidget>().Sync(system.ID);
            foreach (PlanetInfo planetInfo in planetInfoList)
            {
                if (this.App.AssetDatabase.IsPotentialyHabitable(planetInfo.Type))
                {
                    this.App.UI.AddItem("system_list", "", planetInfo.ID + 999999, "", "planetDetailsM_Card");
                    string itemGlobalId = this.App.UI.GetItemGlobalID("system_list", "", planetInfo.ID + 999999, "");
                    this._planetWidgets.Add(new PlanetWidget(this.App, itemGlobalId));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planetInfo.ID, false, true);
                    this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "MoraleRow"), "id", "MoraleRow|" + (object)planetInfo.ID);
                }
                else if (this.App.AssetDatabase.IsGasGiant(planetInfo.Type))
                {
                    this.App.UI.AddItem("system_list", "", planetInfo.ID + 999999, "", "gasgiantDetailsM_Card");
                    string itemGlobalId = this.App.UI.GetItemGlobalID("system_list", "", planetInfo.ID + 999999, "");
                    this._planetWidgets.Add(new PlanetWidget(this.App, itemGlobalId));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planetInfo.ID, false, false);
                    this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "MoraleRow"), "id", "MoraleRow|" + (object)planetInfo.ID);
                }
                else if (this.App.AssetDatabase.IsMoon(planetInfo.Type))
                {
                    this.App.UI.AddItem("system_list", "", planetInfo.ID + 999999, "", "moonDetailsM_Card");
                    string itemGlobalId = this.App.UI.GetItemGlobalID("system_list", "", planetInfo.ID + 999999, "");
                    this._planetWidgets.Add(new PlanetWidget(this.App, itemGlobalId));
                    this._planetWidgets.Last <PlanetWidget>().Sync(planetInfo.ID, false, false);
                    this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "MoraleRow"), "id", "MoraleRow|" + (object)planetInfo.ID);
                }
            }
        }
Ejemplo n.º 14
0
        protected void SyncStationList()
        {
            this.App.UI.ClearItems("station_list");
            this.App.UI.ClearItems("stationModules");
            this.App.UI.ClearItems("moduleQue");
            this.App.UI.SetText("queueCost", "");
            this.App.UI.SetText("turnsToComplete", "");
            this.App.UI.SetPropertyString("moduleDescriptionText", "text", "");
            List <StationInfo> source = this._systemID == 0 ? this.App.GameDatabase.GetStationInfosByPlayerID(this.App.Game.LocalPlayer.ID).ToList <StationInfo>() : this.App.GameDatabase.GetStationForSystemAndPlayer(this._systemID, this.App.Game.LocalPlayer.ID).ToList <StationInfo>();

            foreach (StationInfo stationInfo in new List <StationInfo>((IEnumerable <StationInfo>)source))
            {
                if (!StationManagerDialog.StationViewFilter[stationInfo.DesignInfo.StationType])
                {
                    source.Remove(stationInfo);
                }
            }
            foreach (SystemWidget systemWidget in this._systemWidgets)
            {
                systemWidget.Terminate();
            }
            this._systemWidgets.Clear();
            List <int> intList = new List <int>();

            source.RemoveAll((Predicate <StationInfo>)(x => this.App.GameDatabase.GetOrbitalObjectInfo(x.OrbitalObjectID) == null));
            foreach (StationInfo stationInfo in source.OrderBy <StationInfo, string>((Func <StationInfo, string>)(x => this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(x.OrbitalObjectID).StarSystemID).Name)).ToList <StationInfo>())
            {
                if (stationInfo.DesignInfo.StationLevel > 0 && (stationInfo.DesignInfo.StationType == this._currentFilterMode || this._currentFilterMode == StationType.INVALID_TYPE))
                {
                    int starSystemId = this.App.GameDatabase.GetOrbitalObjectInfo(stationInfo.OrbitalObjectID).StarSystemID;
                    if (!intList.Contains(starSystemId))
                    {
                        StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(starSystemId);
                        if (!(starSystemInfo == (StarSystemInfo)null) && !starSystemInfo.IsDeepSpace)
                        {
                            this.App.UI.AddItem("station_list", "", starSystemId + 999999, "", "systemTitleCard");
                            string itemGlobalId = this.App.UI.GetItemGlobalID("station_list", "", starSystemId + 999999, "");
                            intList.Add(starSystemId);
                            this._systemWidgets.Add(new SystemWidget(this.App, itemGlobalId));
                            this._systemWidgets.Last <SystemWidget>().Sync(starSystemId);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    this.App.UI.AddItem("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty, "navalStation_DetailsCard");
                    this._selectedStation = stationInfo;
                    this.SyncStationProgress();
                    StationUI.SyncStationDetailsWidget(this.App.Game, this.App.UI.GetItemGlobalID("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty), stationInfo.OrbitalObjectID, true);
                }
            }
        }
Ejemplo n.º 15
0
        public override void Initialize()
        {
            StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID);

            this._crits             = new GameObjectSet(this._app);
            this._existingTraps     = this.App.GameDatabase.GetColonyTrapInfosAtSystem(this._systemID).Where <ColonyTrapInfo>((Func <ColonyTrapInfo, bool>)(x => this.App.GameDatabase.GetFleetInfo(x.FleetID).PlayerID == this.App.LocalPlayer.ID)).ToList <ColonyTrapInfo>();
            this._placedTraps       = new List <int>();
            this._currentFilterMode = DialogColonyTrap.PlanetFilterMode.AllPlanets;
            this._planetWidgets     = new List <PlanetWidget>();
            this.SetSyncedSystem(starSystemInfo);
            this.UpdateNumRemainingTraps();
        }
Ejemplo n.º 16
0
        protected override StarMapSystem CreateSystem(
            GameObjectSet gos,
            StarSystemInfo oi,
            StarMapBase.SyncContext context)
        {
            StellarClass      stellarClass  = StellarClass.Parse(oi.StellarClass);
            StarDisplayParams displayParams = StarHelper.GetDisplayParams(stellarClass);
            StarMapSystem     starMapSystem = new StarMapSystem(gos.App, displayParams.AssetPath, oi.Origin, StarHelper.CalcRadius(stellarClass.Size) / StarSystemVars.Instance.StarRadiusIa, oi.Name);

            gos.Add((IGameObject)starMapSystem);
            return(starMapSystem);
        }
Ejemplo n.º 17
0
        protected override StarMapSystem CreateSystem(
            GameObjectSet gos,
            StarSystemInfo oi,
            StarMapBase.SyncContext context)
        {
            StellarClass  stellarClass  = StellarClass.Parse(oi.StellarClass);
            StarMapSystem starMapSystem = new StarMapSystem(this.App, StarHelper.GetDisplayParams(stellarClass).AssetPath, oi.Origin, StarHelper.CalcRadius(stellarClass.Size) / StarSystemVars.Instance.StarRadiusIa, oi.Name);

            starMapSystem.SetSensorRange(this._sim.GameDatabase.GetSystemStratSensorRange(oi.ID, this._sim.LocalPlayer.ID));
            gos.Add((IGameObject)starMapSystem);
            return(starMapSystem);
        }
Ejemplo n.º 18
0
        private void FleetsModified(App app, int[] modifiedFleetIds)
        {
            int?      nullable1  = new int?(modifiedFleetIds[0]);
            int?      nullable2  = new int?(modifiedFleetIds[1]);
            FleetInfo fleetInfo1 = (FleetInfo)null;

            if (nullable2.HasValue)
            {
                fleetInfo1 = this._app.GameDatabase.GetFleetInfo(nullable2.Value);
            }
            if (fleetInfo1 != null && fleetInfo1.Type == FleetType.FL_CARAVAN)
            {
                return;
            }
            StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(fleetInfo1.SystemID);

            if (starSystemInfo != (StarSystemInfo)null)
            {
                int?caravanSourceSystem = this.SelectedCaravanSourceSystem;
                int id = starSystemInfo.ID;
                if ((caravanSourceSystem.GetValueOrDefault() != id ? 1 : (!caravanSourceSystem.HasValue ? 1 : 0)) != 0)
                {
                    this.SelectedCaravanSourceSystem = new int?(starSystemInfo.ID);
                    if (this.SelectedCaravanSourceSystem.HasValue)
                    {
                        List <int>             fleets = this._app.GameDatabase.GetFleetsByPlayerAndSystem(this._app.LocalPlayer.ID, this.SelectedCaravanSourceSystem.Value, FleetType.FL_RESERVE).Select <FleetInfo, int>((Func <FleetInfo, int>)(x => x.ID)).ToList <int>();
                        Dictionary <int, bool> values = new Dictionary <int, bool>();
                        foreach (int key in this._fleetWidget.SyncedFleets.Where <int>((Func <int, bool>)(x => !fleets.Contains(x))))
                        {
                            values.Add(key, false);
                        }
                        this._fleetWidget.SetVisibleFleets(values);
                        FleetInfo fleetInfo2 = this._app.GameDatabase.GetFleetInfo(this.CaravanFleet.Value);
                        if (fleetInfo2 != null)
                        {
                            fleetInfo2.SystemID           = this.SelectedCaravanSourceSystem.Value;
                            fleetInfo2.SupportingSystemID = this.SelectedCaravanSourceSystem.Value;
                            this._app.GameDatabase.UpdateFleetInfo(fleetInfo2);
                            this._app.GameDatabase.UpdateFleetLocation(fleetInfo2.ID, this.SelectedCaravanSourceSystem.Value, new int?());
                        }
                    }
                    else
                    {
                        this._fleetWidget.SetSyncedFleets(0);
                    }
                }
            }
            this.UpdateCanConfirmMission();
        }
Ejemplo n.º 19
0
        private string GetLocation(int admiralID)
        {
            string    str = App.Localize("@ADMIRAL_LOCATION_DEEP_SPACE");
            FleetInfo fleetInfoByAdmiralId = this._app.GameDatabase.GetFleetInfoByAdmiralID(admiralID, FleetType.FL_NORMAL);

            if (fleetInfoByAdmiralId != null)
            {
                StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(fleetInfoByAdmiralId.SystemID);
                if (starSystemInfo != (StarSystemInfo)null)
                {
                    str = starSystemInfo.Name;
                }
            }
            return(str);
        }
Ejemplo n.º 20
0
        public static void AddSuperNovas(GameSession game, GameDatabase gamedb, AssetDatabase assetdb)
        {
            if (!gamedb.HasEndOfFleshExpansion() || game.ScriptModules.SuperNova == null || gamedb.GetTurnCount() < assetdb.GlobalSuperNovaData.MinTurns)
            {
                return;
            }
            string nameValue1 = game.GameDatabase.GetNameValue("GMCount");

            if (string.IsNullOrEmpty(nameValue1))
            {
                game.GameDatabase.InsertNameValuePair("GMCount", "0");
                nameValue1 = game.GameDatabase.GetNameValue("GMCount");
            }
            int nameValue2 = game.GameDatabase.GetNameValue <int>("GSGrandMenaceCount");
            int num1       = int.Parse(nameValue1);

            if (num1 >= nameValue2)
            {
                return;
            }
            Random safeRandom = App.GetSafeRandom();

            if (!safeRandom.CoinToss(assetdb.GlobalSuperNovaData.Chance))
            {
                return;
            }
            List <StarSystemInfo> list1   = gamedb.GetStarSystemInfos().ToList <StarSystemInfo>();
            List <SuperNovaInfo>  list2   = gamedb.GetSuperNovaInfos().ToList <SuperNovaInfo>();
            List <int>            intList = new List <int>();

            foreach (StarSystemInfo starSystemInfo in list1)
            {
                StarSystemInfo ssi          = starSystemInfo;
                StellarClass   stellarClass = new StellarClass(ssi.StellarClass);
                if ((stellarClass.Type == StellarType.O || stellarClass.Type == StellarType.B) && !list2.Any <SuperNovaInfo>((Func <SuperNovaInfo, bool>)(x => x.SystemId == ssi.ID)))
                {
                    intList.Add(ssi.ID);
                }
            }
            if (intList.Count <= 0)
            {
                return;
            }
            game.ScriptModules.SuperNova.AddInstance(gamedb, assetdb, safeRandom.Choose <int>((IList <int>)intList));
            int num2;

            game.GameDatabase.UpdateNameValuePair("GMCount", (num2 = num1 + 1).ToString());
        }
Ejemplo n.º 21
0
		private void SyncSystemOwnershipEffect(string itemID, int systemid, bool cloaksystem)
		{
			StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(systemid);
			if (starSystemInfo == (StarSystemInfo)null || starSystemInfo.IsDeepSpace)
			{
				this._app.UI.SetVisible(this._app.UI.GetGlobalID(this._app.UI.Path(itemID, "systemDeepspace")), true);
				this._app.UI.SetText(this._app.UI.Path(itemID, "title"), cloaksystem ? "Unknown" : starSystemInfo.Name);
			}
			else
			{
				this._systemWidgets.Add(new SystemWidget(this._app, itemID));
				this._systemWidgets.Last<SystemWidget>().Sync(systemid);
				if (cloaksystem)
					this._app.UI.SetText(this._app.UI.Path(itemID, "title"), "Unknown");
				HomeworldInfo homeworldInfo = this._app.GameDatabase.GetHomeworlds().ToList<HomeworldInfo>().FirstOrDefault<HomeworldInfo>((Func<HomeworldInfo, bool>)(x => x.SystemID == systemid));
				int? systemOwningPlayer = this._app.GameDatabase.GetSystemOwningPlayer(systemid);
				PlayerInfo Owner = this._app.GameDatabase.GetPlayerInfo(systemOwningPlayer.HasValue ? systemOwningPlayer.Value : 0);
				if (homeworldInfo != null && homeworldInfo.SystemID != 0 && !cloaksystem)
				{
					string globalId = this._app.UI.GetGlobalID(this._app.UI.Path(itemID, "systemHome"));
					this._app.UI.SetVisible(globalId, true);
					this._app.UI.SetPropertyColor(globalId, "color", this._app.GameDatabase.GetPlayerInfo(homeworldInfo.PlayerID).PrimaryColor * (float)byte.MaxValue);
				}
				else if (!cloaksystem && Owner != null && this._app.GameDatabase.GetProvinceInfos().Where<ProvinceInfo>((Func<ProvinceInfo, bool>)(x =>
			   {
				   if (x.CapitalSystemID != systemid || x.PlayerID != Owner.ID)
					   return false;
				   int capitalSystemId = x.CapitalSystemID;
				   int? homeworld = Owner.Homeworld;
				   if (capitalSystemId == homeworld.GetValueOrDefault())
					   return !homeworld.HasValue;
				   return true;
			   })).Any<ProvinceInfo>())
				{
					string globalId = this._app.UI.GetGlobalID(this._app.UI.Path(itemID, "systemCapital"));
					this._app.UI.SetVisible(globalId, true);
					this._app.UI.SetPropertyColor(globalId, "color", Owner.PrimaryColor * (float)byte.MaxValue);
				}
				else
				{
					string globalId = this._app.UI.GetGlobalID(this._app.UI.Path(itemID, "systemOwnership"));
					this._app.UI.SetVisible(globalId, true);
					if (Owner == null || cloaksystem)
						return;
					this._app.UI.SetPropertyColor(globalId, "color", Owner.PrimaryColor * (float)byte.MaxValue);
				}
			}
		}
Ejemplo n.º 22
0
 protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams)
 {
     if (msgType == "list_sel_changed" && panelName == "sys_list_left")
     {
         StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(int.Parse(msgParams[0]));
         if (starSystemInfo != (StarSystemInfo)null)
         {
             this.SetSyncedSystem(starSystemInfo);
         }
     }
     if (!(msgType == "button_clicked") || !(panelName == PopulationManagerDialog.UIExitButton))
     {
         return;
     }
     this.App.UI.CloseDialog((Dialog)this, true);
 }
Ejemplo n.º 23
0
        public void Sync(int systemID)
        {
            StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(systemID);

            if (starSystemInfo == (StarSystemInfo)null)
            {
                return;
            }
            this._systemID = systemID;
            this.CacheStar(starSystemInfo);
            StarSystemUI.SyncStarDetailsControl(this.App.Game, this._rootPanel, systemID);
            StarSystemUI.SyncStarDetailsStations(this.App.Game, this._rootPanel, systemID, this.App.LocalPlayer.ID);
            Vector4 vector4 = StarHelper.CalcModelColor(new StellarClass(starSystemInfo.StellarClass));

            this.App.UI.SetPropertyColorNormalized(this.App.UI.Path(this._rootPanel, "colorGradient"), "color", vector4.X, vector4.Y, vector4.Z, 0.5f);
            this._initialized = false;
        }
Ejemplo n.º 24
0
        public void ExecuteInstance(GameDatabase gamedb, AssetDatabase assetdb, int systemid)
        {
            StarSystemInfo starSystemInfo1 = gamedb.GetStarSystemInfo(systemid);
            StarSystemInfo starSystemInfo2 = EncounterTools.GetClosestStars(gamedb, starSystemInfo1).Last <StarSystemInfo>();
            int            fleetID         = gamedb.InsertFleet(this.PlayerId, 0, 0, 0, "System Killer", FleetType.FL_NORMAL);

            gamedb.InsertShip(fleetID, this._systemKillerDesignId, null, (ShipParams)0, new int?(), 0);
            int missionID = gamedb.InsertMission(fleetID, MissionType.STRIKE, starSystemInfo1.ID, 0, 0, 0, false, new int?());

            gamedb.InsertWaypoint(missionID, WaypointType.TravelTo, new int?(starSystemInfo1.ID));
            gamedb.InsertMoveOrder(fleetID, 0, starSystemInfo1.Origin - Vector3.Normalize(starSystemInfo2.Origin - starSystemInfo1.Origin) * 10f, starSystemInfo1.ID, Vector3.Zero);
            gamedb.InsertSystemKillerInfo(new SystemKillerInfo()
            {
                Target  = starSystemInfo2.Origin,
                FleetId = new int?(fleetID)
            });
        }
Ejemplo n.º 25
0
 public override void Initialize()
 {
     this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard"));
     StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID);
     this._app.UI.SetText(this._app.UI.Path(this.ID, "intel_desc"), this._descriptor);
     this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.AvatarAssetPath));
     this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerBadge"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.BadgeAssetPath));
     this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true);
     this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), 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, "System");
     this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0);
     this._crits = new GameObjectSet(this._app);
     this._camera = new OrbitCameraController(this._app);
     this._sky = new Sky(this._app, SkyUsage.InSystem, this._systemID);
     this._starsystem = new Kerberos.Sots.GameStates.StarSystem(this.App, 1f, this._systemID, Vector3.Zero, true, (CombatSensor)null, false, 0, false, true);
     this._starsystem.SetAutoDrawEnabled(false);
     this._starsystem.SetCamera(this._camera);
     this._starsystem.SetInputEnabled(true);
     this._starsystem.PostObjectAddObjects((IGameObject)this._sky);
     foreach (IGameObject state in this._starsystem.Crits.Objects.Where<IGameObject>((Func<IGameObject, bool>)(x =>
        {
        if (!(x is StellarBody))
            return x is StarModel;
        return true;
        })))
         state.PostSetProp("AutoDrawEnabled", false);
     this._crits.Add((IEnumerable<IGameObject>)new IGameObject[3]
     {
     (IGameObject) this._camera,
     (IGameObject) this._sky,
     (IGameObject) this._starsystem
     });
     this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarSystemViewport"), (object)this._starsystem.ObjectID);
     this._critsInitialized = false;
     this._camera.PostSetLook(new Vector3(0.0f, 0.0f, 0.0f));
     this._camera.PostSetPosition(new Vector3(0.0f, 100000f, 0.0f));
     this._camera.MaxDistance = 500000f;
     this._camera.MinDistance = 100000f;
     StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true);
     StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true);
     this._currentFilterMode = DialogSystemIntel.PlanetFilterMode.AllPlanets;
     this._planetWidgets = new List<PlanetWidget>();
     this.SetSyncedSystem(starSystemInfo);
     this._systemWidget.Sync(this._systemID);
 }
Ejemplo n.º 26
0
    public static float GetStarSystemEdgeDistance(int _seed)
    {
        StarSystemInfo ssi = GetStarSystemInfo(_seed);

        int i = 0;

        if (ssi.asteroidBelt)
        {
            i++;
        }
        i += ssi.numberOfPlanets;

        float distance = 20 * (i + 3);


        return(distance);
    }
Ejemplo n.º 27
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();
        }
Ejemplo n.º 28
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);
            StationInfo       stationInfo        = this._app.GameDatabase.GetStationInfo(this._stationID);
            OrbitalObjectInfo orbitalObjectInfo1 = this._app.GameDatabase.GetOrbitalObjectInfo(this._stationID);
            OrbitalObjectInfo orbitalObjectInfo2 = this._app.GameDatabase.GetOrbitalObjectInfo(orbitalObjectInfo1.ParentID.Value);

            this._app.UI.SetText(this._app.UI.Path(this.ID, "station_class"), string.Format(App.Localize("@STATION_LEVEL"), (object)stationInfo.DesignInfo.StationLevel.ToString(), (object)stationInfo.DesignInfo.StationType.ToString()));
            this._app.UI.SetText(this._app.UI.Path(this.ID, "upkeep_cost"), string.Format(App.Localize("@STATION_UPKEEP_COST"), (object)GameSession.CalculateStationUpkeepCost(this._app.GameDatabase, this._app.AssetDatabase, stationInfo).ToString()));
            if (stationInfo.DesignInfo.StationType == StationType.NAVAL)
            {
                this._app.UI.SetText(this._app.UI.Path(this.ID, "naval_capacity"), string.Format(App.Localize("@STATION_FLEET_CAPACITY"), (object)this._app.GameDatabase.GetSystemSupportedCruiserEquivalent(this._app.Game, orbitalObjectInfo2.StarSystemID, this._app.LocalPlayer.ID).ToString()));
            }
            else
            {
                this._app.UI.SetVisible(this._app.UI.Path(this.ID, "naval_capacity"), false);
            }
            StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo2.StarSystemID);

            this._app.UI.SetText("gameStationName", orbitalObjectInfo1.Name);
            this._enteredStationName = orbitalObjectInfo2.Name;
            this._app.UI.SetText(this._app.UI.Path(this.ID, "system_name"), string.Format(App.Localize("@STATION_BUILT"), (object)starSystemInfo.Name).ToUpperInvariant());
            this._cameraReduced                 = new OrbitCameraController(this._app);
            this._cameraReduced.MinDistance     = 1002.5f;
            this._cameraReduced.MaxDistance     = 10000f;
            this._cameraReduced.DesiredDistance = 2000f;
            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.PostSetProp("Selected", this._starmapReduced.Systems.Reverse[starSystemInfo.ID].ObjectID);
            this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(starSystemInfo.ID).Origin);
            this._starmapReduced.PostSetProp("CullRadius", 15f);
            DesignInfo di = DesignLab.CreateStationDesignInfo(this._app.AssetDatabase, this._app.GameDatabase, this._app.LocalPlayer.ID, stationInfo.DesignInfo.StationType, stationInfo.DesignInfo.StationLevel, false);

            this._stationModel = new StarSystemDummyOccupant(this._app, this._app.AssetDatabase.ShipSections.First <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => x.FileName == di.DesignSections[0].FilePath)).ModelName, stationInfo.DesignInfo.StationType);
            this._stationModel.PostSetScale(1f / 500f);
            this._stationModel.PostSetPosition(this._trans);
        }
Ejemplo n.º 29
0
        public override void Initialize()
        {
            this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard"));
            StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID);

            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "system_title"), "text", App.Localize("@SURVEY_OF") + " " + string.Format(App.Localize("@SURVEY_SYSTEM_THINGY"), (object)starSystemInfo.Name).ToUpperInvariant());
            this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true);
            this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), false);
            this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP"));
            this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0);
            StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true);
            StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true);
            this._currentFilterMode = SystemSurveyDialog.PlanetFilterMode.AllPlanets;
            this._planetWidgets     = new List <PlanetWidget>();
            this.SetSyncedSystem(starSystemInfo);
            this._systemWidget.Sync(this._systemID);
            this.UpdateCanPlaceTraps();
        }
Ejemplo n.º 30
0
        private List <PlanetInfo> FilteredPlanetList(StarSystemInfo system)
        {
            List <PlanetInfo> list           = ((IEnumerable <PlanetInfo>) this.App.GameDatabase.GetStarSystemPlanetInfos(system.ID)).ToList <PlanetInfo>();
            List <PlanetInfo> planetInfoList = new List <PlanetInfo>();

            foreach (PlanetInfo planetInfo in list)
            {
                if (this.App.GameDatabase.IsSurveyed(this.App.LocalPlayer.ID, system.ID))
                {
                    AIColonyIntel colonyIntelForPlanet = this.App.GameDatabase.GetColonyIntelForPlanet(this.App.LocalPlayer.ID, planetInfo.ID);
                    if (colonyIntelForPlanet != null && colonyIntelForPlanet.OwningPlayerID == this.App.LocalPlayer.ID)
                    {
                        planetInfoList.Add(planetInfo);
                    }
                }
            }
            return(planetInfoList);
        }