Beispiel #1
0
        public static void ShowMessageOnLcd(IMyTextPanel lcd, LcdMessage message)
        {
            if (lcd == null)
            {
                return;
            }

            lcd.WriteText(message.Text);
            lcd.SetValue <Color>("FontColor", message.FontColor);
            lcd.SetValue <Color>("BackgroundColor", message.BackgroundColor);
            lcd.SetValueFloat("FontSize", message.FontSize);
        }
Beispiel #2
0
        // Doesn't work
        public static void ShowMessagesOnLcd(IMyTextPanel lcd, List <LcdMessage> messages)
        {
            if (lcd == null)
            {
                return;
            }

            foreach (var message in messages)
            {
                lcd.SetValue <Color>("FontColor", message.FontColor);
                lcd.SetValue <Color>("BackgroundColor", message.BackgroundColor);
                lcd.SetValueFloat("FontSize", message.FontSize);
                lcd.WriteText(message.Text, true);
            }
        }
Beispiel #3
0
 private void DisplayNonEmptyInfo(IMyTextPanel display, string text, Color color)
 {
     display.SetValue("FontColor", color);
     display.WriteText(text);
     display.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
     //display.WritePublicText(text);
     //display.ShowPublicTextOnScreen();
 }
 // Method for writting to LCD Panels
 void SetText(List <IMyTerminalBlock> blocks, string LCDText, Color color)
 {
     for (int i = 0; i < blocks.Count; i++)
     {
         IMyTextPanel panel = blocks[i] as IMyTextPanel;
         panel.WritePublicText(LCDText);
         panel.SetValue("FontColor", color);
         panel.ShowTextureOnScreen();
         panel.ShowPublicTextOnScreen();
     }
 }
        public void progressPanels()
        {
            while (Runtime.CurrentInstructionCount < LOAD_LIMIT && PanelQueue.Count > 0)
            {
                panelProgressCount++;
                long         panelId = PanelQueue.Dequeue().EntityId;
                IMyTextPanel Panel   = GridTerminalSystem.GetBlockWithId(panelId) as IMyTextPanel;

                IMyTerminalBlock Cargo = getCargo(Panel);
                if (Panel != null && Panel is IMyTextPanel && Cargo != null && Panel.IsFunctional && Panel.IsWorking)
                {
                    int    fillLevel0 = 0;
                    int    fillLevel1 = 0;
                    string fillBar    = getFillLevelBarForBlock(Cargo, out fillLevel0, out fillLevel1);
                    switch (Cargo.InventoryCount)
                    {
                    case 1:
                        Panel.CustomData = getText("lcdStatSingleInventory", Cargo.CustomName, DateTime.Now, fillLevel0);
                        Panel.WritePublicTitle(getText("lcdTitleStatSingle", fillLevel0, Cargo.CustomName));
                        break;

                    case 2:
                        Panel.CustomData = getText("lcdStatDoubleInventory", Cargo.CustomName, DateTime.Now, fillLevel0, fillLevel1);
                        Panel.WritePublicTitle(getText("lcdTitleStatDouble", fillLevel0, fillLevel1, Cargo.CustomName));
                        break;
                    }
                    Panel.WritePublicText(fillBar);
                    Panel.SetValueFloat("FontSize", fontSizeFuelBar);
                    Panel.SetValue <long>("Font", fontIdMonospaced);
                    Panel.ShowPublicTextOnScreen();
                }
                else
                {
                    Panel.WritePublicTitle("");
                    Panel.WritePublicText(getText("warnNoInventory"));
                    Panel.SetValueFloat("FontSize", fontSizeText);
                    Panel.SetValue <long>("Font", fontIdRed);
                    Panel.ShowPublicTextOnScreen();
                }
            }
        }
Beispiel #6
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////
        /*                                                                       INITIALIZATION                                                                           */
        //////////////////////////////////////////////////////////////////////////////////////////////////////////



        void GetBlocks()
        {
            List <IMyTerminalBlock> _blocks = new List <IMyTerminalBlock>();

            GridTerminalSystem.GetBlocksOfType <IMyTerminalBlock>(_blocks);
            for (int i = 0; i < _blocks.Count; i++)
            {
                if (_blocks[i].CustomName.Contains(platformID))
                {
                    ///////////////////////// CHECK FOR HACKED BLOCKs
                    if (IsBeingHacked(_blocks[i]))
                    {
                        Debug("->" + _blocks[i].CustomName + " is being hacked!");

                        hackDetected = true;
                    }
                    ///////////////////////// CHECK FOR DAMAGED BLOCKs
                    if (IsBeingAttacked(_blocks[i]))
                    {
                        Debug("->" + _blocks[i].CustomName + " is damaged!");
                        attackDetected = true;
                    }
                    /////////////////////// GETTING GRAV GENs //////////////////////
                    if (_blocks[i].CustomName.Contains(gravID) && _blocks[i].CustomName.Contains(securityID))
                    {
                        gravs.Add((IMyGravityGenerator)_blocks[i]);
                    }
                    /////////////////////// GETTING AIRVENTS //////////////////////
                    if (_blocks[i].CustomName.Contains(airVentID))
                    {
                        IMyAirVent _vent = (IMyAirVent)_blocks[i];
                        airvents.Add(_vent);
                    }
                    ////////////////// GETTING ALERT SPEAKERS ////////////////////
                    if (_blocks[i].CustomName.Contains(speakerID) && _blocks[i].CustomName.Contains(securityID))
                    {
                        alerts.Add((IMySoundBlock)_blocks[i]);
                    }
                    /////////////////// GETTING INTERIOR LIGHTS ////////////////////
                    if (_blocks[i].CustomName.Contains(lightID) && _blocks[i].CustomName.Contains(securityID))
                    {
                        lights.Add((IMyInteriorLight)_blocks[i]);
                    }
                    /////////////////////// GETTING DOORS //////////////////////////
                    if (_blocks[i].CustomName.Contains(doorID))
                    {
                        doors.Add((IMyDoor)_blocks[i]);
                        if (_blocks[i].CustomName.Contains(securityID))
                        {
                            securityDoors.Add((IMyDoor)_blocks[i]);
                        }
                    }
                    ///////////////////// GETTING TEXT PANELS /////////////////////
                    if (_blocks[i].CustomName.Contains(panelID))
                    {
                        IMyTextPanel _panel = (IMyTextPanel)_blocks[i];
                        if (_panel.GetPublicTitle().Contains(debugID))
                        {
                            //debugger.Add(_panel);
                            //debugEnabled = true;
                        }
                        else
                        {
                            if (!_panel.CustomName.Contains(configID) && _panel.GetPublicTitle() == infoID)
                            {
                                _panel.ShowPublicTextOnScreen();
                                _panel.SetValue("FontSize", 0.8f);
                                panels.Add(_panel);
                            }
                        }
                    }

                    ////////////////////// GETTING PROGRAMS //////////////////////
                    if (_blocks[i].CustomName.Contains(programID))
                    {
                        IMyProgrammableBlock _program = (IMyProgrammableBlock)_blocks[i];
                        if (!_program.CustomName.Contains(coreID))
                        {
                            programs.Add(_program);
                        }
                    }
                    ///////////////////// GETTING TIMERBLOCKS ////////////////////
                    if (_blocks[i].CustomName.Contains(timerID) && _blocks[i].CustomName.Contains(securityID))
                    {
                        timers.Add((IMyTimerBlock)_blocks[i]);
                    }
                    /////////////////// GETTING GATLING TURRETS /////////////////
                    if (_blocks[i].CustomName.Contains(gatlingID))
                    {
                        gatlings.Add((IMyLargeGatlingTurret)_blocks[i]);
                    }
                    if (_blocks[i].CustomName.Contains(missileID))
                    {
                        missiles.Add((IMyLargeMissileTurret)_blocks[i]);
                    }
                    if (_blocks[i].CustomName.Contains(turretID))
                    {
                        turrets.Add((IMyLargeInteriorTurret)_blocks[i]);
                    }
                }
            }
            booted = true;
        }
        void _FindConfigScreen()
        {
            int _screens = 0;
            List<IMyTerminalBlock> _blocks = new List<IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(_blocks);
            Debug("Textpanels found: " + _blocks.Count);
            for (int i = 0; i < _blocks.Count; i++)
            {
                Debug("Found Textpanel with name: " + _blocks[i].CustomName);
                if (_blocks[i].CustomName.Contains(SIOS_CONFIG_SCREEN_ID))
                {
                    Debug("Textpanels which contains SIOS_CONFIG_SCREEN_ID: " + SIOS_CONFIG_SCREEN_ID);
                    _screens++; // there should`nt be more than 1!
                    config = (IMyTextPanel)_blocks[i];

                    config.SetValue("BackgroundColor", panelDefaultBG);
                    config.SetValue("FontColor", panelDefaultFC);
                    config.SetValue("FontSize", 0.8f);
                    StoreExternalConfigData();
                }
            }
            if (_screens == 0) Debug("No Configscreen found");

            if (_screens > 1) Debug("WARNING: TO MANY CONFIGSCREENS FOUND");
        }
Beispiel #8
0
            } // Update method

            // Supporting Methods ----------------------------------------------
            protected void ConfigureScreen(IMyTextPanel screen)
            {
                screen.SetValue("FontSize", 0.8f);               // set the font size
                screen.SetValue("FontColor", Color.Red);         // set the font color
                screen.SetValue("BackgroundColor", Color.Black); // set the background color
            } // ConfigureScreen