private static Color ParseXMLColor(string color) { string[] array = color.Trim(new char[] { '(', ')' }).Split(new char[] { ',' }); return(GenColor.FromBytes(int.Parse(array[0]), int.Parse(array[1]), int.Parse(array[2]), 255)); }
public static Color?FromHex(string hex) { if (hex.StartsWith("#")) { hex = hex.Substring(1); } if (hex.Length != 6 && hex.Length != 8) { return(null); } int r = int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); int g = int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber); int b = int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber); int a = 255; if (hex.Length == 8) { a = int.Parse(hex.Substring(6, 2), NumberStyles.HexNumber); } return(GenColor.FromBytes(r, g, b, a)); }
public static Color FromHex(string hex) { if (hex.StartsWith("#")) { hex = hex.Substring(1); } if (hex.Length != 6 && hex.Length != 8) { Debug.LogError(string.Concat(hex, " is not a valid hex color.")); return(Color.white); } int num = int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); int num1 = int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber); int num2 = int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber); int num3 = 255; if (hex.Length == 8) { num3 = int.Parse(hex.Substring(6, 2), NumberStyles.HexNumber); } return(GenColor.FromBytes(num, num1, num2, num3)); }
private static void DressNakedZombie(Zombie pawn) { if (pawn.apparel.WornApparelCount == 0) { //90% chance of a top if (Rand.Value > 0.1f) { ThingDef top = Rand.Value > 0.3f ? ThingDef.Named("Apparel_BasicShirt") : ThingDef.Named("Apparel_CollarShirt"); Apparel topApparel = (Apparel)ThingMaker.MakeThing(top, ThingDefOf.Cloth); topApparel.HitPoints = Rand.Range((topApparel.MaxHitPoints / 6), (topApparel.MaxHitPoints / 2)); topApparel.SetColor(GenColor.FromBytes(Rand.Range(98, 155), Rand.Range(106, 129), Rand.Range(90, 129))); pawn.apparel.Wear(topApparel, false); } //95% chance of having pants if (Rand.Value > 0.05f) { ThingDef bottom = Rand.Value > 0.05f ? ThingDef.Named("Apparel_Pants") : ThingDef.Named("Apparel_FlakPants"); Apparel bottomApparel = (Apparel)ThingMaker.MakeThing(bottom, bottom == ThingDef.Named("Apparel_Pants") ? ThingDefOf.Cloth : null); bottomApparel.HitPoints = Rand.Range((bottomApparel.MaxHitPoints / 6), (bottomApparel.MaxHitPoints / 2)); pawn.apparel.Wear(bottomApparel, false); } } }
private static Color ParseXMLColor(string color) { string[] rgb = color.Trim(new char[] { '(', ')' }).Split(new char[] { ',' }); return(GenColor.FromBytes(int.Parse(rgb [0]), int.Parse(rgb [1]), int.Parse(rgb [2]))); }
static ColorLibrary() { ColorLibrary.Red = GenColor.FromHex("e50000"); ColorLibrary.Brown = GenColor.FromHex("653700"); ColorLibrary.Pink = GenColor.FromHex("ff81c0"); ColorLibrary.Blue = GenColor.FromHex("0343df"); ColorLibrary.Green = GenColor.FromHex("15b01a"); ColorLibrary.Purple = GenColor.FromHex("7e1e9c"); ColorLibrary.Black = GenColor.FromHex("000000"); ColorLibrary.Violet = GenColor.FromHex("9a0eea"); ColorLibrary.Teal = GenColor.FromHex("029386"); ColorLibrary.Grey = GenColor.FromHex("929591"); ColorLibrary.Magenta = GenColor.FromHex("c20078"); ColorLibrary.Orange = GenColor.FromHex("f97306"); ColorLibrary.Yellow = GenColor.FromHex("ffff14"); ColorLibrary.Leather = GenColor.FromBytes(132, 99, 60, 255); ColorLibrary.LightPurple = GenColor.FromHex("bf77f6"); ColorLibrary.LimeGreen = GenColor.FromHex("89fe05"); ColorLibrary.SkyBlue = GenColor.FromHex("75bbfd"); ColorLibrary.LightGreen = GenColor.FromHex("96f97b"); ColorLibrary.LightBlue = GenColor.FromHex("95d0fc"); ColorLibrary.DarkOrange = GenColor.FromHex("c65102"); ColorLibrary.Sand = GenColor.FromHex("e2ca76"); ColorLibrary.PastelGreen = GenColor.FromHex("b0ff9d"); ColorLibrary.Mint = GenColor.FromHex("9ffeb0"); ColorLibrary.LightOrange = GenColor.FromHex("fdaa48"); ColorLibrary.BrightPink = GenColor.FromHex("fe01b1"); ColorLibrary.DeepPurple = GenColor.FromHex("36013f"); ColorLibrary.DarkBrown = GenColor.FromHex("341c02"); ColorLibrary.Taupe = GenColor.FromHex("b9a281"); ColorLibrary.PeaGreen = GenColor.FromHex("8eab12"); ColorLibrary.PukeGreen = GenColor.FromHex("9aae07"); ColorLibrary.BlueGreen = GenColor.FromHex("137e6d"); ColorLibrary.Khaki = GenColor.FromHex("aaa662"); ColorLibrary.Burgundy = GenColor.FromHex("610023"); ColorLibrary.DarkTeal = GenColor.FromHex("014d4e"); ColorLibrary.BrickRed = GenColor.FromHex("8f1402"); ColorLibrary.RoyalPurple = GenColor.FromHex("4b006e"); ColorLibrary.Plum = GenColor.FromHex("580f41"); ColorLibrary.Gold = GenColor.FromHex("dbb40c"); ColorLibrary.BabyBlue = GenColor.FromHex("a2cffe"); ColorLibrary.YellowGreen = GenColor.FromHex("c0fb2d"); ColorLibrary.BrightPurple = GenColor.FromHex("be03fd"); ColorLibrary.DarkRed = GenColor.FromHex("840000"); ColorLibrary.PaleBlue = GenColor.FromHex("d0fefe"); ColorLibrary.GrassGreen = GenColor.FromHex("3f9b0b"); ColorLibrary.Navy = GenColor.FromHex("01153e"); ColorLibrary.Aquamarine = GenColor.FromHex("04d8b2"); ColorLibrary.BurntOrange = GenColor.FromHex("c04e01"); ColorLibrary.NeonGreen = GenColor.FromHex("0cff0c"); ColorLibrary.BrightBlue = GenColor.FromHex("0165fc"); ColorLibrary.Rose = GenColor.FromHex("cf6275"); ColorLibrary.LightPink = GenColor.FromHex("ffd1df"); ColorLibrary.Mustard = GenColor.FromHex("ceb301"); ColorLibrary.Indigo = GenColor.FromHex("380282"); ColorLibrary.Lime = GenColor.FromHex("aaff32"); ColorLibrary.DarkPink = GenColor.FromHex("cb416b"); ColorLibrary.OliveGreen = GenColor.FromHex("677a04"); ColorLibrary.Peach = GenColor.FromHex("ffb07c"); ColorLibrary.PaleGreen = GenColor.FromHex("c7fdb5"); ColorLibrary.LightBrown = GenColor.FromHex("ad8150"); ColorLibrary.HotPink = GenColor.FromHex("ff028d"); ColorLibrary.Lilac = GenColor.FromHex("cea2fd"); ColorLibrary.NavyBlue = GenColor.FromHex("001146"); ColorLibrary.RoyalBlue = GenColor.FromHex("0504aa"); ColorLibrary.Beige = GenColor.FromHex("e6daa6"); ColorLibrary.Salmon = GenColor.FromHex("ff796c"); ColorLibrary.Olive = GenColor.FromHex("6e750e"); ColorLibrary.Maroon = GenColor.FromHex("650021"); ColorLibrary.BrightGreen = GenColor.FromHex("01ff07"); ColorLibrary.DarkPurple = GenColor.FromHex("35063e"); ColorLibrary.Mauve = GenColor.FromHex("ae7181"); ColorLibrary.ForestGreen = GenColor.FromHex("06470c"); ColorLibrary.Aqua = GenColor.FromHex("13eac9"); ColorLibrary.Cyan = GenColor.FromHex("00ffff"); ColorLibrary.Tan = GenColor.FromHex("d1b26f"); ColorLibrary.DarkBlue = GenColor.FromHex("00035b"); ColorLibrary.Lavender = GenColor.FromHex("c79fef"); ColorLibrary.Turquoise = GenColor.FromHex("06c2ac"); ColorLibrary.DarkGreen = GenColor.FromHex("033500"); }
static WorldMaterials() { WorldTerrain = MatLoader.LoadMat("World/WorldTerrain", 3500); WorldIce = MatLoader.LoadMat("World/WorldIce", 3500); WorldOcean = MatLoader.LoadMat("World/WorldOcean", 3500); UngeneratedPlanetParts = MatLoader.LoadMat("World/UngeneratedPlanetParts", 3500); Rivers = MatLoader.LoadMat("World/Rivers", 3530); RiversBorder = MatLoader.LoadMat("World/RiversBorder", 3520); Roads = MatLoader.LoadMat("World/Roads", 3540); DebugTileRenderQueue = 3510; WorldObjectRenderQueue = 3550; WorldLineRenderQueue = 3590; DynamicObjectRenderQueue = 3600; FeatureNameRenderQueue = 3610; MouseTile = MaterialPool.MatFrom("World/MouseTile", ShaderDatabase.WorldOverlayAdditive, 3560); SelectedTile = MaterialPool.MatFrom("World/SelectedTile", ShaderDatabase.WorldOverlayAdditive, 3560); CurrentMapTile = MaterialPool.MatFrom("World/CurrentMapTile", ShaderDatabase.WorldOverlayTransparent, 3560); Stars = MatLoader.LoadMat("World/Stars"); Sun = MatLoader.LoadMat("World/Sun"); PlanetGlow = MatLoader.LoadMat("World/PlanetGlow"); SmallHills = MaterialPool.MatFrom("World/Hills/SmallHills", ShaderDatabase.WorldOverlayTransparentLit, 3510); LargeHills = MaterialPool.MatFrom("World/Hills/LargeHills", ShaderDatabase.WorldOverlayTransparentLit, 3510); Mountains = MaterialPool.MatFrom("World/Hills/Mountains", ShaderDatabase.WorldOverlayTransparentLit, 3510); ImpassableMountains = MaterialPool.MatFrom("World/Hills/Impassable", ShaderDatabase.WorldOverlayTransparentLit, 3510); VertexColor = MatLoader.LoadMat("World/WorldVertexColor"); TargetSquareMatSingle = MaterialPool.MatFrom("UI/Overlays/TargetHighlight_Square", ShaderDatabase.Transparent, 3560); NumMatsPerMode = 50; OverlayModeMatOcean = SolidColorMaterials.NewSolidColorMaterial(new Color(0.09f, 0.18f, 0.2f), ShaderDatabase.Transparent); FertilitySpectrum = new Color[2] { new Color(0f, 1f, 0f, 0f), new Color(0f, 1f, 0f, 0.5f) }; TemperatureSpectrum = new Color[8] { new Color(1f, 1f, 1f), new Color(0f, 0f, 1f), new Color(0.25f, 0.25f, 1f), new Color(0.6f, 0.6f, 1f), new Color(0.5f, 0.5f, 0.5f), new Color(0.5f, 0.3f, 0f), new Color(1f, 0.6f, 0.18f), new Color(1f, 0f, 0f) }; ElevationSpectrum = new Color[4] { new Color(0.224f, 0.18f, 0.15f), new Color(0.447f, 0.369f, 0.298f), new Color(0.6f, 0.6f, 0.6f), new Color(1f, 1f, 1f) }; RainfallSpectrum = new Color[12] { new Color(0.9f, 0.9f, 0.9f), GenColor.FromBytes(190, 190, 190), new Color(0.58f, 0.58f, 0.58f), GenColor.FromBytes(196, 112, 110), GenColor.FromBytes(200, 179, 150), GenColor.FromBytes(255, 199, 117), GenColor.FromBytes(255, 255, 84), GenColor.FromBytes(145, 255, 253), GenColor.FromBytes(0, 255, 0), GenColor.FromBytes(63, 198, 55), GenColor.FromBytes(13, 150, 5), GenColor.FromBytes(5, 112, 94) }; GenerateMats(ref matsFertility, FertilitySpectrum, NumMatsPerMode); GenerateMats(ref matsTemperature, TemperatureSpectrum, NumMatsPerMode); GenerateMats(ref matsElevation, ElevationSpectrum, NumMatsPerMode); GenerateMats(ref matsRainfall, RainfallSpectrum, NumMatsPerMode); }