From 7590d78e74e5f9290f35bd423592ff3f36c6d535 Mon Sep 17 00:00:00 2001 From: basil <2428390463@qq.com> Date: Mon, 5 Oct 2026 17:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=B6=E8=8E=B7=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96=E6=8E=89?= =?UTF-8?q?=E8=90=BD=E7=89=A9=E8=A1=A8=E7=8E=B0=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameMain/DataTables/tbentityconfig.json | 16 +- .../GameMain/DataTables/tbglobalconfig.bytes | Bin 130 -> 190 bytes .../GameMain/DataTables/tbglobalconfig.json | 12 +- Assets/GameMain/Materials/DropEmission.mat | 32 +++ .../GameMain/Materials/DropEmission.mat.meta | 8 + Assets/GameMain/Materials/Font Presets.meta | 8 + .../{ => Font Presets}/MainTMPFont Normal.mat | 0 .../MainTMPFont Normal.mat.meta | 0 .../Materials/Shaders/DropEmission.shader | 118 ++++++++++ .../Shaders/DropEmission.shader.meta | 9 + .../Combat/DropSpawnRequestedEventArgs.cs | 32 +++ .../DropSpawnRequestedEventArgs.cs.meta | 11 + .../Combat/WaveHarvestSettlementEventArgs.cs | 39 ++++ .../WaveHarvestSettlementEventArgs.cs.meta | 11 + .../Base/Event/Shop/ShopGoodsLockEventArgs.cs | 31 +++ .../Event/Shop/ShopGoodsLockEventArgs.cs.meta | 11 + .../GameMain/Scripts/Base/Gen/GlobalConfig.cs | 45 ++++ .../Scripts/Base/Gen/TbGlobalConfig.cs | 24 ++ .../Presentation/Shop/GoodsItemContext.cs | 3 + .../Presentation/Shop/ShopController.cs | 23 ++ .../Presentation/Shop/ShopGoodsItem.cs | 23 ++ .../Scripts/Procedure/Game/GameStateBattle.cs | 45 ++-- .../Scripts/Procedure/Game/GameStateShop.cs | 2 +- .../Scripts/Runtime/Battle/DropService.cs | 107 +++++++++ .../Runtime/Battle/DropService.cs.meta | 11 + .../Battle/HarvestSettlementUtility.cs | 63 ++++++ .../Battle/HarvestSettlementUtility.cs.meta | 11 + .../Runtime/Components/AbsorbComponent.cs | 8 +- .../Runtime/Components/MovementComponent.cs | 4 +- .../Simulation/Components/PickupStateSim.cs | 10 +- .../Components/PickupTransformSim.cs | 1 + .../Simulation/ISimulationWorld.cs | 4 +- .../Jobs/SimulationWorld.EnemyJobs.cs | 87 +++++-- .../SimulationWorld.TransformSync.cs | 47 ++-- .../Simulation/SimData/PickupSimData.cs | 1 + .../SimulationWorld.EntityToSimData.cs | 1 + .../SimulationWorld.SimEntityState.cs | 27 ++- .../Systems/PickupMovementSystem.cs | 214 +++++++++++++++--- .../Scripts/Runtime/EntityLogic/DropEntity.cs | 8 - .../Runtime/EntityLogic/Enemy/EnemyBase.cs | 11 +- .../Runtime/UIBase/Shop/GoodsItemRawData.cs | 1 + .../Runtime/UIBase/Shop/ShopGoodsSelection.cs | 1 + .../Runtime/UIBase/Shop/ShopUseCase.cs | 147 +++++++++--- .../Scripts/Runtime/Utility/RarityUtility.cs | 24 +- Assets/GameMain/UI/UIForms/ShopForm.prefab | 25 -- Assets/GameMain/UI/UIItems/GoodsItem.prefab | 174 +++++++++++++- .../EditMode/HarvestingEconomyTests.cs | 106 +++++++++ .../EditMode/HarvestingEconomyTests.cs.meta | 11 + .../EditMode/ShopEconomyAndLockTests.cs | 147 ++++++++++++ .../EditMode/ShopEconomyAndLockTests.cs.meta | 11 + .../EditMode/SimulationWorldTickTests.cs | 109 +++++++-- 数据表/Datas/EntityConfig_实体配置.xlsx | Bin 10230 -> 10354 bytes 数据表/Datas/GlobalConfig_全局配置.xlsx | Bin 11913 -> 12383 bytes 53 files changed, 1633 insertions(+), 241 deletions(-) create mode 100644 Assets/GameMain/Materials/DropEmission.mat create mode 100644 Assets/GameMain/Materials/DropEmission.mat.meta create mode 100644 Assets/GameMain/Materials/Font Presets.meta rename Assets/GameMain/Materials/{ => Font Presets}/MainTMPFont Normal.mat (100%) rename Assets/GameMain/Materials/{ => Font Presets}/MainTMPFont Normal.mat.meta (100%) create mode 100644 Assets/GameMain/Materials/Shaders/DropEmission.shader create mode 100644 Assets/GameMain/Materials/Shaders/DropEmission.shader.meta create mode 100644 Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs create mode 100644 Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs.meta create mode 100644 Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs create mode 100644 Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs.meta create mode 100644 Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs create mode 100644 Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs.meta create mode 100644 Assets/GameMain/Scripts/Runtime/Battle/DropService.cs create mode 100644 Assets/GameMain/Scripts/Runtime/Battle/DropService.cs.meta create mode 100644 Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs create mode 100644 Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs.meta create mode 100644 Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs create mode 100644 Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs.meta create mode 100644 Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs create mode 100644 Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs.meta diff --git a/Assets/GameMain/DataTables/tbentityconfig.json b/Assets/GameMain/DataTables/tbentityconfig.json index 7cb6322..1e606af 100644 --- a/Assets/GameMain/DataTables/tbentityconfig.json +++ b/Assets/GameMain/DataTables/tbentityconfig.json @@ -35,12 +35,20 @@ "assetName": "WeaponLance", "prefabPath": "WeaponLance.prefab" }, - { - "assetName": "DropEntity", - "prefabPath": "DropEntity.prefab" - }, { "assetName": "Projectile", "prefabPath": "Projectile.prefab" + }, + { + "assetName": "DropEntity01", + "prefabPath": "Drop/DropEntity01.prefab" + }, + { + "assetName": "DropEntity02", + "prefabPath": "Drop/DropEntity02.prefab" + }, + { + "assetName": "DropEntity03", + "prefabPath": "Drop/DropEntity03.prefab" } ] \ No newline at end of file diff --git a/Assets/GameMain/DataTables/tbglobalconfig.bytes b/Assets/GameMain/DataTables/tbglobalconfig.bytes index 97bd81bc9f1f1599501aa9297c0bd25b00f30b7d..dd92e724a8faf7688d513beb7db490856e7b8aee 100644 GIT binary patch delta 72 zcmZo-+{ZYf){&XVr6|9^HLoPIq|(3;nPY^^F-}W+X2-<9&|r7=%o$q{W?*1&U|=wD F0RWFZ7{CAk delta 12 TcmdnT*u*%YmNhNynH>`V9P0!} diff --git a/Assets/GameMain/DataTables/tbglobalconfig.json b/Assets/GameMain/DataTables/tbglobalconfig.json index eb12760..c91e429 100644 --- a/Assets/GameMain/DataTables/tbglobalconfig.json +++ b/Assets/GameMain/DataTables/tbglobalconfig.json @@ -34,7 +34,17 @@ "critMultiplier": 1.5, "dropEntityCoinCount": 1, "dropEntityExpCount": 1, + "dropEntityAssetNames": [ + "DropEntity01", + "DropEntity02", + "DropEntity03" + ], "enemyBodyRadius": 0.45, - "enemySeparationIterations": 2 + "enemySeparationIterations": 2, + "recoilDistance": 0.25, + "recoilDuration": 0.1, + "dashAccelerationDuration": 0.1, + "dashMaxSpeedMultiplier": 2, + "turnSpeed": 720 } ] \ No newline at end of file diff --git a/Assets/GameMain/Materials/DropEmission.mat b/Assets/GameMain/Materials/DropEmission.mat new file mode 100644 index 0000000..c8f032b --- /dev/null +++ b/Assets/GameMain/Materials/DropEmission.mat @@ -0,0 +1,32 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DropEmission + m_Shader: {fileID: 4800000, guid: ee6321f7c35d4f41a692ace420f07421, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2020 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Ints: [] + m_Floats: + - _EmissionIntensity: 0.25 + m_Colors: + - _BaseColor: {r: 0.04, g: 0.85, b: 0.22, a: 1} + - _EmissionColor: {r: 0.12, g: 1, b: 0.38, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/GameMain/Materials/DropEmission.mat.meta b/Assets/GameMain/Materials/DropEmission.mat.meta new file mode 100644 index 0000000..b944e6d --- /dev/null +++ b/Assets/GameMain/Materials/DropEmission.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cbf218826364797b5f9e4bd8ff5b674 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Materials/Font Presets.meta b/Assets/GameMain/Materials/Font Presets.meta new file mode 100644 index 0000000..c24636b --- /dev/null +++ b/Assets/GameMain/Materials/Font Presets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d9bc2d0d723681449aaea6bc054f6ce +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Materials/MainTMPFont Normal.mat b/Assets/GameMain/Materials/Font Presets/MainTMPFont Normal.mat similarity index 100% rename from Assets/GameMain/Materials/MainTMPFont Normal.mat rename to Assets/GameMain/Materials/Font Presets/MainTMPFont Normal.mat diff --git a/Assets/GameMain/Materials/MainTMPFont Normal.mat.meta b/Assets/GameMain/Materials/Font Presets/MainTMPFont Normal.mat.meta similarity index 100% rename from Assets/GameMain/Materials/MainTMPFont Normal.mat.meta rename to Assets/GameMain/Materials/Font Presets/MainTMPFont Normal.mat.meta diff --git a/Assets/GameMain/Materials/Shaders/DropEmission.shader b/Assets/GameMain/Materials/Shaders/DropEmission.shader new file mode 100644 index 0000000..fe835e6 --- /dev/null +++ b/Assets/GameMain/Materials/Shaders/DropEmission.shader @@ -0,0 +1,118 @@ +Shader "SepCore/Drop/Instanced Emission" +{ + Properties + { + _BaseColor ("Base Color", Color) = (0.04, 0.85, 0.22, 1) + [HDR] _EmissionColor ("Emission Color", Color) = (0.12, 1, 0.38, 1) + _EmissionIntensity ("Emission Intensity", Range(0, 10)) = 1.8 + } + + SubShader + { + Tags + { + "RenderType" = "Opaque" + "RenderPipeline" = "UniversalPipeline" + "Queue" = "Geometry" + } + + LOD 100 + + Pass + { + Name "ForwardLit" + Tags { "LightMode" = "UniversalForward" } + + HLSLPROGRAM + #pragma target 3.0 + #pragma vertex Vert + #pragma fragment Frag + #pragma multi_compile_instancing + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fog + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + UNITY_INSTANCING_BUFFER_START(DropProperties) + UNITY_DEFINE_INSTANCED_PROP(float4, _BaseColor) + UNITY_DEFINE_INSTANCED_PROP(float4, _EmissionColor) + UNITY_DEFINE_INSTANCED_PROP(float, _EmissionIntensity) + UNITY_INSTANCING_BUFFER_END(DropProperties) + + struct Attributes + { + float4 positionOS : POSITION; + float3 normalOS : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float3 normalWS : TEXCOORD0; + float4 shadowCoord : TEXCOORD1; + half fogFactor : TEXCOORD2; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + Varyings Vert(Attributes input) + { + Varyings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + VertexPositionInputs positionInputs = GetVertexPositionInputs(input.positionOS.xyz); + VertexNormalInputs normalInputs = GetVertexNormalInputs(input.normalOS); + + output.positionCS = positionInputs.positionCS; + output.normalWS = normalInputs.normalWS; + output.shadowCoord = GetShadowCoord(positionInputs); + output.fogFactor = ComputeFogFactor(positionInputs.positionCS.z); + return output; + } + + half4 Frag(Varyings input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + half4 baseColor = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _BaseColor); + half3 emissionColor = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _EmissionColor).rgb; + half emissionIntensity = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _EmissionIntensity); + + half3 normalWS = normalize(input.normalWS); + Light mainLight = GetMainLight(input.shadowCoord); + half diffuse = saturate(dot(normalWS, mainLight.direction)) * mainLight.shadowAttenuation; + half3 ambientLighting = SampleSH(normalWS); + half3 baseLighting = baseColor.rgb * (ambientLighting + mainLight.color * diffuse); + half3 color = MixFog(baseLighting + emissionColor * emissionIntensity, input.fogFactor); + + return half4(color, baseColor.a); + } + ENDHLSL + } + + Pass + { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On + ZTest LEqual + ColorMask 0 + Cull Back + + HLSLPROGRAM + #pragma target 3.0 + #pragma vertex ShadowPassVertex + #pragma fragment ShadowPassFragment + #pragma multi_compile_instancing + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl" + ENDHLSL + } + } +} diff --git a/Assets/GameMain/Materials/Shaders/DropEmission.shader.meta b/Assets/GameMain/Materials/Shaders/DropEmission.shader.meta new file mode 100644 index 0000000..732f8fe --- /dev/null +++ b/Assets/GameMain/Materials/Shaders/DropEmission.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ee6321f7c35d4f41a692ace420f07421 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs b/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs new file mode 100644 index 0000000..a1eb371 --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs @@ -0,0 +1,32 @@ +using GameFramework; +using GameFramework.Event; +using UnityEngine; + +namespace SepCore.Event +{ + public class DropSpawnRequestedEventArgs : GameEventArgs + { + public static readonly int EventId = typeof(DropSpawnRequestedEventArgs).GetHashCode(); + + public override int Id => EventId; + + public Vector3 Position { get; private set; } + + public DropSpawnRequestedEventArgs() + { + Position = Vector3.zero; + } + + public static DropSpawnRequestedEventArgs Create(Vector3 position) + { + var args = ReferencePool.Acquire(); + args.Position = position; + return args; + } + + public override void Clear() + { + Position = Vector3.zero; + } + } +} diff --git a/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs.meta b/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs.meta new file mode 100644 index 0000000..757627e --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Combat/DropSpawnRequestedEventArgs.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 17f56868934d4df4b230b3a12924fba7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs b/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs new file mode 100644 index 0000000..751a3f0 --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs @@ -0,0 +1,39 @@ +using GameFramework; +using GameFramework.Event; + +namespace SepCore.Event +{ + public class WaveHarvestSettlementEventArgs : GameEventArgs + { + public static readonly int EventId = typeof(WaveHarvestSettlementEventArgs).GetHashCode(); + + public override int Id => EventId; + + public int HarvestIncome { get; private set; } + public int HarvestGrowth { get; private set; } + public int CurrentHarvest { get; private set; } + + public WaveHarvestSettlementEventArgs() + { + HarvestIncome = 0; + HarvestGrowth = 0; + CurrentHarvest = 0; + } + + public static WaveHarvestSettlementEventArgs Create(int income, int growth, int currentHarvest) + { + var args = ReferencePool.Acquire(); + args.HarvestIncome = income; + args.HarvestGrowth = growth; + args.CurrentHarvest = currentHarvest; + return args; + } + + public override void Clear() + { + HarvestIncome = 0; + HarvestGrowth = 0; + CurrentHarvest = 0; + } + } +} diff --git a/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs.meta b/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs.meta new file mode 100644 index 0000000..280ff09 --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Combat/WaveHarvestSettlementEventArgs.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b78ae26ee6734a84aad77ca563607ee2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs b/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs new file mode 100644 index 0000000..2b00899 --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs @@ -0,0 +1,31 @@ +using GameFramework; +using GameFramework.Event; + +namespace SepCore.Event +{ + public class ShopGoodsLockEventArgs : GameEventArgs + { + public static readonly int EventId = typeof(ShopGoodsLockEventArgs).GetHashCode(); + + public override int Id => EventId; + + public int GoodsIndex { get; private set; } + + public ShopGoodsLockEventArgs() + { + GoodsIndex = -1; + } + + public static ShopGoodsLockEventArgs Create(int index) + { + var args = ReferencePool.Acquire(); + args.GoodsIndex = index; + return args; + } + + public override void Clear() + { + GoodsIndex = -1; + } + } +} diff --git a/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs.meta b/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs.meta new file mode 100644 index 0000000..b3ccab0 --- /dev/null +++ b/Assets/GameMain/Scripts/Base/Event/Shop/ShopGoodsLockEventArgs.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57dd9523362d470fa6e823b2478c18ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Base/Gen/GlobalConfig.cs b/Assets/GameMain/Scripts/Base/Gen/GlobalConfig.cs index efd070d..5891b68 100644 --- a/Assets/GameMain/Scripts/Base/Gen/GlobalConfig.cs +++ b/Assets/GameMain/Scripts/Base/Gen/GlobalConfig.cs @@ -52,8 +52,14 @@ public sealed partial class GlobalConfig : Luban.BeanBase CritMultiplier = _buf.ReadFloat(); DropEntityCoinCount = _buf.ReadInt(); DropEntityExpCount = _buf.ReadInt(); + {int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);DropEntityAssetNames = new System.Collections.Generic.List(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { string _e0; _e0 = _buf.ReadString(); DropEntityAssetNames.Add(_e0);}} EnemyBodyRadius = _buf.ReadFloat(); EnemySeparationIterations = _buf.ReadInt(); + RecoilDistance = _buf.ReadFloat(); + RecoilDuration = _buf.ReadFloat(); + DashAccelerationDuration = _buf.ReadFloat(); + DashMaxSpeedMultiplier = _buf.ReadFloat(); + TurnSpeed = _buf.ReadFloat(); } public static GlobalConfig DeserializeGlobalConfig(ByteBuf _buf) @@ -200,6 +206,11 @@ public sealed partial class GlobalConfig : Luban.BeanBase /// public readonly int DropEntityExpCount; /// + /// 掉落物预制体名列表 + /// + public readonly System.Collections.Generic.List DropEntityAssetNames; + public System.Collections.Generic.List DropEntityAssetNames_Ref; + /// /// 敌人碰撞半径 /// public readonly float EnemyBodyRadius; @@ -207,6 +218,26 @@ public sealed partial class GlobalConfig : Luban.BeanBase /// 敌人分离迭代次数 /// public readonly int EnemySeparationIterations; + /// + /// 掉落物拾取时后退距离 + /// + public readonly float RecoilDistance; + /// + /// 掉落物拾取时后退时间 + /// + public readonly float RecoilDuration; + /// + /// 冲刺加速时长 + /// + public readonly float DashAccelerationDuration; + /// + /// 冲刺最高倍率(基于吸收速度) + /// + public readonly float DashMaxSpeedMultiplier; + /// + /// 转向速度 + /// + public readonly float TurnSpeed; public const int __ID__ = -958250779; public override int GetTypeId() => __ID__; @@ -247,6 +278,14 @@ public sealed partial class GlobalConfig : Luban.BeanBase + DropEntityAssetNames_Ref = new System.Collections.Generic.List(); + foreach (var _v in DropEntityAssetNames) { DropEntityAssetNames_Ref.Add(tables.TbEntityConfig.GetOrDefault(_v)); } + + + + + + } @@ -288,8 +327,14 @@ public sealed partial class GlobalConfig : Luban.BeanBase + "critMultiplier:" + CritMultiplier + "," + "dropEntityCoinCount:" + DropEntityCoinCount + "," + "dropEntityExpCount:" + DropEntityExpCount + "," + + "dropEntityAssetNames:" + Luban.StringUtil.CollectionToString(DropEntityAssetNames) + "," + "enemyBodyRadius:" + EnemyBodyRadius + "," + "enemySeparationIterations:" + EnemySeparationIterations + "," + + "recoilDistance:" + RecoilDistance + "," + + "recoilDuration:" + RecoilDuration + "," + + "dashAccelerationDuration:" + DashAccelerationDuration + "," + + "dashMaxSpeedMultiplier:" + DashMaxSpeedMultiplier + "," + + "turnSpeed:" + TurnSpeed + "," + "}"; } } diff --git a/Assets/GameMain/Scripts/Base/Gen/TbGlobalConfig.cs b/Assets/GameMain/Scripts/Base/Gen/TbGlobalConfig.cs index b392cba..6180543 100644 --- a/Assets/GameMain/Scripts/Base/Gen/TbGlobalConfig.cs +++ b/Assets/GameMain/Scripts/Base/Gen/TbGlobalConfig.cs @@ -167,6 +167,10 @@ public partial class TbGlobalConfig /// public int DropEntityExpCount => _data.DropEntityExpCount; /// + /// 掉落物预制体名列表 + /// + public System.Collections.Generic.List DropEntityAssetNames => _data.DropEntityAssetNames; + /// /// 敌人碰撞半径 /// public float EnemyBodyRadius => _data.EnemyBodyRadius; @@ -174,6 +178,26 @@ public partial class TbGlobalConfig /// 敌人分离迭代次数 /// public int EnemySeparationIterations => _data.EnemySeparationIterations; + /// + /// 掉落物拾取时后退距离 + /// + public float RecoilDistance => _data.RecoilDistance; + /// + /// 掉落物拾取时后退时间 + /// + public float RecoilDuration => _data.RecoilDuration; + /// + /// 冲刺加速时长 + /// + public float DashAccelerationDuration => _data.DashAccelerationDuration; + /// + /// 冲刺最高倍率(基于吸收速度) + /// + public float DashMaxSpeedMultiplier => _data.DashMaxSpeedMultiplier; + /// + /// 转向速度 + /// + public float TurnSpeed => _data.TurnSpeed; public void ResolveRef(Tables tables) { diff --git a/Assets/GameMain/Scripts/Presentation/Shop/GoodsItemContext.cs b/Assets/GameMain/Scripts/Presentation/Shop/GoodsItemContext.cs index cf8084e..39ae9bc 100644 --- a/Assets/GameMain/Scripts/Presentation/Shop/GoodsItemContext.cs +++ b/Assets/GameMain/Scripts/Presentation/Shop/GoodsItemContext.cs @@ -16,6 +16,7 @@ namespace SepCore.UI public string TypeName; public string Description; public int Price; + public bool IsLocked; public GoodsItemContext() { @@ -26,6 +27,7 @@ namespace SepCore.UI Price = 0; Icon = null; ItemType = ItemType.Weapon; + IsLocked = false; } public GoodsItemContext(GoodsItemRawData rawData) : this() @@ -33,6 +35,7 @@ namespace SepCore.UI Price = rawData.Price; Rarity = rawData.Rarity; ItemType = rawData.ItemType; + IsLocked = rawData.IsLocked; if (ItemType == ItemType.Weapon) { diff --git a/Assets/GameMain/Scripts/Presentation/Shop/ShopController.cs b/Assets/GameMain/Scripts/Presentation/Shop/ShopController.cs index e66460f..b468dab 100644 --- a/Assets/GameMain/Scripts/Presentation/Shop/ShopController.cs +++ b/Assets/GameMain/Scripts/Presentation/Shop/ShopController.cs @@ -25,6 +25,7 @@ namespace SepCore.UI protected override void SubscribeCustomEvents() { GameEntry.Event.Subscribe(ShopRefreshEventArgs.EventId, ShopRefresh); + GameEntry.Event.Subscribe(ShopGoodsLockEventArgs.EventId, ShopGoodsLock); GameEntry.Event.Subscribe(ShopPurchaseEventArgs.EventId, ShopPurchase); GameEntry.Event.Subscribe(ShopContinueEventArgs.EventId, ShopContinue); GameEntry.Event.Subscribe(DisplayItemHoverEventArgs.EventId, DisplayItemHover); @@ -38,6 +39,7 @@ namespace SepCore.UI protected override void UnsubscribeCustomEvents() { GameEntry.Event.Unsubscribe(ShopRefreshEventArgs.EventId, ShopRefresh); + GameEntry.Event.Unsubscribe(ShopGoodsLockEventArgs.EventId, ShopGoodsLock); GameEntry.Event.Unsubscribe(ShopPurchaseEventArgs.EventId, ShopPurchase); GameEntry.Event.Unsubscribe(ShopContinueEventArgs.EventId, ShopContinue); GameEntry.Event.Unsubscribe(DisplayItemHoverEventArgs.EventId, DisplayItemHover); @@ -355,6 +357,27 @@ namespace SepCore.UI ApplyGoodsPurchased(result); } + private void ShopGoodsLock(object sender, GameEventArgs e) + { + if (e is not ShopGoodsLockEventArgs args) + { + return; + } + + if (_useCase == null || Context == null) + { + return; + } + + bool isLocked = _useCase.ToggleLock(args.GoodsIndex); + if (args.GoodsIndex >= 0 && args.GoodsIndex < Context.GoodsItems.Count && Context.GoodsItems[args.GoodsIndex] != null) + { + Context.GoodsItems[args.GoodsIndex].IsLocked = isLocked; + Context.NeedRefreshGoodsItems = true; + RefreshUI(Form, Context); + } + } + private void ShopContinue(object sender, GameEventArgs e) { if (e is not ShopContinueEventArgs) diff --git a/Assets/GameMain/Scripts/Presentation/Shop/ShopGoodsItem.cs b/Assets/GameMain/Scripts/Presentation/Shop/ShopGoodsItem.cs index fb9e834..a711168 100644 --- a/Assets/GameMain/Scripts/Presentation/Shop/ShopGoodsItem.cs +++ b/Assets/GameMain/Scripts/Presentation/Shop/ShopGoodsItem.cs @@ -20,6 +20,8 @@ namespace SepCore.UI [SerializeField] private TMP_Text _costText; [SerializeField] private CommonButton _purchaseButton = null; [SerializeField] private TMP_Text _purchaseLabel = null; + [SerializeField] private CommonButton _lockButton = null; + [SerializeField] private TMP_Text _lockLabel = null; [SerializeField] private CanvasGroup _canvasGroup = null; [SerializeField] private RarityPalette _rarityPalette = null; [SerializeField] private Image _rarityBackground = null; @@ -46,6 +48,12 @@ namespace SepCore.UI _typeText.text = data.TypeName; _descriptionText.text = data.Description; _costText.text = $"{data.Price} "; + UpdateLockDisplay(data.IsLocked); + } + + public void UpdateLockDisplay(bool isLocked) + { + _lockLabel.text = isLocked ? "已锁定" : "锁定"; } public void OnReset() @@ -54,6 +62,8 @@ namespace SepCore.UI _data = null; _iconArea.OnReset(); SetRarity(Rarity.None); + _lockButton.interactable = true; + _lockLabel.text = "锁定"; } public void MarkPurchased() @@ -63,6 +73,8 @@ namespace SepCore.UI _canvasGroup.alpha = 0.5f; _purchaseButton.interactable = false; _purchaseLabel.text = "已购买"; + _lockButton.interactable = false; + _lockLabel.text = "锁定"; } private void SetRarity(Rarity rarity) @@ -95,6 +107,7 @@ namespace SepCore.UI _listenersBound = true; _purchaseButton.onClick.AddListener(OnPurchaseClick); + _lockButton.onClick.AddListener(OnLockClick); } private void OnPurchaseClick() @@ -106,5 +119,15 @@ namespace SepCore.UI GameEntry.Event.Fire(this, ShopPurchaseEventArgs.Create(_index)); } + + private void OnLockClick() + { + if (_index < 0) + { + return; + } + + GameEntry.Event.Fire(this, ShopGoodsLockEventArgs.Create(_index)); + } } } diff --git a/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs b/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs index 49e6a45..91c5904 100644 --- a/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs +++ b/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs @@ -3,6 +3,7 @@ using SepCore.Event; using SepCore.Entity; using SepCore.Definition; using SepCore.EnemyManager; +using SepCore.Battle; using SepCore.Simulation; using SepCore.Timer; using UnityEngine; @@ -12,16 +13,13 @@ namespace SepCore.Procedure { public class GameStateBattle : GameStateBase { - private const float VacuumMaxDuration = 0.8f; - private const float VacuumAbsorbSpeed = 30f; - public override GameStateType GameStateType => GameStateType.Battle; private EnemyManagerComponent _enemyManager; + private DropService _dropService; private int _currentLevel; private TimerHandle _levelTimerHandle; private bool _isWaveEnding; - private float _vacuumTimer; private Player Player => _procedureGame.Player; private ProcedureGame _procedureGame; @@ -41,14 +39,15 @@ namespace SepCore.Procedure public override void OnInit(ProcedureGame master) { _enemyManager = GameEntry.EnemyManager; + _dropService = new DropService(); _procedureGame = master; } public override void OnEnter() { + _dropService.Subscribe(); _currentLevel = _procedureGame.CurrentLevel; _isWaveEnding = false; - _vacuumTimer = 0f; var levelConfig = GameEntry.Luban.Get(_currentLevel); _levelTimerHandle = GameEntry.Timer.ScheduleOnce(levelConfig.Duration, OnLevelTimeUp, this); @@ -69,10 +68,9 @@ namespace SepCore.Procedure Vector3 currentPos = Player.CachedTransform.position; GameEntry.SimulationWorld.Tick(new SimulationTickContext(elapseSeconds, currentPos)); - _vacuumTimer -= elapseSeconds; - if (GameEntry.SimulationWorld.PickupCount == 0 || _vacuumTimer <= 0f) + if (_dropService.UpdateVacuum(elapseSeconds, Player)) { - CollectAllRemainingDrops(Player); + HarvestSettlementUtility.Settle(Player); _isWaveEnding = false; _procedureGame.BattleToShopOrLevelUp(); } @@ -93,7 +91,6 @@ namespace SepCore.Procedure if (_isWaveEnding) return; _isWaveEnding = true; - _vacuumTimer = VacuumMaxDuration; // 1. 停止玩家移动与射击 Player.Enable = false; @@ -104,9 +101,8 @@ namespace SepCore.Procedure // 3. 隐藏所有投射物 HideEntityGroup(GameEntry.Luban.Global.ProjectileGroupName); - // 4. 触发全图磁铁,并提高吸附速度 - GameEntry.SimulationWorld.TriggerFullMapMagnet(); - GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(999f, VacuumAbsorbSpeed, GameEntry.Luban.Global.CollectDistance); + // 4. 触发掉落物全图吸附 + _dropService.StartVacuum(); } public override void OnLeave() @@ -127,35 +123,20 @@ namespace SepCore.Procedure // 停止玩家逻辑 Player.Enable = false; - // 隐藏所有掉落物与投射物实体 - HideEntityGroup(GameEntry.Luban.Global.DropGroupName); + // 清理掉落物并隐藏所有投射物实体 + _dropService.HideAllDrops(); HideEntityGroup(GameEntry.Luban.Global.ProjectileGroupName); + _dropService.Unsubscribe(); } public override void OnDestroy() { + _dropService.Unsubscribe(); _enemyManager = null; + _dropService = null; _procedureGame = null; } - private static void CollectAllRemainingDrops(Player player) - { - if (player == null || !GameEntry.Entity.HasEntityGroup(GameEntry.Luban.Global.DropGroupName)) - { - return; - } - - var entityGroup = GameEntry.Entity.GetEntityGroup(GameEntry.Luban.Global.DropGroupName); - var entities = entityGroup.GetAllEntities(); - foreach (var entity in entities) - { - if (entity is UnityGameFramework.Runtime.Entity runtimeEntity && runtimeEntity.Logic is DropEntity drop) - { - drop.TryCollect(player); - } - } - } - private static void HideEntityGroup(string groupName) { if (!GameEntry.Entity.HasEntityGroup(groupName)) diff --git a/Assets/GameMain/Scripts/Procedure/Game/GameStateShop.cs b/Assets/GameMain/Scripts/Procedure/Game/GameStateShop.cs index 61a00de..1852b7a 100644 --- a/Assets/GameMain/Scripts/Procedure/Game/GameStateShop.cs +++ b/Assets/GameMain/Scripts/Procedure/Game/GameStateShop.cs @@ -23,7 +23,7 @@ namespace SepCore.Procedure _procedureGame = master; var shopFormUseCase = - new ShopUseCase(_procedureGame.Player, _procedureGame.CurrentLevel, () => ShopFinish = true); + new ShopUseCase(_procedureGame.Player, () => _procedureGame.CurrentLevel, () => ShopFinish = true); GameEntry.UIRouter.BindUIUseCase(UIFormType.ShopForm, shopFormUseCase); } diff --git a/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs b/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs new file mode 100644 index 0000000..0578b85 --- /dev/null +++ b/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs @@ -0,0 +1,107 @@ +using Cysharp.Threading.Tasks; +using GameFramework.Event; +using SepCore.AsyncTask; +using SepCore.CustomComponent; +using SepCore.Definition; +using SepCore.Entity; +using SepCore.Event; +using Random = UnityEngine.Random; + +namespace SepCore.Battle +{ + public sealed class DropService + { + private const float VacuumMaxDuration = 0.8f; + private const float VacuumAbsorbSpeed = 30f; + private TbGlobalConfig _globalConfig; + + private bool _isListening; + private float _vacuumTimer; + + public void Subscribe() + { + if (_isListening) + { + return; + } + + _globalConfig = GameEntry.Luban.Global; + GameEntry.Event.Subscribe(DropSpawnRequestedEventArgs.EventId, OnDropSpawnRequested); + _isListening = true; + } + + public void Unsubscribe() + { + if (!_isListening) + { + return; + } + + _globalConfig = null; + GameEntry.Event.Unsubscribe(DropSpawnRequestedEventArgs.EventId, OnDropSpawnRequested); + _isListening = false; + } + + public void StartVacuum() + { + _vacuumTimer = VacuumMaxDuration; + + GameEntry.SimulationWorld.TriggerFullMapMagnet(); + GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(999f, VacuumAbsorbSpeed, + _globalConfig.CollectDistance, _globalConfig.RecoilDistance, + _globalConfig.RecoilDuration, _globalConfig.DashAccelerationDuration, + _globalConfig.DashMaxSpeedMultiplier, _globalConfig.TurnSpeed); + } + + public bool UpdateVacuum(float elapseSeconds, Player player) + { + _vacuumTimer -= elapseSeconds; + if (GameEntry.SimulationWorld.PickupCount > 0 && _vacuumTimer > 0f) + { + return false; + } + + CollectAllRemainingDrops(player); + return true; + } + + public void HideAllDrops() + { + _vacuumTimer = 0f; + + var entityGroup = GameEntry.Entity.GetEntityGroup(_globalConfig.DropGroupName); + var entities = entityGroup.GetAllEntities(); + foreach (var entity in entities) + { + GameEntry.Entity.HideEntity(entity.Id); + } + } + + private void CollectAllRemainingDrops(Player player) + { + var entityGroup = GameEntry.Entity.GetEntityGroup(_globalConfig.DropGroupName); + var entities = entityGroup.GetAllEntities(); + foreach (var entity in entities) + { + if (entity is UnityGameFramework.Runtime.Entity runtimeEntity && runtimeEntity.Logic is DropEntity drop) + { + drop.TryCollect(player); + } + } + } + + private void OnDropSpawnRequested(object sender, GameEventArgs e) + { + var eventArgs = (DropSpawnRequestedEventArgs)e; + int idx = Random.Range(0, _globalConfig.DropEntityAssetNames.Count); + var dropEntityAssetName = _globalConfig.DropEntityAssetNames[idx]; + var data = new DropData(_globalConfig.DropEntityCoinCount, _globalConfig.DropEntityExpCount, + GameEntry.Entity.NextId(), dropEntityAssetName) + { + Position = eventArgs.Position + }; + + GameEntry.Entity.ShowDropAsync(data).Forget(); + } + } +} diff --git a/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs.meta b/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs.meta new file mode 100644 index 0000000..5b1adb4 --- /dev/null +++ b/Assets/GameMain/Scripts/Runtime/Battle/DropService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 567ca35279f741d79f25e6d04bda5a63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs b/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs new file mode 100644 index 0000000..e575053 --- /dev/null +++ b/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs @@ -0,0 +1,63 @@ +using SepCore.Definition; +using SepCore.Entity; +using SepCore.Event; +using UnityEngine; +using UnityGameFramework.Runtime; + +namespace SepCore.Battle +{ + public readonly struct HarvestSettlementResult + { + public static readonly HarvestSettlementResult Empty = new(0, 0, 0); + + public int Income { get; } + public int Growth { get; } + public int NewHarvest { get; } + + public HarvestSettlementResult(int income, int growth, int newHarvest) + { + Income = income; + Growth = growth; + NewHarvest = newHarvest; + } + } + + public static class HarvestSettlementUtility + { + public const float HarvestCompoundRate = 0.05f; + public const string HarvestModifierSource = "HarvestInterest"; + + public static HarvestSettlementResult Settle(Player player) + { + if (player == null || !player.Available) + { + return HarvestSettlementResult.Empty; + } + + int currentHarvest = Mathf.FloorToInt(player.StatComponent.GetStatValue(StatType.Harvesting)); + if (currentHarvest <= 0) + { + return HarvestSettlementResult.Empty; + } + + // 1. 发放等额金币/材料 + player.Coin += currentHarvest; + + // 2. 复合增长(利息):永久提升 5%(向上取整) + int growth = Mathf.CeilToInt(currentHarvest * HarvestCompoundRate); + if (growth > 0) + { + player.StatComponent.AddModifier( + StatType.Harvesting, + new StatModifier(growth, ModifierType.Flat, HarvestModifierSource)); + } + + int newHarvest = Mathf.FloorToInt(player.StatComponent.GetStatValue(StatType.Harvesting)); + + // 3. 广播收获结算事件 + GameEntry.Event.Fire(player, WaveHarvestSettlementEventArgs.Create(currentHarvest, growth, newHarvest)); + + return new HarvestSettlementResult(currentHarvest, growth, newHarvest); + } + } +} diff --git a/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs.meta b/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs.meta new file mode 100644 index 0000000..6eedb4f --- /dev/null +++ b/Assets/GameMain/Scripts/Runtime/Battle/HarvestSettlementUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 193a30e24142468791b5c899b31ccae8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Runtime/Components/AbsorbComponent.cs b/Assets/GameMain/Scripts/Runtime/Components/AbsorbComponent.cs index fc35bb5..f262792 100644 --- a/Assets/GameMain/Scripts/Runtime/Components/AbsorbComponent.cs +++ b/Assets/GameMain/Scripts/Runtime/Components/AbsorbComponent.cs @@ -11,6 +11,11 @@ namespace SepCore.Components public float AbsorbRange => GameEntry.Luban.Global.DefaultAbsorbRange; public float AbsorbSpeed => GameEntry.Luban.Global.AbsorbSpeed; public float CollectDistance => GameEntry.Luban.Global.CollectDistance; + public float RecoilDistance => GameEntry.Luban.Global.RecoilDistance; + public float RecoilDuration => GameEntry.Luban.Global.RecoilDuration; + public float DashAccelerationDuration => GameEntry.Luban.Global.DashAccelerationDuration; + public float DashMaxSpeedMultiplier => GameEntry.Luban.Global.DashMaxSpeedMultiplier; + public float TurnSpeed => GameEntry.Luban.Global.TurnSpeed; public void OnInit(Player player) { @@ -22,7 +27,8 @@ namespace SepCore.Components { if (!_player.Available) return; - GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(AbsorbRange, AbsorbSpeed, CollectDistance); + GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(AbsorbRange, AbsorbSpeed, CollectDistance, + RecoilDistance, RecoilDuration, DashAccelerationDuration, DashMaxSpeedMultiplier, TurnSpeed); } public void OnReset() diff --git a/Assets/GameMain/Scripts/Runtime/Components/MovementComponent.cs b/Assets/GameMain/Scripts/Runtime/Components/MovementComponent.cs index 13f2b76..b92b085 100644 --- a/Assets/GameMain/Scripts/Runtime/Components/MovementComponent.cs +++ b/Assets/GameMain/Scripts/Runtime/Components/MovementComponent.cs @@ -37,8 +37,8 @@ namespace SepCore.Components _cachedTransform = target; _direction = Vector3.forward; _avoidEnemyOverlap = avoidEnemyOverlap; - _enemyBodyRadius = GameEntry.Luban.Global.EnemyBodyRadius; - _separationIterations = GameEntry.Luban.Global.EnemySeparationIterations; + _enemyBodyRadius = enemyBodyRadius ?? GameEntry.Luban.Global.EnemyBodyRadius; + _separationIterations = separationIterations ?? GameEntry.Luban.Global.EnemySeparationIterations; TryGetComponent(out _player); TryGetComponent(out _enemy); diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupStateSim.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupStateSim.cs index abe154d..454c996 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupStateSim.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupStateSim.cs @@ -3,8 +3,16 @@ namespace SepCore.Simulation internal struct PickupStateSim : ISimulationComponent { public const int StateIdle = 0; - public const int StateAbsorbing = 1; + public const int StateAbsorbRequested = 1; + public const int StateRecoil = 2; + public const int StateDash = 3; + public const int StateCollected = 4; public int State; + public float PhaseElapsed; + public float IdleElapsed; + public float FloatBaseHeight; + public Unity.Mathematics.float3 RecoilStartPosition; + public Unity.Mathematics.float3 RecoilDirection; } } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupTransformSim.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupTransformSim.cs index 20b5f67..39edb9d 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupTransformSim.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Components/PickupTransformSim.cs @@ -5,5 +5,6 @@ namespace SepCore.Simulation internal struct PickupTransformSim : ISimulationComponent { public float3 Position; + public float3 Forward; } } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/ISimulationWorld.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/ISimulationWorld.cs index 79b0b5c..3f6c228 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/ISimulationWorld.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/ISimulationWorld.cs @@ -30,7 +30,9 @@ namespace SepCore.Simulation void SyncEnemyMovementInput(int entityId, bool isMoving, in Vector3 direction, float speed, bool avoidEnemyOverlap, float enemyBodyRadius, int separationIterations); - void SyncPlayerAbsorbSettings(float absorbRange, float absorbSpeed, float collectDistance); + void SyncPlayerAbsorbSettings(float absorbRange, float absorbSpeed, float collectDistance, + float recoilDistance, float recoilDuration, float dashAccelerationDuration, + float dashMaxSpeedMultiplier, float turnSpeed); void TriggerFullMapMagnet(); } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Jobs/SimulationWorld.EnemyJobs.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Jobs/SimulationWorld.EnemyJobs.cs index 88bc5f0..f4bc706 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Jobs/SimulationWorld.EnemyJobs.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Jobs/SimulationWorld.EnemyJobs.cs @@ -12,30 +12,72 @@ namespace SepCore.Simulation private float _playerAbsorbRange = -1f; private float _playerAbsorbSpeed = -1f; private float _playerCollectDistance = -1f; + private float _playerRecoilDistance = -1f; + private float _playerRecoilDuration = -1f; + private float _playerDashAccelerationDuration = -1f; + private float _playerDashMaxSpeedMultiplier = -1f; + private float _playerTurnSpeed = -1f; - public void SyncPlayerAbsorbSettings(float absorbRange, float absorbSpeed, float collectDistance) + public void SyncPlayerAbsorbSettings(float absorbRange, float absorbSpeed, float collectDistance, + float recoilDistance, float recoilDuration, float dashAccelerationDuration, + float dashMaxSpeedMultiplier, float turnSpeed) { _playerAbsorbRange = absorbRange; _playerAbsorbSpeed = absorbSpeed; _playerCollectDistance = collectDistance; + _playerRecoilDistance = recoilDistance; + _playerRecoilDuration = recoilDuration; + _playerDashAccelerationDuration = dashAccelerationDuration; + _playerDashMaxSpeedMultiplier = dashMaxSpeedMultiplier; + _playerTurnSpeed = turnSpeed; } private float ResolveAbsorbRange() { if (_playerAbsorbRange >= 0f) return _playerAbsorbRange; - return GameEntry.Luban != null ? GameEntry.Luban.Global.DefaultAbsorbRange : 2f; + return GameEntry.Luban.Global.DefaultAbsorbRange; } private float ResolveAbsorbSpeed() { if (_playerAbsorbSpeed >= 0f) return _playerAbsorbSpeed; - return GameEntry.Luban != null ? GameEntry.Luban.Global.AbsorbSpeed : 8f; + return GameEntry.Luban.Global.AbsorbSpeed; } private float ResolveCollectDistance() { if (_playerCollectDistance >= 0f) return _playerCollectDistance; - return GameEntry.Luban != null ? GameEntry.Luban.Global.CollectDistance : 0.5f; + return GameEntry.Luban.Global.CollectDistance; + } + + private float ResolveRecoilDistance() + { + if (_playerRecoilDistance >= 0f) return _playerRecoilDistance; + return GameEntry.Luban.Global.RecoilDistance; + } + + private float ResolveRecoilDuration() + { + if (_playerRecoilDuration >= 0f) return _playerRecoilDuration; + return GameEntry.Luban.Global.RecoilDuration; + } + + private float ResolveDashAccelerationDuration() + { + if (_playerDashAccelerationDuration >= 0f) return _playerDashAccelerationDuration; + return GameEntry.Luban.Global.DashAccelerationDuration; + } + + private float ResolveDashMaxSpeedMultiplier() + { + if (_playerDashMaxSpeedMultiplier >= 0f) return _playerDashMaxSpeedMultiplier; + return GameEntry.Luban.Global.DashMaxSpeedMultiplier; + } + + private float ResolveTurnSpeed() + { + if (_playerTurnSpeed >= 0f) return _playerTurnSpeed; + return GameEntry.Luban.Global.TurnSpeed; } [Header("敌人互斥参数")] @@ -146,8 +188,14 @@ namespace SepCore.Simulation float absorbRange = ResolveAbsorbRange(); float absorbSpeed = ResolveAbsorbSpeed(); float collectDistance = ResolveCollectDistance(); + float recoilDistance = ResolveRecoilDistance(); + float recoilDuration = ResolveRecoilDuration(); + float dashAccelerationDuration = ResolveDashAccelerationDuration(); + float dashMaxSpeedMultiplier = ResolveDashMaxSpeedMultiplier(); + float turnSpeed = ResolveTurnSpeed(); pickupMovementHandle = PickupMovementSystem.Schedule(_pickups, _collectedPickups, context.DeltaTime, - planarPlayerPosition, absorbRange, absorbSpeed, collectDistance, default); + planarPlayerPosition, absorbRange, absorbSpeed, collectDistance, recoilDistance, + recoilDuration, dashAccelerationDuration, dashMaxSpeedMultiplier, turnSpeed, default); } } @@ -232,20 +280,12 @@ namespace SepCore.Simulation } else { - var entityComponent = GameEntry.Entity; - if (entityComponent != null) - { - entityComponent.HideEntity(drop); - } + GameEntry.Entity.HideEntity(drop); } } else { - var entityComponent = GameEntry.Entity; - if (entityComponent != null) - { - entityComponent.HideEntity(entity); - } + GameEntry.Entity.HideEntity(entity); } } @@ -264,19 +304,16 @@ namespace SepCore.Simulation } var entityComponent = GameEntry.Entity; - if (entityComponent != null && GameEntry.Luban != null) + var group = entityComponent.GetEntityGroup(GameEntry.Luban.Global.PlayerGroupName); + if (group != null && group.EntityCount > 0) { - var group = entityComponent.GetEntityGroup(GameEntry.Luban.Global.PlayerGroupName); - if (group != null && group.EntityCount > 0) + var entities = group.GetAllEntities(); + for (int i = 0; i < entities.Length; i++) { - var entities = group.GetAllEntities(); - for (int i = 0; i < entities.Length; i++) + if (entities[i] is UnityGameFramework.Runtime.Entity ugfEntity && + ugfEntity.Logic is Player player && player.Available) { - if (entities[i] is UnityGameFramework.Runtime.Entity ugfEntity && - ugfEntity.Logic is Player player && player.Available) - { - return player; - } + return player; } } } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Presentation/SimulationWorld.TransformSync.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Presentation/SimulationWorld.TransformSync.cs index 057b615..d4b3c7a 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Presentation/SimulationWorld.TransformSync.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Presentation/SimulationWorld.TransformSync.cs @@ -16,30 +16,22 @@ namespace SepCore.Simulation public void OnLateUpdate() { - if (_world == null) - { - return; - } - var enemyManager = GameEntry.EnemyManager; - if (enemyManager != null && enemyManager.Enemies != null) + var enemies = enemyManager.Enemies; + foreach (var enemy in enemies) { - var enemies = enemyManager.Enemies; - foreach (var enemy in enemies) + if (enemy is not EnemyBase enemyEntity || !enemyEntity.Available) { - if (enemy is not EnemyBase enemyEntity || !enemyEntity.Available) - { - continue; - } - - if (!_world._enemies.TryGetSimulationIndex(enemyEntity.Id, out int simulationIndex)) - { - continue; - } - - EnemyTransformSim enemyData = _world._enemies.Transform[simulationIndex]; - ApplyEnemyPresentation(enemyEntity, in enemyData); + continue; } + + if (!_world._enemies.TryGetSimulationIndex(enemyEntity.Id, out int simulationIndex)) + { + continue; + } + + EnemyTransformSim enemyData = _world._enemies.Transform[simulationIndex]; + ApplyEnemyPresentation(enemyEntity, in enemyData); } var projectiles = _world._projectiles; @@ -69,7 +61,15 @@ namespace SepCore.Simulation continue; } - pickupEntity.CachedTransform.position = ToVector3(pickups.Transform[i].Position); + PickupTransformSim transformData = pickups.Transform[i]; + Transform pickupTransform = pickupEntity.CachedTransform; + pickupTransform.position = ToVector3(transformData.Position); + Vector3 forward = ToVector3(transformData.Forward); + forward.y = 0f; + if (forward.sqrMagnitude > float.Epsilon) + { + pickupTransform.rotation = Quaternion.LookRotation(forward.normalized, Vector3.up); + } } } @@ -99,11 +99,6 @@ namespace SepCore.Simulation in ProjectileTransformSim projectileData) { Transform projectileTransform = projectileEntity.CachedTransform; - if (projectileTransform == null) - { - return; - } - projectileTransform.position = ToVector3(projectileData.Position); Vector3 forward = ToVector3(projectileData.Forward); if (forward.sqrMagnitude <= float.Epsilon) diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimData/PickupSimData.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimData/PickupSimData.cs index 16d0cbb..784fab9 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimData/PickupSimData.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimData/PickupSimData.cs @@ -6,6 +6,7 @@ namespace SepCore.Simulation { public int EntityId; public Vector3 Position; + public Vector3 Forward; public float PickupRadius; public int State; } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.EntityToSimData.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.EntityToSimData.cs index 44ac4e9..a0a49cd 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.EntityToSimData.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.EntityToSimData.cs @@ -95,6 +95,7 @@ namespace SepCore.Simulation { EntityId = pickupEntity.Id, Position = pickupEntity.CachedTransform.position, + Forward = pickupEntity.CachedTransform.forward, PickupRadius = 0.35f }; } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.SimEntityState.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.SimEntityState.cs index 30f121e..06b1cc6 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.SimEntityState.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/SimulationWorld.SimEntityState.cs @@ -290,6 +290,7 @@ namespace SepCore.Simulation { EntityId = entityId, Position = ToVector3(transform.Position), + Forward = ToVector3(transform.Forward), PickupRadius = radius.Radius, State = state.State }; @@ -302,9 +303,9 @@ namespace SepCore.Simulation return _pickups.Add( new PickupIdentitySim { EntityId = simData.EntityId }, - new PickupTransformSim { Position = ToFloat3(simData.Position) }, + new PickupTransformSim { Position = ToFloat3(simData.Position), Forward = ToFloat3(simData.Forward) }, new PickupRadiusSim { Radius = simData.PickupRadius }, - new PickupStateSim { State = simData.State }); + new PickupStateSim { State = simData.State, FloatBaseHeight = simData.Position.y }); } internal int UpsertPickup(in PickupSimData simData) @@ -315,9 +316,17 @@ namespace SepCore.Simulation } _pickups.Identity[index] = new PickupIdentitySim { EntityId = simData.EntityId }; - _pickups.Transform[index] = new PickupTransformSim { Position = ToFloat3(simData.Position) }; + _pickups.Transform[index] = new PickupTransformSim + { + Position = ToFloat3(simData.Position), + Forward = ToFloat3(simData.Forward) + }; _pickups.Radius[index] = new PickupRadiusSim { Radius = simData.PickupRadius }; - _pickups.State[index] = new PickupStateSim { State = simData.State }; + _pickups.State[index] = new PickupStateSim + { + State = simData.State, + FloatBaseHeight = simData.Position.y + }; return index; } @@ -326,7 +335,15 @@ namespace SepCore.Simulation int pickupCount = _pickups.Count; for (int i = 0; i < pickupCount; i++) { - _pickups.State[i] = new PickupStateSim { State = PickupStateSim.StateAbsorbing }; + PickupStateSim state = _pickups.State[i]; + if (state.State != PickupStateSim.StateIdle) + { + continue; + } + + state.State = PickupStateSim.StateAbsorbRequested; + state.PhaseElapsed = 0f; + _pickups.State[i] = state; } } diff --git a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Systems/PickupMovementSystem.cs b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Systems/PickupMovementSystem.cs index ec631bf..db4af36 100644 --- a/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Systems/PickupMovementSystem.cs +++ b/Assets/GameMain/Scripts/Runtime/CustomComponent/Simulation/Systems/PickupMovementSystem.cs @@ -11,14 +11,10 @@ namespace SepCore.Simulation // W CollectedPickups public static JobHandle Schedule(PickupStore pickups, NativeList collectedPickups, float deltaTime, float3 playerPosition, float absorbRange, float absorbSpeed, float collectDistance, - JobHandle dependency) + float recoilDistance, float recoilDuration, float dashAccelerationDuration, + float dashMaxSpeedMultiplier, float turnSpeed, JobHandle dependency) { int pickupCount = pickups.Count; - if (pickupCount == 0) - { - return dependency; - } - PickupMovementJob job = new PickupMovementJob { Transforms = pickups.Transform.Data.AsArray(), @@ -27,9 +23,14 @@ namespace SepCore.Simulation Radii = pickups.Radius.Data.AsArray(), CollectedPickups = collectedPickups.AsParallelWriter(), PlayerPosition = playerPosition, - AbsorbRange = math.max(0f, absorbRange), - AbsorbSpeed = math.max(0f, absorbSpeed), - CollectDistance = math.max(0f, collectDistance), + AbsorbRange = absorbRange, + AbsorbSpeed = absorbSpeed, + CollectDistance = collectDistance, + RecoilDistance = recoilDistance, + RecoilDuration = recoilDuration, + DashAccelerationDuration = dashAccelerationDuration, + DashMaxSpeedMultiplier = dashMaxSpeedMultiplier, + TurnSpeedRadians = math.radians(turnSpeed), DeltaTime = deltaTime }; return job.Schedule(pickupCount, 64, dependency); @@ -39,6 +40,10 @@ namespace SepCore.Simulation [BurstCompile] internal struct PickupMovementJob : IJobParallelFor { + private const float IdleFloatAmplitude = 0.08f; + private const float IdleFloatAngularFrequency = 3.14159265f; + private const float IdleRotationSpeedRadians = 0.610865238f; + public NativeArray Transforms; public NativeArray States; [ReadOnly] public NativeArray Identities; @@ -48,52 +53,189 @@ namespace SepCore.Simulation public float AbsorbRange; public float AbsorbSpeed; public float CollectDistance; + public float RecoilDistance; + public float RecoilDuration; + public float DashAccelerationDuration; + public float DashMaxSpeedMultiplier; + public float TurnSpeedRadians; public float DeltaTime; public void Execute(int index) { PickupTransformSim transform = Transforms[index]; PickupStateSim state = States[index]; - PickupIdentitySim identity = Identities[index]; - PickupRadiusSim radius = Radii[index]; - - float3 currentPosition = transform.Position; - float3 horizontalPosition = new float3(currentPosition.x, 0f, currentPosition.z); - float3 toPlayer = PlayerPosition - horizontalPosition; - float sqrDistance = math.lengthsq(toPlayer); - - float effectiveCollectDistance = math.max(CollectDistance, radius.Radius); - float sqrCollectDistance = effectiveCollectDistance * effectiveCollectDistance; - - if (sqrDistance <= sqrCollectDistance) + if (state.State == PickupStateSim.StateCollected) { - CollectedPickups.AddNoResize(identity.EntityId); return; } - bool isAbsorbing = state.State == PickupStateSim.StateAbsorbing; - bool shouldAbsorb = isAbsorbing || (AbsorbRange > 0f && sqrDistance <= AbsorbRange * AbsorbRange); + PickupIdentitySim identity = Identities[index]; + PickupRadiusSim radius = Radii[index]; + float effectiveCollectDistance = math.max(CollectDistance, radius.Radius); + float deltaTime = DeltaTime; - if (shouldAbsorb && AbsorbSpeed > 0f && sqrDistance > float.Epsilon) + if (state.State == PickupStateSim.StateIdle) { - state.State = PickupStateSim.StateAbsorbing; - float distance = math.sqrt(sqrDistance); - float step = AbsorbSpeed * DeltaTime; + state.IdleElapsed = math.fmod(state.IdleElapsed + deltaTime, + 2f * math.PI / IdleFloatAngularFrequency); + transform.Position.y = state.FloatBaseHeight + + math.sin(state.IdleElapsed * IdleFloatAngularFrequency) * IdleFloatAmplitude; + RotateWhileIdle(ref transform, deltaTime); - if (step >= distance) + float3 toPlayer = PlayerPosition - transform.Position; + toPlayer.y = 0f; + if (AbsorbRange <= 0f || math.lengthsq(toPlayer) > AbsorbRange * AbsorbRange || AbsorbSpeed <= 0f) { - transform.Position = new float3(PlayerPosition.x, currentPosition.y, PlayerPosition.z); - CollectedPickups.AddNoResize(identity.EntityId); + Transforms[index] = transform; + States[index] = state; + return; + } + + BeginRecoil(ref transform, ref state, PlayerPosition); + } + else if (state.State == PickupStateSim.StateAbsorbRequested) + { + BeginRecoil(ref transform, ref state, PlayerPosition); + } + + float remainingDeltaTime = deltaTime; + if (state.State == PickupStateSim.StateRecoil && remainingDeltaTime > 0f) + { + if (RecoilDuration <= 0f) + { + transform.Position = state.RecoilStartPosition + state.RecoilDirection * RecoilDistance; + state.State = PickupStateSim.StateDash; + state.PhaseElapsed = 0f; } else { - float3 direction = toPlayer / distance; - transform.Position = currentPosition + direction * step; - } + float phaseRemaining = RecoilDuration - state.PhaseElapsed; + float stepTime = math.min(remainingDeltaTime, phaseRemaining); + state.PhaseElapsed += stepTime; + float recoilProgress = math.saturate(state.PhaseElapsed / RecoilDuration); + transform.Position = state.RecoilStartPosition + + state.RecoilDirection * (RecoilDistance * recoilProgress); + remainingDeltaTime -= stepTime; - Transforms[index] = transform; - States[index] = state; + if (state.PhaseElapsed >= RecoilDuration) + { + state.State = PickupStateSim.StateDash; + state.PhaseElapsed = 0f; + } + } } + + if (state.State == PickupStateSim.StateDash) + { + float3 toPlayer = PlayerPosition - transform.Position; + toPlayer.y = 0f; + float distance = math.length(toPlayer); + if (distance <= effectiveCollectDistance) + { + MarkCollected(ref state, identity.EntityId); + } + else if (remainingDeltaTime > 0f && AbsorbSpeed > 0f) + { + float step = GetDashDistance(AbsorbSpeed, state.PhaseElapsed, remainingDeltaTime, + DashAccelerationDuration, DashMaxSpeedMultiplier); + float distanceToCollect = distance - effectiveCollectDistance; + float movedDistance = math.min(step, distanceToCollect); + transform.Position += toPlayer / distance * movedDistance; + state.PhaseElapsed += remainingDeltaTime; + if (movedDistance >= distanceToCollect) + { + MarkCollected(ref state, identity.EntityId); + } + } + } + + RotateTowardPlayer(ref transform, PlayerPosition, deltaTime); + Transforms[index] = transform; + States[index] = state; + } + + private static void BeginRecoil(ref PickupTransformSim transform, ref PickupStateSim state, + float3 playerPosition) + { + float3 direction = transform.Position - playerPosition; + direction.y = 0f; + if (math.lengthsq(direction) <= float.Epsilon) + { + direction = new float3(0f, 0f, -1f); + } + else + { + direction = math.normalize(direction); + } + + state.State = PickupStateSim.StateRecoil; + state.PhaseElapsed = 0f; + state.RecoilStartPosition = transform.Position; + state.RecoilDirection = direction; + if (math.lengthsq(transform.Forward) <= float.Epsilon) + { + transform.Forward = new float3(0f, 0f, 1f); + } + } + + private static void RotateWhileIdle(ref PickupTransformSim transform, float deltaTime) + { + float3 forward = transform.Forward; + forward.y = 0f; + forward = math.lengthsq(forward) <= float.Epsilon + ? new float3(0f, 0f, 1f) + : math.normalize(forward); + + transform.Forward = math.normalize(math.rotate( + quaternion.AxisAngle(new float3(0f, 1f, 0f), IdleRotationSpeedRadians * deltaTime), forward)); + } + + private void MarkCollected(ref PickupStateSim state, int entityId) + { + state.State = PickupStateSim.StateCollected; + CollectedPickups.AddNoResize(entityId); + } + + private static float GetDashDistance(float speed, float elapsed, float deltaTime, + float accelerationDuration, float maxSpeedMultiplier) + { + if (accelerationDuration <= 0f) + { + return speed * maxSpeedMultiplier * deltaTime; + } + + float acceleratedUntil = math.min(accelerationDuration, elapsed + deltaTime); + float acceleratedDuration = math.max(0f, acceleratedUntil - elapsed); + float averageMultiplier = 1f + (maxSpeedMultiplier - 1f) * + (elapsed + acceleratedUntil) / (2f * accelerationDuration); + float distance = speed * acceleratedDuration * averageMultiplier; + float constantDuration = deltaTime - acceleratedDuration; + return distance + speed * maxSpeedMultiplier * constantDuration; + } + + private void RotateTowardPlayer(ref PickupTransformSim transform, float3 playerPosition, + float deltaTime) + { + float3 targetDirection = playerPosition - transform.Position; + targetDirection.y = 0f; + if (math.lengthsq(targetDirection) <= float.Epsilon) + { + return; + } + + targetDirection = math.normalize(targetDirection); + float3 currentForward = transform.Forward; + currentForward.y = 0f; + currentForward = math.lengthsq(currentForward) <= float.Epsilon + ? new float3(0f, 0f, 1f) + : math.normalize(currentForward); + + float signedAngle = math.atan2(math.cross(currentForward, targetDirection).y, + math.dot(currentForward, targetDirection)); + float angleStep = math.clamp(signedAngle, -TurnSpeedRadians * deltaTime, + TurnSpeedRadians * deltaTime); + transform.Forward = math.normalize(math.rotate(quaternion.AxisAngle(new float3(0f, 1f, 0f), angleStep), + currentForward)); } } } diff --git a/Assets/GameMain/Scripts/Runtime/EntityLogic/DropEntity.cs b/Assets/GameMain/Scripts/Runtime/EntityLogic/DropEntity.cs index b7e9157..87ab03b 100644 --- a/Assets/GameMain/Scripts/Runtime/EntityLogic/DropEntity.cs +++ b/Assets/GameMain/Scripts/Runtime/EntityLogic/DropEntity.cs @@ -1,4 +1,3 @@ -using SepCore.Entity; using UnityEngine; using UnityGameFramework.Runtime; @@ -22,8 +21,6 @@ namespace SepCore.Entity { Log.Error("DropEntity.OnShow() called with wrong type: {0}.", userData?.GetType().Name); } - - CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } public bool TryCollect(Player player, float collectDistance = 0f) @@ -48,10 +45,5 @@ namespace SepCore.Entity GameEntry.Entity.HideEntity(this); return true; } - - private void OnTriggerEnter(Collider other) - { - TryCollect(other.GetComponent()); - } } } diff --git a/Assets/GameMain/Scripts/Runtime/EntityLogic/Enemy/EnemyBase.cs b/Assets/GameMain/Scripts/Runtime/EntityLogic/Enemy/EnemyBase.cs index 1d2b085..d17afe4 100644 --- a/Assets/GameMain/Scripts/Runtime/EntityLogic/Enemy/EnemyBase.cs +++ b/Assets/GameMain/Scripts/Runtime/EntityLogic/Enemy/EnemyBase.cs @@ -1,7 +1,6 @@ -using Cysharp.Threading.Tasks; -using SepCore.AsyncTask; using SepCore.Components; using SepCore.Definition; +using SepCore.Event; using UnityEngine; using UnityGameFramework.Runtime; @@ -75,13 +74,7 @@ namespace SepCore.Entity { if (Random.value < EnemyData.DropPercent) { - int coinCount = GameEntry.Luban.Global.DropEntityCoinCount; - int expCount = GameEntry.Luban.Global.DropEntityExpCount; - var data = new DropData(coinCount, expCount, GameEntry.Entity.NextId()) - { - Position = CachedTransform.position - }; - GameEntry.Entity.ShowDropAsync(data).Forget(); + GameEntry.Event.Fire(this, DropSpawnRequestedEventArgs.Create(CachedTransform.position)); } base.OnDead(attacker); diff --git a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/GoodsItemRawData.cs b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/GoodsItemRawData.cs index 28c44a1..44e04cd 100644 --- a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/GoodsItemRawData.cs +++ b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/GoodsItemRawData.cs @@ -10,5 +10,6 @@ namespace SepCore.UI public ItemType ItemType; public int Price; public object DataRow; + public bool IsLocked; } } diff --git a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopGoodsSelection.cs b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopGoodsSelection.cs index 40d45aa..7ac597b 100644 --- a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopGoodsSelection.cs +++ b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopGoodsSelection.cs @@ -7,5 +7,6 @@ namespace SepCore.UI public GoodsType GoodsType; public int RefId; public int Price; + public bool IsLocked; } } diff --git a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopUseCase.cs b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopUseCase.cs index 000c3e7..5ad3bb2 100644 --- a/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopUseCase.cs +++ b/Assets/GameMain/Scripts/Runtime/UIBase/Shop/ShopUseCase.cs @@ -13,8 +13,11 @@ namespace SepCore.UI { public class ShopUseCase : IUIUseCase { + public const int ShopRerollBaseCost = 1; + private readonly Player _player; - private readonly int _currentLevel; + private readonly Func _getCurrentLevel; + private int _currentLevel; private readonly Action _onShopFinish; private readonly IReadOnlyList _allGoods; @@ -23,28 +26,45 @@ namespace SepCore.UI private readonly Dictionary> _goodsByRarity = new(); private readonly List _selections = new(); - private int _refreshTime; + private int _rollTimesInThisShop; - public ShopUseCase(Player player, int currentLevel, Action onShopFinish) + public int CurrentLevel => _getCurrentLevel != null ? _getCurrentLevel() : _currentLevel; + public int RollTimesInThisShop => _rollTimesInThisShop; + public IReadOnlyList Selections => _selections; + + public ShopUseCase(Player player, Func getCurrentLevel, Action onShopFinish) { _player = player; - _currentLevel = currentLevel; + _getCurrentLevel = getCurrentLevel; + _currentLevel = getCurrentLevel != null ? getCurrentLevel() : 1; _onShopFinish = onShopFinish; _allGoods = GameEntry.Luban.GetTable(); BuildGoodsRarityPools(); } + public ShopUseCase(Player player, int currentLevel, Action onShopFinish) + : this(player, () => currentLevel, onShopFinish) + { + } + + public static int CalculateRefreshPrice(int wave, int rollTimes) + { + return ShopRerollBaseCost + (Mathf.Max(1, wave) * 1) + (Mathf.Max(0, rollTimes) * 2); + } + public ShopRawData CreateInitialModel() { - _refreshTime = 0; + _currentLevel = _getCurrentLevel != null ? _getCurrentLevel() : _currentLevel; + _rollTimesInThisShop = 0; + int initialRefreshPrice = CalculateRefreshPrice(_currentLevel, _rollTimesInThisShop); return new ShopRawData { CurrentLevel = _currentLevel, - RefreshPrice = _currentLevel, + RefreshPrice = initialRefreshPrice, PlayerCoin = _player.Coin, - GoodsItems = BuildRandomGoodsItems(GameEntry.Luban.Global.ShopGoodsCount), + GoodsItems = RefreshGoodsSlots(GameEntry.Luban.Global.ShopGoodsCount), PropItems = _player.Props, PropMaxCount = GameEntry.Luban.Global.PropMaxCount, WeaponItems = _player.Weapons, @@ -84,17 +104,34 @@ namespace SepCore.UI } _player.Coin -= cost; - - int refreshPrice = (_refreshTime + 1) * _currentLevel; - _refreshTime++; + _rollTimesInThisShop++; + int nextRefreshPrice = CalculateRefreshPrice(_currentLevel, _rollTimesInThisShop); return new ShopRefreshResult { - GoodsItems = BuildRandomGoodsItems(GameEntry.Luban.Global.ShopGoodsCount), - RefreshPrice = refreshPrice + GoodsItems = RefreshGoodsSlots(GameEntry.Luban.Global.ShopGoodsCount), + RefreshPrice = nextRefreshPrice }; } + public bool ToggleLock(int goodsIndex) + { + if (goodsIndex < 0 || goodsIndex >= _selections.Count) + { + Log.Error("ShopUseCase::ToggleLock: Invalid goodsIndex {0}.", goodsIndex); + return false; + } + + ShopGoodsSelection selection = _selections[goodsIndex]; + if (selection == null) + { + return false; + } + + selection.IsLocked = !selection.IsLocked; + return selection.IsLocked; + } + public async UniTask TryPurchaseAsync(int goodsIndex) { if (goodsIndex < 0 || goodsIndex >= _selections.Count) @@ -137,76 +174,117 @@ namespace SepCore.UI _onShopFinish?.Invoke(); } - private List BuildRandomGoodsItems(int count) + private List RefreshGoodsSlots(int count) { if (_allGoods.Count == 0) { - Log.Error("ShopFormUseCase::BuildRandomGoodsItems(): _allGoods is empty"); + Log.Error("ShopUseCase::RefreshGoodsSlots(): _allGoods is empty"); return null; } int finalCount = Mathf.Min(count, _allGoods.Count); - List goodsItems = new List(finalCount); - _selections.Clear(); + while (_selections.Count < finalCount) + { + _selections.Add(null); + } int currentLevel = _currentLevel; float priceRandomPercent = GameEntry.Luban.Global.ShopPriceRandomPercent; + List goodsItems = new List(finalCount); for (int i = 0; i < finalCount; i++) { + ShopGoodsSelection existing = _selections[i]; + if (existing != null && existing.IsLocked) + { + goodsItems.Add(CreateGoodsItemRawData(existing)); + continue; + } + Rarity rarity = RollRarity(currentLevel); GoodsConfig goodsConfig = PickGoodsByRarity(rarity); if (goodsConfig == null) { - Log.Error("ShopFormUseCase::BuildRandomGoodsItems: No available goods for selection."); + Log.Error("ShopUseCase::RefreshGoodsSlots: No available goods for selection."); break; } - GoodsItemRawData goodsItem = new GoodsItemRawData(); int price; + object dataRow; + ItemType itemType; if (goodsConfig.GoodsType == GoodsType.Prop) { PropConfig propConfig = GameEntry.Luban.Get(goodsConfig.RefId); int basePrice = propConfig.Price; - price = CalculateRandomizedPrice(basePrice, priceRandomPercent); - goodsItem.ItemType = ItemType.Prop; - goodsItem.Rarity = propConfig.Rarity; - goodsItem.DataRow = propConfig; + itemType = ItemType.Prop; + rarity = propConfig.Rarity; + dataRow = propConfig; } else if (goodsConfig.GoodsType == GoodsType.Weapon) { WeaponConfig weaponConfig = GameEntry.Luban.Get(goodsConfig.RefId); int basePrice = weaponConfig.Price; - price = CalculateRandomizedPrice(basePrice, priceRandomPercent); - goodsItem.ItemType = ItemType.Weapon; - goodsItem.Rarity = weaponConfig.Rarity; - goodsItem.DataRow = weaponConfig; + itemType = ItemType.Weapon; + rarity = weaponConfig.Rarity; + dataRow = weaponConfig; } else { Log.Warning( - $"ShopFormUseCase::BuildRandomGoodsItems: Unsupported goods type = {goodsConfig.GoodsType}"); + $"ShopUseCase::RefreshGoodsSlots: Unsupported goods type = {goodsConfig.GoodsType}"); continue; } - goodsItem.Price = price; - - _selections.Add(new ShopGoodsSelection + _selections[i] = new ShopGoodsSelection { GoodsType = goodsConfig.GoodsType, RefId = goodsConfig.RefId, - Price = price - }); + Price = price, + IsLocked = false + }; - goodsItems.Add(goodsItem); + goodsItems.Add(new GoodsItemRawData + { + Price = price, + Rarity = rarity, + ItemType = itemType, + DataRow = dataRow, + IsLocked = false + }); } return goodsItems; } + private GoodsItemRawData CreateGoodsItemRawData(ShopGoodsSelection selection) + { + GoodsItemRawData item = new GoodsItemRawData + { + Price = selection.Price, + IsLocked = selection.IsLocked + }; + + if (selection.GoodsType == GoodsType.Prop) + { + PropConfig propConfig = GameEntry.Luban.Get(selection.RefId); + item.ItemType = ItemType.Prop; + item.Rarity = propConfig.Rarity; + item.DataRow = propConfig; + } + else if (selection.GoodsType == GoodsType.Weapon) + { + WeaponConfig weaponConfig = GameEntry.Luban.Get(selection.RefId); + item.ItemType = ItemType.Weapon; + item.Rarity = weaponConfig.Rarity; + item.DataRow = weaponConfig; + } + + return item; + } + private void BuildGoodsRarityPools() { _goodsByRarity.Clear(); @@ -270,7 +348,8 @@ namespace SepCore.UI private Rarity RollRarity(int level) { - return RarityUtility.SelectRarityForLevel(level); + float luck = _player?.StatComponent != null ? _player.StatComponent.GetStatValue(StatType.Luck) : 0f; + return RarityUtility.SelectRarityForLevel(level, luck); } private static int CalculateRandomizedPrice(int basePrice, float priceRandomPercent) diff --git a/Assets/GameMain/Scripts/Runtime/Utility/RarityUtility.cs b/Assets/GameMain/Scripts/Runtime/Utility/RarityUtility.cs index 26e9085..6722998 100644 --- a/Assets/GameMain/Scripts/Runtime/Utility/RarityUtility.cs +++ b/Assets/GameMain/Scripts/Runtime/Utility/RarityUtility.cs @@ -6,16 +6,22 @@ namespace SepCore.CustomUtility { public static class RarityUtility { - public static Rarity SelectRarityForLevel(int level) + public static Rarity SelectRarityForLevel(int level, float luck = 0f) { int configId = level >= 1000 ? level : 1000 + level; LevelDropConfig dropConfig = GameEntry.Luban.Get(configId); - return SelectRarity(dropConfig); + return SelectRarity(dropConfig, luck); } - public static Rarity SelectRarity(LevelDropConfig dropConfig) + public static Rarity SelectRarity(LevelDropConfig dropConfig, float luck = 0f) { - float total = dropConfig.WhiteWeight + dropConfig.BlueWeight + dropConfig.PurpleWeight + dropConfig.RedWeight; + float whiteWeight = dropConfig.WhiteWeight; + float luckMultiplier = Mathf.Max(0f, 1f + luck * 0.015f); + float blueWeight = dropConfig.BlueWeight * luckMultiplier; + float purpleWeight = dropConfig.PurpleWeight * luckMultiplier; + float redWeight = dropConfig.RedWeight * luckMultiplier; + + float total = whiteWeight + blueWeight + purpleWeight + redWeight; if (total <= 0f) { Log.Error("LevelDropConfig '{0}' has invalid total weight '{1}'.", dropConfig.Id, total); @@ -23,11 +29,11 @@ namespace SepCore.CustomUtility } float roll = Random.Range(0f, total); - if (roll < dropConfig.WhiteWeight) return Rarity.White; - roll -= dropConfig.WhiteWeight; - if (roll < dropConfig.BlueWeight) return Rarity.Blue; - roll -= dropConfig.BlueWeight; - if (roll < dropConfig.PurpleWeight) return Rarity.Purple; + if (roll < whiteWeight) return Rarity.White; + roll -= whiteWeight; + if (roll < blueWeight) return Rarity.Blue; + roll -= blueWeight; + if (roll < purpleWeight) return Rarity.Purple; return Rarity.Red; } } diff --git a/Assets/GameMain/UI/UIForms/ShopForm.prefab b/Assets/GameMain/UI/UIForms/ShopForm.prefab index 11e697f..0a7fbe6 100644 --- a/Assets/GameMain/UI/UIForms/ShopForm.prefab +++ b/Assets/GameMain/UI/UIForms/ShopForm.prefab @@ -8350,31 +8350,6 @@ PrefabInstance: propertyPath: m_Name value: GoodsItemTemplate objectReference: {fileID: 0} - - target: {fileID: 3072890538777882148, guid: 9f5bba6d2f5c95049a59fcb56df2d38f, - type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3585730205036254032, guid: 9f5bba6d2f5c95049a59fcb56df2d38f, - type: 3} - propertyPath: m_fontColor.b - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3585730205036254032, guid: 9f5bba6d2f5c95049a59fcb56df2d38f, - type: 3} - propertyPath: m_fontColor.g - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3585730205036254032, guid: 9f5bba6d2f5c95049a59fcb56df2d38f, - type: 3} - propertyPath: m_fontColor.r - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3585730205036254032, guid: 9f5bba6d2f5c95049a59fcb56df2d38f, - type: 3} - propertyPath: m_fontColor32.rgba - value: 4294967295 - objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/GameMain/UI/UIItems/GoodsItem.prefab b/Assets/GameMain/UI/UIItems/GoodsItem.prefab index 93a16af..9111c01 100644 --- a/Assets/GameMain/UI/UIItems/GoodsItem.prefab +++ b/Assets/GameMain/UI/UIItems/GoodsItem.prefab @@ -284,8 +284,8 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 4279508777 - m_fontColor: {r: 0.16078432, g: 0.121568635, b: 0.078431375, a: 1} + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: @@ -383,6 +383,7 @@ RectTransform: - {fileID: 7569228790803904920} - {fileID: 5474605388468845308} - {fileID: 1057033168998470395} + - {fileID: 1371646078691775229} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -409,6 +410,8 @@ MonoBehaviour: _costText: {fileID: 1939791114573821530} _purchaseButton: {fileID: 17896329480872315} _purchaseLabel: {fileID: 3585730205036254032} + _lockButton: {fileID: 6399387278004275578} + _lockLabel: {fileID: 6419378833229255191} _canvasGroup: {fileID: 9012657706980112183} _rarityPalette: {fileID: 11400000, guid: fdc414c684fa936469f4d9065421db9e, type: 2} _rarityBackground: {fileID: 7856203203445552886} @@ -1235,7 +1238,7 @@ PrefabInstance: - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, type: 3} propertyPath: m_SizeDelta.x - value: -48 + value: -254 objectReference: {fileID: 0} - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, type: 3} @@ -1295,7 +1298,7 @@ PrefabInstance: - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: -103 objectReference: {fileID: 0} - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, type: 3} @@ -1507,3 +1510,166 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 7276168068522768651} m_PrefabAsset: {fileID: 0} +--- !u!1001 &8023359762795272418 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1568602919960830097} + m_Modifications: + - target: {fileID: 3913210503624231669, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_text + value: "\u5DF2\u9501\u5B9A" + objectReference: {fileID: 0} + - target: {fileID: 3913210503624231669, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_fontSize + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 3913210503624231669, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_fontSizeBase + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 6036930758348516521, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_Name + value: LockButton + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_SizeDelta.x + value: -374 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_SizeDelta.y + value: 88 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 163 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 24 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0722cd253d6bf014eb4134a2151ec7e3, type: 3} +--- !u!224 &1371646078691775229 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8958121344393284127, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + m_PrefabInstance: {fileID: 8023359762795272418} + m_PrefabAsset: {fileID: 0} +--- !u!114 &6399387278004275578 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 4005815405540692376, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + m_PrefabInstance: {fileID: 8023359762795272418} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a5079836f95c2a44b96fa331487ebb70, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &6419378833229255191 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3913210503624231669, guid: 0722cd253d6bf014eb4134a2151ec7e3, + type: 3} + m_PrefabInstance: {fileID: 8023359762795272418} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs b/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs new file mode 100644 index 0000000..d5a4f64 --- /dev/null +++ b/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs @@ -0,0 +1,106 @@ +using NUnit.Framework; +using SepCore.Battle; +using SepCore.Definition; +using SepCore.Event; +using UnityEngine; + +namespace VampireLike.Tests.Gameplay.EditMode +{ + [TestFixture] + public class HarvestingEconomyTests + { + [Test] + public void HarvestInterestRate_IsFivePercent() + { + Assert.AreEqual(0.05f, HarvestSettlementUtility.HarvestCompoundRate, 1e-5f); + Assert.AreEqual("HarvestInterest", HarvestSettlementUtility.HarvestModifierSource); + } + + [Test] + public void WaveHarvestSettlementEventArgs_CreateAndClear_MaintainsValues() + { + var args = WaveHarvestSettlementEventArgs.Create(10, 1, 11); + Assert.AreEqual(10, args.HarvestIncome); + Assert.AreEqual(1, args.HarvestGrowth); + Assert.AreEqual(11, args.CurrentHarvest); + + args.Clear(); + Assert.AreEqual(0, args.HarvestIncome); + Assert.AreEqual(0, args.HarvestGrowth); + Assert.AreEqual(0, args.CurrentHarvest); + } + + [Test] + public void HarvestCompoundGrowth_SmallInitialValue_RoundsUpToOne() + { + // 当收获为 1 时,1 * 0.05 = 0.05,Mathf.CeilToInt 向上取整应为 1 + int initialHarvest = 1; + int growth = Mathf.CeilToInt(initialHarvest * HarvestCompoundRate); + Assert.AreEqual(1, growth); + + // 当收获为 10 时,10 * 0.05 = 0.5,Mathf.CeilToInt 向上取整应为 1 + int growth10 = Mathf.CeilToInt(10 * HarvestCompoundRate); + Assert.AreEqual(1, growth10); + + // 当收获为 21 时,21 * 0.05 = 1.05,Mathf.CeilToInt 向上取整应为 2 + int growth21 = Mathf.CeilToInt(21 * HarvestCompoundRate); + Assert.AreEqual(2, growth21); + + // 当收获为 50 时,50 * 0.05 = 2.5,Mathf.CeilToInt 向上取整应为 3 + int growth50 = Mathf.CeilToInt(50 * HarvestCompoundRate); + Assert.AreEqual(3, growth50); + } + + [Test] + public void HarvestCompoundGrowth_SimulateMultiWaveProgression_InAttributePipeline() + { + var pipeline = new AttributePipeline(); + pipeline.SetBaseValue(StatType.Harvesting, 10f); + + int totalIncome = 0; + // 模拟连续 5 波的收获结算 + for (int wave = 1; wave <= 5; wave++) + { + int currentHarvest = Mathf.FloorToInt(pipeline.GetValue(StatType.Harvesting)); + totalIncome += currentHarvest; + + int growth = Mathf.CeilToInt(currentHarvest * HarvestCompoundRate); + pipeline.AddModifier( + StatType.Harvesting, + new StatModifier(growth, ModifierType.Flat, HarvestSettlementUtility.HarvestModifierSource)); + } + + // Wave 1: Harvest=10, Income=10, Growth=1 -> Next Harvest=11 + // Wave 2: Harvest=11, Income=11, Growth=1 -> Next Harvest=12 + // Wave 3: Harvest=12, Income=12, Growth=1 -> Next Harvest=13 + // Wave 4: Harvest=13, Income=13, Growth=1 -> Next Harvest=14 + // Wave 5: Harvest=14, Income=14, Growth=1 -> Next Harvest=15 + // Total Income = 10 + 11 + 12 + 13 + 14 = 60 + Assert.AreEqual(60, totalIncome); + Assert.AreEqual(15f, pipeline.GetValue(StatType.Harvesting), 1e-4f); + } + + [Test] + public void HarvestCompoundGrowth_HighInitial_AcceleratesExponentially() + { + var pipeline = new AttributePipeline(); + pipeline.SetBaseValue(StatType.Harvesting, 40f); + + // Wave 1: 40 -> growth = ceil(40 * 0.05 = 2.0) = 2 -> 42 + int harvestW1 = Mathf.FloorToInt(pipeline.GetValue(StatType.Harvesting)); + int g1 = Mathf.CeilToInt(harvestW1 * HarvestCompoundRate); + Assert.AreEqual(2, g1); + pipeline.AddModifier(StatType.Harvesting, new StatModifier(g1, ModifierType.Flat)); + Assert.AreEqual(42f, pipeline.GetValue(StatType.Harvesting), 1e-4f); + + // Wave 2: 42 -> growth = ceil(42 * 0.05 = 2.1) = 3 -> 45 + int harvestW2 = Mathf.FloorToInt(pipeline.GetValue(StatType.Harvesting)); + int g2 = Mathf.CeilToInt(harvestW2 * HarvestCompoundRate); + Assert.AreEqual(3, g2); + pipeline.AddModifier(StatType.Harvesting, new StatModifier(g2, ModifierType.Flat)); + Assert.AreEqual(45f, pipeline.GetValue(StatType.Harvesting), 1e-4f); + } + + private const float HarvestCompoundRate = HarvestSettlementUtility.HarvestCompoundRate; + } +} diff --git a/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs.meta b/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs.meta new file mode 100644 index 0000000..c4e03c3 --- /dev/null +++ b/Assets/Tests/Gameplay/EditMode/HarvestingEconomyTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6a278e1490834900afaef82f39139288 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs b/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs new file mode 100644 index 0000000..e087483 --- /dev/null +++ b/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs @@ -0,0 +1,147 @@ +using NUnit.Framework; +using SepCore.CustomUtility; +using SepCore.Definition; +using SepCore.Event; +using SepCore.UI; +using UnityEngine; + +namespace VampireLike.Tests.Gameplay.EditMode +{ + [TestFixture] + public class ShopEconomyAndLockTests + { + [Test] + public void RerollPrice_Progression_CalculatesAccurately() + { + // 公式: BaseCost(1) + (CurrentWave * 1) + (RollTimes * 2) + + // 第 1 波:初始刷新 1 + 1 + 0 = 2 + Assert.AreEqual(2, ShopUseCase.CalculateRefreshPrice(1, 0)); + // 第 1 波第 1 次刷新后: 1 + 1 + 2 = 4 + Assert.AreEqual(4, ShopUseCase.CalculateRefreshPrice(1, 1)); + // 第 1 波第 2 次刷新后: 1 + 1 + 4 = 6 + Assert.AreEqual(6, ShopUseCase.CalculateRefreshPrice(1, 2)); + // 第 1 波第 3 次刷新后: 1 + 1 + 6 = 8 + Assert.AreEqual(8, ShopUseCase.CalculateRefreshPrice(1, 3)); + + // 第 2 波:初始刷新 1 + 2 + 0 = 3 + Assert.AreEqual(3, ShopUseCase.CalculateRefreshPrice(2, 0)); + // 第 2 波第 1 次刷新后: 1 + 2 + 2 = 5 + Assert.AreEqual(5, ShopUseCase.CalculateRefreshPrice(2, 1)); + + // 第 5 波第 3 次刷新后: 1 + 5 + 6 = 12 + Assert.AreEqual(12, ShopUseCase.CalculateRefreshPrice(5, 3)); + + // 边界防守:负波次与负刷新次数 + Assert.AreEqual(2, ShopUseCase.CalculateRefreshPrice(0, -1)); + } + + [Test] + public void SlotLock_ToggleLock_FlipsState() + { + var selection = new ShopGoodsSelection + { + GoodsType = GoodsType.Weapon, + RefId = 1001, + Price = 50, + IsLocked = false + }; + + // 初始未锁定 + Assert.IsFalse(selection.IsLocked); + + // 锁定 + selection.IsLocked = !selection.IsLocked; + Assert.IsTrue(selection.IsLocked); + + // 解锁 + selection.IsLocked = !selection.IsLocked; + Assert.IsFalse(selection.IsLocked); + } + + [Test] + public void GoodsItemContext_ConstructsWithIsLocked_FromRawData() + { + var propBuf = new Luban.ByteBuf(); + propBuf.WriteInt(101); + propBuf.WriteString("TestProp"); + propBuf.WriteInt((int)Rarity.Purple); + propBuf.WriteInt(120); + propBuf.WriteSize(0); + propBuf.WriteString("test_icon"); + var propConfig = new PropConfig(propBuf); + + var rawData = new GoodsItemRawData + { + Price = 120, + Rarity = Rarity.Purple, + ItemType = ItemType.Prop, + DataRow = propConfig, + IsLocked = true + }; + + var context = new GoodsItemContext(rawData); + Assert.IsTrue(context.IsLocked); + Assert.AreEqual(120, context.Price); + Assert.AreEqual(Rarity.Purple, context.Rarity); + Assert.AreEqual("TestProp", context.Name); + + var defaultContext = new GoodsItemContext(); + Assert.IsFalse(defaultContext.IsLocked); + } + + [Test] + public void Luck_IncreasesHighRarityProportion() + { + // 构造测试用 LevelDropConfig: White: 75, Blue: 20, Purple: 5, Red: 0 + var buf = new Luban.ByteBuf(); + buf.WriteInt(1001); + buf.WriteFloat(75f); // White + buf.WriteFloat(20f); // Blue + buf.WriteFloat(5f); // Purple + buf.WriteFloat(0f); // Red + var dropConfig = new LevelDropConfig(buf); + + int samples = 10000; + int highTierCountLuck0 = 0; + int highTierCountLuck50 = 0; + + // 1. 无幸运 (Luck = 0) + for (int i = 0; i < samples; i++) + { + Rarity rarity = RarityUtility.SelectRarity(dropConfig, 0f); + if (rarity != Rarity.White) + { + highTierCountLuck0++; + } + } + + // 2. 高幸运 (Luck = 50) + for (int i = 0; i < samples; i++) + { + Rarity rarity = RarityUtility.SelectRarity(dropConfig, 50f); + if (rarity != Rarity.White) + { + highTierCountLuck50++; + } + } + + // Luck = 0 时,理论高阶占比 25% (2500 左右) + // Luck = 50 时,非白装权重 * 1.75 = 43.75,总权重 118.75,理论高阶占比 ~36.8% (3680 左右) + Assert.Greater(highTierCountLuck50, highTierCountLuck0); + Assert.Greater(highTierCountLuck50, 3200); + Assert.Less(highTierCountLuck0, 2900); + } + + [Test] + public void ShopGoodsLockEventArgs_CreateAndClear_MaintainsValues() + { + var args = ShopGoodsLockEventArgs.Create(2); + Assert.AreEqual(2, args.GoodsIndex); + Assert.AreEqual(ShopGoodsLockEventArgs.EventId, args.Id); + + args.Clear(); + Assert.AreEqual(-1, args.GoodsIndex); + } + } +} diff --git a/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs.meta b/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs.meta new file mode 100644 index 0000000..f3eae70 --- /dev/null +++ b/Assets/Tests/Gameplay/EditMode/ShopEconomyAndLockTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3294c9f757948d8b1a930824cc98a35 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Simulation/EditMode/SimulationWorldTickTests.cs b/Assets/Tests/Simulation/EditMode/SimulationWorldTickTests.cs index 38783d2..1abd2c9 100644 --- a/Assets/Tests/Simulation/EditMode/SimulationWorldTickTests.cs +++ b/Assets/Tests/Simulation/EditMode/SimulationWorldTickTests.cs @@ -220,44 +220,75 @@ namespace SepCore.Tests.Editor } [Test] - public void Pickup_WhenOutsideAbsorbRange_DoesNotMove() + public void Pickup_WhenOutsideAbsorbRange_FloatsAndRotatesWithoutHorizontalMovement() { _world.UpsertPickup(new PickupSimData { EntityId = 7001, Position = new Vector3(10f, 0f, 10f), + Forward = Vector3.forward, PickupRadius = 0.35f, - State = 0 + State = PickupStateSim.StateIdle }); - _world.SyncPlayerAbsorbSettings(3f, 5f, 0.5f); + _world.SyncPlayerAbsorbSettings(3f, 5f, 0.5f, 0.25f, 0.1f, 0.1f, 2f, 720f); _world.Tick(new SimulationTickContext(0.1f, Vector3.zero)); Assert.That(_world.TryGetPickupSnapshot(7001, out PickupSimData snapshot), Is.True); Assert.That(snapshot.Position.x, Is.EqualTo(10f).Within(0.001f)); Assert.That(snapshot.Position.z, Is.EqualTo(10f).Within(0.001f)); - Assert.That(snapshot.State, Is.EqualTo(0)); + Assert.That(snapshot.Position.y, Is.Not.EqualTo(0f)); + Assert.That(snapshot.Forward, Is.Not.EqualTo(Vector3.forward)); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateIdle)); } [Test] - public void Pickup_WhenInsideAbsorbRange_MovesTowardsPlayerAndTransitionsState() + public void Pickup_WhenInsideAbsorbRange_RecoilsForPointOneSecondsThenDashes() { _world.UpsertPickup(new PickupSimData { EntityId = 7002, Position = new Vector3(2f, 0f, 0f), PickupRadius = 0.2f, - State = 0 + Forward = Vector3.forward, + State = PickupStateSim.StateIdle }); - _world.SyncPlayerAbsorbSettings(5f, 4f, 0.5f); - _world.Tick(new SimulationTickContext(0.25f, Vector3.zero)); + _world.SyncPlayerAbsorbSettings(5f, 4f, 0.5f, 0.25f, 0.1f, 0.1f, 2f, 720f); + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); Assert.That(_world.TryGetPickupSnapshot(7002, out PickupSimData snapshot), Is.True); - // Moved from 2.0 towards 0 by 4.0 * 0.25 = 1.0 -> remaining distance is 1.0 - Assert.That(snapshot.Position.x, Is.EqualTo(1.0f).Within(0.01f)); + Assert.That(snapshot.Position.x, Is.EqualTo(2.125f).Within(0.001f)); Assert.That(snapshot.Position.z, Is.EqualTo(0f).Within(0.01f)); - Assert.That(snapshot.State, Is.EqualTo(1)); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateRecoil)); + Assert.That(Vector3.Dot(snapshot.Forward.normalized, Vector3.left), Is.GreaterThan(0.5f)); + + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7002, out snapshot), Is.True); + Assert.That(snapshot.Position.x, Is.EqualTo(2.25f).Within(0.001f)); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateDash)); + + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7002, out snapshot), Is.True); + Assert.That(snapshot.Position.x, Is.EqualTo(2.0f).Within(0.001f)); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateDash)); + + Vector3 positionBeforeConstantSpeed = snapshot.Position; + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7002, out snapshot), Is.True); + Assert.That(Vector3.Distance(positionBeforeConstantSpeed, snapshot.Position), Is.EqualTo(0.35f).Within(0.001f)); + + positionBeforeConstantSpeed = snapshot.Position; + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7002, out snapshot), Is.True); + Assert.That(Vector3.Distance(positionBeforeConstantSpeed, snapshot.Position), Is.EqualTo(0.4f).Within(0.001f)); + + Vector3 movedPlayerPosition = new Vector3(0f, 0f, 1f); + _world.Tick(new SimulationTickContext(0.05f, movedPlayerPosition)); + Assert.That(_world.TryGetPickupSnapshot(7002, out snapshot), Is.True); + Assert.That(snapshot.Position.z, Is.GreaterThan(0f)); + Assert.That(Vector3.Dot(snapshot.Forward.normalized, + (movedPlayerPosition - snapshot.Position).normalized), Is.GreaterThan(0.8f)); } [Test] @@ -268,20 +299,64 @@ namespace SepCore.Tests.Editor EntityId = 7003, Position = new Vector3(50f, 0f, 0f), PickupRadius = 0.2f, - State = 0 + State = PickupStateSim.StateIdle }); - _world.SyncPlayerAbsorbSettings(5f, 10f, 0.5f); + _world.SyncPlayerAbsorbSettings(5f, 10f, 0.5f, 0.25f, 0.1f, 0.1f, 2f, 720f); _world.TriggerFullMapMagnet(); Assert.That(_world.TryGetPickupSnapshot(7003, out PickupSimData snapshotBefore), Is.True); - Assert.That(snapshotBefore.State, Is.EqualTo(1)); + Assert.That(snapshotBefore.State, Is.EqualTo(PickupStateSim.StateAbsorbRequested)); - _world.Tick(new SimulationTickContext(0.5f, Vector3.zero)); + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); Assert.That(_world.TryGetPickupSnapshot(7003, out PickupSimData snapshotAfter), Is.True); - // Moved from 50 towards 0 by 10 * 0.5 = 5 -> remaining distance is 45 - Assert.That(snapshotAfter.Position.x, Is.EqualTo(45f).Within(0.01f)); + Assert.That(snapshotAfter.Position.x, Is.EqualTo(50.125f).Within(0.001f)); + Assert.That(snapshotAfter.State, Is.EqualTo(PickupStateSim.StateRecoil)); + } + + [Test] + public void Pickup_WhenDashReachesCollectDistance_TransitionsToCollectedOnlyOnce() + { + _world.UpsertPickup(new PickupSimData + { + EntityId = 7004, + Position = new Vector3(1f, 0f, 0f), + PickupRadius = 0.2f, + State = PickupStateSim.StateIdle + }); + + _world.SyncPlayerAbsorbSettings(2f, 20f, 0.5f, 0.25f, 0.1f, 0.1f, 2f, 720f); + _world.Tick(new SimulationTickContext(0.1f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7004, out PickupSimData snapshot), Is.True); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateDash)); + + _world.Tick(new SimulationTickContext(0.1f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7004, out snapshot), Is.True); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateCollected)); + + _world.Tick(new SimulationTickContext(0.1f, Vector3.zero)); + Assert.That(_world.TryGetPickupSnapshot(7004, out snapshot), Is.True); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateCollected)); + } + + [Test] + public void Pickup_WhenPlayerAndDropOverlap_UsesDeterministicRetreatDirection() + { + _world.UpsertPickup(new PickupSimData + { + EntityId = 7005, + Position = Vector3.zero, + PickupRadius = 0.2f, + State = PickupStateSim.StateIdle + }); + + _world.SyncPlayerAbsorbSettings(1f, 4f, 0.1f, 0.25f, 0.1f, 0.1f, 2f, 720f); + _world.Tick(new SimulationTickContext(0.05f, Vector3.zero)); + + Assert.That(_world.TryGetPickupSnapshot(7005, out PickupSimData snapshot), Is.True); + Assert.That(snapshot.Position.z, Is.EqualTo(-0.125f).Within(0.001f)); + Assert.That(snapshot.State, Is.EqualTo(PickupStateSim.StateRecoil)); } private static readonly int[] DeterminismEnemyIds = { 5001, 5002, 5003, 5004, 5005, 5006 }; diff --git a/数据表/Datas/EntityConfig_实体配置.xlsx b/数据表/Datas/EntityConfig_实体配置.xlsx index 041ebcee5b8e48233c3f8118a37cd411e725199b..8e18e6138b1dc5f7d1e00c2b69fbe7fc2fa07fcb 100644 GIT binary patch delta 2203 zcmV;M2xRy6Px4T(kpTrN1_>KDla>J=e@eqJ6o&5w-=XBbP16c9F&~b0e~S&{ z?`#V=BV>jZcqW)<_y~;6NJIlt@DXV~Y|{e-$IyTR?Hx{&6n}R;Smpk_&?gs7CH=vK znFifUw&165Z10^Mi(S_xUEXU1{}jKh9@hP+vDC+1aX{5^KMiw!6;`>CAZ`!U8jJ_^ z2DZSz!$R<0k8%slgNVX|^rUxAJD&5q`+AA0jAXNz%wv+*>6}icl#tf~pIgKIY6Pmm z;6GwYVlu7C4b2J7CKtprpz6JUetP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