From 65a5775647fe755632f9d44056c13c05affefc4e Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Mon, 15 Dec 2025 17:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E8=BF=81?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Anchor.cs | 2 +- Assets/Scripts/Editor/SOEditor.cs | 2 +- .../Scripts/Environment/PrefabRootObject.cs | 2 +- Assets/Scripts/Environment/SkyUpdatement.cs | 2 +- .../Scripts/Environment/WorldLightObject.cs | 2 +- Assets/Scripts/Framework/CameraObject.cs | 2 +- Assets/Scripts/Framework/DDT.cs | 24 ++- .../EditiorContent/EditorController.cs | 4 +- .../Framework/GameContent/GameController.cs | 1 + Assets/Scripts/Framework/RootObject.cs | 1 + Assets/Scripts/Framework/ScriptableObject.cs | 88 ++++---- .../DefaultScriptableObjectInstantiate.cs | 195 +++++++++--------- Assets/Scripts/Framework/SubWorld.cs | 27 ++- .../Interaction/Effect/ParticleEffect.cs | 2 +- .../Scripts/Interaction/IEffectHookObject.cs | 22 ++ Assets/Scripts/Interaction/IInteraction.cs | 37 ++++ .../Interaction/IJudgementHookObject.cs | 18 ++ .../Interaction/FullScreenInteraction.cs | 24 ++- .../JudgementEffect/ParticleJudgement.cs | 2 +- Assets/Scripts/LookAtAnchor.cs | 2 +- Assets/Scripts/MaterialUpdatement.cs | 2 +- .../PointBaseRenderer/SplineRenderer.cs | 2 +- .../SplineSurfaceRenderer.cs | 2 +- .../PointBaseRenderer/SplineTrackRenderer.cs | 2 +- .../PointBaseRenderer/SplineTubeRenderer.cs | 2 +- Assets/Scripts/MoreSpline/SplineAnchor.cs | 2 +- Assets/Scripts/MoreSpline/SplineCore.cs | 30 ++- Assets/Scripts/MoreSpline/SplineNode.cs | 2 +- .../MoreSpline/Updatement/SplineMovement.cs | 2 +- .../Updatement/SplinePointerObject.cs | 2 +- .../MoreSpline/Updatement/SplineRotation.cs | 2 +- .../MoreSpline/Updatement/SplineScaling.cs | 2 +- Assets/Scripts/TickMovement.cs | 2 +- Assets/Scripts/TickRotation.cs | 2 +- Assets/Scripts/TickScaling.cs | 2 +- Assets/Scripts/Volume/BaseVolume.cs | 18 ++ Assets/Scripts/Volume/MotionBlurVolume.cs | 2 +- .../Volume/Updatement/BaseVolumeUpdatement.cs | 2 +- .../Updatement/VolumeFloatUpdatement.cs | 2 +- .../Volume/Updatement/VolumeIntUpdatement.cs | 2 +- Assets/Scripts/Volume/VolumeObject.cs | 33 ++- ...niversalRenderPipelineGlobalSettings.asset | 2 +- 42 files changed, 400 insertions(+), 178 deletions(-) diff --git a/Assets/Scripts/Anchor.cs b/Assets/Scripts/Anchor.cs index 693456b..2d8c29a 100644 --- a/Assets/Scripts/Anchor.cs +++ b/Assets/Scripts/Anchor.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/Editor/SOEditor.cs b/Assets/Scripts/Editor/SOEditor.cs index cdc74d8..e9b3289 100644 --- a/Assets/Scripts/Editor/SOEditor.cs +++ b/Assets/Scripts/Editor/SOEditor.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using UnityEditor; using UnityEngine; -[CustomEditor(typeof(Demo.ScriptableObject), true)] +[CustomEditor(typeof(Demo.Game.ScriptableObject), true)] public class SOEditor : Convention.AbstractCustomEditor { diff --git a/Assets/Scripts/Environment/PrefabRootObject.cs b/Assets/Scripts/Environment/PrefabRootObject.cs index 328f6ea..1109dbb 100644 --- a/Assets/Scripts/Environment/PrefabRootObject.cs +++ b/Assets/Scripts/Environment/PrefabRootObject.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/Environment/SkyUpdatement.cs b/Assets/Scripts/Environment/SkyUpdatement.cs index 85becd7..196f0eb 100644 --- a/Assets/Scripts/Environment/SkyUpdatement.cs +++ b/Assets/Scripts/Environment/SkyUpdatement.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/Environment/WorldLightObject.cs b/Assets/Scripts/Environment/WorldLightObject.cs index da6fbba..3fc60b9 100644 --- a/Assets/Scripts/Environment/WorldLightObject.cs +++ b/Assets/Scripts/Environment/WorldLightObject.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/Framework/CameraObject.cs b/Assets/Scripts/Framework/CameraObject.cs index 12bb549..70bf96c 100644 --- a/Assets/Scripts/Framework/CameraObject.cs +++ b/Assets/Scripts/Framework/CameraObject.cs @@ -6,7 +6,7 @@ using Cinemachine; #endif using Convention.WindowsUI.Variant; using UnityEngine; -using Demo.Attr; +using Demo.Game.Attr; namespace Demo.Game { diff --git a/Assets/Scripts/Framework/DDT.cs b/Assets/Scripts/Framework/DDT.cs index bc21f3e..e2efd2f 100644 --- a/Assets/Scripts/Framework/DDT.cs +++ b/Assets/Scripts/Framework/DDT.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System; using System.Collections; using System.Collections.Generic; @@ -10,6 +10,26 @@ using UnityEngine.Rendering; namespace Demo.Game { + namespace ConfigType + { + public class DDTConfig : ScriptLoadableConfig + { + public NativeArray Datas = new(128, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); + + public override void Deserialize(BinaryReader reader) + { + BinarySerializeUtility.DeserializeNativeArray(reader, ref Datas); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.SerializeNativeArray(writer, Datas); + base.Serialize(writer); + } + } + } + [Scriptable] public class DDT : ScriptableObject { @@ -48,7 +68,7 @@ namespace Demo.Game } /// - /// 获取数据长度 + /// 锟斤拷取锟斤拷锟捷筹拷锟斤拷 /// /// [Convention.RScript.Variable.Attr.Method] diff --git a/Assets/Scripts/Framework/EditiorContent/EditorController.cs b/Assets/Scripts/Framework/EditiorContent/EditorController.cs index 171e895..c7786ea 100644 --- a/Assets/Scripts/Framework/EditiorContent/EditorController.cs +++ b/Assets/Scripts/Framework/EditiorContent/EditorController.cs @@ -59,7 +59,7 @@ namespace Demo.Editor { foreach (var type in asm.GetTypes()) { - if (typeof(ScriptableObject).IsAssignableFrom(type) && type.IsAbstract == false) + if (typeof(Demo.Game.ScriptableObject).IsAssignableFrom(type) && type.IsAbstract == false) { result.Add(type.Name, type); } @@ -391,7 +391,7 @@ namespace Demo.Editor { new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(type, () => generater(), null, filename).Register(); } - else if (typeof(ScriptableObject).IsAssignableFrom(type)) + else if (typeof(Demo.Game.ScriptableObject).IsAssignableFrom(type)) { new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(type, null, null, filename).Register(); } diff --git a/Assets/Scripts/Framework/GameContent/GameController.cs b/Assets/Scripts/Framework/GameContent/GameController.cs index 0fa3f6c..939a264 100644 --- a/Assets/Scripts/Framework/GameContent/GameController.cs +++ b/Assets/Scripts/Framework/GameContent/GameController.cs @@ -205,6 +205,7 @@ namespace Demo.Game rootGameObject.transform.SetParent(transform); rootGameObject.ScriptName = rootObject.GetName(true); rootGameObject.audioSystem = MainAudio; + rootGameObject.LoadedScriptSet.Add(rootObject); rootGameObject.EnableScript(content.RootSourceDir, this); rootGameObject.SetContent(nameof(SongOffset), SongOffset); rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0); diff --git a/Assets/Scripts/Framework/RootObject.cs b/Assets/Scripts/Framework/RootObject.cs index cf99b0e..01a090b 100644 --- a/Assets/Scripts/Framework/RootObject.cs +++ b/Assets/Scripts/Framework/RootObject.cs @@ -17,6 +17,7 @@ namespace Demo.Game [Content] public GameController RootGameController; public string SourcePath; + public HashSet LoadedScriptSet = new(); protected override IEnumerator DoSomethingDuringApplyScript() { diff --git a/Assets/Scripts/Framework/ScriptableObject.cs b/Assets/Scripts/Framework/ScriptableObject.cs index 25201bc..6fa63af 100644 --- a/Assets/Scripts/Framework/ScriptableObject.cs +++ b/Assets/Scripts/Framework/ScriptableObject.cs @@ -1,7 +1,7 @@ using Convention; using Convention.RScript; using Convention.WindowsUI.Variant; -using Demo.Attr; +using Demo.Game.Attr; using Demo.Game; using Dreamteck.Splines; using System; @@ -15,7 +15,7 @@ using Unity.VisualScripting; using UnityEngine; using UnityEngine.Rendering; -namespace Demo +namespace Demo.Game { public interface IScriptableObject { @@ -38,52 +38,55 @@ namespace Demo } } - public class ScriptLoadableConfig + namespace ConfigType { - public Vector3 EnterGameLocalPosition, EnterGameEulerAngles, EnterGameLocalScaling; - public bool IsSetObjectDisable; - public int UpdatePerFrame; - public int ScriptUpdateCounter; - public string ScriptName; - private string[] ChildTypes; - public ScriptLoadableConfig[] childs; - - public readonly static Dictionary> ConfigGeneraters = new() + public class ScriptLoadableConfig { - { nameof(ScriptLoadableConfig), ()=>new ScriptLoadableConfig() }, - }; + public Vector3 EnterGameLocalPosition, EnterGameEulerAngles, EnterGameLocalScaling; + public bool IsSetObjectDisable; + public int UpdatePerFrame; + public int ScriptUpdateCounter; + public string ScriptName; + private string[] ChildTypes; + public ScriptLoadableConfig[] childs; - public virtual void Deserialize(BinaryReader reader) - { - EnterGameLocalPosition = BinarySerializeUtility.ReadVec3(reader); - EnterGameEulerAngles = BinarySerializeUtility.ReadVec3(reader); - EnterGameLocalScaling = BinarySerializeUtility.ReadVec3(reader); - IsSetObjectDisable = BinarySerializeUtility.ReadBool(reader); - UpdatePerFrame = BinarySerializeUtility.ReadInt(reader); - ScriptUpdateCounter = BinarySerializeUtility.ReadInt(reader); - ScriptName = BinarySerializeUtility.ReadString(reader); - ChildTypes = BinarySerializeUtility.DeserializeStringArray(reader); - int childCount = ChildTypes.Length; - childs = new ScriptLoadableConfig[childCount]; - for (int i = 0; i < childCount; i++) + public readonly static Dictionary> ConfigGeneraters = new() { - childs[i] = ConfigGeneraters[ChildTypes[i]].Invoke(); - childs[i].Deserialize(reader); + { nameof(ScriptLoadableConfig), ()=>new ScriptLoadableConfig() }, + }; + + public virtual void Deserialize(BinaryReader reader) + { + EnterGameLocalPosition = BinarySerializeUtility.ReadVec3(reader); + EnterGameEulerAngles = BinarySerializeUtility.ReadVec3(reader); + EnterGameLocalScaling = BinarySerializeUtility.ReadVec3(reader); + IsSetObjectDisable = BinarySerializeUtility.ReadBool(reader); + UpdatePerFrame = BinarySerializeUtility.ReadInt(reader); + ScriptUpdateCounter = BinarySerializeUtility.ReadInt(reader); + ScriptName = BinarySerializeUtility.ReadString(reader); + ChildTypes = BinarySerializeUtility.DeserializeStringArray(reader); + int childCount = ChildTypes.Length; + childs = new ScriptLoadableConfig[childCount]; + for (int i = 0; i < childCount; i++) + { + childs[i] = ConfigGeneraters[ChildTypes[i]].Invoke(); + childs[i].Deserialize(reader); + } } - } - public virtual void Serialize(BinaryWriter writer) - { - BinarySerializeUtility.WriteVec3(writer, EnterGameLocalPosition); - BinarySerializeUtility.WriteVec3(writer, EnterGameEulerAngles); - BinarySerializeUtility.WriteVec3(writer, EnterGameLocalScaling); - BinarySerializeUtility.WriteBool(writer, IsSetObjectDisable); - BinarySerializeUtility.WriteInt(writer, UpdatePerFrame); - BinarySerializeUtility.WriteInt(writer, ScriptUpdateCounter); - BinarySerializeUtility.WriteString(writer, ScriptName); - BinarySerializeUtility.SerializeArray(writer, ChildTypes); - foreach (var child in childs) + public virtual void Serialize(BinaryWriter writer) { - child.Serialize(writer); + BinarySerializeUtility.WriteVec3(writer, EnterGameLocalPosition); + BinarySerializeUtility.WriteVec3(writer, EnterGameEulerAngles); + BinarySerializeUtility.WriteVec3(writer, EnterGameLocalScaling); + BinarySerializeUtility.WriteBool(writer, IsSetObjectDisable); + BinarySerializeUtility.WriteInt(writer, UpdatePerFrame); + BinarySerializeUtility.WriteInt(writer, ScriptUpdateCounter); + BinarySerializeUtility.WriteString(writer, ScriptName); + BinarySerializeUtility.SerializeArray(writer, ChildTypes); + foreach (var child in childs) + { + child.Serialize(writer); + } } } } @@ -412,6 +415,7 @@ namespace Demo // 鑾峰彇鏂囦欢 var file = new ToolFile(GetRoot().SourcePath); file = file | path; + GetRoot().LoadedScriptSet.Add(file); // 鎵句笉鍒拌剼鏈 if (file.Exists() == false) { diff --git a/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs b/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs index 62b07c2..8c4ce09 100644 --- a/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs +++ b/Assets/Scripts/Framework/ScriptableObjectInstantiate/DefaultScriptableObjectInstantiate.cs @@ -159,31 +159,33 @@ namespace Demo } } - public partial class ScriptableObject + namespace Game { - protected virtual bool IsImptSerialize => false; - protected virtual IEnumerator LoadFromImptCacheFile(ToolFile cacheFile) + public partial class ScriptableObject { - throw new NotImplementedException(); - } - protected virtual IEnumerator CreateAndLoadingImptCacheFile(ToolFile scriptFile, ToolFile cacheFile) - { - throw new NotImplementedException(); - } + protected virtual bool IsImptSerialize => false; + protected virtual IEnumerator LoadFromImptCacheFile(ToolFile cacheFile) + { + throw new NotImplementedException(); + } + protected virtual IEnumerator CreateAndLoadingImptCacheFile(ToolFile scriptFile, ToolFile cacheFile) + { + throw new NotImplementedException(); + } - private readonly RScriptImportClass s_GenerateImport = new() + private readonly RScriptImportClass s_GenerateImport = new() { typeof(Mathf), typeof(RandomTool), }; - public RScriptImportClass GenerateImport() - { - return s_GenerateImport; - } + public RScriptImportClass GenerateImport() + { + return s_GenerateImport; + } - public RScriptVariables GenerateVariables(ScriptableObject self) - { - RScriptVariables variables = new() + public RScriptVariables GenerateVariables(ScriptableObject self) + { + RScriptVariables variables = new() { { "this", new() { data = self, type = self.GetType() } }, { "self", new() { data = self, type = self.GetType() } }, @@ -198,101 +200,102 @@ namespace Demo { nameof(IInteraction.JudgementLevel), new() { data = IInteractionJudgementLevelInstance.instance, type = typeof(IInteractionJudgementLevelInstance) } } }; - return variables; - } + return variables; + } - private static readonly Dictionary s_FileLocker = new(); + private static readonly Dictionary s_FileLocker = new(); - public IEnumerator ParseFromScriptFile2Expr(ToolFile file) - { - IsParseScript2Expr = true; - try + public IEnumerator ParseFromScriptFile2Expr(ToolFile file) { - var hash = file.CalculateHash(); - var lastHashFile = file.GetParentDir() | ".cache" | $"{file.GetFilename(true)}.hash"; - var bin = file.GetParentDir() | ".cache" | $"{file.GetFilename(true)}.bin"; - if (IsImptSerialize) + IsParseScript2Expr = true; + try { - if (lastHashFile.Exists() == false || lastHashFile.LoadAsText() != hash) + var hash = file.CalculateHash(); + var lastHashFile = file.GetParentDir() | ".cache" | $"{file.GetFilename(true)}.hash"; + var bin = file.GetParentDir() | ".cache" | $"{file.GetFilename(true)}.bin"; + if (IsImptSerialize) { - lastHashFile.MustExistsPath(); - lastHashFile.SaveAsText(hash); - yield return ConventionUtility.AvoidFakeStop(CreateAndLoadingImptCacheFile(file, bin)); + if (lastHashFile.Exists() == false || lastHashFile.LoadAsText() != hash) + { + lastHashFile.MustExistsPath(); + lastHashFile.SaveAsText(hash); + yield return ConventionUtility.AvoidFakeStop(CreateAndLoadingImptCacheFile(file, bin)); + } + else + { + yield return ConventionUtility.AvoidFakeStop(LoadFromImptCacheFile(bin)); + } } else { - yield return ConventionUtility.AvoidFakeStop(LoadFromImptCacheFile(bin)); + IEnumerator step = null; + RScriptEngine engine = new(); + RScriptImportClass importClass = GenerateImport(); + RScriptVariables variables = GenerateVariables(this); + object locker; + if (lastHashFile.Exists() == false || lastHashFile.LoadAsText() != hash) + { + lastHashFile.MustExistsPath(); + bin.MustExistsPath(); + lastHashFile.SaveAsText(hash); + var script = file.LoadAsText(); + + var structBin = engine.Compile(script, importClass, variables); + lock (s_FileLocker) + { + if (s_FileLocker.TryGetValue(file.GetFullPath(), out locker) == false) + { + s_FileLocker.Add(file.GetFullPath(), locker = new object()); + } + } + lock (locker) + { + bin.SaveAsBinary(RScriptSerializer.SerializeClass(structBin)); + } + step = engine.RunAsync(script, importClass, variables); + } + else + { + RScriptContext.SerializableClass structBin; + lock (s_FileLocker) + { + if (s_FileLocker.TryGetValue(file.GetFullPath(), out locker) == false) + { + s_FileLocker.Add(file.GetFullPath(), locker = new object()); + } + } + lock (locker) + { + structBin = RScriptSerializer.DeserializeClass(bin.LoadAsBinary()); + } + step = engine.RunAsync(structBin, importClass, variables); + + } + yield return step;// ConventionUtility.AvoidFakeStop(step); } } - else + finally + { + IsParseScript2Expr = false; + } + } + + public IEnumerator ParseScript2Expr(string script) + { + IsParseScript2Expr = true; + try { - IEnumerator step = null; RScriptEngine engine = new(); RScriptImportClass importClass = GenerateImport(); RScriptVariables variables = GenerateVariables(this); - object locker; - if (lastHashFile.Exists() == false || lastHashFile.LoadAsText() != hash) - { - lastHashFile.MustExistsPath(); - bin.MustExistsPath(); - lastHashFile.SaveAsText(hash); - var script = file.LoadAsText(); - var structBin = engine.Compile(script, importClass, variables); - lock (s_FileLocker) - { - if (s_FileLocker.TryGetValue(file.GetFullPath(), out locker) == false) - { - s_FileLocker.Add(file.GetFullPath(), locker = new object()); - } - } - lock (locker) - { - bin.SaveAsBinary(RScriptSerializer.SerializeClass(structBin)); - } - step = engine.RunAsync(script, importClass, variables); - } - else - { - RScriptContext.SerializableClass structBin; - lock (s_FileLocker) - { - if (s_FileLocker.TryGetValue(file.GetFullPath(), out locker) == false) - { - s_FileLocker.Add(file.GetFullPath(), locker = new object()); - } - } - lock (locker) - { - structBin = RScriptSerializer.DeserializeClass(bin.LoadAsBinary()); - } - step = engine.RunAsync(structBin, importClass, variables); - - } - yield return step;// ConventionUtility.AvoidFakeStop(step); + var step = engine.RunAsync(script, importClass, variables); + yield return step;//ConventionUtility.AvoidFakeStop(step); + } + finally + { + IsParseScript2Expr = false; } - } - finally - { - IsParseScript2Expr = false; - } - } - - public IEnumerator ParseScript2Expr(string script) - { - IsParseScript2Expr = true; - try - { - RScriptEngine engine = new(); - RScriptImportClass importClass = GenerateImport(); - RScriptVariables variables = GenerateVariables(this); - - var step = engine.RunAsync(script, importClass, variables); - yield return step;//ConventionUtility.AvoidFakeStop(step); - } - finally - { - IsParseScript2Expr = false; } } } diff --git a/Assets/Scripts/Framework/SubWorld.cs b/Assets/Scripts/Framework/SubWorld.cs index 3f0a0d2..9018a74 100644 --- a/Assets/Scripts/Framework/SubWorld.cs +++ b/Assets/Scripts/Framework/SubWorld.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.IO; using System.Linq; @@ -8,6 +8,27 @@ using UnityEngine.SceneManagement; namespace Demo.Game { + namespace ConfigType + { + // SubWorld 閰嶇疆 + public class SubWorldConfig : ScriptLoadableConfig + { + public string project; + + public override void Deserialize(BinaryReader reader) + { + project = BinarySerializeUtility.ReadString(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteString(writer, project); + base.Serialize(writer); + } + } + } + [Scriptable] public class SubWorld : ScriptableObject { @@ -25,7 +46,7 @@ namespace Demo.Game var ir = SceneManager.LoadSceneAsync(Editor.EditorController.SceneName, LoadSceneMode.Additive); ir.completed += x => { - SubWorldGameController = (from controller in FindObjectsOfType() + SubWorldGameController = (from controller in FindObjectsByType(FindObjectsSortMode.None) where controller.RootSourcePath == project select controller).First(); ConventionUtility.StartCoroutine(SubWorldGameController.GameInitBySubWorld(GetRoot().InputCatch)); @@ -48,4 +69,4 @@ namespace Demo.Game this.project = project; } } -} \ No newline at end of file +} diff --git a/Assets/Scripts/Interaction/Effect/ParticleEffect.cs b/Assets/Scripts/Interaction/Effect/ParticleEffect.cs index 1942a48..9802f23 100644 --- a/Assets/Scripts/Interaction/Effect/ParticleEffect.cs +++ b/Assets/Scripts/Interaction/Effect/ParticleEffect.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using System.Linq; diff --git a/Assets/Scripts/Interaction/IEffectHookObject.cs b/Assets/Scripts/Interaction/IEffectHookObject.cs index 39ced6e..9cbb6c8 100644 --- a/Assets/Scripts/Interaction/IEffectHookObject.cs +++ b/Assets/Scripts/Interaction/IEffectHookObject.cs @@ -1,10 +1,32 @@ using System; using System.Collections; +using System.IO; using Convention; using UnityEngine; namespace Demo.Game { + namespace ConfigType + { + // IEffectHookObject 閰嶇疆锛堟娊璞″熀绫籆onfig锛 + public class IEffectHookObjectConfig : ScriptLoadableConfig + { + public IEffectHookObject.InteractiveEffectType MyInteractiveLevel; + + public override void Deserialize(BinaryReader reader) + { + MyInteractiveLevel = (IEffectHookObject.InteractiveEffectType)BinarySerializeUtility.ReadInt(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteInt(writer, (int)MyInteractiveLevel); + base.Serialize(writer); + } + } + } + public abstract class IEffectHookObject : ScriptableObject, IHookInteraction { public enum InteractiveEffectType diff --git a/Assets/Scripts/Interaction/IInteraction.cs b/Assets/Scripts/Interaction/IInteraction.cs index 2e0fc49..13f5780 100644 --- a/Assets/Scripts/Interaction/IInteraction.cs +++ b/Assets/Scripts/Interaction/IInteraction.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.IO; using Convention; using Demo.Editor.UI; using UnityEngine; @@ -7,6 +8,42 @@ using UnityEngine.Events; namespace Demo.Game { + namespace ConfigType + { + // IInteraction 閰嶇疆锛堟娊璞″熀绫籆onfig锛岀户鎵胯嚜TimelineScriptObject锛 + public class IInteractionConfig : ScriptLoadableConfig + { + public Vector2 VisibleDuration; + public Vector2 InteractiveDuration; + public Vector2 InteractableScoreInterval; + public Vector2 InteractableIntervalThatCanScoreBest; + public IInteraction.JudgementLevel MyJudgementLevel; + public IInteraction.UpdatePhase MyUpdatePhase; + + public override void Deserialize(BinaryReader reader) + { + VisibleDuration = BinarySerializeUtility.ReadVec2(reader); + InteractiveDuration = BinarySerializeUtility.ReadVec2(reader); + InteractableScoreInterval = BinarySerializeUtility.ReadVec2(reader); + InteractableIntervalThatCanScoreBest = BinarySerializeUtility.ReadVec2(reader); + MyJudgementLevel = (IInteraction.JudgementLevel)BinarySerializeUtility.ReadInt(reader); + MyUpdatePhase = (IInteraction.UpdatePhase)BinarySerializeUtility.ReadInt(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteVec2(writer, VisibleDuration); + BinarySerializeUtility.WriteVec2(writer, InteractiveDuration); + BinarySerializeUtility.WriteVec2(writer, InteractableScoreInterval); + BinarySerializeUtility.WriteVec2(writer, InteractableIntervalThatCanScoreBest); + BinarySerializeUtility.WriteInt(writer, (int)MyJudgementLevel); + BinarySerializeUtility.WriteInt(writer, (int)MyUpdatePhase); + base.Serialize(writer); + } + } + } + public interface IHookInteraction { diff --git a/Assets/Scripts/Interaction/IJudgementHookObject.cs b/Assets/Scripts/Interaction/IJudgementHookObject.cs index aac202d..b8fd3f2 100644 --- a/Assets/Scripts/Interaction/IJudgementHookObject.cs +++ b/Assets/Scripts/Interaction/IJudgementHookObject.cs @@ -1,9 +1,27 @@ using System.Collections; +using System.IO; using Convention; using UnityEngine; namespace Demo.Game { + namespace ConfigType + { + // IJudgementHookObject 閰嶇疆锛堟娊璞″熀绫籆onfig锛 + public class IJudgementHookObjectConfig : ScriptLoadableConfig + { + public override void Deserialize(BinaryReader reader) + { + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + base.Serialize(writer); + } + } + } + public abstract class IJudgementHookObject : ScriptableObject, IHookInteraction { diff --git a/Assets/Scripts/Interaction/Interaction/FullScreenInteraction.cs b/Assets/Scripts/Interaction/Interaction/FullScreenInteraction.cs index 3cb018e..1a93567 100644 --- a/Assets/Scripts/Interaction/Interaction/FullScreenInteraction.cs +++ b/Assets/Scripts/Interaction/Interaction/FullScreenInteraction.cs @@ -1,9 +1,31 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; +using System.IO; using UnityEngine; namespace Demo.Game { + namespace ConfigType + { + // FullScreenInteraction 閰嶇疆 + public class FullScreenInteractionConfig : IInteractionConfig + { + public bool IsNeedTap; + + public override void Deserialize(BinaryReader reader) + { + IsNeedTap = BinarySerializeUtility.ReadBool(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteBool(writer, IsNeedTap); + base.Serialize(writer); + } + } + } + [Scriptable] public class FullScreenInteraction : IInteraction { diff --git a/Assets/Scripts/Interaction/JudgementEffect/ParticleJudgement.cs b/Assets/Scripts/Interaction/JudgementEffect/ParticleJudgement.cs index a637a85..2b859db 100644 --- a/Assets/Scripts/Interaction/JudgementEffect/ParticleJudgement.cs +++ b/Assets/Scripts/Interaction/JudgementEffect/ParticleJudgement.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using NUnit.Framework.Internal; using System.Collections; using System.Collections.Generic; diff --git a/Assets/Scripts/LookAtAnchor.cs b/Assets/Scripts/LookAtAnchor.cs index 803f283..265f146 100644 --- a/Assets/Scripts/LookAtAnchor.cs +++ b/Assets/Scripts/LookAtAnchor.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/MaterialUpdatement.cs b/Assets/Scripts/MaterialUpdatement.cs index 89cfb4d..197d995 100644 --- a/Assets/Scripts/MaterialUpdatement.cs +++ b/Assets/Scripts/MaterialUpdatement.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineRenderer.cs b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineRenderer.cs index bfb5f06..f6c7e49 100644 --- a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineRenderer.cs +++ b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineRenderer.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineSurfaceRenderer.cs b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineSurfaceRenderer.cs index e9e99b4..a0c82a9 100644 --- a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineSurfaceRenderer.cs +++ b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineSurfaceRenderer.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTrackRenderer.cs b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTrackRenderer.cs index e80136c..25ab197 100644 --- a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTrackRenderer.cs +++ b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTrackRenderer.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System; using System.Collections; diff --git a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTubeRenderer.cs b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTubeRenderer.cs index 9329c82..aaf0a95 100644 --- a/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTubeRenderer.cs +++ b/Assets/Scripts/MoreSpline/PointBaseRenderer/SplineTubeRenderer.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System; using System.Collections; diff --git a/Assets/Scripts/MoreSpline/SplineAnchor.cs b/Assets/Scripts/MoreSpline/SplineAnchor.cs index 53ddfcd..7f29fc5 100644 --- a/Assets/Scripts/MoreSpline/SplineAnchor.cs +++ b/Assets/Scripts/MoreSpline/SplineAnchor.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using System; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/SplineCore.cs b/Assets/Scripts/MoreSpline/SplineCore.cs index 98e06cd..69b3968 100644 --- a/Assets/Scripts/MoreSpline/SplineCore.cs +++ b/Assets/Scripts/MoreSpline/SplineCore.cs @@ -1,13 +1,41 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System; using System.Collections; using System.Collections.Generic; +using System.IO; using UnityEngine; namespace Demo.Game { + namespace ConfigType + { + // SplineCore 閰嶇疆 + public class SplineCoreConfig : ScriptLoadableConfig + { + public SplineComputer.SampleMode MySampleMode; + public Spline.Type MyType; + public bool IsClose; + + public override void Deserialize(BinaryReader reader) + { + MySampleMode = (SplineComputer.SampleMode)BinarySerializeUtility.ReadInt(reader); + MyType = (Spline.Type)BinarySerializeUtility.ReadInt(reader); + IsClose = BinarySerializeUtility.ReadBool(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteInt(writer, (int)MySampleMode); + BinarySerializeUtility.WriteInt(writer, (int)MyType); + BinarySerializeUtility.WriteBool(writer, IsClose); + base.Serialize(writer); + } + } + } + public struct SplineClipDuration { public float ClipFrom; diff --git a/Assets/Scripts/MoreSpline/SplineNode.cs b/Assets/Scripts/MoreSpline/SplineNode.cs index 1b124a8..cc632e4 100644 --- a/Assets/Scripts/MoreSpline/SplineNode.cs +++ b/Assets/Scripts/MoreSpline/SplineNode.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/Updatement/SplineMovement.cs b/Assets/Scripts/MoreSpline/Updatement/SplineMovement.cs index 0ff11ea..4650d93 100644 --- a/Assets/Scripts/MoreSpline/Updatement/SplineMovement.cs +++ b/Assets/Scripts/MoreSpline/Updatement/SplineMovement.cs @@ -1,6 +1,6 @@ using Convention; using Convention.WindowsUI.Variant; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/Updatement/SplinePointerObject.cs b/Assets/Scripts/MoreSpline/Updatement/SplinePointerObject.cs index 8ec127c..0988adc 100644 --- a/Assets/Scripts/MoreSpline/Updatement/SplinePointerObject.cs +++ b/Assets/Scripts/MoreSpline/Updatement/SplinePointerObject.cs @@ -1,6 +1,6 @@ using Convention; using Convention.WindowsUI.Variant; -using Demo.Attr; +using Demo.Game.Attr; using Dreamteck.Splines; using System.Collections; using System.Collections.Generic; diff --git a/Assets/Scripts/MoreSpline/Updatement/SplineRotation.cs b/Assets/Scripts/MoreSpline/Updatement/SplineRotation.cs index ded0861..b765a15 100644 --- a/Assets/Scripts/MoreSpline/Updatement/SplineRotation.cs +++ b/Assets/Scripts/MoreSpline/Updatement/SplineRotation.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/MoreSpline/Updatement/SplineScaling.cs b/Assets/Scripts/MoreSpline/Updatement/SplineScaling.cs index e141588..b91df07 100644 --- a/Assets/Scripts/MoreSpline/Updatement/SplineScaling.cs +++ b/Assets/Scripts/MoreSpline/Updatement/SplineScaling.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using UnityEngine; namespace Demo.Game diff --git a/Assets/Scripts/TickMovement.cs b/Assets/Scripts/TickMovement.cs index 4114eb6..414c9bf 100644 --- a/Assets/Scripts/TickMovement.cs +++ b/Assets/Scripts/TickMovement.cs @@ -1,6 +1,6 @@ using Convention; using Convention.WindowsUI.Variant; -using Demo.Attr; +using Demo.Game.Attr; using System; using System.Collections; using System.Collections.Generic; diff --git a/Assets/Scripts/TickRotation.cs b/Assets/Scripts/TickRotation.cs index 44defed..71caa28 100644 --- a/Assets/Scripts/TickRotation.cs +++ b/Assets/Scripts/TickRotation.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System; using UnityEngine; diff --git a/Assets/Scripts/TickScaling.cs b/Assets/Scripts/TickScaling.cs index a86708e..683b706 100644 --- a/Assets/Scripts/TickScaling.cs +++ b/Assets/Scripts/TickScaling.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System; using UnityEngine; diff --git a/Assets/Scripts/Volume/BaseVolume.cs b/Assets/Scripts/Volume/BaseVolume.cs index 66cbe8f..344acee 100644 --- a/Assets/Scripts/Volume/BaseVolume.cs +++ b/Assets/Scripts/Volume/BaseVolume.cs @@ -1,6 +1,7 @@ using Convention; using System; using System.Collections.Generic; +using System.IO; using System.Reflection; using UnityEngine; using UnityEngine.Rendering; @@ -8,6 +9,23 @@ using UnityEngine.Rendering.Universal; namespace Demo.Game { + namespace ConfigType + { + // BaseVolume 閰嶇疆锛堟娊璞″熀绫籆onfig锛 + public class BaseVolumeConfig : ScriptLoadableConfig + { + public override void Deserialize(BinaryReader reader) + { + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + base.Serialize(writer); + } + } + } + public abstract class BaseVolume : ScriptableObject { [Resources, SerializeField] private Volume m_volume; diff --git a/Assets/Scripts/Volume/MotionBlurVolume.cs b/Assets/Scripts/Volume/MotionBlurVolume.cs index 31962a0..12c0697 100644 --- a/Assets/Scripts/Volume/MotionBlurVolume.cs +++ b/Assets/Scripts/Volume/MotionBlurVolume.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using UnityEngine; using UnityEngine.Rendering.Universal; diff --git a/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs index df994a5..b1bb0ec 100644 --- a/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs +++ b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs @@ -1,5 +1,5 @@ 锘縰sing Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs index b6ade12..ea2de5e 100644 --- a/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs +++ b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs @@ -1,5 +1,5 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs index 85c30aa..d891c3e 100644 --- a/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs +++ b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs @@ -1,4 +1,4 @@ -using Demo.Attr; +using Demo.Game.Attr; using UnityEngine; namespace Demo.Game diff --git a/Assets/Scripts/Volume/VolumeObject.cs b/Assets/Scripts/Volume/VolumeObject.cs index 79b03df..1dcd4ca 100644 --- a/Assets/Scripts/Volume/VolumeObject.cs +++ b/Assets/Scripts/Volume/VolumeObject.cs @@ -1,11 +1,35 @@ using Convention; -using Demo.Attr; +using Demo.Game.Attr; using System.Collections; +using System.IO; using UnityEngine; using UnityEngine.Rendering; namespace Demo.Game { + namespace ConfigType + { + // VolumeObject 閰嶇疆 + public class VolumeObjectConfig : BaseVolumeConfig + { + public string MyAssetBundle, MyProfile; + + public override void Deserialize(BinaryReader reader) + { + MyAssetBundle = BinarySerializeUtility.ReadString(reader); + MyProfile = BinarySerializeUtility.ReadString(reader); + base.Deserialize(reader); + } + + public override void Serialize(BinaryWriter writer) + { + BinarySerializeUtility.WriteString(writer, MyAssetBundle); + BinarySerializeUtility.WriteString(writer, MyProfile); + base.Serialize(writer); + } + } + } + [Scriptable] public class VolumeObject : BaseVolume, IAssetBundleLoader { @@ -14,7 +38,8 @@ namespace Demo.Game return new GameObject().AddComponent(); } - [Content, SerializeField] private bool IsLoading = false; + private bool IsLoading = false; + [Content, SerializeField] private string MyAssetBundle, MyProfile; protected override IEnumerator DoSomethingDuringApplyScript() { @@ -30,6 +55,8 @@ namespace Demo.Game public void Load(string ab, string profile) { IsLoading = true; + MyAssetBundle = ab; + MyProfile = profile; ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x => { MyVolume.profile = x.LoadAsset(profile); @@ -37,4 +64,4 @@ namespace Demo.Game })); } } -} \ No newline at end of file +} diff --git a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset index 24a9aac..a0303ed 100644 --- a/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset +++ b/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset @@ -207,7 +207,7 @@ MonoBehaviour: type: {class: RenderGraphSettings, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 - m_EnableRenderCompatibilityMode: 1 + m_EnableRenderCompatibilityMode: 0 - rid: 4324738240734560265 type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: