/// <summary> /// Import custom texture and label settings for buttons /// </summary> /// <param name="button">Button</param> /// <param name="colorName">Name of texture</param> static public void SetCustomButton(ref Button button, string colorName) { // Load texture button.BackgroundTexture = LoadCustomTexture(colorName); button.BackgroundTexture.filterMode = (FilterMode)DaggerfallUnity.Settings.GUIFilterMode; // Load settings from Xml string path = Path.Combine(texturesPath, colorName); if (XMLManager.XmlFileExists(path)) { var xml = new XMLManager(path); string value; if (xml.TryGetString("customtext", out value)) { if (value == "true") // Set custom color for text { button.Label.TextColor = xml.GetColor(button.Label.TextColor); } else if (value == "notext") // Disable text. This is useful if text is drawn on texture { button.Label.Text = string.Empty; } } } }
/// <summary> /// Import custom texture and label settings for buttons /// </summary> /// <param name="button">Button</param> /// <param name="colorName">Name of texture</param> static public void SetCustomButton(ref Button button, string colorName) { // Load texture button.BackgroundTexture = LoadCustomTexture(colorName); button.BackgroundTexture.filterMode = (FilterMode)DaggerfallUnity.Settings.GUIFilterMode; // Load settings from Xml if (XMLManager.XmlFileExist(colorName, texturesPath)) { // Set custom color if (XMLManager.GetString(colorName, "customtext", texturesPath) == "true") { button.Label.TextColor = XMLManager.GetColor(colorName, texturesPath); } // Disable text. This is useful if text is drawn on texture else if (XMLManager.GetString(colorName, "customtext", texturesPath) == "notext") { button.Label.Text = ""; } } }