Пример #1
0
            static bool IsPanelMatchingDisplay(EntityAndMeta <IMyTextPanel> panel, string expectedDisplayType)
            {
                string displayType;
                var    displayResult = panel.meta.TryGetValue("display", out displayType);

                if (!displayResult)
                {
                    return(false);
                }
                return(displayType == expectedDisplayType);
            }
Пример #2
0
        void BootSystem()
        {
            var panels = new List <IMyTextPanel>();

            GridTerminalSystem.GetBlocksOfType(panels);

            var panelsPerDeck = new Dictionary <string, List <EntityAndMeta <IMyTextPanel> > >();

            foreach (var panel in panels)
            {
                Echo(panel.Font);
                var    panelAndMeta = new EntityAndMeta <IMyTextPanel>(panel);
                string deckName;
                var    deckResult = panelAndMeta.meta.TryGetValue("deck", out deckName);
                if (deckResult)
                {
                    List <EntityAndMeta <IMyTextPanel> > panelListOfDeck;
                    var listAlreadyExists = panelsPerDeck.TryGetValue(deckName, out panelListOfDeck);
                    if (listAlreadyExists)
                    {
                        panelListOfDeck.Add(panelAndMeta);
                    }
                    else
                    {
                        panelsPerDeck.Add(deckName, new List <EntityAndMeta <IMyTextPanel> >(new [] { panelAndMeta }));
                    }
                }
            }

            foreach (var deck in panelsPerDeck.Keys)
            {
                Echo(deck);
            }

            foreach (var deck in panelsPerDeck)
            {
                foreach (var panel in deck.Value)
                {
                    panel.entity.WriteText(deck.Key);
                }
            }

            eng = new EngineeringDeck(panelsPerDeck["eng"]);

            state = ProgramState.Booted;
        }