This commit is contained in:
CortexCore
2024-04-06 16:33:32 +08:00
parent 637bbef7d2
commit 37e7fcea51
42 changed files with 597 additions and 149 deletions

View File

@@ -20,7 +20,8 @@ namespace BITKit.OpenWorld
private void AddCullingSource(MeshCombiner meshcombiner)
{
AddCullingSource();
if (enabled)
AddCullingSource();
}
[BIT]

View File

@@ -22,11 +22,10 @@ namespace BITKit
protected override void OnStop(bool interrupted)
{
base.OnStop(interrupted);
if (interrupted)
{
if(output.isDefined)
QuestSystem.Cancel(output.value);
}
if (!interrupted) return;
if (QuestSystem.quests.TryGetValue(output.value, out var info) &&
info.State == QuestSystem.State.InProcess)
QuestSystem.Cancel(output.value);
}
}
}

View File

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

View File

@@ -0,0 +1,20 @@
{
"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

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

View File

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

View File

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

View File

@@ -0,0 +1,23 @@
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);
}
private void OnGeometryChanged(GeometryChangedEvent evt)
{
if (style.display.value is not DisplayStyle.Flex) return;
style.backgroundImage = new StyleBackground(Background.FromRenderTexture(TranslucentService.BlurredScreen));
}
}
}

View File

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

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.iOS;
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 Update()
{
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

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