/// <summary> /// Rewrite window color to become less or more opaque. /// NOTE: If the call has no effect, look for some other code rewriting the color after your call! /// </summary> /// <param name="opacity">Range 0..100, where 100 is solid and 0 invisible.</param> internal void SetOpacity(U.UOpacityValue opacity) { Color32 modified = this.color; modified.a = opacity.GetOpacityByte(); this.color = modified; }
public static void SetGuiTransparency(byte val) { bool isChanged = val != GlobalConfig.Instance.Main.GuiOpacity; GlobalConfig.Instance.Main.GuiOpacity = val; if (isChanged && _guiOpacitySlider != null) { _guiOpacitySlider.value = val; U.UOpacityValue opacity = UOpacityValue.FromOpacity(0.01f * val); ModUI.Instance.uiOpacityObservable.NotifyObservers( new ModUI.UIOpacityNotification { Opacity = opacity, }); } }