private void AfterColorSwitchCallMethod(LightDarkColor.ColorType colorType) { if (afterColorSwitchCall != null) { afterColorSwitchCall(colorType); } }
public void SetColors(LightDarkColor.ColorType colorType) { if (language == null) { return; } if (!this.language.isEnabled) { ColorBlock buttonColors = btn.colors; textName.color = new Color(textName.color.r, textName.color.g, textName.color.b, buttonColors.disabledColor.a); } }
public Color GetColor(LightDarkColor.ColorType colorType) { switch (colorType) { case LightDarkColor.ColorType.Light: return(lightDarkColor.lightColor); case LightDarkColor.ColorType.Dark: return(lightDarkColor.darkColor); default: return(Color.magenta); } }
public static void SwitchTheme() { if (Application.isPlaying) { GameManager.instance.dataManager.darkMode = !GameManager.instance.dataManager.darkMode; } else { currentTheme = (currentTheme == LightDarkColor.ColorType.Light) ? LightDarkColor.ColorType.Dark : LightDarkColor.ColorType.Light; ColorSwitcher[] foundObjects = FindObjectsOfType <ColorSwitcher>(); foreach (ColorSwitcher obj in foundObjects) { obj.SetColorTo(currentTheme); } } }
public void SetColorTo(LightDarkColor.ColorType colorType) { Image img = GetComponent <Image>(); if (img != null) { #if UNITY_EDITOR Undo.RecordObject(img, "Changing the component 'Image' on " + gameObject.name); #endif img.color = GetColor(colorType); AfterColorSwitchCallMethod(colorType); return; } TextMeshProUGUI txt = GetComponent <TextMeshProUGUI>(); if (txt != null) { #if UNITY_EDITOR Undo.RecordObject(txt, "Changing the component 'TextMeshProUGUI' on " + gameObject.name); #endif txt.color = GetColor(colorType); AfterColorSwitchCallMethod(colorType); return; } Camera cam = GetComponent <Camera>(); if (cam != null) { #if UNITY_EDITOR Undo.RecordObject(cam, "Changing the component 'Camera' on " + gameObject.name); #endif cam.backgroundColor = GetColor(colorType); AfterColorSwitchCallMethod(colorType); return; } }
private void SetColorsAfterSwitch(LightDarkColor.ColorType obj) { UpdateVisuals(); }