This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

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

View File

@@ -0,0 +1,20 @@
{
"name": "BITKit.AdvancedCullingSystem.Runtime",
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:a2097016d65c6554fb43a19198fc2220",
"GUID:37151e2099022af42afa90e2ee1b768a"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"BITKit_AdvancedCullingSystem"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

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

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MeshCombineStudio;
using NGS.AdvancedCullingSystem.Dynamic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace BITKit.OpenWorld
{
public class OpenWorldCombiner : MonoBehaviour
{
[SerializeField] private MeshCombiner meshCombiner;
private void Start()
{
meshCombiner.onCombiningReady += AddCullingSource;
}
private void AddCullingSource(MeshCombiner meshcombiner)
{
AddCullingSource();
}
[BIT]
private void AddCullingSource()
{
var reportBuilder = new System.Text.StringBuilder();
var renderers = meshCombiner.GetComponentsInChildren<MeshRenderer>(true);
reportBuilder.AppendLine($"找到{renderers.Length}个Renderer");
foreach (var x in renderers)
{
if (x.GetComponent<DC_SourceSettings>()) continue;
x.gameObject.AddComponent<DC_SourceSettings>();
reportBuilder.AppendLine($"为{x.name}添加了DC_SourceSettings");
}
Debug.Log(reportBuilder.ToString());
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b40a268bf2a87494ab84df06a292ebfd
guid: 7ec9c7ceed8819847905c385597d70f0
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -13,19 +13,16 @@ namespace BITKit.Scene
[SerializeField] private IEntitiesService _entitiesService;
[SerializeField] private CinemachineTargetGroup targetGroup;
[SerializeField] private Optional<Entity[]> initialEntities;
[SerializeField] private bool removeOnEliminate;
private void Update()
{
// foreach (var x in initialEntities.IfNotAllow(()=>_entitiesService.Query<IHealth>().Cast<Entity>().ToArray()))
// {
//
// }
targetGroup.m_Targets =
initialEntities.IfNotAllow(() => _entitiesService.Query<IHealth>().Cast<Entity>().ToArray())
.Select(x => new CinemachineTargetGroup.Target()
{
target = x.transform,
radius = 1,
weight = x.TryGetComponent<IHealth>(out var heal) ? heal.IsAlive ? 1 : 0 : 0
weight =removeOnEliminate ? x.TryGetComponent<IHealth>(out var heal) ? heal.IsAlive ? 1 : 0 : 0 : 1
})
.ToArray();
if (targetGroup.m_Targets.Length is 0)

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
namespace BITKit
{
public class Helper_I18N : MonoBehaviour
{
[PostProcessBuild(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
return;
var folder = Path.Combine(Path.GetDirectoryName(EditorApplication.applicationPath), "Data",
"MonoBleedingEdge", "lib", "mono", "unityjit-win32");
var list = new List<string>()
{
"I18N.CJK.dll", "I18N.dll", "I18N.MidEast.dll", "I18N.Other.dll", "I18N.Rare.dll", "I18N.West.dll"
};
foreach (var name in list)
{
var fileInfo = new FileInfo(Path.Combine(folder, name));
var copyPath = Path.Combine(Path.GetDirectoryName(pathToBuiltProject),
$"{Application.productName}_Data", "Plugins", "x86_64", name);
fileInfo.CopyTo(copyPath);
Debug.Log($"已复制{name}到{copyPath}");
}
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 76b35e3b11d92e34b85b4e1551c250a6
guid: 15b7f9ab470b2cc47a32e191fb12ac37
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using MonKey;
using UnityEditor;
using UnityEngine;
namespace BITKit.GameEditor
{
public class QuickFixFloatModel
{
[Command(nameof(FixedSelectedFloat), "Fixed Selected Model Position", QuickName = "ins"), MenuItem("Tools/Scenes/Fix Float Model Position")]
public static void FixedSelectedFloat()
{
var transforms = UnityEditor.Selection.transforms;
if (transforms is null or {Length:0}) return;
var reportBuilder = new StringBuilder();
reportBuilder.AppendLine($"已选择{transforms.Length}个物体:");
foreach (var x in transforms)
{
if (Physics.Raycast(x.position, Vector3.down, out var hit, 1000) is false) continue;
x.position = hit.point;
EditorUtility.SetDirty(x);
reportBuilder.AppendLine($"已修复{x.name}的位置于{hit.point}");
}
Undo.RecordObjects(transforms,"修复浮动");
Debug.Log(reportBuilder);
}
}
}

View File

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

View File

@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit.NodeCanvas
{
}
public class FindCoverPoint : MonoBehaviour
{
}

View File

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

View File

@@ -11,7 +11,9 @@
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0",
"GUID:7efac18f239530141802fb139776f333",
"GUID:508392158bd966c4d9c21e19661a441d",
"GUID:f06555f75b070af458a003d92f9efb00"
"GUID:f06555f75b070af458a003d92f9efb00",
"GUID:4307f53044263cf4b835bd812fc161a4",
"GUID:4c25c05f410a3a447a75c3b0909152ef"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -12,7 +12,7 @@ namespace BITKit
public BBParameter<QuestSystem.Info> quest;
protected override void OnExecute()
{
if (quest.value.state is not QuestSystem.State.Complete)
if (quest.value.State is not QuestSystem.State.Complete)
QuestSystem.Complete(quest.value);
EndAction();
}

View File

@@ -19,5 +19,14 @@ namespace BITKit
output.SetValue(quest);
EndAction();
}
protected override void OnStop(bool interrupted)
{
base.OnStop(interrupted);
if (interrupted)
{
if(output.isDefined)
QuestSystem.Cancel(output.value);
}
}
}
}

View File

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

View File

@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using NodeCanvas.Framework;
using UnityEngine;
namespace BITKit.NodeCanvas
{
public sealed class CheckEnvironmentVariable:ActionTask
{
public BBParameter<string> key;
protected override void OnUpdate()
{
if (Data.Get<bool>(key.value))
{
EndAction(true);
}
}
}
public sealed class WaitUntilEnvironmentVariable:ConditionTask
{
public BBParameter<string> key;
protected override bool OnCheck()
{
return Data.Get<bool>(key.value);
}
}
}

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Animancer;
using NodeCanvas.DialogueTrees;
using UnityEngine;
namespace BITKit.NodeCanvas.Director
{
public class ActorRandomAnimation : MonoBehaviour
{
[SerializeField] private AnimancerComponent animancerComponent;
[SerializeField] private AnimationClip[] clips;
private IDialogueActor _actor;
private void OnEnable()
{
_actor = GetComponent<IDialogueActor>();
DialogueTree.OnSubtitlesRequest += OnSubtitlesRequest;
}
private void OnDisable()
{
DialogueTree.OnSubtitlesRequest -= OnSubtitlesRequest;
}
private void OnSubtitlesRequest(SubtitlesRequestInfo obj)
{
if(obj.actor != _actor) return;
animancerComponent.Stop();
var state =animancerComponent.Play(clips.Random());
}
}
}

View File

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

View File

@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using NodeCanvas.Framework;
using UnityEngine;
namespace BITKit.NodeCanvas.Director
{
public class DirectorNode : ActionTask
{
public BBParameter<string> directorName;
public bool isStart;
protected override void OnExecute()
{
base.OnExecute();
if(isStart)
DirectorService.Register(directorName.value);
else
DirectorService.UnRegister(directorName.value);
EndAction();
}
}
}

View File

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

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Cinemachine;
using NodeCanvas.DialogueTrees;
using UnityEngine;
namespace BITKit.NodeCanvas.Director
{
public class DirectorService : MonoBehaviour
{
[RuntimeInitializeOnLoadMethod]
private static void Reload()
{
allowDirector.Clear();
}
private static readonly ValidHandle allowDirector = new();
public static void Register(string directorName)
{
allowDirector.AddElement(directorName);
}
public static void UnRegister(string directorName)
{
allowDirector.RemoveElement(directorName);
}
[SerializeField] private CinemachineVirtualCamera directorCamera;
private Cinemachine3rdPersonFollow _trd;
private Transform _lastActor;
private Vector3 _defaultShoulderOffset;
private void OnEnable()
{
DialogueTree.OnSubtitlesRequest += OnSubtitlesRequest;
allowDirector.AddListener(OnAllow);
_trd = directorCamera.GetCinemachineComponent<Cinemachine3rdPersonFollow>();
_defaultShoulderOffset = _trd.ShoulderOffset;
}
private void OnDisable()
{
DialogueTree.OnSubtitlesRequest -= OnSubtitlesRequest;
allowDirector.RemoveListener(OnAllow);
}
private void OnSubtitlesRequest(SubtitlesRequestInfo obj)
{
if (obj.actor is not MonoBehaviour monoBehaviour) return;
var transform1 = monoBehaviour.transform;
directorCamera.LookAt = transform1;
directorCamera.Follow = _lastActor ? _lastActor : transform1;
var newOffset = _defaultShoulderOffset;
newOffset.z = _lastActor ? _defaultShoulderOffset.z : 3;
_trd.ShoulderOffset = newOffset;
_lastActor = transform1;
}
private void OnAllow(bool allow)
{
if (allow)
{
directorCamera.Priority = 64;
}
else
{
directorCamera.Priority = -1;
}
}
}
}

View File

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

View File

@@ -7,7 +7,7 @@ using BITKit.SubSystems;
using BITKit.SubSystems.Quest;
namespace BITKit
{
public class InvokeMonoAction : ActionTask
public class InvokeMonoActionTask : ActionTask
{
public BBParameter<MonoAction> action;
protected override void OnExecute()

View File

@@ -50,6 +50,8 @@ namespace BITKit.Node {
var _dir = target.value.position - transform.position;
if(_dir is {x:0,y:0,z:0}) return;
var direction =Quaternion.LookRotation(Vector3.ProjectOnPlane(_dir ,Vector3.up)) ;
transform.rotation = Quaternion.RotateTowards(transform.rotation,direction,Time.deltaTime*agent.angularSpeed);

View File

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

View File

@@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using NodeCanvas.Framework;
using UnityEngine;
namespace BITKit.NodeCanvas
{
public sealed class SetBehaviourEnabled:ActionTask
{
public BBParameter<Object> behaviour;
public BBParameter<bool> enabled;
protected override void OnExecute()
{
switch (behaviour.value)
{
case MonoBehaviour monoBehaviour:
monoBehaviour.enabled = enabled.value;
break;
case Collider collider:
collider.enabled = enabled.value;
break;
case Component component:
component.GetType().GetProperty(nameof(BoxCollider.enabled),
BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase
).SetValue(behaviour.value, enabled.value);
break;
}
EndAction();
}
protected override string info
{
get
{
if(behaviour.isNoneOrNull || enabled.isNoneOrNull)
return "Set Behaviour Enabled";
var enabledStr = enabled.value ? "Enabled" : "Disabled";
return $"Set {behaviour.name} {enabledStr}";
}
}
}
}

View File

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

View File

@@ -0,0 +1,130 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using UnityEngine.AI;
namespace BITKit.NodeCanvas.Pathfinding
{
[Category("Movement/Pathfinding")]
[Description("Makes the agent wander randomly within the navigation map")]
public class AIWander : ActionTask<NavMeshAgent>
{
[Tooltip("The speed to wander with.")]
public BBParameter<float> speed = 4;
[Tooltip("The distance to keep from each wander point.")]
public BBParameter<float> keepDistance = 0.1f;
[Tooltip("A wander point can't be closer than this distance")]
public BBParameter<float> minWanderDistance = 5;
[Tooltip("A wander point can't be further than this distance")]
public BBParameter<float> maxWanderDistance = 20;
[Tooltip("If enabled, will keep wandering forever. If not, only one wander point will be performed.")]
public bool repeat = true;
[Tooltip("If enabled,will execute a move and exit")]
public bool forget;
private Vector3? lastPosition;
private readonly IntervalUpdate newPositionInterval=new (1);
private int newTargetCount;
protected override void OnExecute() {
agent.speed = speed.value;
if (IsArrived is false)
{
if (lastPosition.HasValue &&
Vector3.Distance(agent.pathEndPosition, lastPosition.Value) <= keepDistance.value)
{
newPositionInterval.Reset();
EndAction();
return;
}
}
DoWander();
}
protected override string info
{
get
{
reportBuilder.Clear();
reportBuilder.AppendLine(nameof(AIWander));
reportBuilder.AppendLine($"NewTargetCount:{newTargetCount}");
reportBuilder.AppendLine($"LastPosition:{lastPosition}");
reportBuilder.AppendLine($"RemainDistance:{agent.remainingDistance}");
return reportBuilder.ToString();
}
}
private readonly StringBuilder reportBuilder = new();
protected override void OnUpdate() {
if ( IsArrived ) {
if ( repeat ) {
DoWander();
} else {
EndAction();
}
lastPosition = null;
}
else
{
if (forget)
{
EndAction();
}
}
}
private bool IsArrived => !agent.pathPending && agent.remainingDistance <= agent.stoppingDistance + keepDistance.value;
void DoWander() {
var min = minWanderDistance.value;
var max = maxWanderDistance.value;
min = Mathf.Clamp(min, 0.01f, max);
max = Mathf.Clamp(max, min, max);
var wanderPos = agent.transform.position;
if (lastPosition.HasValue && newPositionInterval.AllowUpdateWithoutReset is false)
{
wanderPos = lastPosition.Value;
agent.SetDestination(wanderPos);
}
else
{
while ((wanderPos - agent.transform.position).magnitude < min)
{
wanderPos = (Random.insideUnitSphere * max) + agent.transform.position;
}
NavMeshHit hit;
if ( NavMesh.SamplePosition(wanderPos, out hit, agent.height * 2, NavMesh.AllAreas) ) {
agent.SetDestination(hit.position);
lastPosition = hit.position;
newTargetCount++;
newPositionInterval.Reset();
}
}
}
protected override void OnPause() { OnStop(); }
protected override void OnStop()
{
if (agent.gameObject.activeSelf && agent.isOnNavMesh)
{
if (forget is false)
agent.ResetPath();
}
}
}
}

View File

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

View File

@@ -0,0 +1,35 @@
using NodeCanvas.Framework;
using UnityEngine.Playables;
namespace BITKit.NodeCanvas.Timeline
{
public class PlayTimeline : ActionTask<PlayableDirector>
{
public BBParameter<bool> waitUntilFinish;
protected override void OnExecute()
{
base.OnExecute();
if(waitUntilFinish.value)
{
agent.stopped += OnPlayEnd;
}
agent.time = 0;
agent.Play();
}
protected override void OnStop()
{
base.OnStop();
if (waitUntilFinish.value)
{
agent.stopped -= OnPlayEnd;
}
}
private void OnPlayEnd(PlayableDirector obj)
{
EndAction();
}
}
}

View File

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

View File

@@ -4,7 +4,8 @@
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:9c184a1e5cc20654384071dfebc106ed",
"GUID:bdb069e155d2f944cb1bf28602b6d4c1"
"GUID:bdb069e155d2f944cb1bf28602b6d4c1",
"GUID:1193c2664d97cc049a6e4c486c6bce71"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Pinwheel.Griffin;
using UnityEngine;
namespace BITKit.WorldChunk
{
public class PolarisTerrainChunk : WorldChunk
{
private GStylizedTerrain terrain;
private Vector2 _position;
private void Start()
{
terrain = GetComponent<GStylizedTerrain>();
var pos = terrain.transform.position;
_position = new Vector2(pos.x, pos.z);
Add(this);
destroyCancellationToken.Register(() => { Remove(this); });
}
public override Rect GetRect()
{
return new Rect(
_position,
new Vector2()
{
x = terrain.TerrainData.Geometry.Width,
y = terrain.TerrainData.Geometry.Length,
}
);
}
public override void SetActive(bool active)
{
terrain.gameObject.SetActive(active);
}
}
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Pinwheel.Griffin;
using UnityEngine;
namespace BITKit.WorldChunk
{
public class PolarisTerrainChunkManager : MonoBehaviour
{
private void Start()
{
foreach (var x in GetComponentsInChildren<GStylizedTerrain>())
{
x.gameObject.AddComponent<PolarisTerrainChunk>();
}
}
}
}

View File

@@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Pinwheel.Griffin;
using Quadtree;
using UnityEngine;
namespace BITKit.OpenWorld
{
public class PolarisTerrainChunkService : WorldChunkService<PolarisTerrainChunkService>
{
private class ChunkData:IWorldChunkObject
{
public Collider Collider { get; set; }
public Bounds GetBounds() => Bounds;
public Bounds Bounds { get; set; }
public Node<IWorldChunkObject> ParentNode { get; set; }
public void QuadTree_Root_Initialized(IQuadtreeRoot<IWorldChunkObject, Node<IWorldChunkObject>> root)
{
}
public int Id { get; set; }
public int Lod
{
get => lod;
set
{
Collider.enabled = value is 0;
lod = value;
}
}
private int lod=-1;
}
[SerializeField] private GStylizedTerrain[] terrains;
protected override void Start()
{
base.Start();
var reporter = new StringBuilder();
foreach (var terrain in terrains)
{
reporter.AppendLine($"正在注册地形 {terrain.name},尺寸:{terrain.TerrainData.Geometry.Width}x{terrain.TerrainData.Geometry.Length}");
foreach (var chunk in terrain.GetChunks())
{
var data =new ChunkData()
{
Collider = chunk.MeshColliderComponent,
Bounds = chunk.MeshColliderComponent.bounds
};
data.Collider.enabled = false;
Register(data);
reporter.AppendLine($"注册地形碰撞体 {chunk.name},尺寸:{data.Bounds.size}");
}
}
Debug.Log(reporter);
OnTick(Time.deltaTime);
}
}
}

View File

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

View File

@@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab6c34283d61d534183f9a63e54f932c, type: 3}
m_Name: 26
m_EditorClassIdentifier:
addressablePath: Cosmetic_26
id: 4981
defId: 3070
type:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 64d140caaa6719142a36df2ac76c0610
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ab6c34283d61d534183f9a63e54f932c, type: 3}
m_Name: Steve
m_EditorClassIdentifier:
addressablePath: Cosmetics/Steve
id: 4980
defId: 3070
addressablePath: Cosmetic_Steve
id: 4984
defId: 3072
type:

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using System.Text;
using UnityEngine.TestTools;
using System.Linq;
using UnityEditor;
using Random = UnityEngine.Random;
namespace BITKit
{
public class MiscTest
{
[Test]
public static void CheckPath()
{
var reportBuilder = new StringBuilder();
reportBuilder.AppendLine($"{nameof(EditorApplication.applicationPath)}:{EditorApplication.applicationPath}");
reportBuilder.AppendLine($"{nameof(Application.dataPath)}:{Application.dataPath}");
reportBuilder.AppendLine($"{nameof(Environment.CurrentDirectory)}:{Environment.CurrentDirectory}");
reportBuilder.AppendLine($"{nameof(Application.streamingAssetsPath)}:{Application.streamingAssetsPath}");
reportBuilder.AppendLine($"{nameof(Application.persistentDataPath)}:{Application.persistentDataPath}");
reportBuilder.AppendLine($"{nameof(Application.temporaryCachePath)}:{Application.temporaryCachePath}");
reportBuilder.AppendLine($"{nameof(Application.consoleLogPath)}:{Application.consoleLogPath}");
reportBuilder.AppendLine($"{nameof(Application.installerName)}:{Application.installerName}");
reportBuilder.AppendLine($"{nameof(Application.companyName)}:{Application.companyName}");
reportBuilder.AppendLine($"{nameof(Application.productName)}:{Application.productName}");
reportBuilder.AppendLine($"{nameof(Application.version)}:{Application.version}");
reportBuilder.AppendLine($"{nameof(Application.unityVersion)}:{Application.unityVersion}");
reportBuilder.AppendLine($"{nameof(Application.identifier)}:{Application.identifier}");
reportBuilder.AppendLine($"{nameof(Application.internetReachability)}:{Application.internetReachability}");
reportBuilder.AppendLine($"{nameof(Application.systemLanguage)}:{Application.systemLanguage}");
reportBuilder.AppendLine($"{nameof(Application.platform)}:{Application.platform}");
reportBuilder.AppendLine($"{nameof(Application.isMobilePlatform)}:{Application.isMobilePlatform}");
reportBuilder.AppendLine($"{nameof(Application.isConsolePlatform)}:{Application.isConsolePlatform}");
reportBuilder.AppendLine($"{nameof(Application.isEditor)}:{Application.isEditor}");
reportBuilder.AppendLine($"{nameof(Application.isFocused)}:{Application.isFocused}");
reportBuilder.AppendLine($"{nameof(Application.isPlaying)}:{Application.isPlaying}");
reportBuilder.AppendLine($"{nameof(Application.isBatchMode)}:{Application.isBatchMode}");
Debug.Log(reportBuilder.ToString());
}
}
}

View File

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

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using System.Text;
using UnityEngine.TestTools;
using System.Linq;
namespace BITKit
{
public class PointerTest
{
public object value;
[Test]
public void MakeRefAndRefValue()
{
value = 64;
var typedReference = __makeref(value);
var field = typeof(PointerTest).GetField("value");
field.SetValueDirect(typedReference,128);
__refvalue(typedReference,object) = 128;
Debug.Log("预期值:128,实际值:"+value);
}
}
}

View File

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

View File

@@ -5,10 +5,10 @@
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:21d1eb854b91ade49bc69a263d12bee2",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
"GUID:66d2ae14764cc7d49aad4b16930747c0",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0",
"GUID:7efac18f239530141802fb139776f333"
"GUID:7efac18f239530141802fb139776f333",
"GUID:f06555f75b070af458a003d92f9efb00"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -0,0 +1,109 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Splines;
using UnityEngine.Timeline;
namespace BITKit.Spline
{
public class UnitySplineAnimateBehaviour : PlayableBehaviour
{
public SplineAnimate splineAnimate { get; set; }
public SplineContainer splineContainer { get; set; }
public Transform additiveTransform { get; set; }
public bool isNormalized;
public override void OnBehaviourPlay(Playable playable, FrameData info)
{
if (splineAnimate)
splineAnimate.Updated += OnSplineAnimateUpdated;
}
public override void OnBehaviourPause(Playable playable, FrameData info)
{
if (splineAnimate)
splineAnimate.Updated -= OnSplineAnimateUpdated;
}
private void OnSplineAnimateUpdated(Vector3 position, Quaternion rotation)
{
if (splineAnimate == null)
return;
if (BITAppForUnity.IsEditor&& BITAppForUnity.IsPlaying is false)
{
var transform = splineAnimate.transform;
var parent = transform.parent;
var localPosition = position;
var localRotation = rotation;
if (parent != null)
{
localPosition = transform.parent.worldToLocalMatrix.MultiplyPoint3x4(position);
localRotation = Quaternion.Inverse(parent.rotation) * localRotation;
}
transform.localPosition = localPosition;
transform.localRotation = localRotation;
}
}
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
{
splineAnimate = playerData as SplineAnimate;
if (!splineAnimate)
{
Debug.LogException(new NullReferenceException("SplineAnimate is null"));
return;
}
var time = (float)playable.GetTime();
splineAnimate.Container = splineContainer;
if (BITAppForUnity.IsEditor is false && BITAppForUnity.IsPlaying is false)
{
}
else
{
if (isNormalized)
{
splineAnimate.NormalizedTime =info.deltaTime;
}
else
{
splineAnimate.ElapsedTime =time;
}
}
}
}
[Serializable]
[DisplayName("SplineAnimate Clip")]
public class UnitySplineAnimateAsset : PlayableAsset,ITimelineClipAsset
{
private UnitySplineAnimateBehaviour template = new();
public ExposedReference<SplineContainer> spline;
public AnimationCurve curve;
public bool isNormalized;
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
var playable = ScriptPlayable<UnitySplineAnimateBehaviour>.Create(graph,template);
var behaviour = playable.GetBehaviour();
behaviour.splineContainer = spline.Resolve(graph.GetResolver());
behaviour.isNormalized = isNormalized;
return playable;
}
public ClipCaps clipCaps => ClipCaps.None;
}
}

View File

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

View File

@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Splines;
using UnityEngine.Timeline;
namespace BITKit.Spline
{
[TrackBindingType(typeof(SplineAnimate))]
[TrackClipType(typeof(UnitySplineAnimateAsset))]
public class UnitySplineAnimateTrack : TrackAsset
{
}
}

View File

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

View File

@@ -9,5 +9,4 @@ namespace BITKit.Spline
{
}
}