示例#1
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);
 }
示例#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();
        }
示例#3
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();
        }
示例#4
0
        public override void Initialize()
        {
            StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID);
            ColonyInfo     colonyInfo     = this._app.GameDatabase.GetColonyInfo(this._colonyID);
            PlanetInfo     planetInfo     = this._app.GameDatabase.GetPlanetInfo(colonyInfo.OrbitalObjectID);
            PlayerInfo     playerInfo     = this._app.GameDatabase.GetPlayerInfo(colonyInfo.PlayerID);

            this._playerID = playerInfo.ID;
            this._planetID = colonyInfo.OrbitalObjectID;
            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "title"), "text", App.Localize("@UI_INDEPENDENT_CIVILIZATION_FOUND_TITLE").ToUpperInvariant());
            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "faction_name"), "text", playerInfo.Name);
            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "tech_level"), "text", "");
            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "avatar"), "texture", playerInfo.AvatarAssetPath);
            this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "tech_level"), "text", App.Localize("@UI_INDEPENDENT_TECH_" + playerInfo.Name.ToUpper()));
            StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true);
            this._app.UI.SetEnabled(this._app.UI.Path(this.ID, "diploButton"), (Kerberos.Sots.StarFleet.StarFleet.CollectAvailableFleets(this._app.Game, this._app.LocalPlayer.ID, this._systemID, MissionType.CONSTRUCT_STN, true).Any <FleetInfo>() ? 1 : 0) != 0);
            this._planetWidgets = new List <PlanetWidget>();
            this.SetSyncedSystem(starSystemInfo, planetInfo);
        }
示例#5
0
 internal static string SelectIcon(
     PlanetInfo planetInfo,
     IEnumerable <OrbitalObjectInfo> orbitalObjectInfos,
     IEnumerable <PlanetInfo> planetInfos)
 {
     if (StarSystemMapUI.IsTerrestrialPlanet(planetInfo))
     {
         return(StarSystemMapUI.HasMoons(planetInfo, orbitalObjectInfos, planetInfos) ? "sysmap_planetmoon" : "sysmap_planet");
     }
     if (!StarSystemMapUI.IsGasGiant(planetInfo))
     {
         return(string.Empty);
     }
     if (StarSystemMapUI.HasTerrestrialMoons(planetInfo, orbitalObjectInfos, planetInfos))
     {
         return("sysmap_gasgiantplanet");
     }
     if (StarSystemMapUI.HasMoons(planetInfo, orbitalObjectInfos, planetInfos))
     {
         return("sysmap_gasgiantmoon");
     }
     return(StarSystemMapUI.HasRing(planetInfo) ? "sysmap_gasgiantrings" : "sysmap_gasgiant");
 }
示例#6
0
 private static bool HasTerrestrialMoons(
     PlanetInfo planetInfo,
     IEnumerable <OrbitalObjectInfo> orbitalObjectInfos,
     IEnumerable <PlanetInfo> planetInfos)
 {
     foreach (OrbitalObjectInfo orbitalObjectInfo in orbitalObjectInfos.Where <OrbitalObjectInfo>((Func <OrbitalObjectInfo, bool>)(x =>
     {
         if (x.ParentID.HasValue)
         {
             return(x.ParentID.Value == planetInfo.ID);
         }
         return(false);
     })))
     {
         OrbitalObjectInfo moon        = orbitalObjectInfo;
         PlanetInfo        planetInfo1 = planetInfos.FirstOrDefault <PlanetInfo>((Func <PlanetInfo, bool>)(x => x.ID == moon.ID));
         if (planetInfo1 != null && StarSystemMapUI.IsTerrestrialPlanet(planetInfo1))
         {
             return(true);
         }
     }
     return(false);
 }
示例#7
0
        internal static void Sync(App game, int systemId, string mapPanelId, bool isClickable)
        {
            bool flag = StarMap.IsInRange(game.Game.GameDatabase, game.LocalPlayer.ID, game.GameDatabase.GetStarSystemInfo(systemId), (Dictionary <int, List <ShipInfo> >)null);

            StarSystemMapUI.ResetMap(game, mapPanelId);
            if (systemId == 0)
            {
                return;
            }
            float        time         = 0.0f;
            GameDatabase gameDatabase = game.GameDatabase;
            IEnumerable <OrbitalObjectInfo> orbitalObjectInfos = gameDatabase.GetStarSystemOrbitalObjectInfos(systemId);
            StarSystemInfo starSystemInfo = gameDatabase.GetStarSystemInfo(systemId);
            StellarClass   stellarClass   = StellarClass.Parse(starSystemInfo.StellarClass);

            if (starSystemInfo.IsDeepSpace)
            {
                return;
            }
            float num1 = StarHelper.CalcRadius(StellarSize.Ia);
            float num2 = StarHelper.CalcRadius(StellarSize.VII);
            float num3 = ScalarExtensions.Lerp(0.67f, 3f, (float)(((double)StarHelper.CalcRadius(stellarClass.Size) - (double)num2) / ((double)num1 - (double)num2)));

            StarSystemMapUI.IconParams iconParams1 = StarSystemMapUI.IconParams.Default;
            iconParams1.ObjectID  = StarSystemDetailsUI.StarItemID;
            iconParams1.Text      = starSystemInfo.Name;
            iconParams1.Icon      = "sysmap_star";
            iconParams1.X         = 0.0f;
            iconParams1.Y         = 0.0f;
            iconParams1.Scale     = num3;
            iconParams1.Color     = StarHelper.CalcIconColor(stellarClass);
            iconParams1.Clickable = isClickable;
            StarSystemMapUI.AddMapIcon(game, mapPanelId, iconParams1);
            foreach (AsteroidBeltInfo asteroidBeltInfo in gameDatabase.GetStarSystemAsteroidBeltInfos(systemId))
            {
                AsteroidBeltInfo           asteroidBelt      = asteroidBeltInfo;
                OrbitalObjectInfo          orbitalObjectInfo = orbitalObjectInfos.First <OrbitalObjectInfo>((Func <OrbitalObjectInfo, bool>)(x => x.ID == asteroidBelt.ID));
                StarSystemMapUI.IconParams iconParams2       = new StarSystemMapUI.IconParams();
                iconParams2.SetPos(game, orbitalObjectInfos, time, orbitalObjectInfo.ID);
                iconParams2.ObjectID  = orbitalObjectInfo.ID;
                iconParams2.Icon      = "sysmap_roiddust";
                iconParams2.Scale     = 0.85f;
                iconParams2.Color     = Vector4.One;
                iconParams2.Text      = orbitalObjectInfo.Name;
                iconParams2.Clickable = false;
                StarSystemMapUI.AddMapIcon(game, mapPanelId, iconParams2);
            }
            PlanetInfo[] systemPlanetInfos = gameDatabase.GetStarSystemPlanetInfos(systemId);
            foreach (OrbitalObjectInfo orbitalObjectInfo in orbitalObjectInfos.Where <OrbitalObjectInfo>((Func <OrbitalObjectInfo, bool>)(x => !x.ParentID.HasValue)))
            {
                OrbitalObjectInfo orbital    = orbitalObjectInfo;
                PlanetInfo        planetInfo = ((IEnumerable <PlanetInfo>)systemPlanetInfos).FirstOrDefault <PlanetInfo>((Func <PlanetInfo, bool>)(x => x.ID == orbital.ID));
                if (planetInfo != null)
                {
                    string str = StarSystemMapUI.SelectIcon(planetInfo, orbitalObjectInfos, (IEnumerable <PlanetInfo>)systemPlanetInfos);
                    if (string.IsNullOrEmpty(str))
                    {
                        App.Log.Trace(string.Format("Planet {0} does not have an icon to represent it in the mini system map.", (object)orbital.Name), "gui");
                    }
                    else
                    {
                        AIColonyIntel colonyIntelForPlanet = game.GameDatabase.GetColonyIntelForPlanet(game.LocalPlayer.ID, planetInfo.ID);
                        if (colonyIntelForPlanet != null && flag)
                        {
                            Vector3 primaryColor = game.GameDatabase.GetPlayerInfo(colonyIntelForPlanet.OwningPlayerID).PrimaryColor;
                            Vector4 vector4      = new Vector4(primaryColor.X, primaryColor.Y, primaryColor.Z, 1f);
                            StarSystemMapUI.IconParams iconParams2 = StarSystemMapUI.IconParams.Default;
                            iconParams2.SetPos(game, orbitalObjectInfos, time, planetInfo.ID);
                            iconParams2.ObjectID  = 0;
                            iconParams2.Icon      = "sysmap_ownerring";
                            iconParams2.Scale     = 0.85f;
                            iconParams2.Color     = vector4;
                            iconParams2.Text      = string.Empty;
                            iconParams2.Clickable = false;
                            StarSystemMapUI.AddMapIcon(game, mapPanelId, iconParams2);
                        }
                        StarSystemMapUI.IconParams iconParams3 = new StarSystemMapUI.IconParams();
                        iconParams3.SetPos(game, orbitalObjectInfos, time, planetInfo.ID);
                        iconParams3.ObjectID  = planetInfo.ID;
                        iconParams3.Icon      = str;
                        iconParams3.Scale     = 0.85f;
                        iconParams3.Color     = Vector4.One;
                        iconParams3.Text      = orbital.Name;
                        iconParams3.Clickable = isClickable;
                        StarSystemMapUI.AddMapIcon(game, mapPanelId, iconParams3);
                    }
                }
            }
        }