protected void RefreshGameList()
        {
            int selectedIndex = m_scenarioTable.SelectedRowIndex ?? -1;

            m_scenarioTable.Clear();
            Color?color = null;

            for (int index = 0; index < m_availableSaves.Count; index++)
            {
                var checkpoint = m_availableSaves[index].Item2;
                var name       = new StringBuilder(checkpoint.SessionName);
                var row        = new MyGuiControlTable.Row(m_availableSaves[index]);
                row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, textColor: color, icon: GetIcon(m_availableSaves[index])));
                row.AddCell(new MyGuiControlTable.Cell(text: name, textColor: color, userData: name));
                m_scenarioTable.Add(row);

                // Select row with same world ID as we had before refresh.
                if (index == selectedIndex)
                {
                    m_selectedRow = index;
                    m_scenarioTable.SelectedRow = row;
                }
            }

            m_scenarioTable.SelectedRowIndex = m_selectedRow;
            m_scenarioTable.ScrollToSelection();
            FillRight();
        }
Esempio n. 2
0
        private void RefreshMedicalRooms()
        {
            List <MyMedicalRoom> medicalRooms;

            GetAvailableMedicalRooms(MySession.LocalPlayerId, out medicalRooms);

            foreach (var medRoom in medicalRooms)
            {
                var row = new MyGuiControlTable.Row(medRoom);
                row.AddCell(new MyGuiControlTable.Cell(text: medRoom.CustomName));


                var ownerText = new StringBuilder();
                if (MySession.Static.Settings.EnableOxygen)
                {
                    ownerText.Append("O2 ");
                    ownerText.Append((medRoom.GetOxygenLevel() * 100).ToString("F0"));
                    ownerText.Append("% ");
                }
                ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom));

                row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
                m_respawnsTable.Add(row);
            }
        }
Esempio n. 3
0
        private void AddRespawnInSuit()
        {
            var row = new MyGuiControlTable.Row();

            row.AddCell(new MyGuiControlTable.Cell(text: MyTexts.GetString(MySpaceTexts.SpawnInSpaceSuit)));
            row.AddCell(new MyGuiControlTable.Cell(text: MyTexts.GetString(MySpaceTexts.ScreenMedicals_RespawnShipReady)));

            m_respawnsTable.Add(row);
        }
        private void AddMember(long playerId, string playerName, bool isLeader, MyMemberComparerEnum status, MyStringId textEnum, Color?color = null)
        {
            var row = new MyGuiControlTable.Row(new MyFactionMember(playerId, isLeader));

            row.AddCell(new MyGuiControlTable.Cell(text:    new StringBuilder(playerName),
                                                   toolTip: playerName,
                                                   userData: playerId, textColor: color));
            row.AddCell(new MyGuiControlTable.Cell(text: MyTexts.Get(textEnum), userData: status, textColor: color));
            m_tableMembers.Add(row);
        }
Esempio n. 5
0
        private void PopulateOwnedCubeGrids(HashSet <CubeGridInfo> gridInfoList)
        {
            float scrollBarValue = m_shipsData.ScrollBar.Value;

            m_shipsData.Clear();
            foreach (var gridInfo in gridInfoList)
            {
                UserData data;
                MyGuiControlTable.Row  row;
                MyGuiControlTable.Cell nameCell, controlCell, distanceCell, statusCell, accessCell;

                data.GridEntityId = gridInfo.EntityId;
                if (gridInfo.Status == MyCubeGridConnectionStatus.Connected || gridInfo.Status == MyCubeGridConnectionStatus.PhysicallyConnected || gridInfo.Status == MyCubeGridConnectionStatus.Me)
                {
                    StringBuilder minDistance = new StringBuilder();
                    if (gridInfo.Status == MyCubeGridConnectionStatus.Connected)
                    {
                        minDistance = gridInfo.AppendedDistance.Append(" m");
                    }

                    data.IsSelectable = true;
                    nameCell          = new MyGuiControlTable.Cell(new StringBuilder(gridInfo.Name), textColor: Color.White);
                    controlCell       = CreateControlCell(gridInfo, true);
                    distanceCell      = new MyGuiControlTable.Cell(minDistance, userData: gridInfo.Distance, textColor: Color.White);
                    statusCell        = CreateStatusIcons(gridInfo, true);
                    accessCell        = CreateTerminalCell(gridInfo, true);
                }

                else
                {
                    data.IsSelectable = false;
                    nameCell          = new MyGuiControlTable.Cell(new StringBuilder(gridInfo.Name), textColor: Color.Gray);
                    controlCell       = CreateControlCell(gridInfo, false);
                    distanceCell      = new MyGuiControlTable.Cell(new StringBuilder("Not Available"), userData: float.MaxValue, textColor: Color.Gray);
                    statusCell        = CreateStatusIcons(gridInfo, true);
                    accessCell        = CreateTerminalCell(gridInfo, false);
                }

                row = new MyGuiControlTable.Row(data);
                row.AddCell(nameCell);
                row.AddCell(controlCell);
                row.AddCell(distanceCell);
                row.AddCell(statusCell);
                row.AddCell(accessCell);
                m_shipsData.Add(row);
                m_shipsData.SortByColumn(m_columnToSort, MyGuiControlTable.SortStateEnum.Ascending, false);
            }
            m_shipsData.ScrollBar.ChangeValue(scrollBarValue);
        }
Esempio n. 6
0
        private void AddMod(bool active, StringBuilder title, StringBuilder toolTip, StringBuilder modState, MyGuiHighlightTexture?icon, MyObjectBuilder_Checkpoint.ModItem mod, Color?textColor = null)
        {
            var row = new MyGuiControlTable.Row(mod);

            row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, toolTip: modState.ToString(), icon: icon));
            row.AddCell(new MyGuiControlTable.Cell(text: title, toolTip: toolTip.ToString(), textColor: textColor));

            if (active)
            {
                m_modsTableEnabled.Insert(0, row);
            }
            else
            {
                m_modsTableDisabled.Insert(0, row);
            }
        }
        protected void AddPlayer(ulong userId)
        {
            //string playerName = SteamAPI.Instance.Friends.GetPersonaName(userId);
            string playerName = MyMultiplayer.Static.GetMemberName(userId);

            if (String.IsNullOrEmpty(playerName))
            {
                return;
            }

            var row = new MyGuiControlTable.Row(userData: userId);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(playerName), userData: playerName));

            var playerId = Sync.Players.TryGetIdentityId(userId);
            var faction  = MySession.Static.Factions.GetPlayerFaction(playerId);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(faction != null ? faction.Tag : "")));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(faction != null ? faction.Name : "")));

            // cell with/without mute checkbox
            MyGuiControlTable.Cell cell = new MyGuiControlTable.Cell(text: new StringBuilder(""));
            row.AddCell(cell);

            if (MyPerGameSettings.EnableMutePlayer && userId != Sync.MyId)
            {
                MyGuiControlCheckbox check = new MyGuiControlCheckbox(toolTip: "", visualStyle: MyGuiControlCheckboxStyleEnum.Muted);
                check.IsChecked         = MySandboxGame.Config.MutedPlayers.Contains(userId);
                check.IsCheckedChanged += IsMuteCheckedChanged;
                check.UserData          = userId;
                cell.Control            = check;

                m_playersTable.Controls.Add(check);
            }

            // cell with admin marker
            StringBuilder  adminString = new StringBuilder();
            MyPromoteLevel userLevel   = MySession.Static.GetUserPromoteLevel(userId);

            for (int i = 0; i < (int)userLevel; i++)
            {
                adminString.Append("*");
            }

            row.AddCell(new MyGuiControlTable.Cell(adminString));
            m_playersTable.Add(row);
        }
Esempio n. 8
0
        void RefreshMedicalRooms(List <MyMedicalRoomInfo> medicalRooms)
        {
            m_respawnsTable.Clear();

            foreach (var medRoom in medicalRooms)
            {
                var row = new MyGuiControlTable.Row(medRoom);
                row.AddCell(new MyGuiControlTable.Cell(text: medRoom.MedicalRoomName));


                var ownerText = new StringBuilder();
                if (MySession.Static.Settings.EnableOxygen)
                {
                    ownerText.Append("O2 ");
                    ownerText.Append((medRoom.OxygenLevel * 100).ToString("F0"));
                    ownerText.Append("% ");
                }
                ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom.OwnerId));

                row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
                m_respawnsTable.Add(row);
            }


            if (MySession.Static.CreativeMode)
            {
                AddRespawnInSuit();
            }
            else
            if ((MySession.Static.Settings.EnableRespawnShips && !MySession.Static.Settings.Scenario))
            {
                RefreshSpawnShips();
                AddRespawnInSuit();
            }

            if (m_respawnsTable.RowsCount > 0)
            {
                m_respawnsTable.SelectedRowIndex = 0;
                OnTableItemSelected(null, new MyGuiControlTable.EventArgs());
                m_noRespawnText.Visible = false;
            }
            else
            {
                m_noRespawnText.Visible = true;
            }
        }
        private void AddFaction(IMyFaction faction, Color?color = null, MyGuiHighlightTexture?icon = null, String iconToolTip = null)
        {
            System.Diagnostics.Debug.Assert(m_tableFactions != null);
            if (m_tableFactions == null)
            {
                return;
            }

            var row  = new MyGuiControlTable.Row(faction);
            var tag  = new StringBuilder(faction.Tag);
            var name = new StringBuilder(faction.Name);

            row.AddCell(new MyGuiControlTable.Cell(text: tag, userData: tag, textColor: color));
            row.AddCell(new MyGuiControlTable.Cell(text: name, userData: name, textColor: color, toolTip: faction.Name));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), icon: icon, toolTip: iconToolTip));
            m_tableFactions.Add(row);
        }
 private MyGuiControlTable.Row AddToList(MyGps ins)
 {
     var row = new MyGuiControlTable.Row(ins);
     var name = new StringBuilder(ins.Name);
     row.AddCell(new MyGuiControlTable.Cell(text: name, userData: ins, textColor: (ins.DiscardAt != null ? Color.Gray : (ins.ShowOnHud ? ITEM_SHOWN_COLOR : Color.White))));
     m_tableIns.Add(row);
     return row;
 }
Esempio n. 11
0
        private void AddPlayer(ulong userId)
        {
            //string playerName = SteamAPI.Instance.Friends.GetPersonaName(userId);
            string playerName = MyMultiplayer.Static.GetMemberName(userId);

            if (String.IsNullOrEmpty(playerName))
            {
                return;
            }

            bool isAdmin = MyMultiplayer.Static.IsAdmin(userId);

            var row = new MyGuiControlTable.Row(userData: userId);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(playerName), userData: playerName));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(isAdmin ? GAME_OWNER_MARKER : "")));
            m_playersTable.Add(row);
        }
Esempio n. 12
0
 private void AddRow(MyTerminalBlock block)
 {
     MyGuiControlTable.Row  row;
     MyGuiControlTable.Cell cell;
     row  = new MyGuiControlTable.Row(block);
     cell = new MyGuiControlTable.Cell(block.CustomName);
     row.AddCell(cell);
     m_selectedBlocks.Add(row);
 }
Esempio n. 13
0
        private void AddServerItem(GameServerItem server, string sessionName, StringBuilder gamemodeSB, StringBuilder gamemodeToolTipSB, string remainingTimeText = null, float?remainingTimeSeconds = null)
        {
            ulong modCount = server.GetGameTagByPrefixUlong(MyMultiplayer.ModCountTag);

            string        limit     = server.MaxPlayers.ToString();
            StringBuilder userCount = new StringBuilder(server.Players + "/" + limit);

            var viewDistance = server.GetGameTagByPrefix(MyMultiplayer.ViewDistanceTag);

            //TODO: refactor
            if (!String.IsNullOrEmpty(viewDistance) && server.AppID == 244850)
            {
                gamemodeToolTipSB.AppendLine();
                gamemodeToolTipSB.AppendFormat(MyTexts.Get(MyCommonTexts.JoinGame_GameTypeToolTip_ViewDistance).ToString(), viewDistance);
            }

            var row = new MyGuiControlTable.Row(server);

            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(sessionName), userData: server.SteamID, toolTip: m_textCache.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: gamemodeSB, toolTip: gamemodeToolTipSB.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Name), toolTip: m_gameTypeToolTip.Clear().AppendLine(server.Name).Append(server.NetAdr.ToString()).ToString()));

            if (MyFakes.ENABLE_JOIN_SCREEN_REMAINING_TIME)
            {
                if (remainingTimeText != null)
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(remainingTimeText)));
                }
                else if (remainingTimeSeconds != null)
                {
                    row.AddCell(new CellRemainingTime(remainingTimeSeconds.Value));
                }
                else
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear()));
                }
            }

            row.AddCell(new MyGuiControlTable.Cell(text: userCount, toolTip: userCount.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Ping), toolTip: m_textCache.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(modCount == 0 ? "---" : modCount.ToString()), toolTip: MyTexts.GetString(MyCommonTexts.JoinGame_SelectServerToShowModList)));
            m_gamesTable.Add(row);

            var selectedRow = m_gamesTable.SelectedRow;

            m_gamesTable.Sort(false);

            m_gamesTable.SelectedRowIndex = m_gamesTable.FindRow(selectedRow);
        }
Esempio n. 14
0
        protected void AddPlayer(ulong userId)
        {
            //string playerName = SteamAPI.Instance.Friends.GetPersonaName(userId);
            string playerName = MyMultiplayer.Static.GetMemberName(userId);

            if (String.IsNullOrEmpty(playerName))
            {
                return;
            }

            bool isAdmin        = MyMultiplayer.Static.IsAdmin(userId);
            bool hasAdminRights = MySession.Static.HasPlayerAdminRights(userId);

            var row = new MyGuiControlTable.Row(userData: userId);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(playerName), userData: playerName));

            var playerId = Sync.Players.TryGetIdentityId(userId);
            var faction  = MySession.Static.Factions.GetPlayerFaction(playerId);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(faction != null ? faction.Tag : "")));
            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(faction != null ? faction.Name : "")));

            // cell with/without mute checkbox
            MyGuiControlTable.Cell cell = new MyGuiControlTable.Cell(text: new StringBuilder(""));
            row.AddCell(cell);

            if (MyPerGameSettings.EnableMutePlayer && userId != Sync.MyId)
            {
                MyGuiControlCheckbox check = new MyGuiControlCheckbox(toolTip: "", visualStyle: MyGuiControlCheckboxStyleEnum.Muted);
                check.IsChecked         = MySandboxGame.Config.MutedPlayers.Contains(userId);
                check.IsCheckedChanged += IsMuteCheckedChanged;
                check.UserData          = userId;
                cell.Control            = check;

                m_playersTable.Controls.Add(check);
            }

            // cell with admin marker
            string adminString = isAdmin ? GAME_OWNER_MARKER : (hasAdminRights ? GAME_MASTER_MARKER : String.Empty);

            row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(adminString)));
            m_playersTable.Add(row);
        }
Esempio n. 15
0
        private void RefreshSpawnShips()
        {
            var respawnShips = MyDefinitionManager.Static.GetRespawnShipDefinitions();

            foreach (var pair in respawnShips)
            {
                var respawnShip = pair.Value;
                var row         = new MyGuiControlTable.Row(respawnShip);

                //Add description or name?
                row.AddCell(new MyGuiControlTable.Cell(text: respawnShip.DisplayNameText));

                var respawnTimeCell = new MyGuiControlTable.Cell(String.Empty);
                AddShipRespawnInfo(respawnShip, respawnTimeCell.Text);
                row.AddCell(respawnTimeCell);

                m_respawnsTable.Add(row);
            }
        }
        private void RefreshGameList()
        {
            int selectedIndex = m_scenarioTable.SelectedRowIndex ?? -1;

            m_scenarioTable.Clear();
            AddHeaders();

            for (int index = 0; index < m_availableSaves.Count; index++)
            {
                var checkpoint = m_availableSaves[index].Item2;
                var name       = new StringBuilder(checkpoint.SessionName);

                var row = new MyGuiControlTable.Row(m_availableSaves[index]);
                if (m_availableSaves[index].Item1 == WORKSHOP_PATH_TAG)
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, icon: MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP));
                }
                else if (m_availableSaves[index].Item2.ScenarioEditMode == true)
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, icon: MyGuiConstants.TEXTURE_ICON_MODS_LOCAL));
                }
                else
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, icon: MyGuiConstants.TEXTURE_ICON_BLUEPRINTS_LOCAL));
                }

                row.AddCell(new MyGuiControlTable.Cell(text: name, userData: name));
                m_scenarioTable.Add(row);

                // Select row with same world ID as we had before refresh.
                if (index == selectedIndex)
                {
                    m_selectedRow = index;
                    m_scenarioTable.SelectedRow = row;
                }
            }

            m_scenarioTable.SelectedRowIndex = m_selectedRow;
            m_scenarioTable.ScrollToSelection();
            FillRight();
        }
Esempio n. 17
0
        static void RefreshMedicalRoomsResponse_Implementation(List <MyMedicalRoomInfo> medicalRooms)
        {
            foreach (var medRoom in medicalRooms)
            {
                var row = new MyGuiControlTable.Row(medRoom);
                row.AddCell(new MyGuiControlTable.Cell(text: medRoom.MedicalRoomName));


                var ownerText = new StringBuilder();
                if (MySession.Static.Settings.EnableOxygen)
                {
                    ownerText.Append("O2 ");
                    ownerText.Append((medRoom.OxygenLevel * 100).ToString("F0"));
                    ownerText.Append("% ");
                }
                ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom.OwnerId));

                row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
                MyGuiScreenMedicals.Static.m_respawnsTable.Add(row);
            }
        }
Esempio n. 18
0
        private void RefreshGameList()
        {
            m_worldsTable.Clear();
            AddHeaders();

            if (m_subscribedWorlds != null)
            {
                for (int i = 0; i < m_subscribedWorlds.Count; ++i)
                {
                    var world   = m_subscribedWorlds[i];
                    var row     = new MyGuiControlTable.Row(world);
                    var titleSB = new StringBuilder(world.Title);
                    row.AddCell(new MyGuiControlTable.Cell(text: titleSB.ToString(),
                                                           userData: titleSB));
                    row.AddCell(new MyGuiControlTable.Cell());
                    m_worldsTable.Add(row);
                }
            }

            m_worldsTable.SelectedRowIndex = null;
        }
        private void RefreshGameList()
        {
            string selectedWorldId = null;

            {
                var selectedRow = m_scenarioTable.SelectedRow;
                if (selectedRow != null)
                {
                    selectedWorldId = (string)selectedRow.UserData;
                }
            }

            m_scenarioTable.Clear();
            AddHeaders();

            for (int index = 0; index < m_availableSaves.Count; index++)
            {
                var checkpoint = m_availableSaves[index].Item2;
                var name       = new StringBuilder(checkpoint.SessionName);

                var row = new MyGuiControlTable.Row(m_availableSaves[index].Item1);
                row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, icon: MyGuiConstants.TEXTURE_ICON_MODS_LOCAL));
                row.AddCell(new MyGuiControlTable.Cell(text: name,
                                                       userData: name));
                m_scenarioTable.Add(row);

                // Select row with same world ID as we had before refresh.
                if (index == 0)//selectedWorldId != null && checkpoint.WorldID == selectedWorldId)
                {
                    m_selectedRow = index;
                    m_scenarioTable.SelectedRow = row;
                }
            }
            m_scenarioTable.SetColumnComparison(1, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
            m_scenarioTable.SortByColumn(1);

            m_scenarioTable.SelectedRowIndex = m_selectedRow;
            m_scenarioTable.ScrollToSelection();
            FillRight();
        }
        protected void RefreshGameList(bool tutorials = false)
        {
            int selectedIndex = m_scenarioTable.SelectedRowIndex ?? -1;

            m_scenarioTable.Clear();
            Color?color = null;

            for (int index = 0; index < m_availableSaves.Count; index++)
            {
                var checkpoint = m_availableSaves[index].Item2;
                var name       = new StringBuilder(checkpoint.SessionName);
                if (tutorials)
                {
                    if (MyTutorialHelper.IsUnlocked(checkpoint.SessionName) || MyFakes.DEVELOPMENT_PRESET)
                    {
                        color = null;
                    }
                    else
                    {
                        color = Color.Gray;
                    }
                }
                var row = new MyGuiControlTable.Row(m_availableSaves[index]);
                row.AddCell(new MyGuiControlTable.Cell(text: String.Empty, textColor: color, icon: GetIcon(m_availableSaves[index])));
                row.AddCell(new MyGuiControlTable.Cell(text: name, textColor: color, userData: name));
                m_scenarioTable.Add(row);

                // Select row with same world ID as we had before refresh.
                if (index == selectedIndex)
                {
                    m_selectedRow = index;
                    m_scenarioTable.SelectedRow = row;
                }
            }

            m_scenarioTable.SelectedRowIndex = m_selectedRow;
            m_scenarioTable.ScrollToSelection();
            FillRight();
        }
Esempio n. 21
0
        private void RefreshGameList()
        {
            string selectedWorldSavePath = null;

            {
                var selectedRow = m_sessionsTable.SelectedRow;
                if (selectedRow != null)
                {
                    selectedWorldSavePath = (string)selectedRow.UserData;
                }
            }

            m_sessionsTable.Clear();
            AddHeaders();

            for (int index = 0; index < m_availableSaves.Count; index++)
            {
                var checkpoint = m_availableSaves[index].Item2;
                var name       = new StringBuilder(checkpoint.SessionName);

                var row = new MyGuiControlTable.Row(m_availableSaves[index].Item1);
                row.AddCell(new MyGuiControlTable.Cell(text: name,
                                                       userData: name));
                row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(checkpoint.LastLoadTime.ToString()),
                                                       userData: checkpoint.LastLoadTime));
                m_sessionsTable.Add(row);

                // Select row with same world ID as we had before refresh.
                if (selectedWorldSavePath != null && m_availableSaves[index].Item1 == selectedWorldSavePath)
                {
                    m_selectedRow = index;
                }
            }

            m_sessionsTable.SelectedRowIndex = m_selectedRow;
            m_sessionsTable.ScrollToSelection();
        }
        private static void UpdatePlayerList(MyGuiControlTable table)
        {
            MyPlayer selectedRowPlayer = table.SelectedRow != null ? table.SelectedRow.UserData as MyPlayer : null;

            table.Clear();

            var onlinePlayers = Sync.Players.GetOnlinePlayers();

            foreach (var player in onlinePlayers)
            {
                var name = player.DisplayName;
                var row  = new MyGuiControlTable.Row(player);
                row.AddCell(new MyGuiControlTable.Cell(text: name));
                if (Sync.ServerId == player.Id.SteamId)
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: "SERVER"));
                }
                else
                {
                    if (m_readyPlayers.Contains(player.Id.SteamId))
                    {
                        row.AddCell(new MyGuiControlTable.Cell(text: "ready"));
                    }
                    else
                    {
                        row.AddCell(new MyGuiControlTable.Cell(text: ""));
                    }
                }
                table.Add(row);

                if (player == selectedRowPlayer)
                {
                    table.SelectedRow = row;
                }
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Opens the dialog to add a subtype id to the given table
        /// </summary>
        /// <param name="table">Table to add item to</param>
        /// <param name="addAction">Action, which should add the id to the settings file</param>
        private void OpenEnterIdDialog(MyGuiControlTable table, Action <string> addAction)
        {
            MyGuiScreenDialogText inputBox = new MyGuiScreenDialogText();

            inputBox.OnConfirmed += delegate(string text)
            {
                if (Regex.Match(text, ILLEGAL_XML).Success)
                {
                    MyPluginGuiHelper.DisplayError("The entered subtype id contains invalid characters (& < >).", "Error, invalid character");
                    return;
                }

                var row = new MyGuiControlTable.Row(text);
                row.AddCell(new MyGuiControlTable.Cell(text));

                table.Add(row);
                addAction(text);
            };
            MyGuiSandbox.AddScreen(inputBox);
        }
Esempio n. 24
0
        /// <summary>
        /// Loads the global settings and reflects them in gui
        /// </summary>
        private void LoadSettings()
        {
            foreach (var moon in MySettings.Static.Settings.MoonDefinitions)
            {
                var row = new MyGuiControlTable.Row(moon);
                row.AddCell(new MyGuiControlTable.Cell(moon));

                m_moonDefsTable.Add(row);
            }
            foreach (var gasGiant in MySettings.Static.Settings.GasGiantDefinitions)
            {
                var row = new MyGuiControlTable.Row(gasGiant);
                row.AddCell(new MyGuiControlTable.Cell(gasGiant));

                m_gasGiantsDefsTable.Add(row);
            }
            foreach (var sun in MySettings.Static.Settings.SunDefinitions)
            {
                var row = new MyGuiControlTable.Row(sun);
                row.AddCell(new MyGuiControlTable.Cell(sun));

                m_sunDefsTable.Add(row);
            }
            foreach (var mandatory in MySettings.Static.Settings.MandatoryPlanetDefinitions)
            {
                var row = new MyGuiControlTable.Row(mandatory);
                row.AddCell(new MyGuiControlTable.Cell(mandatory));

                m_mandatoryDefsTable.Add(row);
            }
            foreach (var blacklisted in MySettings.Static.Settings.BlacklistedPlanetDefinitions)
            {
                var row = new MyGuiControlTable.Row(blacklisted);
                row.AddCell(new MyGuiControlTable.Cell(blacklisted));

                m_blacklistDefsTable.Add(row);
            }
            m_planetNameBox.SetText(new StringBuilder(MySettings.Static.Settings.PlanetNameFormat));
            m_moonNameBox.SetText(new StringBuilder(MySettings.Static.Settings.MoonNameFormat));
            m_beltNameBox.SetText(new StringBuilder(MySettings.Static.Settings.BeltNameFormat));
        }
        private void PopulateOwnedCubeGrids(HashSet <CubeGridInfo> gridInfoList)
        {
            float scrollBarValue = m_shipsData.ScrollBar.Value;

            m_shipsData.Clear();
            foreach (var gridInfo in gridInfoList)
            {
                UserData data;
                MyGuiControlTable.Row  row;
                MyGuiControlTable.Cell nameCell, distanceCell, statusCell;

                data.GridEntityId = gridInfo.EntityId;
                if (gridInfo.Status == MyCubeGridConnectionStatus.Connected || gridInfo.Status == MyCubeGridConnectionStatus.PhysicallyConnected || gridInfo.Status == MyCubeGridConnectionStatus.Me)
                {
                    StringBuilder minDistance = new StringBuilder();
                    if (gridInfo.Status == MyCubeGridConnectionStatus.Connected)
                    {
                        minDistance = gridInfo.AppendedDistance.Append(" m");
                    }

                    data.IsSelectable = true;
                    nameCell          = new MyGuiControlTable.Cell(new StringBuilder(gridInfo.Name), textColor: Color.White);
                    distanceCell      = new MyGuiControlTable.Cell(minDistance, userData: gridInfo.Distance, textColor: Color.White);
                    switch (gridInfo.Status)
                    {
                    case MyCubeGridConnectionStatus.PhysicallyConnected:
                        statusCell = new MyGuiControlTable.Cell(MyTexts.Get(MySpaceTexts.BroadcastStatus_PhysicallyConnected), userData: gridInfo.Status, textColor: Color.White);
                        break;

                    case MyCubeGridConnectionStatus.Me:
                        statusCell = new MyGuiControlTable.Cell(MyTexts.Get(MySpaceTexts.BroadcastStatus_Me), userData: gridInfo.Status, textColor: Color.White);
                        break;

                    case MyCubeGridConnectionStatus.Connected:
                    default:
                        statusCell = new MyGuiControlTable.Cell(MyTexts.Get(MySpaceTexts.BroadcastStatus_Connected), userData: gridInfo.Status, textColor: Color.White);
                        break;
                    }
                }

                else
                {
                    data.IsSelectable = false;
                    nameCell          = new MyGuiControlTable.Cell(new StringBuilder(gridInfo.Name), textColor: Color.Gray);
                    distanceCell      = new MyGuiControlTable.Cell(new StringBuilder(""), userData: float.MaxValue, textColor: Color.Gray);
                    if (gridInfo.Status == MyCubeGridConnectionStatus.OutOfReceivingRange)
                    {
                        statusCell = new MyGuiControlTable.Cell(MyTexts.Get(MySpaceTexts.BroadcastStatus_OutOfReceivingRange), userData: gridInfo.Status, textColor: Color.Gray);
                    }
                    else
                    {
                        statusCell = new MyGuiControlTable.Cell(MyTexts.Get(MySpaceTexts.BroadcastStatus_OutOfBroadcastingRange), userData: gridInfo.Status, textColor: Color.Gray);
                    }
                }

                row = new MyGuiControlTable.Row(data);
                row.AddCell(nameCell);
                row.AddCell(distanceCell);
                row.AddCell(statusCell);
                m_shipsData.Add(row);
                m_shipsData.SortByColumn(m_columnToSort, MyGuiControlTable.SortStateEnum.Ascending, false);
            }
            m_shipsData.ScrollBar.ChangeValue(scrollBarValue);
        }
        private void RefreshTableMembers()
        {
            m_tableMembers.Clear();

            foreach (var entry in m_selectedFaction.Members)
            {
                var member = entry.Value;

                var identity = Sync.Players.TryGetIdentity(member.PlayerId);
                System.Diagnostics.Debug.Assert(identity != null, "Faction member is not known identity!");
                if (identity == null)
                {
                    continue;
                }

                var   row        = new MyGuiControlTable.Row(member);
                var   compare    = MyMemberComparerEnum.Member;
                var   statusEnum = MySpaceTexts.Member;
                Color?txtColor   = null;

                if (m_selectedFaction.IsFounder(member.PlayerId))
                {
                    compare    = MyMemberComparerEnum.Founder;
                    statusEnum = MySpaceTexts.Founder;
                }
                else if (m_selectedFaction.IsLeader(member.PlayerId))
                {
                    compare    = MyMemberComparerEnum.Leader;
                    statusEnum = MySpaceTexts.Leader;
                }
                else if (m_selectedFaction.JoinRequests.ContainsKey(member.PlayerId))
                {
                    txtColor   = COLOR_CUSTOM_GREY;
                    compare    = MyMemberComparerEnum.Applicant;
                    statusEnum = MySpaceTexts.Applicant;
                }

                row.AddCell(new MyGuiControlTable.Cell(text:    new StringBuilder(identity.DisplayName),
                                                       toolTip: identity.DisplayName,
                                                       userData: entry, textColor: txtColor));
                row.AddCell(new MyGuiControlTable.Cell(text: MyTexts.Get(statusEnum), userData: compare, textColor: txtColor));
                m_tableMembers.Add(row);
            }

            foreach (var entry in m_selectedFaction.JoinRequests)
            {
                var request = entry.Value;
                var row     = new MyGuiControlTable.Row(request);

                var identity = Sync.Players.TryGetIdentity(request.PlayerId);
                System.Diagnostics.Debug.Assert(identity != null, "Player is not in allplayers list!");
                if (identity != null)
                {
                    row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(identity.DisplayName),
                                                           toolTip: identity.DisplayName,
                                                           userData: entry, textColor: COLOR_CUSTOM_GREY));

                    row.AddCell(new MyGuiControlTable.Cell(text: MyTexts.Get(MySpaceTexts.Applicant),
                                                           userData: MyMemberComparerEnum.Applicant,
                                                           textColor: COLOR_CUSTOM_GREY));
                    m_tableMembers.Add(row);
                }
            }
        }
Esempio n. 27
0
        bool AddServerItem(GameServerItem server, bool isFiltered = false)
        {
            if (m_allowedGroups.IsChecked && !SteamAPI.Instance.Friends.IsUserInGroup(server.GetGameTagByPrefixUlong("groupId")))
            {
                return(false);
            }

            if (server.AppID != MySteam.AppId)
            {
                return(false);
            }

            if (!isFiltered && !string.IsNullOrWhiteSpace(m_blockSearch.Text)) // this must be here for filtering LAN games
            {
                if (!server.Name.ToLower().Contains(m_blockSearch.Text.ToLower()))
                {
                    return(false);
                }
            }

            var row = new MyGuiControlTable.Row(server);

            string sessionName = server.Map;
            int    appVersion  = server.ServerVersion;

            m_gameTypeText.Clear();
            m_gameTypeToolTip.Clear();

            // Skip world without name (not fully initialized)
            if (string.IsNullOrEmpty(sessionName))
            {
                return(false);
            }

            // Show only same app versions
            if (m_showOnlyCompatibleGames.IsChecked && appVersion != MyFinalBuildConstants.APP_VERSION)
            {
                return(false);
            }

            // Show only if the game data match
            string remoteHash = server.GetGameTagByPrefix("datahash");

            if (m_showOnlyWithSameMods.IsChecked && MyFakes.ENABLE_MP_DATA_HASHES && remoteHash != "" && remoteHash != MyDataIntegrityChecker.GetHashBase64())
            {
                return(false);
            }

            var gamemodeSB        = new StringBuilder();
            var gamemodeToolTipSB = new StringBuilder();

            string gamemode = server.GetGameTagByPrefix("gamemode");

            if (gamemode == "C")
            {
                gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
                gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
            }
            else if (gamemode == "B")
            {
                gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
                gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
            }
            else if (!string.IsNullOrWhiteSpace(gamemode))
            {
                var multipliers = gamemode.Substring(1);
                var split       = multipliers.Split('-');
                //TODO: refactor
                if (split.Length == 3 && server.AppID == 244850)
                {
                    gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival)).Append(" ").Append(multipliers);
                    gamemodeToolTipSB.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_MultipliersFormat).ToString(), split[0], split[1], split[2]);
                }
                else
                {
                    gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
                    gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
                }
            }

            ulong modCount = server.GetGameTagByPrefixUlong(MyMultiplayer.ModCountTag);

            string        limit     = server.MaxPlayers.ToString();
            StringBuilder userCount = new StringBuilder(server.Players + "/" + limit);

            var viewDistance = server.GetGameTagByPrefix(MyMultiplayer.ViewDistanceTag);

            //TODO: refactor
            if (!String.IsNullOrEmpty(viewDistance) && server.AppID == 244850)
            {
                gamemodeToolTipSB.AppendLine();
                gamemodeToolTipSB.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_ViewDistance).ToString(), viewDistance);
            }

            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(sessionName), userData: server.SteamID, toolTip: m_textCache.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: gamemodeSB, toolTip: gamemodeToolTipSB.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Name), toolTip: m_gameTypeToolTip.Clear().AppendLine(server.Name).Append(server.NetAdr.ToString()).ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: userCount, toolTip: userCount.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Ping), toolTip: m_textCache.ToString()));
            row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(modCount == 0 ? "---" : modCount.ToString()), toolTip: MyTexts.GetString(MySpaceTexts.JoinGame_SelectServerToShowModList)));
            m_gamesTable.Add(row);

            var selectedRow = m_gamesTable.SelectedRow;

            m_gamesTable.Sort(false);

            m_gamesTable.SelectedRowIndex = m_gamesTable.FindRow(selectedRow);

            return(true);
        }
Esempio n. 28
0
        private void RefreshGameList()
        {
            m_gamesTable.Clear();
            AddHeaders();

            m_textCache.Clear();
            m_gameTypeText.Clear();
            m_gameTypeToolTip.Clear();

            m_lobbyPage.Text = MyTexts.Get(MySpaceTexts.JoinGame_TabTitle_Lobbies);

            if (m_lobbies != null)
            {
                int shownGames = 0;
                for (int i = 0; i < m_lobbies.Count; ++i)
                {
                    var lobby = m_lobbies[i];
                    var row   = new MyGuiControlTable.Row(lobby);

                    string sessionName = MyMultiplayerLobby.GetLobbyWorldName(lobby);
                    ulong  sessionSize = MyMultiplayerLobby.GetLobbyWorldSize(lobby);
                    int    appVersion  = MyMultiplayerLobby.GetLobbyAppVersion(lobby);
                    int    modCount    = MyMultiplayerLobby.GetLobbyModCount(lobby);

                    var searchName = m_blockSearch.Text.Trim();
                    if (!string.IsNullOrWhiteSpace(searchName) && !sessionName.ToLower().Contains(searchName.ToLower()))
                    {
                        continue;
                    }

                    m_gameTypeText.Clear();
                    m_gameTypeToolTip.Clear();
                    //TODO: refactor - split to ME a SE versions
                    if (appVersion > 01022000 && MySteam.AppId == 244850)
                    {
                        var inventory = MyMultiplayerLobby.GetLobbyFloat(MyMultiplayer.InventoryMultiplierTag, lobby, 1);
                        var refinery  = MyMultiplayerLobby.GetLobbyFloat(MyMultiplayer.RefineryMultiplierTag, lobby, 1);
                        var assembler = MyMultiplayerLobby.GetLobbyFloat(MyMultiplayer.AssemblerMultiplierTag, lobby, 1);

                        MyGameModeEnum gameMode = MyMultiplayerLobby.GetLobbyGameMode(lobby);
                        if (MyMultiplayerLobby.GetLobbyScenario(lobby))
                        {
                            m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameScenario));
                            DateTime started = MyMultiplayerLobby.GetLobbyDateTime(MyMultiplayer.ScenarioStartTimeTag, lobby, DateTime.MinValue);
                            if (started > DateTime.MinValue)
                            {
                                TimeSpan timeRunning = DateTime.UtcNow - started;
                                var      hrs         = Math.Truncate(timeRunning.TotalHours);
                                int      mins        = (int)((timeRunning.TotalHours - hrs) * 60);
                                m_gameTypeText.Append(" ").Append(hrs).Append(":").Append(mins.ToString("D2"));
                            }
                            else
                            {
                                m_gameTypeText.Append(" Lobby");
                            }
                        }
                        else
                        {
                            switch (gameMode)
                            {
                            case MyGameModeEnum.Creative:
                                m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
                                break;

                            case MyGameModeEnum.Survival:
                                m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
                                m_gameTypeText.Append(String.Format(" {0}-{1}-{2}", inventory, assembler, refinery));
                                break;

                            default:
                                Debug.Fail("Unknown game type");
                                break;
                            }
                        }

                        m_gameTypeToolTip.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_MultipliersFormat).ToString(), inventory, assembler, refinery);

                        var viewDistance = MyMultiplayerLobby.GetLobbyViewDistance(lobby);
                        m_gameTypeToolTip.AppendLine();
                        m_gameTypeToolTip.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_ViewDistance).ToString(), viewDistance);
                    }
                    else
                    {
                        MyGameModeEnum gameMode = MyMultiplayerLobby.GetLobbyGameMode(lobby);

                        switch (gameMode)
                        {
                        case MyGameModeEnum.Creative:
                            m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
                            m_gameTypeToolTip.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
                            break;

                        case MyGameModeEnum.Survival:
                            bool isBattle = MyMultiplayerLobby.GetLobbyBattle(lobby);

                            if (MyFakes.ENABLE_BATTLE_SYSTEM && isBattle)
                            {
                                // Cannot join already started battles
                                bool battleCanBeJoined = MyMultiplayerLobby.GetLobbyBattleCanBeJoined(lobby);
                                if (!battleCanBeJoined)
                                {
                                    continue;
                                }

                                m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
                                m_gameTypeToolTip.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
                            }
                            else
                            {
                                m_gameTypeText.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
                                m_gameTypeToolTip.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
                            }
                            break;

                        default:
                            Debug.Fail("Unknown game type");
                            break;
                        }
                    }

                    // Skip world without name (not fully initialized)
                    if (string.IsNullOrEmpty(sessionName))
                    {
                        continue;
                    }

                    // Show only same app versions
                    if (m_showOnlyCompatibleGames.IsChecked && appVersion != MyFinalBuildConstants.APP_VERSION)
                    {
                        continue;
                    }

                    // Show only if the game data match
                    if (m_showOnlyWithSameMods.IsChecked && MyFakes.ENABLE_MP_DATA_HASHES && !MyMultiplayerLobby.HasSameData(lobby))
                    {
                        continue;
                    }

                    float  sessionFormattedSize = (float)sessionSize;
                    string owner     = MyMultiplayerLobby.GetLobbyHostName(lobby);
                    string limit     = lobby.MemberLimit.ToString();
                    string userCount = lobby.MemberCount + "/" + limit;

                    var prefixSize = MyUtils.FormatByteSizePrefix(ref sessionFormattedSize);

                    var modListToolTip = new StringBuilder();

                    int displayedModsMax = 15;
                    int lastMod          = Math.Min(displayedModsMax, modCount - 1);
                    foreach (var mod in MyMultiplayerLobby.GetLobbyMods(lobby))
                    {
                        if (displayedModsMax-- <= 0)
                        {
                            modListToolTip.Append("...");
                            break;
                        }

                        if (lastMod-- <= 0)
                        {
                            modListToolTip.Append(mod.FriendlyName);
                        }
                        else
                        {
                            modListToolTip.AppendLine(mod.FriendlyName);
                        }
                    }

                    //row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(MyMultiplayerLobby.HasSameData(lobby) ? "" : "*")));
                    row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(sessionName), userData: lobby.LobbyId, toolTip: m_textCache.ToString()));
                    row.AddCell(new MyGuiControlTable.Cell(text: m_gameTypeText, toolTip: (m_gameTypeToolTip.Length > 0) ? m_gameTypeToolTip.ToString() : null));
                    row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(sessionFormattedSize.ToString("0.") + prefixSize + "B    ")));
                    row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(owner), toolTip: m_textCache.ToString()));
                    row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(userCount)));
                    row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(modCount == 0 ? "---" : modCount.ToString()), toolTip: modListToolTip.ToString()));
                    m_gamesTable.Add(row);
                    shownGames++;
                }

                m_lobbyPage.Text = new StringBuilder().Append(MyTexts.Get(MySpaceTexts.JoinGame_TabTitle_Lobbies).ToString()).Append(" (").Append(shownGames).Append(")");
            }

            //m_gameDataLabel.Visible = m_incompatibleGameData;

            m_gamesTable.SelectedRowIndex = null;
        }
Esempio n. 29
0
        private void RefreshGameList()
        {
            m_selectedRow   = null;
            m_selectedTable = null;

            ListReader <MyObjectBuilder_Checkpoint.ModItem> lastActiveMods;

            if (m_keepActiveMods)
            {
                var tmp = new List <MyObjectBuilder_Checkpoint.ModItem>(m_modsTableEnabled.RowsCount);
                GetActiveMods(tmp);
                lastActiveMods = tmp;
            }
            else
            {
                lastActiveMods = m_modListToEdit;
            }
            m_keepActiveMods = true;
            GetWorldMods(lastActiveMods);

            m_modsTableEnabled.Clear();
            m_modsTableDisabled.Clear();
            AddHeaders();

            foreach (var mod in lastActiveMods)
            {
                if (mod.PublishedFileId == 0)
                {
                    var   title                = new StringBuilder(mod.Name);
                    var   modFullPath          = Path.Combine(MyFileSystem.ModsPath, mod.Name);
                    var   toolTip              = new StringBuilder(modFullPath);
                    var   modState             = MyTexts.Get(MySpaceTexts.ScreenMods_LocalMod);
                    Color?textColor            = null;
                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL;

                    if (!Directory.Exists(modFullPath) && !File.Exists(modFullPath))
                    {
                        toolTip   = MyTexts.Get(MySpaceTexts.ScreenMods_MissingLocalMod);
                        modState  = toolTip;
                        textColor = MyHudConstants.MARKER_COLOR_RED;
                    }

                    AddMod(true, title, toolTip, modState, icon, mod, textColor);
                }
                else
                {
                    var   title     = new StringBuilder();
                    var   toolTip   = new StringBuilder();
                    var   modState  = MyTexts.Get(MySpaceTexts.ScreenMods_WorkshopMod);
                    Color?textColor = null;

                    var subscribedItem = GetSubscribedItem(mod.PublishedFileId);
                    if (subscribedItem != null)
                    {
                        title.Append(subscribedItem.Title);

                        var shortLen     = Math.Min(subscribedItem.Description.Length, 128);
                        var newlineIndex = subscribedItem.Description.IndexOf("\n");
                        if (newlineIndex > 0)
                        {
                            shortLen = Math.Min(shortLen, newlineIndex - 1);
                        }
                        toolTip.Append(subscribedItem.Description.Substring(0, shortLen));
                    }
                    else
                    {
                        title.Append(mod.PublishedFileId.ToString());
                        toolTip   = MyTexts.Get(MySpaceTexts.ScreenMods_MissingDetails);
                        textColor = MyHudConstants.MARKER_COLOR_RED;
                    }

                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;

                    AddMod(true, title, toolTip, modState, icon, mod, textColor);
                }
            }

            if (!Directory.Exists(MyFileSystem.ModsPath))
            {
                Directory.CreateDirectory(MyFileSystem.ModsPath);
            }

            foreach (var modFullPath in Directory.GetDirectories(MyFileSystem.ModsPath, "*", SearchOption.TopDirectoryOnly))
            {
                var modName = Path.GetFileName(modFullPath);
                if (m_worldLocalMods.Contains(modName))
                {
                    continue;
                }

                if (Directory.GetFileSystemEntries(modFullPath).Length == 0)
                {
                    continue;
                }

                if (MyFakes.ENABLE_MOD_CATEGORIES)
                {
                    if (!CheckSearch(modName))
                    {
                        continue;
                    }
                }

                var titleSB       = new StringBuilder(modName);
                var descriptionSB = modFullPath;
                var modStateSB    = MyTexts.GetString(MySpaceTexts.ScreenMods_LocalMod);

                var publishedFileId = MySteamWorkshop.GetWorkshopIdFromLocalMod(modFullPath);

                MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL;

                var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(modName, 0));
                row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
                row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB));
                m_modsTableDisabled.Add(row);
            }

            if (m_subscribedMods != null)
            {
                foreach (var mod in m_subscribedMods)
                {
                    if (m_worldWorkshopMods.Contains(mod.PublishedFileId))
                    {
                        continue;
                    }
                    if (MyFakes.ENABLE_MOD_CATEGORIES)
                    {
                        bool add = false;
                        foreach (var tag in mod.Tags)
                        {
                            if (m_selectedCategories.Contains(tag.ToLower()) || m_selectedCategories.Count == 0)
                            {
                                add = true;
                                break;
                            }
                        }
                        if (!CheckSearch(mod.Title))
                        {
                            continue;
                        }
                        if (!add)
                        {
                            continue;
                        }
                    }
                    var titleSB      = new StringBuilder(mod.Title);
                    var shortLen     = Math.Min(mod.Description.Length, 128);
                    var newlineIndex = mod.Description.IndexOf("\n");
                    if (newlineIndex > 0)
                    {
                        shortLen = Math.Min(shortLen, newlineIndex - 1);
                    }
                    var descriptionSB = new StringBuilder();
                    var modStateSB    = MyTexts.GetString(MySpaceTexts.ScreenMods_WorkshopMod);

                    var path = Path.Combine(MyFileSystem.ModsPath, string.Format("{0}.sbm", mod.PublishedFileId));

                    if (mod.Description.Length != 0)
                    {
                        descriptionSB.AppendLine(path);
                    }
                    else
                    {
                        descriptionSB.Append(path);
                    }
                    descriptionSB.Append(mod.Description.Substring(0, shortLen));

                    MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;

                    var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(null, mod.PublishedFileId));
                    row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
                    row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB.ToString()));
                    m_modsTableDisabled.Add(row);
                }
            }
        }