protected override void DrawWorld(SpriteBatch spriteBatch) { if (!Context.IsPlayerFree) { return; } // draw each tile IReadOnlySet <Vector2> junimoChestTiles = this.JunimoGroup.GetTiles(this.LocationKey); foreach (Vector2 tile in TileHelper.GetVisibleTiles(expand: 1)) { // get tile's screen coordinates float screenX = tile.X * Game1.tileSize - Game1.viewport.X; float screenY = tile.Y * Game1.tileSize - Game1.viewport.Y; int tileSize = Game1.tileSize; // get machine group IMachineGroup?group = null; Color? color = null; if (junimoChestTiles.Contains(tile)) { color = this.JunimoGroup.HasInternalAutomation ? Color.Green * 0.2f : Color.Red * 0.2f; group = this.JunimoGroup; } else if (this.MachineData is not null) { if (this.MachineData.ActiveTiles.TryGetValue(tile, out group)) { color = Color.Green * 0.2f; } else if (this.MachineData.DisabledTiles.TryGetValue(tile, out group) || this.MachineData.OutdatedTiles.ContainsKey(tile)) { color = Color.Red * 0.2f; } } color ??= Color.Black * 0.5f; // draw background spriteBatch.DrawLine(screenX + this.TileGap, screenY + this.TileGap, new Vector2(tileSize - this.TileGap * 2, tileSize - this.TileGap * 2), color); // draw group edge borders if (group != null) { this.DrawEdgeBorders(spriteBatch, group, tile, group.HasInternalAutomation ? Color.Green : Color.Red); } } // draw cursor this.DrawCursor(); }
protected override void Draw(SpriteBatch spriteBatch) { if (!Context.IsPlayerFree) { return; } // draw each tile foreach (Vector2 tile in TileHelper.GetVisibleTiles()) { // get tile's screen coordinates float screenX = tile.X * Game1.tileSize - Game1.viewport.X; float screenY = tile.Y * Game1.tileSize - Game1.viewport.Y; int tileSize = Game1.tileSize; // get machine group this.GroupTiles.TryGetValue(tile, out MachineGroup group); bool isGrouped = group != null; bool isActive = isGrouped && group.HasInternalAutomation; // draw background { Color color = Color.Black * 0.5f; if (isActive) { color = Color.Green * 0.2f; } else if (isGrouped) { color = Color.Red * 0.2f; } spriteBatch.DrawLine(screenX + this.TileGap, screenY + this.TileGap, new Vector2(tileSize - this.TileGap * 2, tileSize - this.TileGap * 2), color); } // draw group edge borders if (group != null) { this.DrawEdgeBorders(spriteBatch, group, tile, group.HasInternalAutomation ? Color.Green : Color.Red); } } // draw cursor this.DrawCursor(); }