private void PopulateMutuallyConnectedCubeGrids(HashSet <MyAntennaSystem.BroadcasterInfo> playerMutualConnection) { m_shipsInRange.ClearItems(); bool isCubeGrid = m_openInventoryInteractedEntityRepresentative is MyCubeGrid; //You should always be selectable m_shipsInRange.AddItem(m_openInventoryInteractedEntityRepresentative.EntityId, new StringBuilder(m_openInventoryInteractedEntityRepresentative.DisplayName)); foreach (var connection in playerMutualConnection) { if (m_shipsInRange.TryGetItemByKey(connection.EntityId) == null) { m_shipsInRange.AddItem(connection.EntityId, new StringBuilder(connection.Name)); } } m_shipsInRange.Visible = true; m_button.Visible = true; m_shipsInRange.SortItemsByValueText(); //if the interacted entity is not in the combobox, it means we're watching a disconnected ship so it should be red (somehow) if (m_shipsInRange.TryGetItemByKey(m_interactedEntityRepresentative.EntityId) == null) { if (m_interactedEntityRepresentative is MyCubeGrid) { m_shipsInRange.AddItem(m_interactedEntityRepresentative.EntityId, new StringBuilder((m_interactedEntityRepresentative as MyCubeGrid).DisplayName)); } } m_shipsInRange.SelectItemByKey(m_interactedEntityRepresentative.EntityId); }
void assembler_CustomNameChanged(MyTerminalBlock block) { Debug.Assert(block is MyAssembler && m_assemblersByKey.ContainsValue(block as MyAssembler)); foreach (var entry in m_assemblersByKey) { if (entry.Value == block) { var comboItem = m_comboboxAssemblers.TryGetItemByKey(entry.Key); comboItem.Value.Clear().AppendStringBuilder(block.CustomName); } } }