From a772331918312c17200555fbd8ee5dc856ff1c9c Mon Sep 17 00:00:00 2001 From: CortexCore <2630229280@qq.com> Date: Thu, 12 Jun 2025 16:08:12 +0800 Subject: [PATCH] 1 --- Src/Health/HealthService.cs | 1 + Src/Level.meta | 8 +++++ Src/Level/LevelComponent.cs | 39 +++++++++++++++++++++ Src/Level/LevelComponent.cs.meta | 11 ++++++ Src/Level/Net.Project.B.Level.asmdef | 16 +++++++++ Src/Level/Net.Project.B.Level.asmdef.meta | 7 ++++ Src/Mark/MarkComponent.cs | 10 ++++++ Src/PlayerSettings/IPlayerSettings.cs | 10 ++++++ Src/UX/UXDefine.cs | 6 +++- Src/WorldNode/UnityEnvironmentController.cs | 2 +- 10 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 Src/Level.meta create mode 100644 Src/Level/LevelComponent.cs create mode 100644 Src/Level/LevelComponent.cs.meta create mode 100644 Src/Level/Net.Project.B.Level.asmdef create mode 100644 Src/Level/Net.Project.B.Level.asmdef.meta diff --git a/Src/Health/HealthService.cs b/Src/Health/HealthService.cs index c6f0b64..394b84c 100644 --- a/Src/Health/HealthService.cs +++ b/Src/Health/HealthService.cs @@ -32,6 +32,7 @@ namespace Net.Project.B.Health if(prevHp==value)return; healthPoint = value; OnHealthChanged?.Invoke(prevHp,healthPoint); + } } diff --git a/Src/Level.meta b/Src/Level.meta new file mode 100644 index 0000000..59f189d --- /dev/null +++ b/Src/Level.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab89ce641ffd51543b1bc41781de9c71 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Level/LevelComponent.cs b/Src/Level/LevelComponent.cs new file mode 100644 index 0000000..a778377 --- /dev/null +++ b/Src/Level/LevelComponent.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Unity.Mathematics; + +namespace Net.Project.B.Level +{ + public class LevelComponent + { + public int Level { get; private set; } + public int2 Exp { get; set; } = new(0, 1000); + public event Action OnExpChanged; + public event Action OnLevelChanged; + public void AddExp(int exp) + { + var current = Exp; + var newExp = Exp + new int2(exp, 0); + +// 是否升级(x 是当前经验,y 是当前等级所需经验) + if (newExp.x >= Exp.y) + { + newExp.x -= Exp.y; // 超出部分保留 + newExp.y = (Level/10+1)+Level%10; // 如果你有更高级别的经验需求函数 + + Exp = newExp; + Level++; + OnLevelChanged?.Invoke(Level); + } + else + { + Exp = newExp; + } + + OnExpChanged?.Invoke(current.x, newExp.x); + + } + } + +} diff --git a/Src/Level/LevelComponent.cs.meta b/Src/Level/LevelComponent.cs.meta new file mode 100644 index 0000000..2b8e643 --- /dev/null +++ b/Src/Level/LevelComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e174908a3e850e4ba7c55460b1179ac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Level/Net.Project.B.Level.asmdef b/Src/Level/Net.Project.B.Level.asmdef new file mode 100644 index 0000000..3f56fb6 --- /dev/null +++ b/Src/Level/Net.Project.B.Level.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Net.Project.B.Level", + "rootNamespace": "", + "references": [ + "GUID:d8b63aba1907145bea998dd612889d6b" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Src/Level/Net.Project.B.Level.asmdef.meta b/Src/Level/Net.Project.B.Level.asmdef.meta new file mode 100644 index 0000000..01dd459 --- /dev/null +++ b/Src/Level/Net.Project.B.Level.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 16c1175489fd8a84b846b3dedc7e7836 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Mark/MarkComponent.cs b/Src/Mark/MarkComponent.cs index d461840..41ebf94 100644 --- a/Src/Mark/MarkComponent.cs +++ b/Src/Mark/MarkComponent.cs @@ -1,14 +1,24 @@ using System; using System.Collections; using System.Collections.Generic; +using BITKit; using BITKit.WorldNode; using Unity.Mathematics; +using UnityEngine; namespace Net.Project.B.Mark { public interface IMarkType{} public interface IMarkComponent { + } + [Serializable] + public class NameMark:IWorldNode + { + #if UNITY_5_3_OR_NEWER + [SerializeReference, SubclassSelector] private IReference name; + public string Name => name?.Value; +#endif } public class PositionMark:IMarkComponent{} } diff --git a/Src/PlayerSettings/IPlayerSettings.cs b/Src/PlayerSettings/IPlayerSettings.cs index 5941d3c..ace5d70 100644 --- a/Src/PlayerSettings/IPlayerSettings.cs +++ b/Src/PlayerSettings/IPlayerSettings.cs @@ -76,6 +76,16 @@ namespace Project.B.Player [DisplayName("Settings_TPS_FOV")] public int TpsFov { get; set; } = 75; /// + /// 镜头晃动幅度,防止用户眩晕 + /// + [DisplayName("Settings_View_Camera_Movement_Intensity")] + public float ViewCameraMovementIntensity { get; set; } = 1f; + /// + /// 最低第三人称视角距离,防止用户眩晕 + /// + [DisplayName("Settings_TPS_Min_Distance")] + public float TpsMinDistance { get; set; } + /// /// 分辨率 /// [DisplayName("Settings_Resolution")] public int2 Resolution { get; set; } diff --git a/Src/UX/UXDefine.cs b/Src/UX/UXDefine.cs index 26d9e8d..5a80cdb 100644 --- a/Src/UX/UXDefine.cs +++ b/Src/UX/UXDefine.cs @@ -9,7 +9,10 @@ using Net.Project.B.World; namespace Net.Project.B.UX { - public interface IUXHud:IUXPanel{} + public interface IUXHud : IUXPanel + { + public ValidHandle InCinematicMode { get; } + } public interface IUXInitialize:IUXPanel,ILogger {} public interface IUXBuyStation:IUXPanel{} public interface IUXControlMode:IUXPanel{} @@ -53,4 +56,5 @@ namespace Net.Project.B.UX public IReadOnlyCollection SurvivalBuffs { get; set; } } public interface IUXChat:IUXPanel{} + public interface IUXLevelUp:IUXPanel{} } diff --git a/Src/WorldNode/UnityEnvironmentController.cs b/Src/WorldNode/UnityEnvironmentController.cs index 499654d..78df9a1 100644 --- a/Src/WorldNode/UnityEnvironmentController.cs +++ b/Src/WorldNode/UnityEnvironmentController.cs @@ -32,7 +32,7 @@ namespace Net.Project.B.WorldNode if (!searchGameObject) continue; hashSet.UnionWith(searchGameObject.GetComponentsInChildren()); } - staticGameObjects = hashSet.Select(x => x.gameObject).ToArray(); + staticGameObjects = hashSet.Where(x=>x.gameObject.isStatic).Select(x => x.gameObject).ToArray(); } else {