diff --git a/InfoDisplays/InfoDisplays.csproj b/InfoDisplays/InfoDisplays.csproj index 7705310..0a1596e 100644 --- a/InfoDisplays/InfoDisplays.csproj +++ b/InfoDisplays/InfoDisplays.csproj @@ -24,4 +24,6 @@ + + \ No newline at end of file diff --git a/InfoDisplays/Program.cs b/InfoDisplays/Program.cs index 64f0015..e5a6ca1 100644 --- a/InfoDisplays/Program.cs +++ b/InfoDisplays/Program.cs @@ -9,12 +9,14 @@ namespace IngameScript public IConsole Console { get; private set; } public MyIni Ini { get; private set; } + private FailoverManager _failover; private ResourceReport _oreReport = null; public Program() { Ini = new MyIni(); Console = new MainConsole(this, "Info Displays"); + _failover = new FailoverManager(this, Console, Ini); // find displays that are configured to show info, create the necessary objects. // TODO: currently we only support one display per report, and we just use the first one @@ -67,6 +69,7 @@ namespace IngameScript public void Main(string argument, UpdateType updateSource) { Console.UpdateTickCount(); + if (_failover.ActiveCheck() == FailoverState.Standby) return; if (_oreReport != null) { diff --git a/Mixins/ScaledGridDisplay/ScaledGridDisplay.cs b/Mixins/ScaledGridDisplay/ScaledGridDisplay.cs index a643712..09fa270 100644 --- a/Mixins/ScaledGridDisplay/ScaledGridDisplay.cs +++ b/Mixins/ScaledGridDisplay/ScaledGridDisplay.cs @@ -1,5 +1,7 @@ using Sandbox.ModAPI.Ingame; using System.Collections.Generic; +using VRage.Game.GUI.TextPanel; +using VRageMath; namespace IngameScript { @@ -21,8 +23,11 @@ namespace IngameScript private int _columns; private float _columnWidth; - public ScaledGridDisplay(IMyTextSurface surface, int rows, int columns) + private IConsole _console; + + public ScaledGridDisplay(IMyTextSurface surface, int rows, int columns, IConsole console) { + _console = new PrefixedConsole(console, "ScaledGridDisplay"); // Setup draw surface _surface = surface; _surface.ScriptBackgroundColor = new Color(0, 0, 0, 255); @@ -39,8 +44,8 @@ namespace IngameScript // Calculate grid geometry _rows = rows; _columns = columns; - _topPadding = (_viewport.Size.Y / rows) * 0.3; - _rowHeight = (_viewport.Size.Y - topPadding) / rows; + _topPadding = _viewport.Size.Y / rows * 0.3f; + _rowHeight = (_viewport.Size.Y - _topPadding) / rows; _columnWidth = (_viewport.Size.X - LeftPadding) / columns; } @@ -57,13 +62,13 @@ namespace IngameScript switch (row) { case 0: - sprite.Scale = _scale * 1.2f; + sprite.RotationOrScale = _scale * 1.2f; break; case 1: - sprite.Scale = _scale * 1.1f; + sprite.RotationOrScale = _scale * 1.1f; break; default: - sprite.Scale = _scale; + sprite.RotationOrScale = _scale; break; } break; @@ -81,7 +86,7 @@ namespace IngameScript public void Draw() { MySpriteDrawFrame frame = _surface.DrawFrame(); - foreach (MySprite sprite in _staticSprites.Values) frame.Add(sprite); + foreach (MySprite sprite in _sprites) frame.Add(sprite); frame.Dispose(); }