void drawDrillStatus(Display screen, GeneralStatus status, float loadFactor, float angle, float targetAngle) { using (Display.Frame f = screen.DrawFrame()) { if (status.AreFrontLightsOn) { f.DrawCollection("drillLights", translation: LIGHTS_OFFSET); } if (status.AreArmLightsOn) { f.DrawCollection("drillLights", translation: DRILL_ARM_CENTER, rotation: angle); } f.DrawCollection("drillsShapesBackground"); f.Draw(new Shape("SquareSimple", this.scheme.MedDark, position: new Vector2(32, 93), size: new Vector2(loadFactor * 108, 45))); f.DrawCollection("drillsShapesForeground"); if (!float.IsNaN(angle)) { if (!float.IsNaN(targetAngle)) { f.DrawCollection("drillShapesArm", translation: DRILL_ARM_CENTER, rotation: targetAngle, color: this.scheme.MedDark); } f.DrawCollection("drillShapesArm", translation: DRILL_ARM_CENTER, rotation: angle); } f.DrawText($"Full at {loadFactor * 100:000}%", INV_TEXT_POS, scale: 0.5f, alignment: TextAlignment.LEFT); f.DrawText(this.conStatus(), CON_TEXT_POS, scale: 0.5f, alignment: TextAlignment.LEFT); } }
void updateInventoryDisplay(Display display, string title, List <ComponentStatus> statuses) { using (Display.Frame f = display.DrawFrame()) { f.DrawText(title, new Vector2(display.SurfaceSize.X / 2, 0)); float y = 50; foreach (ComponentStatus status in statuses) { Color?color = status.Status == ComponentStatusLevel.ERROR ? CRITICAL : status.Status == ComponentStatusLevel.WARNING ? WARNING : (Color?)null; this.drawLineOfText(f, status.Type.DisplayName, $"{status.Amount:N0}", display.SurfaceSize.X - 2, ref y, color); } } }
void drawLineOfText(Display.Frame f, string left, string right, float x, ref float y, Color?color = null) { f.DrawText(left, new Vector2(0, y), color, 0.75f, TextAlignment.LEFT); f.DrawText(right, new Vector2(x, y), color, 0.75f, TextAlignment.RIGHT); y += 30; }
void drawLine(Display.Frame f, float width, ref float y) { y += 15; f.Draw(new Shape("SquareSimple", SCHEME.Light, new Vector2(0, y), new Vector2(width, 2))); y += 20; }
void updateStatusDisplay() { using (Display.Frame f = this.statusDisplay.DrawFrame()) { f.DrawText(this.name + " status", new Vector2(this.statusDisplay.SurfaceSize.X / 2, 0)); float x = this.statusDisplay.SurfaceSize.X - 2; float y = 60; this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); ProjectorStatus projStatus = this.projector.GetStatus(); WelderStatus welderStatus = this.welder.GetStatus(); InventoryStatus invStatus = this.invManager.GetStatus(); if (projStatus == ProjectorStatus.Projecting && welderStatus == WelderStatus.Deployed && invStatus != InventoryStatus.NotReady) { this.drawLineOfText(f, "Status", "Ready", x, ref y); } else { this.drawLineOfText(f, "Status", "Not ready", x, ref y, CRITICAL); } if (projStatus == ProjectorStatus.Projecting) { this.drawLineOfText(f, "Completion", $"{this.projector.GetCompletion() * 100:N0}%", x, ref y); this.drawLineOfText(f, "Time since block added", $"{this.counter}", x, ref y); } else { this.drawLineOfText(f, "Completion", "N/A", x, ref y); this.drawLineOfText(f, "Time since block added", "N/A", x, ref y); } this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); Color?color = projStatus != ProjectorStatus.Projecting ? CRITICAL : (Color?)null; this.drawLineOfText(f, "Projector status", projStatus.ToString(), x, ref y, color); color = this.projector.HasBlocksAttached() ? WARNING : (Color?)null; this.drawLineOfText(f, "Has blocks attached", this.projector.HasBlocksAttached().ToString(), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); color = welderStatus != WelderStatus.Deployed ? CRITICAL : (Color?)null; this.drawLineOfText(f, "Welder status", welderStatus.ToString(), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); color = invStatus == InventoryStatus.NotReady ? CRITICAL : invStatus == InventoryStatus.MandatoryLow ? ERROR : invStatus == InventoryStatus.OptionalLow ? WARNING : (Color?)null; this.drawLineOfText(f, "Inventory status", this.getString(invStatus), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); if (!string.IsNullOrEmpty(this.LastMessage)) { f.DrawText(this.LastMessage, new Vector2(0, y), CRITICAL, 0.75f, alignment: TextAlignment.LEFT); } } }