Esempio n. 1
0
        public void Main(string argument, UpdateType updateSource)
        {
            string[] runParams = argument.Split(' ');
            bool     doIdle    = true;

            if (runParams.Length >= 2)
            {
                string  command = runParams[0];
                string  name    = runParams[1];
                Airlock airlock = findAirlock(name);
                if (airlock != null)
                {
                    if (command == "enter")
                    {
                        airlock.startEnter();
                        doIdle = false;
                    }
                    else if (command == "exit")
                    {
                        airlock.startExit();
                        doIdle = false;
                    }
                }
            }
            if (doIdle)
            {
                foreach (var item in airlocks)
                {
                    item.Value.update(Runtime.TimeSinceLastRun);
                }
            }
            updateAirlockDisplay();
            SpinningBar.Step();
        }
Esempio n. 2
0
        private void updateAirlockDisplay()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (var item in airlocks)
            {
                sb.Append("\n\n" + item.Value.description());
            }
            string displayText = "[Airlock " + SpinningBar.Render() + "]\n---------------------------------------" + sb.ToString();

            System.Collections.Generic.List <IMyTextPanel> displays = new System.Collections.Generic.List <IMyTextPanel>();
            GridTerminalSystem.GetBlocksOfType <IMyTextPanel>(displays, d =>
            {
                MyIni displayIni;
                if (MyIni.HasSection(d.CustomData, "airlock"))
                {
                    displayIni    = new MyIni();
                    string prefix = "";
                    if (displayIni.TryParse(d.CustomData))
                    {
                        prefix = displayIni.Get("airlock", "gridPrefix").ToString();
                        if (prefix != "")
                        {
                            prefix = prefix + "_";
                        }
                        return(gridPrefix == prefix);
                    }
                }
                return(false);
            });
            foreach (IMyTextPanel d in displays)
            {
                d.WriteText(displayText);
            }
            SpinningBar.Step();
        }
Esempio n. 3
0
        public void Main(string argument, UpdateType updateSource)
        {
            System.Collections.Generic.List <IMyTextPanel> displays = new System.Collections.Generic.List <IMyTextPanel>();
            GridTerminalSystem.GetBlocksOfType <IMyTextPanel>(displays, d => MyIni.HasSection(d.CustomData, "energy"));
            string           report1 = display1.Render(energyInfo1);
            string           report2 = display2.Render(energyInfo2);
            MyIni            menuIni = new MyIni();
            MyIniParseResult br;

            foreach (IMyTextPanel d in displays)
            {
                if (menuIni.TryParse(d.CustomData, out br))
                {
                    string group = menuIni.Get("energy", "group").ToString();
                    if (group.Equals("1"))
                    {
                        d.WriteText(report1);
                    }
                    else if (group.Equals("2"))
                    {
                        d.WriteText(report2);
                    }
                }
            }
            SpinningBar.Step();
        }
Esempio n. 4
0
 public void Main(string argument, UpdateType updateSource)
 {
     Initialize();
     foreach (ResourceDisplay display in _resourceDisplays)
     {
         display.ShowSummary();
     }
     SpinningBar.Step();
 }
Esempio n. 5
0
 public void Steps()
 {
     Assert.AreEqual("-", SpinningBar.Render());
     SpinningBar.Step();
     Assert.AreEqual("\\", SpinningBar.Render());
     SpinningBar.Step();
     Assert.AreEqual("|", SpinningBar.Render());
     SpinningBar.Step();
     Assert.AreEqual("/", SpinningBar.Render());
     SpinningBar.Step();
     Assert.AreEqual("-", SpinningBar.Render());
 }
Esempio n. 6
0
 public void Main(string argument)
 {
     if (argument == "next")
     {
         panel.SelectNext();
     }
     else if (argument == "prev")
     {
         panel.SelectPrevious();
     }
     else if (argument == "current")
     {
         panel.ActivateCurrent();
     }
     else if (argument == "parent")
     {
         panel.ActivateParent();
     }
     else
     {
         SpinningBar.Step();
     }
     display.WriteText(panel.ToString());
 }