/// <summary>Creates a <see cref="Display"/></summary> /// <param name="surface">Surface to wrap</param> /// <param name="offset">Everything drawn on this <see cref="Display"/> will be offset by this</param> /// <param name="scale">Everything drawn on this <see cref="Display"/> will be scaled by this</param> /// <param name="scheme">Gives the base colors of the display</param> /// <param name="sprites">The collection of shapes that can be easility drawn on the surface</param> public Display(IMyTextSurface surface, Vector2?offset = null, float scale = 1f, ColorScheme scheme = null, ShapeCollections sprites = null) { surface.ContentType = ContentType.SCRIPT; surface.Script = ""; this.surface = surface; this.offset = offset ?? Vector2.Zero; this.scale = scale; this.scheme = scheme ?? new ColorScheme(); this.sprites = sprites; }
//readonly List<Display> wheelDisplays; public ScreensController(GeneralStatus status, InventoryWatcher invWatcher, IEnumerable <IMyTextSurface> drillStatusSurfaces, IEnumerable <IMyTextSurface> wheelStatusSurfaces, ColorScheme scheme, string sprites, IProcessSpawner spawner) { this.scheme = scheme; var sprts = new ShapeCollections(this.scheme); sprts.Parse(sprites); this.drillDisplays = drillStatusSurfaces.Select(s => new Display(s, new Vector2(2, 25), scheme: this.scheme, sprites: sprts)).ToList(); //this.wheelDisplays = wheelStatusSurfaces.Select(s => new Display(s, new Vector2(2, 25), scheme: this.scheme)).ToList(); this.status = status; spawner.Spawn(p => this.updateScreens(status, invWatcher), "screens-update", period: 20); }
public ScreensController(GeneralStatus status, InventoriesController inventoryController, IMyTextSurface drillStatusSurface, IMyTextSurface wheelStatusSurface, ColorScheme scheme, string sprites, IProcessSpawner spawner) { this._scheme = scheme; if (drillStatusSurface != null) { var offset = new Vector2(2, 25); var sprts = new ShapeCollections(this._scheme); sprts.Parse(sprites); this._drillSurface = new Display(drillStatusSurface, offset, scheme: this._scheme, sprites: sprts); } if (wheelStatusSurface != null) { this._wheelSurface = new Display(wheelStatusSurface, scheme: this._scheme); } this._status = status; spawner.Spawn(p => this._updateScreens(status, inventoryController), "screens-update", period: 20); }