This commit is contained in:
CortexCore
2025-03-04 16:34:27 +08:00
parent c29bf0d12f
commit 42eb7b00d9
16 changed files with 64 additions and 245 deletions

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1705803e58f488146b0c364b69f275ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,20 +0,0 @@
{
"name": "BITKit.Extensions.TranslucentImage",
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:6ef4ed8ff60a7aa4bb60a8030e6f4008",
"GUID:ff218ee40fe2b8648ab3234d56415557"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"LeTai_TranslucentImage"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: f4dea7f9c2d5c3d4abb7467736ee56df
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using LeTai.Asset.TranslucentImage;
using UnityEngine;
namespace BITKit.UX
{
public class TranslucentService : MonoBehaviour
{
public static RenderTexture BlurredScreen;
[SerializeField] private TranslucentImageSource source;
[SerializeField] private RenderTexture blurredScreen;
private void LateUpdate()
{
source.Request();
BlurredScreen = blurredScreen = source.BlurredScreen;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 14ba5b1e81092234d944bec5c7063bc1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,34 +0,0 @@
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));
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 45ff73d2202441b44a5453c22ebf0dab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,38 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BITKit.UX
{
public class UXTranslucentService : MonoBehaviour
{
[SerializeField] private Image image;
private float alpha;
private void Start()
{
BITAppForUnity.AllowCursor.AddListener(OnCursor);
destroyCancellationToken.Register(Dispose);
}
private void Dispose()
{
BITAppForUnity.AllowCursor.RemoveListener(OnCursor);
}
private void OnCursor(bool obj)
{
image.enabled = obj;
if (obj) alpha = 0;
}
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);
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c99210a06ff163b4ab4bfce7ebbccbe9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: