// Displays the info of a topic, along with a possible title void IDialogView.DisplayInfo(string text, string title) { if (title != null) { title = char.ToUpper(title[0]) + title.Substring(1); var color = IniManager.GetColor("FontColor", "color_big_header"); var colorHex = ColorUtility.ToHtmlStringRGB(color); if (text == null) { text = $"<color=#{colorHex}>{title}</color>{text}"; } else { text = $"<color=#{colorHex}>{title}</color>\r\n{text}"; } } if (text != null) { var infoClone = Instantiate(infoPrefab, infoParent); infoClone.text = text; } ScrollToBottom(); }
private void Awake() { button.colors = new ColorBlock { normalColor = IniManager.GetColor("FontColor", $"color_{key}"), highlightedColor = IniManager.GetColor("FontColor", $"color_{key}_over"), pressedColor = IniManager.GetColor("FontColor", $"color_{key}_pressed"), disabledColor = IniManager.GetColor("FontColor", $"color_disabled"), colorMultiplier = 1 }; }
private Gradient GetGradient(string section, string key) { var gradient = new Gradient(); var colorKeys = new List <GradientColorKey>(); // All times are normalized from 0-1, where 0 = midnight, 0.5 = midday, then 1 = midnight again var transitionDelta = IniManager.GetFloat(section, "Transition Delta"); // Transition delta is said to be in realtime, but lets make it independant of current time scale var secondsPerDay = (60 * 60 * 24) / 30; // 2880, number of realtime seconds in a MW day transitionDelta = (1f / transitionDelta) / secondsPerDay; var sunriseColor = IniManager.GetColor(section, $"{key} Sunrise Color"); var dayColor = IniManager.GetColor(section, $"{key} Day Color"); var nightColor = IniManager.GetColor(section, $"{key} Night Color"); var sunsetColor = IniManager.GetColor(section, $"{key} Sunset Color"); // Sunrise var sunriseTime = IniManager.GetFloat("Weather", "Sunrise Time") / 24; var sunriseDuration = IniManager.GetFloat("Weather", "Sunrise Duration") / 24; var preSunriseTime = IniManager.GetFloat("Weather", $"{key} Pre-Sunrise Time") / 24; var postSunriseTime = IniManager.GetFloat("Weather", $"{key} Post-Sunrise Time") / 24; // Night/Sunrise/Day transition var sunriseStart = sunriseTime - preSunriseTime; var sunriseStop = sunriseTime + sunriseDuration + postSunriseTime; colorKeys.Add(new GradientColorKey(nightColor, sunriseStart)); colorKeys.Add(new GradientColorKey(sunriseColor, sunriseStart + transitionDelta)); colorKeys.Add(new GradientColorKey(sunriseColor, sunriseStop)); colorKeys.Add(new GradientColorKey(dayColor, sunriseStop + transitionDelta)); // Day/sunset/night transition var sunsetTime = IniManager.GetFloat("Weather", "Sunset Time") / 24; var sunsetDuration = IniManager.GetFloat("Weather", "Sunset Duration") / 24; var preSunsetTime = IniManager.GetFloat("Weather", $"{key} Pre-Sunset Time") / 24; var postSunsetTime = IniManager.GetFloat("Weather", $"{key} Post-Sunset Time") / 24; var sunsetStart = sunsetTime - preSunsetTime; var sunsetStop = sunsetTime + sunsetDuration + postSunsetTime; colorKeys.Add(new GradientColorKey(dayColor, sunsetStart)); colorKeys.Add(new GradientColorKey(sunsetColor, sunsetStart + transitionDelta)); colorKeys.Add(new GradientColorKey(sunsetColor, sunsetStop)); colorKeys.Add(new GradientColorKey(nightColor, sunsetStop + transitionDelta)); gradient.colorKeys = colorKeys.ToArray(); return(gradient); }