Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void AddInstance(GameDatabase gamedb, AssetDatabase assetdb, int SystemId, int OrbitId)
        {
            int num1 = OrbitId;

            if (gamedb.GetLargeAsteroidInfo(OrbitId) == null && gamedb.GetAsteroidBeltInfo(OrbitId) == null)
            {
                OrbitalObjectInfo orbitalObjectInfo = gamedb.GetOrbitalObjectInfo(OrbitId);
                StarSystemInfo    starSystemInfo    = gamedb.GetStarSystemInfo(SystemId);
                gamedb.RemoveOrbitalObject(orbitalObjectInfo.ID);
                if (!orbitalObjectInfo.ParentID.HasValue)
                {
                    num1 = gamedb.InsertAsteroidBelt(new int?(), orbitalObjectInfo.StarSystemID, orbitalObjectInfo.OrbitalPath, "Swarmed Asteroid Belt", App.GetSafeRandom().Next());
                }
                else
                {
                    int         num2        = gamedb.GetStarSystemOrbitalObjectInfos(SystemId).Where <OrbitalObjectInfo>((Func <OrbitalObjectInfo, bool>)(x => !x.ParentID.HasValue)).Count <OrbitalObjectInfo>();
                    OrbitalPath orbitalPath = gamedb.OrbitNumberToOrbitalPath(num2 + 1, StellarClass.Parse(starSystemInfo.StellarClass).Size, new float?());
                    num1 = gamedb.InsertAsteroidBelt(new int?(), orbitalObjectInfo.StarSystemID, orbitalPath, "Swarmed Asteroid Belt", App.GetSafeRandom().Next());
                }
            }
            SwarmerInfo si = new SwarmerInfo();

            si.GrowthStage    = 0;
            si.SystemId       = SystemId;
            si.OrbitalId      = num1;
            si.HiveFleetId    = new int?(gamedb.InsertFleet(this.PlayerId, 0, SystemId, SystemId, "Swarm", FleetType.FL_NORMAL));
            si.QueenFleetId   = new int?();
            si.SpawnHiveDelay = 1;
            gamedb.InsertSwarmerInfo(si);
            gamedb.InsertShip(si.HiveFleetId.Value, this._hiveStage1DesignId, null, (ShipParams)0, new int?(), 0);
        }
Exemplo n.º 4
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);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private static IGameObject CreateProceduralStar(
            App game,
            CombatConfig.DataContext context,
            XmlElement node)
        {
            string  stringOrDefault1 = node["StellarClass"].ExtractStringOrDefault("G2V");
            string  stringOrDefault2 = node["Name"].ExtractStringOrDefault(string.Empty);
            Vector3 vector3OrDefault = node["Position"].ExtractVector3OrDefault(Vector3.Zero);

            context.TransformPosition(ref vector3OrDefault);
            return((IGameObject)Kerberos.Sots.GameStates.StarSystem.CreateStar(game, vector3OrDefault, StellarClass.Parse(stringOrDefault1), stringOrDefault2, 1f, true));
        }