35 lines
821 B
C#
35 lines
821 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace BITKit.UX
|
|
{
|
|
|
|
public class TranslucentVisualElement : VisualElement
|
|
{
|
|
public new class UxmlFactory : UxmlFactory<TranslucentVisualElement, UxmlTraits> { }
|
|
public TranslucentVisualElement()
|
|
{
|
|
RegisterCallback<GeometryChangedEvent>(OnGeometryChanged);
|
|
generateVisualContent += DrawCanvas;
|
|
}
|
|
|
|
private void DrawCanvas(MeshGenerationContext obj)
|
|
{
|
|
|
|
}
|
|
|
|
private void OnGeometryChanged(GeometryChangedEvent evt)
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (BITAppForUnity.IsPlaying is false) return;
|
|
#endif
|
|
if (style.display.value is not DisplayStyle.Flex) return;
|
|
style.backgroundImage = new StyleBackground(Background.FromRenderTexture(TranslucentService.BlurredScreen));
|
|
}
|
|
|
|
}
|
|
|
|
}
|