1
This commit is contained in:
@@ -6101,7 +6101,7 @@ MonoBehaviour:
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
|
@@ -101838,15 +101838,15 @@ MonoBehaviour:
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 11400000, guid: 7b6a2cbff5c66dc42a81b604c826c04d, type: 2}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 11400000}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 11400000}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
m_RegularStyleWeight: 0
|
||||
m_RegularStyleSpacing: 0
|
||||
|
BIN
Src/Unity/Art/Fonts/SourceHanMonoSC-Bold.otf
Normal file
BIN
Src/Unity/Art/Fonts/SourceHanMonoSC-Bold.otf
Normal file
Binary file not shown.
21
Src/Unity/Art/Fonts/SourceHanMonoSC-Bold.otf.meta
Normal file
21
Src/Unity/Art/Fonts/SourceHanMonoSC-Bold.otf.meta
Normal file
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b7684d3e4f46a246a45689991580374
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Source Han Mono SC
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -34,21 +34,47 @@ namespace BITKit.IO
|
||||
var scriptableObject = objs[index];
|
||||
var entity = new Entity();
|
||||
|
||||
var idComponent = new IdComponent();
|
||||
var idComponent = new IdComponent()
|
||||
{
|
||||
Name = scriptableObject.name
|
||||
};
|
||||
|
||||
entity.ServiceCollection.AddSingleton(idComponent);
|
||||
|
||||
var type = scriptableObject.GetType();
|
||||
|
||||
var typeName = type.Name;
|
||||
|
||||
entity.ServiceCollection.AddSingleton(type, scriptableObject);
|
||||
|
||||
foreach (var x in type.GetInterfaces())
|
||||
{
|
||||
entity.ServiceCollection.AddSingleton(x, scriptableObject);
|
||||
}
|
||||
|
||||
while (type is not null)
|
||||
{
|
||||
if (type.BaseType is null) break;
|
||||
entity.ServiceCollection.AddSingleton(type.BaseType, scriptableObject);
|
||||
type = type.BaseType;
|
||||
typeName += $":{type.Name}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
_entitiesService.Register(entity);
|
||||
|
||||
logger?.LogInformation($"已加载:{scriptableObject.name}:{type.Name},剩余:{index + 1}/{objs.Count}");
|
||||
logger?.LogInformation($"已加载:{scriptableObject.name}:{typeName},剩余:{index + 1}/{objs.Count}");
|
||||
_registeredEntities.Add(entity);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
logger?.LogInformation("加载完成");
|
||||
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@@ -135,7 +135,9 @@ namespace BITKit
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Reload()
|
||||
{
|
||||
|
||||
BITApp.WalkUntilInitialize = new();
|
||||
|
||||
|
||||
IsPlaying = true;
|
||||
//启动BITApp
|
||||
BITApp.SynchronizationContext = SynchronizationContext.Current;
|
||||
|
8
Src/Unity/Scripts/Impact.meta
Normal file
8
Src/Unity/Scripts/Impact.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee77d81b8f27d6a44923a2a6901a66e0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Src/Unity/Scripts/Impact/Net.BITKit.Impact.Unity.asmdef
Normal file
19
Src/Unity/Scripts/Impact/Net.BITKit.Impact.Unity.asmdef
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Net.BITKit.Impact.Unity",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:89bd0da52dc3cc94daadea6252c6ad1b",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24866f14213d2124aa20be037476b521
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Src/Unity/Scripts/Impact/ScriptableImpact.cs
Normal file
28
Src/Unity/Scripts/Impact/ScriptableImpact.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using AYellowpaper.SerializedCollections;
|
||||
using BITKit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.BITKit.Impact
|
||||
{
|
||||
public class ScriptableImpact : ScriptableObject,ITag
|
||||
{
|
||||
[SerializeReference, SubclassSelector] private IReference[] tags;
|
||||
[SerializeField] private int priority;
|
||||
|
||||
[SerializeField] private Transform[] prefabs;
|
||||
[SerializeField] private AudioClip[] audioClips;
|
||||
|
||||
public int Hash { get; set; }
|
||||
public IReadOnlyCollection<string> Tags => tags.Select(x=>x.Get()).ToArray();
|
||||
|
||||
public Transform Prefab => prefabs.Random();
|
||||
public AudioClip AudioClip => audioClips.Random();
|
||||
public int Priority => priority;
|
||||
}
|
||||
|
||||
}
|
11
Src/Unity/Scripts/Impact/ScriptableImpact.cs.meta
Normal file
11
Src/Unity/Scripts/Impact/ScriptableImpact.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac8fd6229773587428b5dca77471e986
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -4,6 +4,7 @@ using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine.InputSystem.Controls;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
@@ -11,7 +12,7 @@ namespace BITKit
|
||||
{
|
||||
public static bool JustPressed(this InputAction.CallbackContext self)
|
||||
{
|
||||
return self.interaction is null && self.started;
|
||||
return self is { started:true, control: ButtonControl { wasPressedThisFrame: true , isPressed:true} };
|
||||
}
|
||||
public static InputAction RegisterCallback(this InputAction self, Action<InputAction.CallbackContext> action)
|
||||
{
|
||||
|
@@ -7,37 +7,6 @@ using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public abstract class UnityLogger:ILogger
|
||||
{
|
||||
[HideInCallstack]
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Critical:
|
||||
case LogLevel.Error:
|
||||
if (exception is not null)
|
||||
{
|
||||
Debug.LogException(exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"{CurrentScope}:{state.ToString()}");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.Log($"{CurrentScope}:{state.ToString()}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public bool IsEnabled(LogLevel logLevel) => true;
|
||||
private string CurrentScope { get; set; }
|
||||
public IDisposable BeginScope<TState>(TState state) where TState : notnull
|
||||
{
|
||||
CurrentScope = typeof(TState).Name;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public sealed class UnityLogger<T>:ILogger<T>
|
||||
{
|
||||
[HideInCallstack]
|
||||
@@ -53,11 +22,11 @@ namespace BITKit
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"{typeof(T).Name}:{state.ToString()}");
|
||||
Debug.LogError($"{typeof(T).CSharpName()}:{state.ToString()}");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Debug.Log($"<b>{typeof(T).Name}</b>:{state.ToString()}");
|
||||
Debug.Log($"<b>{typeof(T).CSharpName()}</b>:{state.ToString()}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -27,22 +27,31 @@ namespace BITKit.Physics
|
||||
|
||||
var vertices = _mesh.vertices;
|
||||
|
||||
if (vertices.Length > 2048) return false;
|
||||
if (vertices.Length > 256) return false;
|
||||
|
||||
var minPos = new Vector3(64, 64, 64);
|
||||
var minDistance = 64f;
|
||||
|
||||
for (var index = 0; index < _mesh.triangles.Length; index+=3)
|
||||
{
|
||||
var x = vertices[_mesh.triangles[index]];
|
||||
|
||||
if (Vector3.Distance(x, _position) > minDistance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var y = vertices[_mesh.triangles[index + 1]];
|
||||
var z = vertices[_mesh.triangles[index + 2]];
|
||||
|
||||
var pos = GeometryUtils.GetPosInTriangle(x, y, z, _position);
|
||||
|
||||
if (Vector3.Distance(pos, _position) < Vector3.Distance(minPos, _position))
|
||||
{
|
||||
minPos = pos;
|
||||
}
|
||||
var distance = Vector3.Distance(pos, _position);
|
||||
|
||||
if (!(distance < minDistance)) continue;
|
||||
|
||||
minPos = pos;
|
||||
minDistance = distance;
|
||||
}
|
||||
|
||||
position = minPos;
|
||||
|
@@ -42,7 +42,9 @@ namespace BITKit.Pool
|
||||
ReadyPool.Clear();
|
||||
}
|
||||
|
||||
public async UniTask<T> Spawn<T>(string path) where T : class
|
||||
public int DefaultCapacity { get; set; } = 8;
|
||||
|
||||
public async UniTask<T> Spawn<T>(string path,object prefab) where T : class
|
||||
{
|
||||
if (Pool.ContainsKey(path))
|
||||
{
|
||||
@@ -55,7 +57,7 @@ namespace BITKit.Pool
|
||||
return obj as T;
|
||||
}
|
||||
|
||||
if (usingList.Count>0)
|
||||
if (usingList.Count>=DefaultCapacity)
|
||||
{
|
||||
obj = usingList[0];
|
||||
usingList.RemoveAt(0);
|
||||
@@ -81,13 +83,33 @@ namespace BITKit.Pool
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
if (typeof(Object).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
var asset =await ModService.LoadAsset<T>(path);
|
||||
var asset =prefab as T ?? await ModService.LoadAsset<T>(path);
|
||||
if (asset is Object o)
|
||||
{
|
||||
var instance = Object.Instantiate(o);
|
||||
list.Add(instance);
|
||||
UsingPool.GetOrCreate(path).Add(instance);
|
||||
ReadyPool.GetOrCreate(path);
|
||||
|
||||
if (instance is GameObject gameObject)
|
||||
{
|
||||
gameObject.GetCancellationTokenOnDestroy().Register(DisposeGo);
|
||||
|
||||
void DisposeGo()
|
||||
{
|
||||
Pool.GetOrCreate(path).TryRemove(gameObject);
|
||||
UsingPool.GetOrCreate(path).TryRemove(gameObject);
|
||||
var queue = ReadyPool.GetOrCreate(path);
|
||||
var removeObjectList = new List<object>(queue);
|
||||
removeObjectList.TryRemove(gameObject);
|
||||
queue.Clear();
|
||||
foreach (var x in removeObjectList)
|
||||
{
|
||||
queue.Enqueue(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance as T;
|
||||
}
|
||||
}
|
||||
|
18
Src/Unity/Scripts/Scenes/UnityAutoDestroyOnStart.cs
Normal file
18
Src/Unity/Scripts/Scenes/UnityAutoDestroyOnStart.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UnityAutoDestroyOnStart : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Src/Unity/Scripts/Scenes/UnityAutoDestroyOnStart.cs.meta
Normal file
11
Src/Unity/Scripts/Scenes/UnityAutoDestroyOnStart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 802bbaa627560f547ba5c71f6f7b4a0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -8,19 +8,10 @@ namespace BITKit
|
||||
{
|
||||
public class Tag : MonoBehaviour,ITag
|
||||
{
|
||||
[Header(Constant.Header.Settings)]
|
||||
[Tooltip("It's will be deprecated in the future, use reference instead.")]
|
||||
[SerializeField] private string[] tags;
|
||||
[Tooltip("Disable when tags is not empty")]
|
||||
[SerializeReference,SubclassSelector] private IReference[] reference;
|
||||
public int Hash => _id is 0 ? _id = MathE.GetHash(GetTags()) : _id;
|
||||
public int Hash => _id is 0 ? _id = MathE.GetHash(Tags) : _id;
|
||||
private int _id;
|
||||
public string[] GetTags() => CacheTags ??= reference?.Length > 0 ? reference.Select(x => x.Value).ToArray() : tags;
|
||||
private string[] CacheTags;
|
||||
public void SetTags(IReference[] newReference)
|
||||
{
|
||||
reference = newReference;
|
||||
CacheTags = null;
|
||||
}
|
||||
public IReadOnlyCollection<string> Tags=> _cacheTags ??= reference.Select(x => x.Value).ToArray();
|
||||
private string[] _cacheTags;
|
||||
}
|
||||
}
|
@@ -14,6 +14,7 @@ namespace BITKit
|
||||
[Serializable]
|
||||
public class IntervalTick:ITicker
|
||||
{
|
||||
[SerializeField]
|
||||
private float interval;
|
||||
public ulong TickCount=>IntervalTickService.GetTickCount(interval);
|
||||
|
||||
|
@@ -32,11 +32,6 @@ namespace BITKit.UX
|
||||
_container.Clear();
|
||||
|
||||
_template =await ModService.LoadAsset<VisualTreeAsset>("ui_radial_menu-template");
|
||||
|
||||
RootVisualElement.RegisterCallback<PointerDownEvent>(x =>
|
||||
{
|
||||
UXService.Return();
|
||||
});
|
||||
}
|
||||
protected override void OnPanelEntry()
|
||||
{
|
||||
|
@@ -74,7 +74,7 @@ namespace BITKit.UX
|
||||
|
||||
|
||||
foreach (var fieldInfo in self.GetType()
|
||||
.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
|
||||
.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)
|
||||
.Where(x => x.GetCustomAttribute<UXBindPathAttribute>() is not null)
|
||||
)
|
||||
{
|
||||
|
@@ -461,6 +461,11 @@ namespace BITKit
|
||||
return true;
|
||||
}
|
||||
component = self.GetComponentInParent<T>(true);
|
||||
if (component is not null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
component = self.GetComponent<T>();
|
||||
return component is not null;
|
||||
}
|
||||
public static bool TryGetFirstOrDefault<T>(this IEnumerable<T> self, out T value)
|
||||
|
8
Src/Unity/Scripts/VFX.meta
Normal file
8
Src/Unity/Scripts/VFX.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdd91b53bafc0804d8d8382169b67308
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Src/Unity/Scripts/VFX/Net.Project.B.VFX.Unity.asmdef
Normal file
19
Src/Unity/Scripts/VFX/Net.Project.B.VFX.Unity.asmdef
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Net.Project.B.VFX.Unity",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:24866f14213d2124aa20be037476b521"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21442fa5e0c49e3408652e96f6565891
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
63
Src/Unity/Scripts/VFX/VFXService.cs
Normal file
63
Src/Unity/Scripts/VFX/VFXService.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using Net.BITKit.Impact;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.BITKit.VFX
|
||||
{
|
||||
public class VFXService
|
||||
{
|
||||
private readonly IEntitiesService _entitiesService;
|
||||
private readonly IReadOnlyCollection<ScriptableImpact> _scriptableImpacts;
|
||||
|
||||
public VFXService(IEntitiesService entitiesService)
|
||||
{
|
||||
_entitiesService = entitiesService;
|
||||
_scriptableImpacts = _entitiesService.QueryComponents<ScriptableImpact>();
|
||||
}
|
||||
|
||||
public AudioClip GetAudioClip(IReadOnlyCollection<string> tags)
|
||||
{
|
||||
var bestMatches = Search(tags);
|
||||
|
||||
return bestMatches.AudioClip;
|
||||
}
|
||||
|
||||
public Transform GetPrefab(IReadOnlyCollection<string> tags)
|
||||
{
|
||||
var bestMatches = Search(tags);
|
||||
return bestMatches.Prefab;
|
||||
}
|
||||
|
||||
private ScriptableImpact Search(IReadOnlyCollection<string> tags)
|
||||
{
|
||||
var maxPoint = 0;
|
||||
var max = new HashSet<ScriptableImpact>();
|
||||
foreach (var impact in _scriptableImpacts)
|
||||
{
|
||||
var point = impact.Tags.Intersect(tags).Count();
|
||||
if (point > maxPoint)
|
||||
{
|
||||
maxPoint = point;
|
||||
max.Clear();
|
||||
max.Add(impact);
|
||||
}else if (point == maxPoint)
|
||||
{
|
||||
max.Add(impact);
|
||||
}
|
||||
}
|
||||
|
||||
if (max.Count is 1)
|
||||
{
|
||||
return max.First();
|
||||
}
|
||||
|
||||
return max.OrderByDescending(x => x.Priority).First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Src/Unity/Scripts/VFX/VFXService.cs.meta
Normal file
11
Src/Unity/Scripts/VFX/VFXService.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bee817d1b196f842899232c3a28d504
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -60,7 +60,7 @@ namespace BITKit.OpenWorld
|
||||
#if UNITY_EDITOR
|
||||
[BIT]
|
||||
#endif
|
||||
private void CalculateBounds()
|
||||
public void CalculateBounds()
|
||||
{
|
||||
if (TryGetComponent<Collider>(out var _collider))
|
||||
{
|
||||
|
@@ -25,7 +25,6 @@ namespace BITKit.OpenWorld
|
||||
private readonly ConcurrentDictionary<int, IWorldChunkObject> dictionary=new();
|
||||
|
||||
[SerializeReference, SubclassSelector] private ITicker ticker;
|
||||
[SerializeReference, SubclassSelector] private ISceneService sceneService;
|
||||
[SerializeField, ReadOnly] private int count;
|
||||
[SerializeField, ReadOnly] private int tickTaskCount;
|
||||
[SerializeField] private bool drawBounds;
|
||||
@@ -42,24 +41,13 @@ namespace BITKit.OpenWorld
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
sceneService?.RegisterLoadTaskAsync(LoadTask);
|
||||
ticker.Add(OnTick);
|
||||
destroyCancellationToken.Register(Dispose);
|
||||
_quadtree = new QuadtreeRoot<IWorldChunkObject, Node<IWorldChunkObject>>(transform.position, size);
|
||||
_camera = Camera.main;
|
||||
}
|
||||
private async UniTask LoadTask()
|
||||
{
|
||||
var frame=0;
|
||||
while (count is 0 || frame++<32)
|
||||
{
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
await UniTask.NextFrame();
|
||||
}
|
||||
}
|
||||
protected virtual void Dispose()
|
||||
{
|
||||
sceneService?.UnRegisterLoadTaskAsync(LoadTask);
|
||||
ticker.Remove(OnTick);
|
||||
_registerQueue.Clear();
|
||||
_unregisterQueue.Clear();
|
||||
|
@@ -14,6 +14,7 @@ namespace BITKit.OpenWorld
|
||||
{
|
||||
public class WorldTerrainBehaviour : MonoBehaviour,IWorldChunkObject
|
||||
{
|
||||
public static UniTaskCompletionSource WaitUntilInitialized = new();
|
||||
[SerializeReference, SubclassSelector] private IReference sceneName;
|
||||
[SerializeField] private Vector3 size;
|
||||
[SerializeField] private Vector3 position;
|
||||
@@ -26,7 +27,15 @@ namespace BITKit.OpenWorld
|
||||
var stopWatcher = new System.Diagnostics.Stopwatch();
|
||||
stopWatcher.Start();
|
||||
_sceneHandle = YooAssets.LoadSceneAsync(sceneName.Value,LoadSceneMode.Additive,priority:8);
|
||||
await _sceneHandle;
|
||||
try
|
||||
{
|
||||
await _sceneHandle.WithCancellation(destroyCancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
stopWatcher.Stop();
|
||||
Debug.Log($"加载场景 {sceneName.Value} 耗时 {stopWatcher.ElapsedMilliseconds}ms");
|
||||
}
|
||||
|
@@ -21,10 +21,11 @@ Material:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Billboard
|
||||
m_Shader: {fileID: -6465566751694194690, guid: fc56a447eb0944f4f9fc3b51a4913759, type: 3}
|
||||
m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_ValidKeywords:
|
||||
- SHAKEUV_ON
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
@@ -37,6 +38,14 @@ Material:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _A:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _AlphaTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@@ -45,6 +54,18 @@ Material:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorRampTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorRampTexGradient:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorSwapTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@@ -57,14 +78,30 @@ Material:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DistortTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
- _FadeBurnTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _FadeTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _GlowTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 10904, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTexture:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@@ -73,14 +110,34 @@ Material:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OutlineDistortTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OutlineTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OverlayTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ShineMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@@ -99,40 +156,216 @@ Material:
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _Alpha: 1
|
||||
- _AlphaClip: 0
|
||||
- _AlphaCutoffValue: 0.25
|
||||
- _AlphaOutlineBlend: 1
|
||||
- _AlphaOutlineGlow: 5
|
||||
- _AlphaOutlineMinAlpha: 0
|
||||
- _AlphaOutlinePower: 1
|
||||
- _AlphaRoundThreshold: 0.5
|
||||
- _AlphaToMask: 0
|
||||
- _BillboardY: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BlurHD: 0
|
||||
- _BlurIntensity: 10
|
||||
- _Brightness: 0
|
||||
- _BumpScale: 1
|
||||
- _ChromAberrAlpha: 0.4
|
||||
- _ChromAberrAmount: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _ClipUvDown: 0
|
||||
- _ClipUvLeft: 0
|
||||
- _ClipUvRight: 0
|
||||
- _ClipUvUp: 0
|
||||
- _ColorChangeLuminosity: 0
|
||||
- _ColorChangeTolerance: 0.25
|
||||
- _ColorChangeTolerance2: 0.25
|
||||
- _ColorChangeTolerance3: 0.25
|
||||
- _ColorRampBlend: 1
|
||||
- _ColorRampLuminosity: 0
|
||||
- _ColorRampOutline: 0
|
||||
- _ColorSwapBlend: 1
|
||||
- _ColorSwapBlueLuminosity: 0.5
|
||||
- _ColorSwapGreenLuminosity: 0.5
|
||||
- _ColorSwapRedLuminosity: 0.5
|
||||
- _Contrast: 1
|
||||
- _Cull: 2
|
||||
- _CullingOption: 0
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DistortAmount: 0.5
|
||||
- _DistortTexXSpeed: 5
|
||||
- _DistortTexYSpeed: 5
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EditorDrawers: 6
|
||||
- _EnableExternalAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FadeAmount: -0.1
|
||||
- _FadeBurnGlow: 2
|
||||
- _FadeBurnTransition: 0.075
|
||||
- _FadeBurnWidth: 0.025
|
||||
- _FishEyeUvAmount: 0.35
|
||||
- _FlickerAlpha: 0
|
||||
- _FlickerFreq: 0.2
|
||||
- _FlickerPercent: 0.05
|
||||
- _GhostBlend: 1
|
||||
- _GhostColorBoost: 1
|
||||
- _GhostTransparency: 0
|
||||
- _GlitchAmount: 3
|
||||
- _GlitchSize: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Glow: 10
|
||||
- _GlowGlobal: 1
|
||||
- _GradBlend: 1
|
||||
- _GradBoostX: 1.2
|
||||
- _GradBoostY: 1.2
|
||||
- _GradIsRadial: 0
|
||||
- _GrassManualAnim: 1
|
||||
- _GrassManualToggle: 0
|
||||
- _GrassRadialBend: 0.1
|
||||
- _GrassSpeed: 2
|
||||
- _GrassWind: 20
|
||||
- _GreyscaleBlend: 1
|
||||
- _GreyscaleLuminosity: 0
|
||||
- _GreyscaleOutline: 0
|
||||
- _HandDrawnAmount: 10
|
||||
- _HandDrawnSpeed: 5
|
||||
- _HitEffectBlend: 1
|
||||
- _HitEffectGlow: 5
|
||||
- _HologramBlend: 1
|
||||
- _HologramMaxAlpha: 0.75
|
||||
- _HologramMinAlpha: 0.1
|
||||
- _HologramStripesAmount: 0.1
|
||||
- _HologramStripesSpeed: 4.5
|
||||
- _HologramUnmodAmount: 0
|
||||
- _HsvBright: 1
|
||||
- _HsvSaturation: 1
|
||||
- _HsvShift: 180
|
||||
- _InnerOutlineAlpha: 1
|
||||
- _InnerOutlineGlow: 4
|
||||
- _InnerOutlineThickness: 1
|
||||
- _MaxXUV: 1
|
||||
- _MaxYUV: 1
|
||||
- _Metallic: 0
|
||||
- _MinXUV: 0
|
||||
- _MinYUV: 0
|
||||
- _MotionBlurAngle: 0.1
|
||||
- _MotionBlurDist: 1.25
|
||||
- _MyDstMode: 10
|
||||
- _MySrcMode: 5
|
||||
- _NegativeAmount: 1
|
||||
- _NormalStrength: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _OffsetUvX: 0
|
||||
- _OffsetUvY: 0
|
||||
- _OnlyInnerOutline: 0
|
||||
- _OnlyOutline: 0
|
||||
- _OutlineAlpha: 1
|
||||
- _OutlineDistortAmount: 0.5
|
||||
- _OutlineDistortTexXSpeed: 5
|
||||
- _OutlineDistortTexYSpeed: 5
|
||||
- _OutlineGlow: 1
|
||||
- _OutlinePixelWidth: 1
|
||||
- _OutlineTexXSpeed: 10
|
||||
- _OutlineTexYSpeed: 0
|
||||
- _OutlineWidth: 0.004
|
||||
- _OverlayBlend: 1
|
||||
- _OverlayGlow: 1
|
||||
- _OverlayTextureScrollXSpeed: 0.25
|
||||
- _OverlayTextureScrollYSpeed: 0.25
|
||||
- _Parallax: 0.005
|
||||
- _PinchUvAmount: 0.35
|
||||
- _PixelateSize: 32
|
||||
- _PosterizeGamma: 0.75
|
||||
- _PosterizeNumColors: 8
|
||||
- _PosterizeOutline: 0
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
- _RadialClip: 45
|
||||
- _RadialClip2: 0
|
||||
- _RadialStartAngle: 90
|
||||
- _RandomSeed: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _RectSize: 1
|
||||
- _RotateUvAmount: 0
|
||||
- _RoundWaveSpeed: 2
|
||||
- _RoundWaveStrength: 0.7
|
||||
- _ShadowAlpha: 0.5
|
||||
- _ShadowX: 0.1
|
||||
- _ShadowY: -0.05
|
||||
- _ShakeUvSpeed: 1
|
||||
- _ShakeUvX: 0
|
||||
- _ShakeUvY: 5
|
||||
- _ShineGlow: 1
|
||||
- _ShineLocation: 0.5
|
||||
- _ShineRotate: 0
|
||||
- _ShineWidth: 0.1
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _TextureScrollXSpeed: 1
|
||||
- _TextureScrollYSpeed: 0
|
||||
- _TwistUvAmount: 1
|
||||
- _TwistUvPosX: 0.5
|
||||
- _TwistUvPosY: 0.5
|
||||
- _TwistUvRadius: 0.75
|
||||
- _WarpScale: 0.5
|
||||
- _WarpSpeed: 8
|
||||
- _WarpStrength: 0.025
|
||||
- _WaveAmount: 7
|
||||
- _WaveSpeed: 10
|
||||
- _WaveStrength: 7.5
|
||||
- _WaveX: 0
|
||||
- _WaveY: 0.5
|
||||
- _WindQuality: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZTestMode: 4
|
||||
- _ZWrite: 1
|
||||
- _ZoomUvAmount: 0.5
|
||||
m_Colors:
|
||||
- _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1}
|
||||
- _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1}
|
||||
- _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1}
|
||||
- _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Distance_Fade: {r: 0, g: 4, b: 0, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1}
|
||||
- _Flip: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1}
|
||||
- _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Height_Fade: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _HitEffectColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1}
|
||||
- _HueVariation: {r: 1, g: 0.5, b: 0, a: 0.1}
|
||||
- _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _OverlayColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _RGBA: {r: 1, g: 1, b: 1, a: 0.8705882}
|
||||
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ShadowColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ShineColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
File diff suppressed because it is too large
Load Diff
5992
Src/Unity/Shader/ShaderGraph/billboard-shadow.shadergraph
Normal file
5992
Src/Unity/Shader/ShaderGraph/billboard-shadow.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff3d183ed9fe89044b0695522de0cf66
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
Reference in New Issue
Block a user