diff --git a/Assets/Assets/Volume/Default.asset b/Assets/Assets/Volume/Default.asset index 2ab3ca7..b3d5638 100644 --- a/Assets/Assets/Volume/Default.asset +++ b/Assets/Assets/Volume/Default.asset @@ -75,8 +75,8 @@ MonoBehaviour: m_OverrideState: 0 m_Value: 65472 tint: - m_OverrideState: 0 - m_Value: {r: 1, g: 1, b: 1, a: 1} + m_OverrideState: 1 + m_Value: {r: 0, g: 0, b: 0, a: 1} highQualityFiltering: m_OverrideState: 0 m_Value: 0 @@ -261,7 +261,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3} m_Name: DepthOfField m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.DepthOfField - active: 1 + active: 0 mode: m_OverrideState: 1 m_Value: 1 diff --git a/Assets/Scenes/Game/EditorScene.unity b/Assets/Scenes/Game/EditorScene.unity index 31e5765..aac4e52 100644 --- a/Assets/Scenes/Game/EditorScene.unity +++ b/Assets/Scenes/Game/EditorScene.unity @@ -616,7 +616,8 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] - m_RemovedGameObjects: [] + m_RemovedGameObjects: + - {fileID: 8780852774427548101, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} diff --git a/Assets/Scripts/Volume/BaseVolume.cs b/Assets/Scripts/Volume/BaseVolume.cs index 1a3dc47..66cbe8f 100644 --- a/Assets/Scripts/Volume/BaseVolume.cs +++ b/Assets/Scripts/Volume/BaseVolume.cs @@ -60,6 +60,14 @@ namespace Demo.Game return false; return ConventionUtility.PushValue(component, value, name, BindingFlags.Public | BindingFlags.Instance); } + + public bool TrySetOverrideField(string type, string name, FieldType value) + { + var component = GetOverride(type); + if (component == null) + return false; + return ConventionUtility.PushValue(component, value, name, BindingFlags.Public | BindingFlags.Instance); + } } public abstract class BaseForSingleVolume : BaseVolume where T : VolumeComponent diff --git a/Assets/Scripts/Volume/Updatement.meta b/Assets/Scripts/Volume/Updatement.meta new file mode 100644 index 0000000..0d294ed --- /dev/null +++ b/Assets/Scripts/Volume/Updatement.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6817d5ed5f3f2ba46b718a0003027dee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs new file mode 100644 index 0000000..df994a5 --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs @@ -0,0 +1,48 @@ +using Convention; +using Demo.Attr; +using System.Collections; +using UnityEngine; + +namespace Demo.Game +{ + public abstract class BaseVolumeUpdatement : Updatement where T : unmanaged + { + [Content, SerializeField] private BaseVolume target; + [Content, SerializeField] private string updateOverride; + [Content, SerializeField] private string updateField; + + protected override IEnumerator DoSomethingDuringApplyScript() + { + yield return base.DoSomethingDuringApplyScript(); + if (target == null) + { + target = this.UpdateTarget.SeekComponent(); + } + } + + protected override void UpdateData(T data) + { + target.TrySetOverrideField(updateOverride, updateField, data); + } + + [Convention.RScript.Variable.Attr.Method] + public void SetUpdateOverrideAndField(string updateOverride, string updateField) + { + this.updateOverride = updateOverride; + this.updateField = updateField; + } + + + /// + /// 新增 + /// + /// 插值时间 + /// 值 + /// 缓动曲线 + [Convention.RScript.Variable.Attr.Method] + public void Add(float time, T value, MathExtension.EaseCurveType curveType) + { + ManualAddEntry(time, value, curveType); + } + } +} diff --git a/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs.meta b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs.meta new file mode 100644 index 0000000..6bff647 --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3310713d1026b944facb4c172ad38bb1 \ No newline at end of file diff --git a/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs new file mode 100644 index 0000000..b6ade12 --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs @@ -0,0 +1,21 @@ +using Convention; +using Demo.Attr; +using System.Collections; +using UnityEngine; + +namespace Demo.Game +{ + [Scriptable] + public class VolumeFloatUpdatement : BaseVolumeUpdatement + { + public static VolumeFloatUpdatement Make() + { + return new GameObject().AddComponent(); + } + + protected override float Lerp(float begin, float end, float t) + { + return Mathf.Lerp(begin, end, t); + } + } +} diff --git a/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs.meta b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs.meta new file mode 100644 index 0000000..94ee423 --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/VolumeFloatUpdatement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6b3813d5ec8404345bcbd745281e2671 \ No newline at end of file diff --git a/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs new file mode 100644 index 0000000..85c30aa --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs @@ -0,0 +1,19 @@ +using Demo.Attr; +using UnityEngine; + +namespace Demo.Game +{ + [Scriptable] + public class VolumeIntUpdatement : BaseVolumeUpdatement + { + public static VolumeIntUpdatement Make() + { + return new GameObject().AddComponent(); + } + + protected override int Lerp(int begin, int end, float t) + { + return Mathf.FloorToInt(Mathf.Lerp(begin, end, t)); + } + } +} diff --git a/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs.meta b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs.meta new file mode 100644 index 0000000..48b5ec4 --- /dev/null +++ b/Assets/Scripts/Volume/Updatement/VolumeIntUpdatement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 600cb8d3ed5900d4baa30e5d8aafa66e diff --git a/Assets/Scripts/Volume/VolumeObject.cs b/Assets/Scripts/Volume/VolumeObject.cs new file mode 100644 index 0000000..79b03df --- /dev/null +++ b/Assets/Scripts/Volume/VolumeObject.cs @@ -0,0 +1,40 @@ +using Convention; +using Demo.Attr; +using System.Collections; +using UnityEngine; +using UnityEngine.Rendering; + +namespace Demo.Game +{ + [Scriptable] + public class VolumeObject : BaseVolume, IAssetBundleLoader + { + public static VolumeObject Make() + { + return new GameObject().AddComponent(); + } + + [Content, SerializeField] private bool IsLoading = false; + + protected override IEnumerator DoSomethingDuringApplyScript() + { + yield return base.DoSomethingDuringApplyScript(); + yield return new WaitUntil(() => !IsLoading); + if (MyVolume.profile == null) + { + MyVolume.profile = Resources.Load("Volume/Default"); + } + } + + [Convention.RScript.Variable.Attr.Method] + public void Load(string ab, string profile) + { + IsLoading = true; + ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x => + { + MyVolume.profile = x.LoadAsset(profile); + IsLoading = false; + })); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Volume/VolumeObject.cs.meta b/Assets/Scripts/Volume/VolumeObject.cs.meta new file mode 100644 index 0000000..8e9f7a8 --- /dev/null +++ b/Assets/Scripts/Volume/VolumeObject.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6905b41c61f830c4fac86087660118e4 \ No newline at end of file diff --git a/Assets/Settings/Build Profiles/Windows.asset b/Assets/Settings/Build Profiles/Windows.asset index 2b4cfec..fc00a87 100644 --- a/Assets/Settings/Build Profiles/Windows.asset +++ b/Assets/Settings/Build Profiles/Windows.asset @@ -422,7 +422,7 @@ MonoBehaviour: - line: '| - m_BuildTarget: ' - line: '| m_Icons:' - line: '| - serializedVersion: 2' - - line: '| m_Icon: {fileID: 2800000, guid: 8a1e37e4b2571444b95d20abbea33454, + - line: '| m_Icon: {fileID: 2800000, guid: e7fd089a9ebf1be4589638221dc0a006, type: 3}' - line: '| m_Width: 128' - line: '| m_Height: 128'