命名空间迁移

This commit is contained in:
2025-12-15 17:20:55 +08:00
parent 88c15a43f2
commit 65a5775647
42 changed files with 400 additions and 178 deletions

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
[CustomEditor(typeof(Demo.ScriptableObject), true)] [CustomEditor(typeof(Demo.Game.ScriptableObject), true)]
public class SOEditor : Convention.AbstractCustomEditor public class SOEditor : Convention.AbstractCustomEditor
{ {

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -6,7 +6,7 @@ using Cinemachine;
#endif #endif
using Convention.WindowsUI.Variant; using Convention.WindowsUI.Variant;
using UnityEngine; using UnityEngine;
using Demo.Attr; using Demo.Game.Attr;
namespace Demo.Game namespace Demo.Game
{ {

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -10,6 +10,26 @@ using UnityEngine.Rendering;
namespace Demo.Game namespace Demo.Game
{ {
namespace ConfigType
{
public class DDTConfig : ScriptLoadableConfig
{
public NativeArray<float> 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] [Scriptable]
public class DDT : ScriptableObject public class DDT : ScriptableObject
{ {
@@ -48,7 +68,7 @@ namespace Demo.Game
} }
/// <summary> /// <summary>
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> /// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Convention.RScript.Variable.Attr.Method] [Convention.RScript.Variable.Attr.Method]

View File

@@ -59,7 +59,7 @@ namespace Demo.Editor
{ {
foreach (var type in asm.GetTypes()) 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); result.Add(type.Name, type);
} }
@@ -391,7 +391,7 @@ namespace Demo.Editor
{ {
new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(type, () => generater(), null, filename).Register(); 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(); new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(type, null, null, filename).Register();
} }

View File

@@ -205,6 +205,7 @@ namespace Demo.Game
rootGameObject.transform.SetParent(transform); rootGameObject.transform.SetParent(transform);
rootGameObject.ScriptName = rootObject.GetName(true); rootGameObject.ScriptName = rootObject.GetName(true);
rootGameObject.audioSystem = MainAudio; rootGameObject.audioSystem = MainAudio;
rootGameObject.LoadedScriptSet.Add(rootObject);
rootGameObject.EnableScript(content.RootSourceDir, this); rootGameObject.EnableScript(content.RootSourceDir, this);
rootGameObject.SetContent(nameof(SongOffset), SongOffset); rootGameObject.SetContent(nameof(SongOffset), SongOffset);
rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0); rootGameObject.SetContent(nameof(IsAutoPlay), IsAutoPlay ? 1 : 0);

View File

@@ -17,6 +17,7 @@ namespace Demo.Game
[Content] public GameController RootGameController; [Content] public GameController RootGameController;
public string SourcePath; public string SourcePath;
public HashSet<string> LoadedScriptSet = new();
protected override IEnumerator DoSomethingDuringApplyScript() protected override IEnumerator DoSomethingDuringApplyScript()
{ {

View File

@@ -1,7 +1,7 @@
using Convention; using Convention;
using Convention.RScript; using Convention.RScript;
using Convention.WindowsUI.Variant; using Convention.WindowsUI.Variant;
using Demo.Attr; using Demo.Game.Attr;
using Demo.Game; using Demo.Game;
using Dreamteck.Splines; using Dreamteck.Splines;
using System; using System;
@@ -15,7 +15,7 @@ using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
namespace Demo namespace Demo.Game
{ {
public interface IScriptableObject public interface IScriptableObject
{ {
@@ -38,6 +38,8 @@ namespace Demo
} }
} }
namespace ConfigType
{
public class ScriptLoadableConfig public class ScriptLoadableConfig
{ {
public Vector3 EnterGameLocalPosition, EnterGameEulerAngles, EnterGameLocalScaling; public Vector3 EnterGameLocalPosition, EnterGameEulerAngles, EnterGameLocalScaling;
@@ -87,6 +89,7 @@ namespace Demo
} }
} }
} }
}
public partial class ScriptableObject : IScriptableObject public partial class ScriptableObject : IScriptableObject
{ {
@@ -412,6 +415,7 @@ namespace Demo
// 获取文件 // 获取文件
var file = new ToolFile(GetRoot().SourcePath); var file = new ToolFile(GetRoot().SourcePath);
file = file | path; file = file | path;
GetRoot().LoadedScriptSet.Add(file);
// 找不到脚本 // 找不到脚本
if (file.Exists() == false) if (file.Exists() == false)
{ {

View File

@@ -159,6 +159,8 @@ namespace Demo
} }
} }
namespace Game
{
public partial class ScriptableObject public partial class ScriptableObject
{ {
protected virtual bool IsImptSerialize => false; protected virtual bool IsImptSerialize => false;
@@ -297,3 +299,4 @@ namespace Demo
} }
} }
} }
}

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -8,6 +8,27 @@ using UnityEngine.SceneManagement;
namespace Demo.Game 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] [Scriptable]
public class SubWorld : ScriptableObject public class SubWorld : ScriptableObject
{ {
@@ -25,7 +46,7 @@ namespace Demo.Game
var ir = SceneManager.LoadSceneAsync(Editor.EditorController.SceneName, LoadSceneMode.Additive); var ir = SceneManager.LoadSceneAsync(Editor.EditorController.SceneName, LoadSceneMode.Additive);
ir.completed += x => ir.completed += x =>
{ {
SubWorldGameController = (from controller in FindObjectsOfType<GameController>() SubWorldGameController = (from controller in FindObjectsByType<GameController>(FindObjectsSortMode.None)
where controller.RootSourcePath == project where controller.RootSourcePath == project
select controller).First(); select controller).First();
ConventionUtility.StartCoroutine(SubWorldGameController.GameInitBySubWorld(GetRoot().InputCatch)); ConventionUtility.StartCoroutine(SubWorldGameController.GameInitBySubWorld(GetRoot().InputCatch));

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,10 +1,32 @@
using System; using System;
using System.Collections; using System.Collections;
using System.IO;
using Convention; using Convention;
using UnityEngine; using UnityEngine;
namespace Demo.Game namespace Demo.Game
{ {
namespace ConfigType
{
// IEffectHookObject 配置抽象基类Config
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 abstract class IEffectHookObject : ScriptableObject, IHookInteraction
{ {
public enum InteractiveEffectType public enum InteractiveEffectType

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.IO;
using Convention; using Convention;
using Demo.Editor.UI; using Demo.Editor.UI;
using UnityEngine; using UnityEngine;
@@ -7,6 +8,42 @@ using UnityEngine.Events;
namespace Demo.Game namespace Demo.Game
{ {
namespace ConfigType
{
// IInteraction 配置抽象基类Config继承自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 public interface IHookInteraction
{ {

View File

@@ -1,9 +1,27 @@
using System.Collections; using System.Collections;
using System.IO;
using Convention; using Convention;
using UnityEngine; using UnityEngine;
namespace Demo.Game namespace Demo.Game
{ {
namespace ConfigType
{
// IJudgementHookObject 配置抽象基类Config
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 public abstract class IJudgementHookObject : ScriptableObject, IHookInteraction
{ {

View File

@@ -1,9 +1,31 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.IO;
using UnityEngine; using UnityEngine;
namespace Demo.Game 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] [Scriptable]
public class FullScreenInteraction : IInteraction public class FullScreenInteraction : IInteraction
{ {

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using NUnit.Framework.Internal; using NUnit.Framework.Internal;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System; using System;
using System.Collections; using System.Collections;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System; using System;
using System.Collections; using System.Collections;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,13 +1,41 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using UnityEngine; using UnityEngine;
namespace Demo.Game 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 struct SplineClipDuration
{ {
public float ClipFrom; public float ClipFrom;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,6 @@
using Convention; using Convention;
using Convention.WindowsUI.Variant; using Convention.WindowsUI.Variant;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,6 @@
using Convention; using Convention;
using Convention.WindowsUI.Variant; using Convention.WindowsUI.Variant;
using Demo.Attr; using Demo.Game.Attr;
using Dreamteck.Splines; using Dreamteck.Splines;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using UnityEngine; using UnityEngine;
namespace Demo.Game namespace Demo.Game

View File

@@ -1,6 +1,6 @@
using Convention; using Convention;
using Convention.WindowsUI.Variant; using Convention.WindowsUI.Variant;
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System; using System;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,7 @@
using Convention; using Convention;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
@@ -8,6 +9,23 @@ using UnityEngine.Rendering.Universal;
namespace Demo.Game namespace Demo.Game
{ {
namespace ConfigType
{
// BaseVolume 配置抽象基类Config
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 public abstract class BaseVolume : ScriptableObject
{ {
[Resources, SerializeField] private Volume m_volume; [Resources, SerializeField] private Volume m_volume;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.Universal; using UnityEngine.Rendering.Universal;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;

View File

@@ -1,4 +1,4 @@
using Demo.Attr; using Demo.Game.Attr;
using UnityEngine; using UnityEngine;
namespace Demo.Game namespace Demo.Game

View File

@@ -1,11 +1,35 @@
using Convention; using Convention;
using Demo.Attr; using Demo.Game.Attr;
using System.Collections; using System.Collections;
using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
namespace Demo.Game 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] [Scriptable]
public class VolumeObject : BaseVolume, IAssetBundleLoader public class VolumeObject : BaseVolume, IAssetBundleLoader
{ {
@@ -14,7 +38,8 @@ namespace Demo.Game
return new GameObject().AddComponent<VolumeObject>(); return new GameObject().AddComponent<VolumeObject>();
} }
[Content, SerializeField] private bool IsLoading = false; private bool IsLoading = false;
[Content, SerializeField] private string MyAssetBundle, MyProfile;
protected override IEnumerator DoSomethingDuringApplyScript() protected override IEnumerator DoSomethingDuringApplyScript()
{ {
@@ -30,6 +55,8 @@ namespace Demo.Game
public void Load(string ab, string profile) public void Load(string ab, string profile)
{ {
IsLoading = true; IsLoading = true;
MyAssetBundle = ab;
MyProfile = profile;
ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x => ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x =>
{ {
MyVolume.profile = x.LoadAsset<VolumeProfile>(profile); MyVolume.profile = x.LoadAsset<VolumeProfile>(profile);

View File

@@ -207,7 +207,7 @@ MonoBehaviour:
type: {class: RenderGraphSettings, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} type: {class: RenderGraphSettings, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
data: data:
m_Version: 0 m_Version: 0
m_EnableRenderCompatibilityMode: 1 m_EnableRenderCompatibilityMode: 0
- rid: 4324738240734560265 - rid: 4324738240734560265
type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
data: data: