Exemplo n.º 1
0
 private void btnCalculate_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = dalSourceData.GetList("isExported=0");
         System.Data.DataTable dt = ds.Tables[0];
         if (dt.Rows.Count > 0)
         {
             foreach (DataRow dr in dt.Rows)
             {
                 DateTime t1       = DateTime.Now;
                 int      sourceId = int.Parse(dr["id"].ToString());
                 DataList dl       = new DataList();
                 Adult    ad       = new Adult(sourceId);
                 dl.serialCode = ad.serialCode;
                 dl.sourceID   = sourceId;
                 List <TestData> listData   = new List <TestData>();
                 double          test       = ad.zzgj_gm();
                 string          aa         = "Formula.Adult";
                 Type            t          = Assembly.Load("Formula").GetType(aa);
                 Object[]        parameters = new Object[1];
                 parameters[0] = sourceId;
                 var          obj  = t.Assembly.CreateInstance(aa, true, System.Reflection.BindingFlags.Default, null, parameters, null, null);
                 MethodInfo[] info = t.GetMethods();
                 foreach (MethodInfo infoData in info)
                 {
                     if (infoData.ReturnType.ToString() == "System.Double" || infoData.ReturnType.ToString() == "System.Nullable`1[System.Double]")
                     {
                         TestData td = new TestData();
                         if (infoData.ReturnType.ToString() == "System.Nullable`1[System.Double]")
                         {
                             if (infoData.Invoke(obj, null) == null)
                             {
                                 td.value = "";
                             }
                             else
                             {
                                 td.value = infoData.Invoke(obj, null).ToString();
                                 string hh = "";
                             }
                         }
                         else
                         {
                             td.value = infoData.Invoke(obj, null).ToString();
                             string hh = "";
                         }
                         MyDescription ma = Attribute.GetCustomAttribute(infoData, typeof(MyDescription), false) as MyDescription;
                         td.description = ma.DisplayName;
                         td.code        = ma.DisplayCode;
                         listData.Add(td);
                     }
                 }
                 dl.testDatas = listData;
                 string        rtnJson   = JsonConvert.SerializeObject(dl);
                 List <string> sqlList   = new List <string>();
                 string        sqlInsert = string.Format("insert into djk_SavedData (sourceID,saveDate,savedData,serialCode) values ('{0}','{1}','{2}','{3}')", sourceId, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), rtnJson, ad.serialCode);
                 sqlList.Add(sqlInsert);
                 string sqlUpdate = "update djk_SourceData set isExported=1,exportDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where id=" + sourceId;
                 sqlList.Add(sqlUpdate);
                 int      re   = dalSourceData.ExecuteTransactions(sqlList);
                 DateTime t2   = DateTime.Now;
                 TimeSpan ts1  = new TimeSpan(t1.Ticks);
                 TimeSpan ts2  = new TimeSpan(t2.Ticks);
                 TimeSpan ts   = ts2.Subtract(ts1).Duration();
                 int      time = ts.Seconds;
                 if (re > 0)
                 {
                     textBox1.AppendText("数据保存成功---耗时" + time + "秒" + "\n");
                 }
                 else
                 {
                     textBox1.AppendText("数据保存失败");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         textBox1.AppendText("数据保存失败,出现错误");
     }
 }
    public void EditSelectedModComponent()
    {
        if (currentlySelected.TryGetComponent(out SpawnGroupRef spawnGroupRef))
        {
            Logging.Log($"Loading Spawngroup {spawnGroupRef.GetMySpawnGroup().SubtypeId} to edit.");
            EditingFlag = true;
            UIManager.me.NewShipMenu();

            SpawnGroupMenu  spMenu     = UIManager.me.spawnGroupMenu;
            DescriptionMenu menu       = UIManager.me.descriptionMenu;
            SpawnGroup      spawnGroup = spawnGroupRef.GetMySpawnGroup();
            MyDescription   desc;
            if (!MyDescription.ParseFromString(spawnGroup.Description, out desc))
            {
                Logging.LogErr($"Failed to load description from spawngroup {spawnGroup.SubtypeId} to edit.");
            }

            spMenu.Name.text      = spawnGroup.SubtypeId;
            spMenu.Frequency.text = spawnGroup.Frequency.ToString();

            menu.UseAutopilotInSpace.isOn       = desc.useAutoPilotInSpace;
            menu.PlanetaryInstallationType.text = desc.planetaryInstallationType;
            menu.CutVoxelsAtAirtightCels.isOn   = desc.cutVoxelsAtAirtightCells;
            menu.ForceStaticGrid.isOn           = desc.forceStaticGrid;
            menu.RemoveVoxelsIfGridRemoved.isOn = desc.removeVoxelsIfGridRemoved;
            menu.UniqueEncounter.isOn           = desc.uniqueEncounter;
            menu.FactionOwner.text                   = desc.factionOwner;
            menu.PlanetRequiresAtmo.isOn             = desc.planetRequiresAtmo;
            menu.PlanetRequiresOxygen.isOn           = desc.planetRequiresOxygen;
            menu.PlanetRequiresVacuum.isOn           = desc.planetRequiresVacuum;
            menu.PlanetMinimumSize.text              = desc.planetMinimumSize.ToString();
            menu.PlanetMaximumSize.text              = desc.planetMinimumSize.ToString();
            menu.UseThreatLevelCheck.isOn            = desc.useThreatLevelCheck;
            menu.ThreatLevelCheckRange.text          = desc.threatLevelCheckRange.ToString();
            menu.ThreatScoreMinimum.text             = desc.threatScoreMinimum.ToString();
            menu.ThreatScoreMaximum.text             = desc.threatScoreMaximum.ToString();
            menu.ThreatLevelCheckOtherNPCOwners.isOn = desc.threatLevelCheckOtherNPCOwners;
            menu.UsePCUCheck.isOn                             = desc.usePCUCheck;
            menu.PCUCheckRadius.text                          = desc.PCUCheckRadius.ToString();
            menu.PCUMaximum.text                              = desc.PCUMaximum.ToString();
            menu.PCUMinimum.text                              = desc.PCUMinimum.ToString();
            menu.UsePlayerCountCheck.isOn                     = desc.usePlayerCountCheck;
            menu.PlayerCountCheckRadius.text                  = desc.usePlayerCountCheck.ToString();
            menu.MinimumPlayers.text                          = desc.minimumPlayers.ToString();
            menu.MaximumPlayers.text                          = desc.maximumPlayers.ToString();
            menu.UsePlayerCredits.isOn                        = desc.usePlayerCredits;
            menu.IncludeAllPlayersInRadius.isOn               = desc.includeAllPlayersInRadius;
            menu.IncludeFactionBalance.isOn                   = desc.includeFactionBalance;
            menu.PlayerCreditCheckRadius.text                 = desc.playerCreditCheckRadius.ToString();
            menu.MinimumPlayerCredits.text                    = desc.minimumPlayerCredits.ToString();
            menu.MaximumPlayerCredits.text                    = desc.maximumPlayerCredits.ToString();
            menu.UsePlayerFactionReputation.isOn              = desc.usePlayerFactionReputation;
            menu.CheckReputationAgainstOtherNPCFaction.text   = desc.checkReputationAgainstOtherNPCFaction;
            menu.PlayerReputationCheckRadius.text             = desc.playerReputationCheckRadius.ToString();
            menu.MinimumReputation.text                       = desc.minimumReputation.ToString();
            menu.MaximumReputation.text                       = desc.maximumReputation.ToString();
            menu.AttachModComponentToGrid.isOn                = desc.attachModStorageComponentToGrid;
            menu.StorageKey.text                              = desc.storageKey;
            menu.StorageValue.text                            = desc.storageValue;
            menu.UseKnownPlayerLocation.isOn                  = desc.useKnowPlayerLocations;
            menu.KnownPlayerLocationMustMatchFaction.isOn     = desc.knownPlayerLocationMustMatchFaction;
            menu.KnownPlayerLocationMinSpawnedEncounters.text = desc.knownPlayerLocationMinSpawnedEncounters.ToString();
            menu.KnownPlayerLocationMaxSpawnedEncounters.text = desc.knownPlayerLocationMaxSpawnedEncounters.ToString();
            menu.TerritoryName.text                           = desc.territory;
            menu.MinDistanceFromTerritoryCenter.text          = desc.minDistanceFromTerritoryCenter.ToString();
            menu.MaxDistanceFromTerritoryCenter.text          = desc.maxDistanceFromTerritoryCenter.ToString();
            menu.ReplenishSystems.isOn                        = desc.replenishSystems;
            menu.IgnoreCleanupRules.isOn                      = desc.ignoreCleanupRules;
            menu.InitializeStoreBlocks.isOn                   = desc.initializeStoreBlocks;
            menu.AdminSpawnOnly.isOn                          = desc.adminSpawnOnly;
            menu.RotateFirstCockpitToForward.isOn             = desc.rotateFirstCockpitToForward;
            menu.SpawnRandomCargo.isOn                        = desc.spawnRandomCargo;
            menu.DisableDampners.isOn                         = desc.disableDampeners;
            menu.ReactorsOn.isOn                              = desc.reactorsOn;
            menu.PauseAutopilotAtDistance.text                = desc.pauseAutopilotAtPlayerDistance.ToString();
            menu.MinSpawnFromWorldCenter.text                 = desc.minSpawnFromWorldCenter.ToString();
            menu.MaxSpawnFromWorldCenter.text                 = desc.maxSpawnFromWorldCenter.ToString();
        }
        else if (currentlySelected.TryGetComponent(out PrefabRef prefabRef))
        {
            Logging.Log($"Loading Prefab {prefabRef.GetMyPrefab().SubtypeId} to edit.");
            EditingFlag = true;
            UIManager.me.NewPrefabMenu();

            PrefabMenu menu   = UIManager.me.prefabMenu;
            Prefab     prefab = prefabRef.GetMyPrefab();

            menu.FileName.text   = prefab.SubtypeId;
            menu.BeaconText.text = prefab.BeaconText;
            menu.Speed.text      = prefab.Speed.ToString();
        }
        else if (currentlySelected.TryGetComponent(out TerritoryRef territoryRef))
        {
            Logging.Log($"Loading Territory {territoryRef.GetMyTerritory().SubtypeId} to edit.");
            EditingFlag = true;
            UIManager.me.NewTerritoryMenu();

            TerritoryMenu menu      = UIManager.me.territoryMenu;
            SpawnGroup    territory = territoryRef.GetMyTerritory();
            MyDescription desc;
            if (!MyDescription.ParseFromString(territory.Description, out desc))
            {
                Logging.LogErr("Error loading description for edit."); return;
            }

            menu.Name.text = territory.SubtypeId;
            if (desc.type.Contains("tatic"))
            {
                menu.Type.value = 0;
            }
            else
            {
                menu.Type.value = 1;
            }
            menu.Active.isOn               = desc.active;
            menu.Radius.text               = desc.radius.ToString();
            menu.CoordsX.text              = desc.coordsX.ToString();
            menu.CoordsY.text              = desc.coordsY.ToString();
            menu.CoordsZ.text              = desc.coordsZ.ToString();
            menu.ScaleWithPlanetSize.isOn  = desc.scaleRadiusWithPlanetSize;
            menu.PlanetGeneratorName.text  = desc.planetGeneratorName;
            menu.AnnounceArriveDepart.isOn = desc.announceArriveDepart;
            menu.CustomArriveMessage.text  = desc.customArriveMessage;
            menu.CustomDepartMessage.text  = desc.customDepartMessage;
        }
        else
        {
            Logging.LogErr($"Failed to load mod element from selected Gameobject to be edited.");
        }
    }
Exemplo n.º 3
0
    public string CreateDescription(bool IsTerritory)
    {
        MyDescription desc = new MyDescription();

        desc.isTerritory = IsTerritory;

        if (IsTerritory)
        {
            desc.name = spawnGroupMenu.Name.text;
            if (territoryMenu.Type.value == 0)
            {
                desc.type = "Static";
            }
            else
            {
                desc.type = "Planetary";
                desc.planetGeneratorName = territoryMenu.PlanetGeneratorName.text;
            }
            desc.active = territoryMenu.Active.isOn;
            double.TryParse(territoryMenu.Radius.text, out desc.radius);
            desc.scaleRadiusWithPlanetSize = territoryMenu.ScaleWithPlanetSize.isOn;
            double.TryParse(territoryMenu.CoordsX.text, out desc.coordsX);
            double.TryParse(territoryMenu.CoordsY.text, out desc.coordsY);
            double.TryParse(territoryMenu.CoordsZ.text, out desc.coordsZ);
            desc.announceArriveDepart = territoryMenu.AnnounceArriveDepart.isOn;
            desc.customArriveMessage  = territoryMenu.CustomArriveMessage.text;
            desc.customDepartMessage  = territoryMenu.CustomDepartMessage.text;
        }
        else
        {
            if (shipType == ShipType.SpaceCargoShip)
            {
                desc.spaceCargoShip = true;
            }
            else
            {
                desc.spaceCargoShip = false;
            }

            if (shipType == ShipType.LunarCargoShip)
            {
                desc.lunarCargoShip = true;
            }
            else
            {
                desc.lunarCargoShip = false;
            }

            if (shipType == ShipType.AtmosphericCargoShip)
            {
                desc.atmosphericCargoShip = true;
            }
            else
            {
                desc.atmosphericCargoShip = false;
            }

            if (shipType == ShipType.PlanetaryInstallation)
            {
                desc.planetaryInstallation = true;
            }
            else
            {
                desc.planetaryInstallation = false;
            }

            if (shipType == ShipType.RandomSpaceEncounter)
            {
                desc.spaceRandomEncounter = true;
            }
            else
            {
                desc.spaceRandomEncounter = false;
            }

            desc.useAutoPilotInSpace       = descriptionMenu.UseAutopilotInSpace.isOn;
            desc.planetaryInstallationType = descriptionMenu.PlanetaryInstallationType.text;
            desc.cutVoxelsAtAirtightCells  = descriptionMenu.CutVoxelsAtAirtightCels.isOn;
            desc.factionOwner     = descriptionMenu.FactionOwner.text;
            desc.replenishSystems = descriptionMenu.ReplenishSystems;
            desc.uniqueEncounter  = descriptionMenu.UniqueEncounter.isOn;

            if (factionType == FactionType.RadomTrader)
            {
                desc.useRandomTraderFaction = true;
            }
            else
            {
                desc.useRandomTraderFaction = false;
            }

            if (factionType == FactionType.RandomMiner)
            {
                desc.useRandomMinerFaction = true;
            }
            else
            {
                desc.useRandomMinerFaction = false;
            }

            if (factionType == FactionType.RandomtBuilder)
            {
                desc.useRandomBuilderFaction = true;
            }
            else
            {
                desc.useRandomBuilderFaction = false;
            }

            desc.ignoreCleanupRules    = descriptionMenu.IgnoreCleanupRules.isOn;
            desc.initializeStoreBlocks = descriptionMenu.InitializeStoreBlocks.isOn;
            double.TryParse(descriptionMenu.PauseAutopilotAtDistance.text, out desc.pauseAutopilotAtPlayerDistance);
            desc.forceStaticGrid = descriptionMenu.ForceStaticGrid.isOn;
            desc.adminSpawnOnly  = descriptionMenu.AdminSpawnOnly.isOn;
            double.TryParse(descriptionMenu.MinSpawnFromWorldCenter.text, out desc.minSpawnFromWorldCenter);
            double.TryParse(descriptionMenu.MaxSpawnFromWorldCenter.text, out desc.maxSpawnFromWorldCenter);
            desc.planetRequiresVacuum = descriptionMenu.PlanetRequiresVacuum.isOn;
            desc.planetRequiresOxygen = descriptionMenu.PlanetRequiresOxygen.isOn;
            desc.planetRequiresAtmo   = descriptionMenu.PlanetRequiresAtmo.isOn;
            double.TryParse(descriptionMenu.PlanetMinimumSize.text, out desc.planetMinimumSize);
            double.TryParse(descriptionMenu.PlanetMaximumSize.text, out desc.planetMaximumSize);
            desc.useThreatLevelCheck = descriptionMenu.UseThreatLevelCheck.isOn;
            double.TryParse(descriptionMenu.ThreatLevelCheckRange.text, out desc.threatLevelCheckRange);
            desc.threatLevelCheckOtherNPCOwners = descriptionMenu.ThreatLevelCheckOtherNPCOwners.isOn;
            double.TryParse(descriptionMenu.ThreatScoreMinimum.text, out desc.threatScoreMinimum);
            double.TryParse(descriptionMenu.ThreatScoreMaximum.text, out desc.threatScoreMaximum);
            desc.usePCUCheck = descriptionMenu.UsePCUCheck.isOn;
            double.TryParse(descriptionMenu.PCUCheckRadius.text, out desc.PCUCheckRadius);
            double.TryParse(descriptionMenu.PCUMinimum.text, out desc.PCUMinimum);
            double.TryParse(descriptionMenu.PCUMaximum.text, out desc.PCUMaximum);
            desc.usePlayerCountCheck = descriptionMenu.UsePlayerCountCheck.isOn;
            double.TryParse(descriptionMenu.PlayerCountCheckRadius.text, out desc.playerCountCheckRadius);
            int.TryParse(descriptionMenu.MinimumPlayers.text, out desc.minimumPlayers);
            int.TryParse(descriptionMenu.MaximumPlayers.text, out desc.maximumPlayers);
            desc.usePlayerCredits          = descriptionMenu.UsePlayerCredits.isOn;
            desc.includeAllPlayersInRadius = descriptionMenu.IncludeAllPlayersInRadius.isOn;
            desc.includeFactionBalance     = descriptionMenu.IncludeFactionBalance.isOn;
            double.TryParse(descriptionMenu.PlayerCreditCheckRadius.text, out desc.playerCreditCheckRadius);
            int.TryParse(descriptionMenu.MinimumPlayerCredits.text, out desc.minimumPlayerCredits);
            int.TryParse(descriptionMenu.MaximumPlayerCredits.text, out desc.maximumPlayerCredits);
            desc.usePlayerFactionReputation = descriptionMenu.UsePlayerFactionReputation.isOn;
            double.TryParse(descriptionMenu.PlayerReputationCheckRadius.text, out desc.playerReputationCheckRadius);
            desc.checkReputationAgainstOtherNPCFaction = descriptionMenu.CheckReputationAgainstOtherNPCFaction.text;
            double.TryParse(descriptionMenu.MinimumReputation.text, out desc.minimumReputation);
            double.TryParse(descriptionMenu.MaximumReputation.text, out desc.maximumReputation);
            desc.attachModStorageComponentToGrid = descriptionMenu.AttachModComponentToGrid.isOn;
            desc.storageKey             = descriptionMenu.StorageKey.text;
            desc.storageValue           = descriptionMenu.StorageValue.text;
            desc.useKnowPlayerLocations = descriptionMenu.UseKnownPlayerLocation.isOn;
            desc.knownPlayerLocationMustMatchFaction = descriptionMenu.KnownPlayerLocationMustMatchFaction.isOn;
            double.TryParse(descriptionMenu.KnownPlayerLocationMinSpawnedEncounters.text, out desc.knownPlayerLocationMinSpawnedEncounters);
            double.TryParse(descriptionMenu.KnownPlayerLocationMaxSpawnedEncounters.text, out desc.knownPlayerLocationMaxSpawnedEncounters);
            desc.territory = descriptionMenu.TerritoryName.text;
            double.TryParse(descriptionMenu.MinDistanceFromTerritoryCenter.text, out desc.minDistanceFromTerritoryCenter);
            double.TryParse(descriptionMenu.MaxDistanceFromTerritoryCenter.text, out desc.maxDistanceFromTerritoryCenter);
            desc.rotateFirstCockpitToForward = descriptionMenu.RotateFirstCockpitToForward.isOn;
            desc.spawnRandomCargo            = descriptionMenu.SpawnRandomCargo.isOn;
            desc.disableDampeners            = descriptionMenu.DisableDampners.isOn;
            desc.reactorsOn = descriptionMenu.ReactorsOn.isOn;
            desc.removeVoxelsIfGridRemoved = descriptionMenu.RemoveVoxelsIfGridRemoved.isOn;
        }

        return(desc.ToString());
    }
    void ShowInfo(SpawnGroup spawnGroup)
    {
        Logging.Log("Showing info for Territory/Spawngroup.");
        MyDescription desc;

        if (!MyDescription.ParseFromString(spawnGroup.Description, out desc))
        {
            Logging.LogErr($"Error loading description from string to show information for Territory/Spawngroup {spawnGroup.SubtypeId}");
            return;
        }

        if (desc.isTerritory)
        {
            //is territory
            short lineCount = 5;
            if (desc.scaleRadiusWithPlanetSize)
            {
                lineCount += 1;
            }
            if (desc.announceArriveDepart)
            {
                lineCount += 3;
            }
            if (desc.type == "Planetary")
            {
                lineCount += 1;
            }


            GameObject[] lines = new GameObject[lineCount];

            for (short i = 0; i < lines.Length; i++)//Instantiate all the lines
            {
                lines[i] = Instantiate(InfoLineObject, InfoScrollPanel.transform);
                lines[i].transform.localPosition = new Vector3(0, i * -90 + 260, 0);
            }

            short index = 5;
            lines[0].GetComponentInChildren <Text>().text = $"Territory name: {desc.name}";
            lines[1].GetComponentInChildren <Text>().text = $"Territory type: {desc.type}";
            lines[2].GetComponentInChildren <Text>().text = $"Active: {desc.active}";
            lines[3].GetComponentInChildren <Text>().text = $"Radius: {desc.radius}";
            lines[4].GetComponentInChildren <Text>().text = $"Coordinates: (x:{desc.coordsX} y:{desc.coordsY} z:{desc.coordsZ})";
            if (desc.scaleRadiusWithPlanetSize)
            {
                lines[index].GetComponentInChildren <Text>().text = $"Scale Radius With Planet Size: {desc.scaleRadiusWithPlanetSize}";
                index++;
            }
            if (desc.announceArriveDepart)
            {
                lines[index].GetComponentInChildren <Text>().text     = $"Announce Arrive Depart: {desc.announceArriveDepart}";
                lines[index + 1].GetComponentInChildren <Text>().text = $"Custom Arrive Message: {desc.customArriveMessage}";
                lines[index + 2].GetComponentInChildren <Text>().text = $"Custom Depart Message: {desc.customDepartMessage}";
                index += 3;
            }
            if (desc.type == "Planetary")
            {
                lines[index].GetComponentInChildren <Text>().text = $"Planet Generator Name: {desc.planetGeneratorName}";
            }
        }
        else
        {
            //is spawngroup
            short lineCount = 5;

            /*
             * 1-SubtypeId-
             *
             * 1-Type-
             *
             * 1-FactionOwner/random...faction-
             *
             * 1 foreach valued thing-
             *
             * 1-frequency-
             *
             * 1-Prefabs-
             */

            if (desc.planetaryInstallation)
            {
                lineCount += 3;
            }
            if (desc.spaceCargoShip || desc.spaceRandomEncounter)
            {
                lineCount += 1;
            }
            if (desc.spaceRandomEncounter)
            {
                lineCount += 1;
            }
            if (desc.ignoreCleanupRules)
            {
                lineCount += 1;
            }
            if (desc.replenishSystems)
            {
                lineCount += 1;
            }
            if (desc.initializeStoreBlocks)
            {
                lineCount += 1;
            }
            if (desc.pauseAutopilotAtPlayerDistance != 1)
            {
                lineCount += 1;
            }
            if (desc.forceStaticGrid)
            {
                lineCount += 1;
            }
            if (desc.adminSpawnOnly)
            {
                lineCount += 1;
            }
            if (desc.minSpawnFromWorldCenter != -1)
            {
                lineCount += 1;
            }
            if (desc.maxSpawnFromWorldCenter != -1)
            {
                lineCount += 1;
            }
            if (desc.planetRequiresVacuum)
            {
                lineCount += 1;
            }
            if (desc.planetRequiresAtmo)
            {
                lineCount += 1;
            }
            if (desc.planetRequiresOxygen)
            {
                lineCount += 1;
            }
            if (desc.planetMinimumSize != -1)
            {
                lineCount += 1;
            }
            if (desc.planetMaximumSize != -1)
            {
                lineCount += 1;
            }
            if (desc.useThreatLevelCheck)
            {
                lineCount += 5;
            }
            if (desc.usePCUCheck)
            {
                lineCount += 4;
            }
            if (desc.usePlayerCountCheck)
            {
                lineCount += 4;
            }
            if (desc.usePlayerCredits)
            {
                lineCount += 6;
            }
            if (desc.usePlayerFactionReputation)
            {
                lineCount += 5;
            }
            if (desc.attachModStorageComponentToGrid)
            {
                lineCount += 3;
            }
            if (desc.useKnowPlayerLocations)
            {
                lineCount += 4;
            }
            if (!string.IsNullOrEmpty(desc.territory))
            {
                lineCount += 3;
            }
            if (desc.rotateFirstCockpitToForward)
            {
                lineCount += 1;
            }
            if (desc.spawnRandomCargo)
            {
                lineCount += 1;
            }
            if (desc.disableDampeners)
            {
                lineCount += 1;
            }
            if (desc.reactorsOn)
            {
                lineCount += 1;
            }


            GameObject[] lines = new GameObject[lineCount]; //Set length

            for (int a = 0; a < lines.Length; a++)          //Instantiate all the lines
            {
                lines[a] = Instantiate(InfoLineObject, InfoScrollPanel.transform);
                lines[a].transform.localPosition = new Vector3(0, a * -90 + 260, 0);
            }

            short i = 5;

            lines[0].GetComponentInChildren <Text>().text = $"Name: {spawnGroup.SubtypeId}";
            lines[1].GetComponentInChildren <Text>().text = $"Frequency: {spawnGroup.Frequency}";

            if (desc.spaceCargoShip)
            {
                lines[3].GetComponentInChildren <Text>().text = $"Space Cargo Ship";
            }
            else if (desc.lunarCargoShip)
            {
                lines[3].GetComponentInChildren <Text>().text = $"Lunar Cargo Ship";
            }
            else if (desc.atmosphericCargoShip)
            {
                lines[3].GetComponentInChildren <Text>().text = $"Atmospheric Cargo Ship";
            }
            else if (desc.spaceRandomEncounter)
            {
                lines[3].GetComponentInChildren <Text>().text = $"Space Random Encounter";
            }
            else
            {
                lines[3].GetComponentInChildren <Text>().text = $"Planetary Installation";
            }

            if (desc.useRandomBuilderFaction)
            {
                lines[2].GetComponentInChildren <Text>().text = $"Random Builder Faction";
            }
            else if (desc.useRandomMinerFaction)
            {
                lines[2].GetComponentInChildren <Text>().text = $"Random Miner Faction";
            }
            else if (desc.useRandomTraderFaction)
            {
                lines[2].GetComponentInChildren <Text>().text = $"Random Trader Faction";
            }
            else
            {
                lines[2].GetComponentInChildren <Text>().text = $"Faction Owner: {desc.factionOwner}";
            }

            string s = string.Empty;

            foreach (Prefab pre in spawnGroup.Prefabs)
            {
                s += $"{pre.SubtypeId};";
            }

            lines[4].GetComponentInChildren <Text>().text = $"Prefabs: {s}";

            if (desc.spaceCargoShip || desc.spaceRandomEncounter)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Use Autopilot In Space: {desc.useAutoPilotInSpace}";
                i += 1;
            }

            if (desc.spaceRandomEncounter)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Unique Encounter: {desc.uniqueEncounter}";
                i += 1;
            }

            if (desc.planetaryInstallation)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Installation Type: {desc.planetaryInstallationType}";
                lines[i + 1].GetComponentInChildren <Text>().text = $"Cut Voxels At Airtight Cells: {desc.cutVoxelsAtAirtightCells}";
                lines[i + 2].GetComponentInChildren <Text>().text = $"Remove Voxels If Grid Remove: {desc.removeVoxelsIfGridRemoved}";
                i += 3;
            }

            if (desc.ignoreCleanupRules)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Ignore Cleanup Rules";
                i += 1;
            }

            if (desc.replenishSystems)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Replenish Systems";
                i += 1;
            }

            if (desc.initializeStoreBlocks)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Initialize Store Blocks";
                i += 1;
            }

            if (desc.pauseAutopilotAtPlayerDistance != -1)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Pause Autopilot At Player Distance: {desc.pauseAutopilotAtPlayerDistance}";
                i += 1;
            }

            if (desc.forceStaticGrid)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Force Static Grid";
                i += 1;
            }

            if (desc.adminSpawnOnly)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Admin Spawn Only";
                i += 1;
            }

            if (desc.minSpawnFromWorldCenter != -1)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Min Spawn From World Center: {desc.minSpawnFromWorldCenter}";
                i += 1;
            }

            if (desc.maxSpawnFromWorldCenter != -1)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Max Spawn From World Center: {desc.maxSpawnFromWorldCenter}";
                i += 1;
            }

            if (desc.planetRequiresVacuum)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Planet Requires Vacuum";
                i += 1;
            }

            if (desc.planetRequiresAtmo)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Planet Requires Atmosphere";
                i += 1;
            }

            if (desc.planetRequiresOxygen)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Planet Requires Oxygen";
                i += 1;
            }

            if (desc.planetMinimumSize != -1)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Planet Minimum Size: {desc.planetMinimumSize}";
                i += 1;
            }

            if (desc.planetMaximumSize != -1)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Planet Maximum Size: {desc.planetMaximumSize}";
                i += 1;
            }

            if (desc.useThreatLevelCheck)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use Threat Level Check:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Check Radius: {desc.threatLevelCheckRange}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Include Other NPC Owners: {desc.threatLevelCheckOtherNPCOwners}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Minimum Score: {desc.threatScoreMinimum}";
                lines[i + 4].GetComponentInChildren <Text>().text = $" -Maximum Score: {desc.threatScoreMaximum}";
                i += 5;
            }

            if (desc.usePCUCheck)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use PCU Check:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Check Radius: {desc.PCUCheckRadius}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Minimum: {desc.PCUMinimum}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Maximum: {desc.PCUMaximum}";
                i += 4;
            }

            if (desc.usePlayerCountCheck)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use Player Count Check:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Check Radius: {desc.playerCountCheckRadius}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Minimum: {desc.minimumPlayers}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Maximum: {desc.maximumPlayers}";
                i += 4;
            }

            if (desc.usePlayerCredits)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use Player Credits:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Include All Players In Radius: {desc.includeAllPlayersInRadius}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Inclued Faction Balance: {desc.includeFactionBalance}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Check Radius: {desc.playerCreditCheckRadius}";
                lines[i + 4].GetComponentInChildren <Text>().text = $" -Minimum: {desc.minimumPlayerCredits}";
                lines[i + 5].GetComponentInChildren <Text>().text = $" -Maximum: {desc.maximumPlayerCredits}";
                i += 6;
            }

            if (desc.usePlayerFactionReputation)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use Player Faction Reputation:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Check Radius: {desc.playerReputationCheckRadius}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Check Reputation Agains Other NPC Factions: {desc.checkReputationAgainstOtherNPCFaction}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Minimum: {desc.minimumReputation}";
                lines[i + 4].GetComponentInChildren <Text>().text = $" -Maximum: {desc.maximumReputation}";
                i += 5;
            }

            if (desc.attachModStorageComponentToGrid)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Attach Mod Storage To Grid:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Key: {desc.storageKey}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Value: {desc.storageValue}";
                i += 3;
            }

            if (desc.useKnowPlayerLocations)
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Use Known Player Locations:";
                lines[i + 1].GetComponentInChildren <Text>().text = $" -Known Player Location Must Match Faction: {desc.knownPlayerLocationMustMatchFaction}";
                lines[i + 2].GetComponentInChildren <Text>().text = $" -Min Spawned Encounters: {desc.knownPlayerLocationMinSpawnedEncounters}";
                lines[i + 3].GetComponentInChildren <Text>().text = $" -Max Spawned Encounters: {desc.knownPlayerLocationMaxSpawnedEncounters}";
                i += 4;
            }

            if (!string.IsNullOrEmpty(desc.territory))
            {
                lines[i].GetComponentInChildren <Text>().text     = $"Territory: {desc.territory}";
                lines[i + 1].GetComponentInChildren <Text>().text = $"Min Distance From Territory Center: {desc.minDistanceFromTerritoryCenter}";
                lines[i + 2].GetComponentInChildren <Text>().text = $"Max Distance From Territory Center: {desc.maxDistanceFromTerritoryCenter}";
                i += 3;
            }

            if (desc.rotateFirstCockpitToForward)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Rotate First Cockpit To Forward";
                i += 1;
            }

            if (desc.spawnRandomCargo)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Spawn Random Cargo";
                i += 1;
            }

            if (desc.disableDampeners)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Disable Dampners";
                i += 1;
            }

            if (desc.reactorsOn)
            {
                lines[i].GetComponentInChildren <Text>().text = $"Reactors On";
                i += 1;
            }
        }
    }