public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showWire = true) { var c = new Color(0, 0, 0, 0); if (tile.Wall > 0 && showWall) { c = c.AlphaBlend(World.WallProperties[tile.Wall].Color); } else { c = background; } if (tile.IsActive && showTile) { c = c.AlphaBlend(World.TileProperties[tile.Type].Color); } if (tile.Liquid > 0 && showLiquid) { c = c.AlphaBlend(tile.IsLava ? World.GlobalColors["Lava"] : World.GlobalColors["Water"]); } if (tile.HasWire && showWire) { c = c.AlphaBlend(World.GlobalColors["Wire"]); } return(c); }
public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showRedWire = true, bool showBlueWire = true, bool showGreenWire = true, bool showYellowWire = true) { var c = new Color(0, 0, 0, 0); if (tile.Wall > 0 && showWall) { if (World.WallProperties.Count > tile.Wall) { if (World.WallProperties[tile.Wall].Color.A != 0) { c = c.AlphaBlend(World.WallProperties[tile.Wall].Color); } else { c = background; } } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } // blend paint if (tile.WallColor > 0 && (!showTile || tile.TileColor == 0)) { var paint = World.PaintProperties[tile.WallColor].Color; switch (tile.WallColor) { case 29: float light = c.B * 0.3f; c.R = (byte)(c.R * light); c.G = (byte)(c.G * light); c.B = (byte)(c.B * light); break; case 30: c.R = (byte)((byte.MaxValue - c.R) * 0.5); c.G = (byte)((byte.MaxValue - c.G) * 0.5); c.B = (byte)((byte.MaxValue - c.B) * 0.5); break; default: paint.A = (byte)32; c = c.AlphaBlend(paint); break; } } } else { c = background; } if (tile.IsActive && showTile) { if (World.TileProperties.Count > tile.Type) { c = c.AlphaBlend(World.TileProperties[tile.Type].Color); } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } // blend paint if (tile.TileColor > 0 && tile.TileColor <= World.PaintProperties.Count) { var paint = World.PaintProperties[tile.TileColor].Color; switch (tile.TileColor) { case 29: float light = c.B * 0.3f; c.R = (byte)(c.R * light); c.G = (byte)(c.G * light); c.B = (byte)(c.B * light); break; case 30: c.R = (byte)(byte.MaxValue - c.R); c.G = (byte)(byte.MaxValue - c.G); c.B = (byte)(byte.MaxValue - c.B); break; default: paint.A = (byte)32; c = c.AlphaBlend(paint); break; } } } if (tile.LiquidAmount > 0 && showLiquid) { if (tile.LiquidType == LiquidType.Lava) { c = c.AlphaBlend(World.GlobalColors["Lava"]); } else if (tile.LiquidType == LiquidType.Honey) { c = c.AlphaBlend(World.GlobalColors["Honey"]); } else { c = c.AlphaBlend(World.GlobalColors["Water"]); } } if (tile.WireRed && showRedWire) { c = c.AlphaBlend(World.GlobalColors["Wire"]); } if (tile.WireGreen && showGreenWire) { c = c.AlphaBlend(World.GlobalColors["Wire2"]); } if (tile.WireBlue && showBlueWire) { c = c.AlphaBlend(World.GlobalColors["Wire1"]); } if (tile.WireYellow && showYellowWire) { c = c.AlphaBlend(World.GlobalColors["Wire3"]); } return(c); }
public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showRedWire = true, bool showBlueWire = true, bool showGreenWire = true, bool showYellowWire = true) { var c = new Color(0, 0, 0, 0); if (tile.Wall > 0 && showWall) { if (tile.WallColor > 0 && (!showTile || tile.TileColor == 0)) { c = c.AlphaBlend(World.PaintProperties[tile.WallColor].Color); } else if (World.WallProperties.Count > tile.Wall) { if (World.WallProperties[tile.Wall].Color.A != 0) { c = c.AlphaBlend(World.WallProperties[tile.Wall].Color); } else { c = background; } } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } } else { c = background; } if (tile.IsActive && showTile) { if (tile.TileColor > 0) { c = c.AlphaBlend(World.PaintProperties[tile.TileColor].Color); } else if (World.TileProperties.Count > tile.Type) { c = c.AlphaBlend(World.TileProperties[tile.Type].Color); } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } } if (tile.LiquidAmount > 0 && showLiquid) { if (tile.LiquidType == LiquidType.Lava) { c = c.AlphaBlend(World.GlobalColors["Lava"]); } else if (tile.LiquidType == LiquidType.Honey) { c = c.AlphaBlend(World.GlobalColors["Honey"]); } else { c = c.AlphaBlend(World.GlobalColors["Water"]); } } if (tile.WireRed && showRedWire) { c = c.AlphaBlend(World.GlobalColors["Wire"]); } if (tile.WireGreen && showGreenWire) { c = c.AlphaBlend(World.GlobalColors["Wire2"]); } if (tile.WireBlue && showBlueWire) { c = c.AlphaBlend(World.GlobalColors["Wire1"]); } if (tile.WireYellow && showYellowWire) { c = c.AlphaBlend(World.GlobalColors["Wire3"]); } return(c); }
public static Color GetTileColor(Tile tile, Color background, bool showWall = true, bool showTile = true, bool showLiquid = true, bool showWire = true) { var c = new Color(0, 0, 0, 0); if (tile.Wall > 0 && showWall) { if (World.WallProperties.Count > tile.Wall) { c = c.AlphaBlend(World.WallProperties[tile.Wall].Color); } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } } else { c = background; } if (tile.IsActive && showTile) { if (World.TileProperties.Count > tile.Type) { c = c.AlphaBlend(World.TileProperties[tile.Type].Color); } else { c = c.AlphaBlend(Color.Magenta); // Add out-of-range colors } } if (tile.Liquid > 0 && showLiquid) { if (tile.IsLava) { c = c.AlphaBlend(World.GlobalColors["Lava"]); } else if (tile.IsHoney) { c = c.AlphaBlend(World.GlobalColors["Honey"]); } else { c = c.AlphaBlend(World.GlobalColors["Water"]); } } if (showWire) { if (tile.HasWire) { c = c.AlphaBlend(World.GlobalColors["Wire"]); } if (tile.HasWire2) { c = c.AlphaBlend(World.GlobalColors["Wire1"]); } if (tile.HasWire3) { c = c.AlphaBlend(World.GlobalColors["Wire2"]); } } return(c); }