命名空间迁移

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.Generic;
using UnityEngine;

View File

@@ -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
{

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<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]
public class DDT : ScriptableObject
{
@@ -48,7 +68,7 @@ namespace Demo.Game
}
/// <summary>
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
/// </summary>
/// <returns></returns>
[Convention.RScript.Variable.Attr.Method]

View File

@@ -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();
}

View File

@@ -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);

View File

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

View File

@@ -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<string, Func<ScriptLoadableConfig>> 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<string, Func<ScriptLoadableConfig>> 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)
{

View File

@@ -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<string, object> s_FileLocker = new();
private static readonly Dictionary<string, object> 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;
}
}
}

View File

@@ -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<GameController>()
SubWorldGameController = (from controller in FindObjectsByType<GameController>(FindObjectsSortMode.None)
where controller.RootSourcePath == project
select controller).First();
ConventionUtility.StartCoroutine(SubWorldGameController.GameInitBySubWorld(GetRoot().InputCatch));

View File

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

View File

@@ -1,10 +1,32 @@
using System;
using System.Collections;
using System.IO;
using Convention;
using UnityEngine;
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 enum InteractiveEffectType

View File

@@ -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 配置抽象基类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
{

View File

@@ -1,9 +1,27 @@
using System.Collections;
using System.IO;
using Convention;
using UnityEngine;
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
{

View File

@@ -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
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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;

View File

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

View File

@@ -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;

View File

@@ -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;

View File

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

View File

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

View File

@@ -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;

View File

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

View File

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

View File

@@ -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 配置抽象基类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
{
[Resources, SerializeField] private Volume m_volume;

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<VolumeObject>();
}
[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<VolumeProfile>(profile);

View File

@@ -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: