This commit is contained in:
CortexCore
2024-05-31 01:23:15 +08:00
parent c798b224be
commit 299082fe27
164 changed files with 3604 additions and 2018 deletions

View File

@@ -11,6 +11,11 @@ namespace BITKit.UX
public static RenderTexture BlurredScreen;
[SerializeField] private TranslucentImageSource source;
[SerializeField] private RenderTexture blurredScreen;
private void LateUpdate()
{
source.Request();
BlurredScreen = blurredScreen = source.BlurredScreen;
}
}
}

View File

@@ -12,12 +12,23 @@ namespace BITKit.UX
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));
}
}
}

View File

@@ -2,7 +2,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.iOS;
using UnityEngine.UI;
namespace BITKit.UX
@@ -25,12 +24,13 @@ namespace BITKit.UX
image.enabled = obj;
if (obj) alpha = 0;
}
private void Update()
private void LateUpdate()
{
if (BITAppForUnity.AllowCursor.Allow && alpha is not 1)
{
alpha = Mathf.Clamp01(alpha + Time.deltaTime*5);
image.color = new Color(0, 0, 0, alpha);
}
}
}