diff --git a/Source/Editor/Modules/SourceCodeEditing/CodeEditingModule.cs b/Source/Editor/Modules/SourceCodeEditing/CodeEditingModule.cs index e6868e4fd..1afddf2fc 100644 --- a/Source/Editor/Modules/SourceCodeEditing/CodeEditingModule.cs +++ b/Source/Editor/Modules/SourceCodeEditing/CodeEditingModule.cs @@ -178,7 +178,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing /// /// The control types collection (for game UI). /// - public readonly CachedTypesCollection Controls = new CachedTypesCollection(64, new ScriptType(typeof(Control)), IsTypeValidScriptingTypeControls, HasAssemblyValidScriptingTypes); + public readonly CachedTypesCollection Controls = new CachedTypesCollection(64, new ScriptType(typeof(ContainerControl)), IsTypeValidScriptingTypeControls, HasAssemblyValidScriptingTypes); /// /// The Animation Graph custom nodes collection. diff --git a/Source/Engine/UI/GUI/Common/Panels/AlphaPanel.cs b/Source/Engine/UI/GUI/Common/Panels/AlphaPanel.cs new file mode 100644 index 000000000..f6319f1fa --- /dev/null +++ b/Source/Engine/UI/GUI/Common/Panels/AlphaPanel.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using FlaxEngine; + +namespace FlaxEngine.GUI +{ + /// + /// Changes alpha of all its children + /// + public class AlphaPanel : ContainerControl + { + /// + /// The target alpha value + /// + public float Alpha; + /// + /// Whether or not we should ignore previous alphas + /// + public bool IgnoreStack; + + /// + public override void Draw() + { + Render2D.PeekTint(out Color oldColor); + if (IgnoreStack) + { + Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, Alpha); + Render2D.PushTint(ref newColor, false); + } + else + { + Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, oldColor.A * Alpha); + Render2D.PushTint(ref newColor, false); + } + base.Draw(); + + Render2D.PopTint(); + } + } +}