alpha+showcont

This commit is contained in:
honzapatCZ
2021-04-07 12:40:59 +02:00
committed by Wojtek Figat
parent 4392e07cd6
commit 388ec655bf
2 changed files with 41 additions and 1 deletions

View File

@@ -178,7 +178,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
/// <summary>
/// The control types collection (for game UI).
/// </summary>
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);
/// <summary>
/// The Animation Graph custom nodes collection.

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using FlaxEngine;
namespace FlaxEngine.GUI
{
/// <summary>
/// Changes alpha of all its children
/// </summary>
public class AlphaPanel : ContainerControl
{
/// <summary>
/// The target alpha value
/// </summary>
public float Alpha;
/// <summary>
/// Whether or not we should ignore previous alphas
/// </summary>
public bool IgnoreStack;
/// <inheritdoc/>
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();
}
}
}