From bb257507bcd66b36e02aa598fa71a64aac0858e1 Mon Sep 17 00:00:00 2001 From: CortexCore <2630229280@qq.com> Date: Sat, 23 Nov 2024 17:20:13 +0800 Subject: [PATCH] 1 --- .gitignore | 10 ++ Com.Project.B.csproj | 23 ++++ Src/Authorize.meta | 8 ++ Src/Authorize/Com.Project.B.Authorize.asmdef | 17 +++ .../Com.Project.B.Authorize.asmdef.meta | 7 ++ Src/Authorize/IAuthorizeData.cs | 35 ++++++ Src/Authorize/IAuthorizeData.cs.meta | 3 + Src/Authorize/IAuthorizeService.cs | 43 +++++++ Src/Authorize/IAuthorizeService.cs.meta | 11 ++ Src/CharacterAnimation.meta | 8 ++ .../Com.Project.B.CharacterAnimation.asmdef | 19 +++ ...m.Project.B.CharacterAnimation.asmdef.meta | 7 ++ Src/CharacterAnimation/IAnimationFactory.cs | 12 ++ .../IAnimationFactory.cs.meta | 11 ++ .../IHumanoidAnimationFactory.cs | 21 ++++ .../IHumanoidAnimationFactory.cs.meta | 11 ++ .../IPlayerAnimationFactory.cs | 12 ++ .../IPlayerAnimationFactory.cs.meta | 11 ++ Src/CharacterController.meta | 8 ++ .../Com.Project.B.CharacterController.asmdef | 17 +++ ....Project.B.CharacterController.asmdef.meta | 7 ++ .../IBotCharacterController.cs | 8 ++ .../IBotCharacterController.cs.meta | 11 ++ .../ICharacterController.cs | 19 +++ .../ICharacterController.cs.meta | 11 ++ Src/CharacterController/ICharacterService.cs | 12 ++ .../ICharacterService.cs.meta | 11 ++ Src/CharacterController/ICharacterState.cs | 73 ++++++++++++ .../ICharacterState.cs.meta | 11 ++ .../IPlayerCharacterController.cs | 20 ++++ .../IPlayerCharacterController.cs.meta | 11 ++ Src/Dialogue.meta | 8 ++ Src/Dialogue/IDialogueData.cs | 79 +++++++++++++ Src/Dialogue/IDialogueData.cs.meta | 11 ++ Src/Dialogue/IDialogueService.cs | 91 +++++++++++++++ Src/Dialogue/IDialogueService.cs.meta | 11 ++ Src/Dialogue/Net.Project.B.Dialogue.asmdef | 17 +++ .../Net.Project.B.Dialogue.asmdef.meta | 7 ++ Src/Entities.meta | 8 ++ Src/Entities/Com.Project.B.Entities.asmdef | 17 +++ .../Com.Project.B.Entities.asmdef.meta | 7 ++ Src/Entities/IEntitiesFactory.cs | 18 +++ Src/Entities/IEntitiesFactory.cs.meta | 11 ++ Src/Entities/IGameEntitiesService.cs | 11 ++ Src/Entities/IGameEntitiesService.cs.meta | 11 ++ Src/Entities/INpcFactory.cs | 7 ++ Src/Entities/INpcFactory.cs.meta | 11 ++ Src/Entities/IPlayerFactory.cs | 10 ++ Src/Entities/IPlayerFactory.cs.meta | 11 ++ Src/GameService.meta | 8 ++ .../Com.Project.B.GameService.asmdef | 18 +++ .../Com.Project.B.GameService.asmdef.meta | 7 ++ Src/GameService/IGameMapService.cs | 58 ++++++++++ Src/GameService/IGameMapService.cs.meta | 11 ++ Src/Health.meta | 8 ++ Src/Health/HealthService.cs | 89 ++++++++++++++ Src/Health/HealthService.cs.meta | 11 ++ Src/Health/KnockedService.cs | 109 ++++++++++++++++++ Src/Health/KnockedService.cs.meta | 11 ++ Src/Health/Net.Project.B.Health.asmdef | 17 +++ Src/Health/Net.Project.B.Health.asmdef.meta | 7 ++ Src/Interaction.meta | 8 ++ .../Com.Project.B.Interaction.asmdef | 14 +++ .../Com.Project.B.Interaction.asmdef.meta | 7 ++ Src/Interaction/IWorldInteractionService.cs | 64 ++++++++++ .../IWorldInteractionService.cs.meta | 11 ++ Src/Interaction/IWorldInteractions.cs | 20 ++++ Src/Interaction/IWorldInteractions.cs.meta | 11 ++ Src/Inventory.meta | 8 ++ Src/Inventory/Com.Project.B.Inventory.asmdef | 18 +++ .../Com.Project.B.Inventory.asmdef.meta | 7 ++ Src/Inventory/IPlayerInventory.cs | 36 ++++++ Src/Inventory/IPlayerInventory.cs.meta | 11 ++ Src/Inventory/IPlayerWeaponInventory.cs | 81 +++++++++++++ Src/Inventory/IPlayerWeaponInventory.cs.meta | 11 ++ Src/Item.meta | 8 ++ Src/Item/IManagedItemService.cs | 22 ++++ Src/Item/IManagedItemService.cs.meta | 11 ++ Src/Item/Net.Project.B.Item.asmdef | 19 +++ Src/Item/Net.Project.B.Item.asmdef.meta | 7 ++ Src/Lobby.meta | 3 + Src/Lobby/Com.Project.B.Lobby.asmdef | 17 +++ Src/Lobby/Com.Project.B.Lobby.asmdef.meta | 7 ++ Src/Lobby/ILobbyData.cs | 87 ++++++++++++++ Src/Lobby/ILobbyData.cs.meta | 3 + Src/Lobby/ILobbyServices.cs | 99 ++++++++++++++++ Src/Lobby/ILobbyServices.cs.meta | 3 + Src/Net.meta | 8 ++ Src/Net/Com.Project.B.Net.asmdef | 16 +++ Src/Net/Com.Project.B.Net.asmdef.meta | 7 ++ Src/Net/IGameNetService.cs | 24 ++++ Src/Net/IGameNetService.cs.meta | 11 ++ Src/Player.meta | 8 ++ Src/Player/Com.Project.B.Player.asmdef | 17 +++ Src/Player/Com.Project.B.Player.asmdef.meta | 7 ++ Src/Player/IPlayerData.cs | 45 ++++++++ Src/Player/IPlayerData.cs.meta | 11 ++ Src/Player/IPlayerService.cs | 30 +++++ Src/Player/IPlayerService.cs.meta | 11 ++ Src/PlayerSettings.meta | 8 ++ .../Com.Project.B.PlayerSettings.asmdef | 17 +++ .../Com.Project.B.PlayerSettings.asmdef.meta | 7 ++ Src/PlayerSettings/IKeyMap.cs | 13 +++ Src/PlayerSettings/IKeyMap.cs.meta | 11 ++ Src/PlayerSettings/IPlayerKeyMap.cs | 93 +++++++++++++++ Src/PlayerSettings/IPlayerKeyMap.cs.meta | 11 ++ Src/PlayerSettings/IPlayerSettings.cs | 34 ++++++ Src/PlayerSettings/IPlayerSettings.cs.meta | 11 ++ Src/PlayerSettings/IUXKeyMap.cs | 12 ++ Src/PlayerSettings/IUXKeyMap.cs.meta | 11 ++ Src/Quest.meta | 8 ++ Src/Quest/IQuestData.cs | 30 +++++ Src/Quest/IQuestData.cs.meta | 11 ++ Src/Quest/IQuestService.cs | 45 ++++++++ Src/Quest/IQuestService.cs.meta | 11 ++ Src/Quest/Net.Project.B.Quest.asmdef | 16 +++ Src/Quest/Net.Project.B.Quest.asmdef.meta | 7 ++ Src/Skin.meta | 8 ++ Src/Skin/Com.Project.B.Skin.asmdef | 17 +++ Src/Skin/Com.Project.B.Skin.asmdef.meta | 7 ++ Src/Skin/IPlayerSkinData.cs | 30 +++++ Src/Skin/IPlayerSkinData.cs.meta | 11 ++ Src/Skin/IPlayerSkinService.cs | 32 +++++ Src/Skin/IPlayerSkinService.cs.meta | 11 ++ Src/WorldNode.meta | 8 ++ Src/WorldNode/Net.Project.B.WorldNode.asmdef | 18 +++ .../Net.Project.B.WorldNode.asmdef.meta | 7 ++ Src/WorldNode/UnityDoorNode.cs | 32 +++++ Src/WorldNode/UnityDoorNode.cs.meta | 11 ++ Src/WorldNode/UnityItemNode.cs | 22 ++++ Src/WorldNode/UnityItemNode.cs.meta | 11 ++ Src/package.json | 10 ++ Src/package.json.meta | 7 ++ 133 files changed, 2574 insertions(+) create mode 100644 .gitignore create mode 100644 Com.Project.B.csproj create mode 100644 Src/Authorize.meta create mode 100644 Src/Authorize/Com.Project.B.Authorize.asmdef create mode 100644 Src/Authorize/Com.Project.B.Authorize.asmdef.meta create mode 100644 Src/Authorize/IAuthorizeData.cs create mode 100644 Src/Authorize/IAuthorizeData.cs.meta create mode 100644 Src/Authorize/IAuthorizeService.cs create mode 100644 Src/Authorize/IAuthorizeService.cs.meta create mode 100644 Src/CharacterAnimation.meta create mode 100644 Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef create mode 100644 Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef.meta create mode 100644 Src/CharacterAnimation/IAnimationFactory.cs create mode 100644 Src/CharacterAnimation/IAnimationFactory.cs.meta create mode 100644 Src/CharacterAnimation/IHumanoidAnimationFactory.cs create mode 100644 Src/CharacterAnimation/IHumanoidAnimationFactory.cs.meta create mode 100644 Src/CharacterAnimation/IPlayerAnimationFactory.cs create mode 100644 Src/CharacterAnimation/IPlayerAnimationFactory.cs.meta create mode 100644 Src/CharacterController.meta create mode 100644 Src/CharacterController/Com.Project.B.CharacterController.asmdef create mode 100644 Src/CharacterController/Com.Project.B.CharacterController.asmdef.meta create mode 100644 Src/CharacterController/IBotCharacterController.cs create mode 100644 Src/CharacterController/IBotCharacterController.cs.meta create mode 100644 Src/CharacterController/ICharacterController.cs create mode 100644 Src/CharacterController/ICharacterController.cs.meta create mode 100644 Src/CharacterController/ICharacterService.cs create mode 100644 Src/CharacterController/ICharacterService.cs.meta create mode 100644 Src/CharacterController/ICharacterState.cs create mode 100644 Src/CharacterController/ICharacterState.cs.meta create mode 100644 Src/CharacterController/IPlayerCharacterController.cs create mode 100644 Src/CharacterController/IPlayerCharacterController.cs.meta create mode 100644 Src/Dialogue.meta create mode 100644 Src/Dialogue/IDialogueData.cs create mode 100644 Src/Dialogue/IDialogueData.cs.meta create mode 100644 Src/Dialogue/IDialogueService.cs create mode 100644 Src/Dialogue/IDialogueService.cs.meta create mode 100644 Src/Dialogue/Net.Project.B.Dialogue.asmdef create mode 100644 Src/Dialogue/Net.Project.B.Dialogue.asmdef.meta create mode 100644 Src/Entities.meta create mode 100644 Src/Entities/Com.Project.B.Entities.asmdef create mode 100644 Src/Entities/Com.Project.B.Entities.asmdef.meta create mode 100644 Src/Entities/IEntitiesFactory.cs create mode 100644 Src/Entities/IEntitiesFactory.cs.meta create mode 100644 Src/Entities/IGameEntitiesService.cs create mode 100644 Src/Entities/IGameEntitiesService.cs.meta create mode 100644 Src/Entities/INpcFactory.cs create mode 100644 Src/Entities/INpcFactory.cs.meta create mode 100644 Src/Entities/IPlayerFactory.cs create mode 100644 Src/Entities/IPlayerFactory.cs.meta create mode 100644 Src/GameService.meta create mode 100644 Src/GameService/Com.Project.B.GameService.asmdef create mode 100644 Src/GameService/Com.Project.B.GameService.asmdef.meta create mode 100644 Src/GameService/IGameMapService.cs create mode 100644 Src/GameService/IGameMapService.cs.meta create mode 100644 Src/Health.meta create mode 100644 Src/Health/HealthService.cs create mode 100644 Src/Health/HealthService.cs.meta create mode 100644 Src/Health/KnockedService.cs create mode 100644 Src/Health/KnockedService.cs.meta create mode 100644 Src/Health/Net.Project.B.Health.asmdef create mode 100644 Src/Health/Net.Project.B.Health.asmdef.meta create mode 100644 Src/Interaction.meta create mode 100644 Src/Interaction/Com.Project.B.Interaction.asmdef create mode 100644 Src/Interaction/Com.Project.B.Interaction.asmdef.meta create mode 100644 Src/Interaction/IWorldInteractionService.cs create mode 100644 Src/Interaction/IWorldInteractionService.cs.meta create mode 100644 Src/Interaction/IWorldInteractions.cs create mode 100644 Src/Interaction/IWorldInteractions.cs.meta create mode 100644 Src/Inventory.meta create mode 100644 Src/Inventory/Com.Project.B.Inventory.asmdef create mode 100644 Src/Inventory/Com.Project.B.Inventory.asmdef.meta create mode 100644 Src/Inventory/IPlayerInventory.cs create mode 100644 Src/Inventory/IPlayerInventory.cs.meta create mode 100644 Src/Inventory/IPlayerWeaponInventory.cs create mode 100644 Src/Inventory/IPlayerWeaponInventory.cs.meta create mode 100644 Src/Item.meta create mode 100644 Src/Item/IManagedItemService.cs create mode 100644 Src/Item/IManagedItemService.cs.meta create mode 100644 Src/Item/Net.Project.B.Item.asmdef create mode 100644 Src/Item/Net.Project.B.Item.asmdef.meta create mode 100644 Src/Lobby.meta create mode 100644 Src/Lobby/Com.Project.B.Lobby.asmdef create mode 100644 Src/Lobby/Com.Project.B.Lobby.asmdef.meta create mode 100644 Src/Lobby/ILobbyData.cs create mode 100644 Src/Lobby/ILobbyData.cs.meta create mode 100644 Src/Lobby/ILobbyServices.cs create mode 100644 Src/Lobby/ILobbyServices.cs.meta create mode 100644 Src/Net.meta create mode 100644 Src/Net/Com.Project.B.Net.asmdef create mode 100644 Src/Net/Com.Project.B.Net.asmdef.meta create mode 100644 Src/Net/IGameNetService.cs create mode 100644 Src/Net/IGameNetService.cs.meta create mode 100644 Src/Player.meta create mode 100644 Src/Player/Com.Project.B.Player.asmdef create mode 100644 Src/Player/Com.Project.B.Player.asmdef.meta create mode 100644 Src/Player/IPlayerData.cs create mode 100644 Src/Player/IPlayerData.cs.meta create mode 100644 Src/Player/IPlayerService.cs create mode 100644 Src/Player/IPlayerService.cs.meta create mode 100644 Src/PlayerSettings.meta create mode 100644 Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef create mode 100644 Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef.meta create mode 100644 Src/PlayerSettings/IKeyMap.cs create mode 100644 Src/PlayerSettings/IKeyMap.cs.meta create mode 100644 Src/PlayerSettings/IPlayerKeyMap.cs create mode 100644 Src/PlayerSettings/IPlayerKeyMap.cs.meta create mode 100644 Src/PlayerSettings/IPlayerSettings.cs create mode 100644 Src/PlayerSettings/IPlayerSettings.cs.meta create mode 100644 Src/PlayerSettings/IUXKeyMap.cs create mode 100644 Src/PlayerSettings/IUXKeyMap.cs.meta create mode 100644 Src/Quest.meta create mode 100644 Src/Quest/IQuestData.cs create mode 100644 Src/Quest/IQuestData.cs.meta create mode 100644 Src/Quest/IQuestService.cs create mode 100644 Src/Quest/IQuestService.cs.meta create mode 100644 Src/Quest/Net.Project.B.Quest.asmdef create mode 100644 Src/Quest/Net.Project.B.Quest.asmdef.meta create mode 100644 Src/Skin.meta create mode 100644 Src/Skin/Com.Project.B.Skin.asmdef create mode 100644 Src/Skin/Com.Project.B.Skin.asmdef.meta create mode 100644 Src/Skin/IPlayerSkinData.cs create mode 100644 Src/Skin/IPlayerSkinData.cs.meta create mode 100644 Src/Skin/IPlayerSkinService.cs create mode 100644 Src/Skin/IPlayerSkinService.cs.meta create mode 100644 Src/WorldNode.meta create mode 100644 Src/WorldNode/Net.Project.B.WorldNode.asmdef create mode 100644 Src/WorldNode/Net.Project.B.WorldNode.asmdef.meta create mode 100644 Src/WorldNode/UnityDoorNode.cs create mode 100644 Src/WorldNode/UnityDoorNode.cs.meta create mode 100644 Src/WorldNode/UnityItemNode.cs create mode 100644 Src/WorldNode/UnityItemNode.cs.meta create mode 100644 Src/package.json create mode 100644 Src/package.json.meta diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f64af3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# custom +.idea +.plastic +.vscode +/Assets/StreamingAssets/yoo +yoo/ +Bundles/ +Profiler/ +/bin +/obj diff --git a/Com.Project.B.csproj b/Com.Project.B.csproj new file mode 100644 index 0000000..3be19b6 --- /dev/null +++ b/Com.Project.B.csproj @@ -0,0 +1,23 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + ..\BITKit\DLL\Unity.Mathematics.dll + + + + diff --git a/Src/Authorize.meta b/Src/Authorize.meta new file mode 100644 index 0000000..a225b29 --- /dev/null +++ b/Src/Authorize.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5df31814c76fd5f429ae3f4c7b60aeaf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Authorize/Com.Project.B.Authorize.asmdef b/Src/Authorize/Com.Project.B.Authorize.asmdef new file mode 100644 index 0000000..f53a991 --- /dev/null +++ b/Src/Authorize/Com.Project.B.Authorize.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.Authorize", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Authorize/Com.Project.B.Authorize.asmdef.meta b/Src/Authorize/Com.Project.B.Authorize.asmdef.meta new file mode 100644 index 0000000..129c247 --- /dev/null +++ b/Src/Authorize/Com.Project.B.Authorize.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 213fef69b5745f547bdcc386328dc311 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Authorize/IAuthorizeData.cs b/Src/Authorize/IAuthorizeData.cs new file mode 100644 index 0000000..80790dc --- /dev/null +++ b/Src/Authorize/IAuthorizeData.cs @@ -0,0 +1,35 @@ +using System; + +namespace Com.Project.B.Authorize +{ + /// + /// 授权数据 + /// + public interface IAuthorizeData + { + /// + /// 链接ID,仅用于网络通讯 + /// + int ConnectionId { get; set; } + /// + /// 玩家ID + /// + Guid PlayerId { get; } + /// + /// 授权令牌 + /// + string Token { get; } + /// + /// 上次更新时间 + /// + DateTime LastUpdateTime { get; } + } + + public struct AuthorizeData:IAuthorizeData + { + public int ConnectionId { get; set; } + public Guid PlayerId { get; set; } + public string Token { get; set; } + public DateTime LastUpdateTime { get; set; } + } +} \ No newline at end of file diff --git a/Src/Authorize/IAuthorizeData.cs.meta b/Src/Authorize/IAuthorizeData.cs.meta new file mode 100644 index 0000000..d610ffc --- /dev/null +++ b/Src/Authorize/IAuthorizeData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 64fdf8c4f6b4457c87647acd79359508 +timeCreated: 1724414639 \ No newline at end of file diff --git a/Src/Authorize/IAuthorizeService.cs b/Src/Authorize/IAuthorizeService.cs new file mode 100644 index 0000000..a916a22 --- /dev/null +++ b/Src/Authorize/IAuthorizeService.cs @@ -0,0 +1,43 @@ +using System; +using Com.Project.B.Authorize; +using Cysharp.Threading.Tasks; + +namespace Project.B.Authorize +{ + /// + /// 授权服务 + /// + public interface IAuthorizeService + { + /// + /// 尝试获取授权数据 + /// + /// + /// + /// + bool TryGetAuthorizeData(Guid playerId, out IAuthorizeData data); + UniTask GetAllAuthorizeDataAsync(); + /// + /// 授权和登录 + /// + /// + /// + UniTask AuthorizeAsync(IAuthorizeData data); + /// + /// 保持心跳,超时则断开链接 + /// + /// + /// + /// + UniTask HeartbeatAsync(Guid playerId,int connectionId); + /// + /// 授权成功回调 + /// + event Action OnAuthorized; + /// + /// 授权超时回调 + /// + event Action OnAuthorizeTimeout; + } +} + diff --git a/Src/Authorize/IAuthorizeService.cs.meta b/Src/Authorize/IAuthorizeService.cs.meta new file mode 100644 index 0000000..d732c6c --- /dev/null +++ b/Src/Authorize/IAuthorizeService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d55accd2aeb80c940a0b80fcd1e4c634 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterAnimation.meta b/Src/CharacterAnimation.meta new file mode 100644 index 0000000..7e661b1 --- /dev/null +++ b/Src/CharacterAnimation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af56161a7c158cb4f97da44de0d64528 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef b/Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef new file mode 100644 index 0000000..35fad59 --- /dev/null +++ b/Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef @@ -0,0 +1,19 @@ +{ + "name": "Com.Project.B.CharacterAnimation", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:ecc5a2501a2c44d4cb8366674714f3d9", + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "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/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef.meta b/Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef.meta new file mode 100644 index 0000000..6357f91 --- /dev/null +++ b/Src/CharacterAnimation/Com.Project.B.CharacterAnimation.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6bf9bfd639affa44788ad1d79942746b +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterAnimation/IAnimationFactory.cs b/Src/CharacterAnimation/IAnimationFactory.cs new file mode 100644 index 0000000..ca0da1d --- /dev/null +++ b/Src/CharacterAnimation/IAnimationFactory.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using Cysharp.Threading.Tasks; + +namespace Project.B.Animation +{ + public interface IAnimationFactory + { + public UniTask InitializeAsync(); + } + +} diff --git a/Src/CharacterAnimation/IAnimationFactory.cs.meta b/Src/CharacterAnimation/IAnimationFactory.cs.meta new file mode 100644 index 0000000..1cd2a00 --- /dev/null +++ b/Src/CharacterAnimation/IAnimationFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93300d0073822a34184faa323300fcfd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterAnimation/IHumanoidAnimationFactory.cs b/Src/CharacterAnimation/IHumanoidAnimationFactory.cs new file mode 100644 index 0000000..24c957a --- /dev/null +++ b/Src/CharacterAnimation/IHumanoidAnimationFactory.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using BITKit; +using Unity.Mathematics; + +namespace Project.B.Animation +{ + public interface IHumanoidAnimationFactory: IAnimationFactory + { + IWrapper CreateIdleAnimation(); + IWrapper CreateWalkAnimation(); + IWrapper CreateCrouchedAnimation(); + IWrapper CreateInAirAnimation(); + IWrapper CreateRunAnimation(); + IWrapper CreateSprintAnimation(); + IWrapper CreateKnockedAnimation(); + object CreateKnockingAnimation(); + object CreateDeathAnimation(); + + } +} diff --git a/Src/CharacterAnimation/IHumanoidAnimationFactory.cs.meta b/Src/CharacterAnimation/IHumanoidAnimationFactory.cs.meta new file mode 100644 index 0000000..d79c9ca --- /dev/null +++ b/Src/CharacterAnimation/IHumanoidAnimationFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85e6ac8c46e30404cbd8d8cffc15f319 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterAnimation/IPlayerAnimationFactory.cs b/Src/CharacterAnimation/IPlayerAnimationFactory.cs new file mode 100644 index 0000000..63b99da --- /dev/null +++ b/Src/CharacterAnimation/IPlayerAnimationFactory.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using BITKit; +using Unity.Mathematics; + +namespace Project.B.Animation +{ + public interface IPlayerAnimationFactory : IHumanoidAnimationFactory + { + public object CreateStepUpAnimation(); + } +} diff --git a/Src/CharacterAnimation/IPlayerAnimationFactory.cs.meta b/Src/CharacterAnimation/IPlayerAnimationFactory.cs.meta new file mode 100644 index 0000000..f9757d8 --- /dev/null +++ b/Src/CharacterAnimation/IPlayerAnimationFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f0cf21fa72c864844acd31f144d12f86 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController.meta b/Src/CharacterController.meta new file mode 100644 index 0000000..a2b0dce --- /dev/null +++ b/Src/CharacterController.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0b88cd3c8eae9724caabbf566ba0e879 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/Com.Project.B.CharacterController.asmdef b/Src/CharacterController/Com.Project.B.CharacterController.asmdef new file mode 100644 index 0000000..55f4100 --- /dev/null +++ b/Src/CharacterController/Com.Project.B.CharacterController.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.CharacterController", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:d8b63aba1907145bea998dd612889d6b" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/CharacterController/Com.Project.B.CharacterController.asmdef.meta b/Src/CharacterController/Com.Project.B.CharacterController.asmdef.meta new file mode 100644 index 0000000..5c2b005 --- /dev/null +++ b/Src/CharacterController/Com.Project.B.CharacterController.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ecc5a2501a2c44d4cb8366674714f3d9 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/IBotCharacterController.cs b/Src/CharacterController/IBotCharacterController.cs new file mode 100644 index 0000000..80fce9c --- /dev/null +++ b/Src/CharacterController/IBotCharacterController.cs @@ -0,0 +1,8 @@ +namespace Project.B.CharacterController +{ + public interface IBotCharacterController + { + ICharacterController CharacterController { get; } + } +} + diff --git a/Src/CharacterController/IBotCharacterController.cs.meta b/Src/CharacterController/IBotCharacterController.cs.meta new file mode 100644 index 0000000..206253c --- /dev/null +++ b/Src/CharacterController/IBotCharacterController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ed442d9b01567644b3ba71d2290f15d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/ICharacterController.cs b/Src/CharacterController/ICharacterController.cs new file mode 100644 index 0000000..dfb19a7 --- /dev/null +++ b/Src/CharacterController/ICharacterController.cs @@ -0,0 +1,19 @@ +using BITKit.StateMachine; +using Unity.Mathematics; + +namespace Project.B.CharacterController +{ + + /// + /// 角色控制器 + /// + public interface ICharacterController:IStateMachine + { + float3 Center { get; } + float3 Position { get; set; } + float3 Velocity { get; set; } + float3 AngularVelocity { get; } + quaternion Rotation { get; set; } + float3 SelfVelocity { get; set; } + } +} diff --git a/Src/CharacterController/ICharacterController.cs.meta b/Src/CharacterController/ICharacterController.cs.meta new file mode 100644 index 0000000..df08477 --- /dev/null +++ b/Src/CharacterController/ICharacterController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea09f811bb3610f448df064bf4af3c3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/ICharacterService.cs b/Src/CharacterController/ICharacterService.cs new file mode 100644 index 0000000..27c0655 --- /dev/null +++ b/Src/CharacterController/ICharacterService.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Project.B.CharacterController +{ + /// + /// 角色服务 + /// + public interface ICharacterService + { + IDictionary Dictionary { get; } + } +} diff --git a/Src/CharacterController/ICharacterService.cs.meta b/Src/CharacterController/ICharacterService.cs.meta new file mode 100644 index 0000000..72243d9 --- /dev/null +++ b/Src/CharacterController/ICharacterService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8623eebfb2e93db44b3c1f3356660112 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/ICharacterState.cs b/Src/CharacterController/ICharacterState.cs new file mode 100644 index 0000000..67e41c2 --- /dev/null +++ b/Src/CharacterController/ICharacterState.cs @@ -0,0 +1,73 @@ +using BITKit.StateMachine; +using Unity.Mathematics; + +namespace Project.B.CharacterController +{ + /// + /// 角色状态 + /// + public interface ICharacterState : IState + { + public void UpdateVelocity(ref float3 currentVelocity, float deltaTime); + + public void UpdateRotation(ref float3 localPosition, ref quaternion currentRotation, + ref quaternion viewRotation, float deltaTime); + + public void BeforeUpdateVelocity(float deltaTime); + + public void AfterUpdateVelocity(float deltaTime); + } + /// + /// 角色状态数据 + /// + public interface ICharacterStateData + { + public float BaseHeight { get; } + public float BaseSpeed { get; } + public float2 ViewOffset { get; } + } + /// + /// 空状态 + /// + public interface ICharacterStateEmpty:ICharacterState{} + /// + /// 静止 + /// + public interface ICharacterStateIdle:ICharacterState{} + /// + /// 行走 + /// + public interface ICharacterStateWalk:ICharacterState{} + /// + /// 蹲下 + /// + public interface ICharacterStateCrouched:ICharacterState{} + /// + /// 奔跑 + /// + public interface ICharacterStateRun:ICharacterState{} + /// + /// 战术跑 + /// + public interface ICharacterSprint:ICharacterState{} + /// + /// 在空中,包括跳跃、下落、飞行等 + /// + public interface ICharacterStateInAir:ICharacterState{} + /// + /// 爬上低障碍物 + /// + public interface ICharacterStateStepUp:ICharacterState{} + /// + /// 翻阅障碍物 + /// + public interface ICharacterStateVault:ICharacterState{} + /// + /// 攀爬 + /// + public interface ICharacterStateClimb:ICharacterState{} + /// + /// 被击倒 + /// + public interface ICharacterKnocked:ICharacterState{} +} \ No newline at end of file diff --git a/Src/CharacterController/ICharacterState.cs.meta b/Src/CharacterController/ICharacterState.cs.meta new file mode 100644 index 0000000..68fb378 --- /dev/null +++ b/Src/CharacterController/ICharacterState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a1d7bf82adaa85429d4edf3663803b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/CharacterController/IPlayerCharacterController.cs b/Src/CharacterController/IPlayerCharacterController.cs new file mode 100644 index 0000000..2d21740 --- /dev/null +++ b/Src/CharacterController/IPlayerCharacterController.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using BITKit; +using Unity.Mathematics; + +namespace Project.B.CharacterController +{ + public interface IPlayerCharacterController + { + ICharacterController CharacterController { get; } + IDictionary AdditiveCameraQuaternion { get; } + IDictionary ZoomFactor { get; } + ValidHandle AllowTpsCamera { get; } + ValidHandle AllowRun { get; } + ValidHandle AllowSprint { get; } + void CancelRun(); + void CancelSprint(); + } +} + diff --git a/Src/CharacterController/IPlayerCharacterController.cs.meta b/Src/CharacterController/IPlayerCharacterController.cs.meta new file mode 100644 index 0000000..001ed4d --- /dev/null +++ b/Src/CharacterController/IPlayerCharacterController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1653b18508ad4d749bcea633bff67802 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Dialogue.meta b/Src/Dialogue.meta new file mode 100644 index 0000000..1fc748e --- /dev/null +++ b/Src/Dialogue.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee183f11afcda5644bd64299bd2f47f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Dialogue/IDialogueData.cs b/Src/Dialogue/IDialogueData.cs new file mode 100644 index 0000000..198df2e --- /dev/null +++ b/Src/Dialogue/IDialogueData.cs @@ -0,0 +1,79 @@ +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace Net.Project.B.Dialogue +{ + /// + /// 对话数据 + /// + public interface IDialogueData + { + /// + /// 唯一对话ID + /// + public int Identity { get; set; } + /// + /// 通道ID,用于区分不同的对话 + /// + public int Channel { get; } + /// + /// 演员ID,谁是说话的人 + /// + public int ActorIdentity { get; } + /// + /// 文本 + /// + public string Text { get; } + /// + /// 语音路径 + /// + public string VoicePath { get; } + /// + /// 等待对话完成 + /// + /// + TaskAwaiter GetAwaiter(); + } + /// + /// 对话选择 + /// + public interface IDialogueChoice + { + /// + /// 索引 + /// + public int Index { get; } + /// + /// 文本 + /// + public string Text { get; } + /// + /// 是否可选 + /// + public bool Enabled { get; } + /// + /// 备注,例如:选择这个选项会触发什么事件,不可选的原因等 + /// + public string Remark { get; } + } + public struct DialogueData:IDialogueData + { + public int Identity { get; set; } + public int Channel { get; set; } + public int ActorIdentity { get; set; } + public string Text { get; set; } + public string VoicePath { get; set; } + public TaskAwaiter GetAwaiter() + { + throw new System.NotImplementedException(); + } + } + public struct DialogueChoice:IDialogueChoice + { + public int Index { get; set; } + public string Text { get; set; } + public bool Enabled { get; set; } + public string Remark { get; set; } + } +} \ No newline at end of file diff --git a/Src/Dialogue/IDialogueData.cs.meta b/Src/Dialogue/IDialogueData.cs.meta new file mode 100644 index 0000000..95b904d --- /dev/null +++ b/Src/Dialogue/IDialogueData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebb9eb40cce574a44b3419bd4d58411f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Dialogue/IDialogueService.cs b/Src/Dialogue/IDialogueService.cs new file mode 100644 index 0000000..ee48ff0 --- /dev/null +++ b/Src/Dialogue/IDialogueService.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using BITKit; +using Cysharp.Threading.Tasks; + +namespace Net.Project.B.Dialogue +{ + /// + /// 对话服务 + /// + public interface IDialogueService + { + /// + /// 所有对话 + /// + IReadOnlyDictionary Dialogues { get; } + + /// + /// 对话开始 + /// + public event Func OnDialogueStart; + + /// + /// 对话结束 + /// + public event Action OnDialogueEnd; + + /// + /// 对话选择 + /// + public event Func, UniTask> OnDialogueChoose; + + /// + /// 对话选择回调 + /// + public event Action OnDialogueChose; + + /// + /// 开启对话 + /// + /// 对话 + /// + UniTask CreateDialogue(IDialogueData dialogueData); + + UniTask CreateDialogue(IDialogueData dialogueData, IReadOnlyCollection dialogueChoices); + } + + public class DialogueService : IDialogueService + { + public IReadOnlyDictionary Dialogues => _dialogues; + + public event Func OnDialogueStart; + public event Action OnDialogueEnd; + public event Func, UniTask> OnDialogueChoose; + public event Action OnDialogueChose; + + public async UniTask CreateDialogue(IDialogueData dialogueData) + { + if (_dialogues.TryAdd(dialogueData.Identity, dialogueData) is false) + { + dialogueData.Identity = _dialogues.Keys.Max() + 1; + _dialogues.TryAdd(dialogueData.Identity, dialogueData); + } + + await OnDialogueStart.UniTaskFunc(dialogueData); + + OnDialogueEnd?.Invoke(dialogueData); + } + + public async UniTask CreateDialogue(IDialogueData dialogueData, + IReadOnlyCollection dialogueChoices) + { + if (OnDialogueChoose is null) + { + throw new NullReferenceException("OnDialogueChoose is null,unable to create dialogue"); + } + + var task = OnDialogueChoose.Invoke(dialogueData, dialogueChoices); + var index = await task; + + OnDialogueChose?.Invoke(dialogueData, dialogueChoices.ElementAt(index)); + + return index; + } + + private readonly ConcurrentDictionary _dialogues = new(); + } +} \ No newline at end of file diff --git a/Src/Dialogue/IDialogueService.cs.meta b/Src/Dialogue/IDialogueService.cs.meta new file mode 100644 index 0000000..62210a7 --- /dev/null +++ b/Src/Dialogue/IDialogueService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b6700c7171a00048b0d5907bd7c0133 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Dialogue/Net.Project.B.Dialogue.asmdef b/Src/Dialogue/Net.Project.B.Dialogue.asmdef new file mode 100644 index 0000000..a7e5bd0 --- /dev/null +++ b/Src/Dialogue/Net.Project.B.Dialogue.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Net.Project.B.Dialogue", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Dialogue/Net.Project.B.Dialogue.asmdef.meta b/Src/Dialogue/Net.Project.B.Dialogue.asmdef.meta new file mode 100644 index 0000000..168bd75 --- /dev/null +++ b/Src/Dialogue/Net.Project.B.Dialogue.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ba8323a5a01afc24188ded7f4b05db8a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities.meta b/Src/Entities.meta new file mode 100644 index 0000000..2151127 --- /dev/null +++ b/Src/Entities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 035b607824c8f7444a065771731609f5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities/Com.Project.B.Entities.asmdef b/Src/Entities/Com.Project.B.Entities.asmdef new file mode 100644 index 0000000..8463d0f --- /dev/null +++ b/Src/Entities/Com.Project.B.Entities.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.Entities", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Src/Entities/Com.Project.B.Entities.asmdef.meta b/Src/Entities/Com.Project.B.Entities.asmdef.meta new file mode 100644 index 0000000..be18b29 --- /dev/null +++ b/Src/Entities/Com.Project.B.Entities.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c469c0b0902774247810f42d61a18bd7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities/IEntitiesFactory.cs b/Src/Entities/IEntitiesFactory.cs new file mode 100644 index 0000000..f78b014 --- /dev/null +++ b/Src/Entities/IEntitiesFactory.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using BITKit.Entities; +using Cysharp.Threading.Tasks; + +namespace Project.B.Entities +{ + /// + /// 实体工厂 + /// + public interface IEntitiesFactory:IDisposable + { + IReadOnlyDictionary Entities { get; } + UniTask CreateAsync(string addressablePath); + public event Func OnEntityCreate; + public event Func OnEntityCreated; + } +} diff --git a/Src/Entities/IEntitiesFactory.cs.meta b/Src/Entities/IEntitiesFactory.cs.meta new file mode 100644 index 0000000..ef36b55 --- /dev/null +++ b/Src/Entities/IEntitiesFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a04dc5a4e09c045449fae446e3ce4f4c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities/IGameEntitiesService.cs b/Src/Entities/IGameEntitiesService.cs new file mode 100644 index 0000000..0d9638c --- /dev/null +++ b/Src/Entities/IGameEntitiesService.cs @@ -0,0 +1,11 @@ +namespace Project.B.Entities +{ + /// + /// 游戏实体服务,通常是场景中的角色,怪物,道具等 + /// + public interface IInGameEntitiesService + { + + } + +} diff --git a/Src/Entities/IGameEntitiesService.cs.meta b/Src/Entities/IGameEntitiesService.cs.meta new file mode 100644 index 0000000..bb68606 --- /dev/null +++ b/Src/Entities/IGameEntitiesService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 37fcf1ccb8b19e049a5e20b3ceaf53de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities/INpcFactory.cs b/Src/Entities/INpcFactory.cs new file mode 100644 index 0000000..16c1d3e --- /dev/null +++ b/Src/Entities/INpcFactory.cs @@ -0,0 +1,7 @@ +namespace Project.B.Entities +{ + public interface INpcFactory:IEntitiesFactory + { + + } +} diff --git a/Src/Entities/INpcFactory.cs.meta b/Src/Entities/INpcFactory.cs.meta new file mode 100644 index 0000000..6010197 --- /dev/null +++ b/Src/Entities/INpcFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15be9f6a652c2fa4da9f3a5432cea177 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Entities/IPlayerFactory.cs b/Src/Entities/IPlayerFactory.cs new file mode 100644 index 0000000..74b64de --- /dev/null +++ b/Src/Entities/IPlayerFactory.cs @@ -0,0 +1,10 @@ +namespace Project.B.Entities +{ + /// + /// 玩家工厂 + /// + public interface IPlayerFactory:IEntitiesFactory + { + + } +} diff --git a/Src/Entities/IPlayerFactory.cs.meta b/Src/Entities/IPlayerFactory.cs.meta new file mode 100644 index 0000000..b958337 --- /dev/null +++ b/Src/Entities/IPlayerFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40f616061eb458a4c9ac203fe981a405 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/GameService.meta b/Src/GameService.meta new file mode 100644 index 0000000..fab6a91 --- /dev/null +++ b/Src/GameService.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e61e9d1af77a0a3459eb82460e214bbd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/GameService/Com.Project.B.GameService.asmdef b/Src/GameService/Com.Project.B.GameService.asmdef new file mode 100644 index 0000000..a47b820 --- /dev/null +++ b/Src/GameService/Com.Project.B.GameService.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Com.Project.B.GameService", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:a4033552c5c40fa408838a1ce2b1b215", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/GameService/Com.Project.B.GameService.asmdef.meta b/Src/GameService/Com.Project.B.GameService.asmdef.meta new file mode 100644 index 0000000..1ba2160 --- /dev/null +++ b/Src/GameService/Com.Project.B.GameService.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 12c795c5ebfb7b245a0399e28b4015e8 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/GameService/IGameMapService.cs b/Src/GameService/IGameMapService.cs new file mode 100644 index 0000000..8a7b27c --- /dev/null +++ b/Src/GameService/IGameMapService.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit; +using Cysharp.Threading.Tasks; + +namespace Project.B.Map +{ + /// + /// 游戏地图服务 + /// + public interface IGameMapService + { + /// + /// 初始化状态 + /// + InitializationState InitializationState { get; } + /// + /// 当前已加载或正在加载的地图 + /// + string CurrentMap { get; } + /// + /// 获取地图 + /// + /// + UniTask GetMapAsync(); + /// + /// 进入地图 + /// + /// + /// + UniTask StartMapAsync(string map); + /// + /// 停止地图,也是返回菜单的意思 + /// + /// + UniTask StopMapAsync(); + /// + /// 当加载状态发生变化时 + /// + event Action OnInitializationStateChanged; + /// + /// 切换场景前 + /// + event Func OnMapChanging; + + /// + /// 切换场景后 + /// + event Action OnMapChanged; + + /// + /// 地图加载进度 + /// + event Action OnMapLoadingProgress; + } + +} diff --git a/Src/GameService/IGameMapService.cs.meta b/Src/GameService/IGameMapService.cs.meta new file mode 100644 index 0000000..69edbd1 --- /dev/null +++ b/Src/GameService/IGameMapService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3cef42cfdedec0c41b3992402685c70c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Health.meta b/Src/Health.meta new file mode 100644 index 0000000..6def4c4 --- /dev/null +++ b/Src/Health.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62c1efeb1f5e26c45b753b1b37c1e3f7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Health/HealthService.cs b/Src/Health/HealthService.cs new file mode 100644 index 0000000..0276bd5 --- /dev/null +++ b/Src/Health/HealthService.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using BITKit; +using Cysharp.Threading.Tasks; + + +namespace Net.Project.B.Health +{ + /// + /// 生命值服务 + /// + public interface IHealthService + { + /// + /// 已缓存的生命值 + /// + public IReadOnlyDictionary Healths { get; } + /// + /// 在改变生命值前,ID,当前生命值,新的生命值,来源 + /// 增加的数值 + /// + public event Func OnHealthPlus; + /// + /// 在改变生命值后 + /// + /// /// + /// 当健康值发生变化时触发的事件。 + /// + public event Action OnHealthChanged; + /// + /// 调整生命值 + /// + /// + /// +- not set + /// + public UniTask AddHealth(int id,int value,object arg); + } + public class HealthService:IHealthService + { + private static HealthService _singleton; + public HealthService() + { + _singleton = this; + } + [BITCommand] + public static void SetHealth(int id, int newHealth) + { + Healths.GetOrAdd(id,100); + Healths.Set(id,newHealth); + OnHealthChanged?.Invoke(id,newHealth,newHealth,null); + } + [BITCommand] + public static void AddHealth(int id, int newHealth) + { + Healths.GetOrAdd(id,100); + _singleton.AddHealth(id, newHealth, null).Forget(); + } + + + IReadOnlyDictionary IHealthService.Healths => Healths; + private static event Func OnHealthChange; + private static event Action OnHealthChanged; + private static readonly ConcurrentDictionary Healths = new(); + + event Func IHealthService.OnHealthPlus + { + add => OnHealthChange += value; + remove => OnHealthChange -= value; + } + event Action IHealthService.OnHealthChanged + { + add => OnHealthChanged += value; + remove => OnHealthChanged -= value; + } + public UniTask AddHealth(int id, int value,object arg) + { + var current = Healths.GetOrAdd(id,100); + foreach (var func in OnHealthChange.CastAsFunc()) + { + value =func.Invoke(id,current, value, arg); + } + var newHp = Math.Clamp(current + value, -1, 100); + Healths.Set(id,newHp); + OnHealthChanged?.Invoke(id,current,newHp,arg); + return UniTask.FromResult(newHp); + } + } +} diff --git a/Src/Health/HealthService.cs.meta b/Src/Health/HealthService.cs.meta new file mode 100644 index 0000000..42e0da6 --- /dev/null +++ b/Src/Health/HealthService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 128dfad42ea28ca458121d3ca6b70ffc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Health/KnockedService.cs b/Src/Health/KnockedService.cs new file mode 100644 index 0000000..4aaa0f5 --- /dev/null +++ b/Src/Health/KnockedService.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using BITKit; +using Microsoft.Extensions.Logging; + +namespace Net.Project.B.Health +{ + /// + /// 击倒服务 + /// + public interface IKnockedService + { + /// + /// 击倒列表 + /// + public HashSet Knocked { get; } + /// + /// 击倒生命值 + /// + public IReadOnlyDictionary KnockedHealth { get; } + /// + /// 击倒回调 + /// + public event Action OnKnocked; + /// + /// 击倒生命值回调 + /// + public event Action OnKnockedHealthChanged; + } + + public class KnockedService : IKnockedService,IDisposable + { + private readonly IHealthService _healthService; + private readonly ILogger _logger; + + public KnockedService(IHealthService healthService, ILogger logger) + { + _healthService = healthService; + _logger = logger; + _healthService.OnHealthPlus += OnHealthPlus; + _healthService.OnHealthChanged += OnHealthChanged; + } + + private int OnHealthPlus(int id, int oldHp, int plus, object sendor) + { + var isKnocked = _knocked.Contains(id); + if (oldHp < 0) return plus; + if ((oldHp + plus) > -1) return plus; + if (plus > 0) return plus; + if (isKnocked) + { + var currentHealth = _knockedHealth.GetOrAdd(id,100); + if (currentHealth + plus > -1) + { + var nextHealth = currentHealth + plus; + _knockedHealth[id] = nextHealth; + _onKnockedHealthChanged?.Invoke(id, currentHealth, nextHealth); + _logger.LogInformation($"Entity {id} 的击倒生命值减少了,剩余{_knockedHealth[id]}"); + return 0; + } + _knockedHealth.Set(id,-1); + return plus; + } + _knockedHealth.TryAdd(id, 100); + _knocked.Add(id); + _onKnocked?.Invoke(id, true); + _logger.LogInformation($"Entity {id} 被击倒了"); + return 0; + } + + private void OnHealthChanged(int arg1, int arg2, int arg3, object arg4) + { + var isKnocked = _knocked.Contains(arg1); + if(isKnocked is false)return; + if (arg3 <= arg2) return; + _knocked.Remove(arg1); + _knockedHealth.TryRemove(arg1,out _); + _onKnocked?.Invoke(arg1, false); + + _logger.LogInformation($"Entity {arg1} 自起了"); + } + + private static readonly HashSet _knocked = new(); + private static readonly ConcurrentDictionary _knockedHealth = new(); + private static event Action _onKnocked; + private static event Action _onKnockedHealthChanged; + public HashSet Knocked=> _knocked; + public IReadOnlyDictionary KnockedHealth => _knockedHealth; + public event Action OnKnocked + { + add => _onKnocked += value; + remove => _onKnocked -= value; + } + public event Action OnKnockedHealthChanged + { + add => _onKnockedHealthChanged += value; + remove => _onKnockedHealthChanged -= value; + } + + public void Dispose() + { + _healthService.OnHealthPlus -= OnHealthPlus; + _healthService.OnHealthChanged -= OnHealthChanged; + } + } + +} diff --git a/Src/Health/KnockedService.cs.meta b/Src/Health/KnockedService.cs.meta new file mode 100644 index 0000000..91afc2a --- /dev/null +++ b/Src/Health/KnockedService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1eec6f99cef0ae14ab1593764fad6a50 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Health/Net.Project.B.Health.asmdef b/Src/Health/Net.Project.B.Health.asmdef new file mode 100644 index 0000000..1a9cd51 --- /dev/null +++ b/Src/Health/Net.Project.B.Health.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Net.Project.B.Health", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Health/Net.Project.B.Health.asmdef.meta b/Src/Health/Net.Project.B.Health.asmdef.meta new file mode 100644 index 0000000..8c19c23 --- /dev/null +++ b/Src/Health/Net.Project.B.Health.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8f79dfa3edfa9514b8f6d7d2f0102ccc +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Interaction.meta b/Src/Interaction.meta new file mode 100644 index 0000000..6f37451 --- /dev/null +++ b/Src/Interaction.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1bcfe1d2412306a47900a35a4f5ae3e2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Interaction/Com.Project.B.Interaction.asmdef b/Src/Interaction/Com.Project.B.Interaction.asmdef new file mode 100644 index 0000000..25a88fe --- /dev/null +++ b/Src/Interaction/Com.Project.B.Interaction.asmdef @@ -0,0 +1,14 @@ +{ + "name": "Com.Project.B.Interaction", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Interaction/Com.Project.B.Interaction.asmdef.meta b/Src/Interaction/Com.Project.B.Interaction.asmdef.meta new file mode 100644 index 0000000..c83aeb9 --- /dev/null +++ b/Src/Interaction/Com.Project.B.Interaction.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e527b3ce3106f974585be5134b6200e9 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Interaction/IWorldInteractionService.cs b/Src/Interaction/IWorldInteractionService.cs new file mode 100644 index 0000000..3887f2c --- /dev/null +++ b/Src/Interaction/IWorldInteractionService.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Net.Project.B.Interaction +{ + + public enum WorldInteractionProcess + { + None, + Hover, + Started, + Tap, + Hold, + Performed, + } + /// + /// 可互动类型 + /// + public interface IWorldInteractable + { + public int Id { get; } + public IWorldInteractable Root { get; } + public IWorldInteractionType InteractionType { get; } + public object WorldObject { get; set; } + } + /// + /// 世界互动服务 + /// + public interface IWorldInteractionService + { + /// + /// 注册可互动对象 + /// + /// + /// + public bool Register(IWorldInteractable interactable); + /// + /// 注销可互动对象 + /// + /// + /// + public bool Unregister(IWorldInteractable interactable); + /// + /// 尝试获取互动 + /// + /// 通常是Collider InstanceId + /// 可互动对象 + /// + public bool TryGetValue(int id, out IWorldInteractable interactable); + /// + /// 互动 + /// + /// 互动者 + /// 互动对象 + /// 过程,例如开始,完成,结束 + /// 是否互动成功 + bool Interaction(object sender,IWorldInteractable interactable,WorldInteractionProcess process=WorldInteractionProcess.Performed); + /// + /// 互动回调 + /// + public event Action OnInteraction; + } +} diff --git a/Src/Interaction/IWorldInteractionService.cs.meta b/Src/Interaction/IWorldInteractionService.cs.meta new file mode 100644 index 0000000..3d1ab4a --- /dev/null +++ b/Src/Interaction/IWorldInteractionService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a77240fca943a0349904c895ba032c26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Interaction/IWorldInteractions.cs b/Src/Interaction/IWorldInteractions.cs new file mode 100644 index 0000000..cbc47b7 --- /dev/null +++ b/Src/Interaction/IWorldInteractions.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Net.Project.B.Interaction +{ + /// + /// 互动类型 + /// + public interface IWorldInteractionType + { + + } + /// + /// 长按互动 + /// + public interface IWorldHoldingInteraction + { + + } +} diff --git a/Src/Interaction/IWorldInteractions.cs.meta b/Src/Interaction/IWorldInteractions.cs.meta new file mode 100644 index 0000000..e708ec8 --- /dev/null +++ b/Src/Interaction/IWorldInteractions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c6a00515bdf235468aa2da01fffde5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Inventory.meta b/Src/Inventory.meta new file mode 100644 index 0000000..6fe9ecb --- /dev/null +++ b/Src/Inventory.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c978c6ae445f49849a7c47d44b60a54e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Inventory/Com.Project.B.Inventory.asmdef b/Src/Inventory/Com.Project.B.Inventory.asmdef new file mode 100644 index 0000000..21a411a --- /dev/null +++ b/Src/Inventory/Com.Project.B.Inventory.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Com.Project.B.Inventory", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:677cd05ca06c46b4395470200b1acdad", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Src/Inventory/Com.Project.B.Inventory.asmdef.meta b/Src/Inventory/Com.Project.B.Inventory.asmdef.meta new file mode 100644 index 0000000..ed32b90 --- /dev/null +++ b/Src/Inventory/Com.Project.B.Inventory.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4f0d7989fc8bc01489c1e1f65eedd1c3 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Inventory/IPlayerInventory.cs b/Src/Inventory/IPlayerInventory.cs new file mode 100644 index 0000000..2a581f1 --- /dev/null +++ b/Src/Inventory/IPlayerInventory.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit; + +namespace Net.Project.B.Inventory +{ + + /// + /// 玩家背包 + /// + public interface IPlayerInventory + { + /// + /// 背包 + /// + public IRuntimeItemContainer Container { get; } + + /// + /// 拾取物品的工厂方法 + /// + event Action OnPickupItemFactory; + + /// + /// 使用物品的工厂方法,如果返回true则代表物品已被其他逻辑处理 + /// + event Action UseFactory; + + /// + /// 使用物品的事件,如果返回true则代表物品已被其他逻辑处理 + /// + event Action OnUsedItem; + + void UseItem(int id); + } +} diff --git a/Src/Inventory/IPlayerInventory.cs.meta b/Src/Inventory/IPlayerInventory.cs.meta new file mode 100644 index 0000000..b492e14 --- /dev/null +++ b/Src/Inventory/IPlayerInventory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c7d743b00f286c04985e59bc3d610882 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Inventory/IPlayerWeaponInventory.cs b/Src/Inventory/IPlayerWeaponInventory.cs new file mode 100644 index 0000000..1e60074 --- /dev/null +++ b/Src/Inventory/IPlayerWeaponInventory.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit; +using BITKit.StateMachine; + +namespace Net.Project.B.Inventory +{ + /// + /// 玩家武器槽 + /// + public enum PlayerWeaponSlot + { + /// + /// 主武器 + /// + Primary, + /// + /// 主武器2 + /// + Secondary, + /// + /// 副武器,例如手枪,近战武器等 + /// + Sidearm, + /// + /// 消耗品,通常是护甲,医疗包等 + /// + Supplies, + /// + /// 战术道具 + /// + Tactics, + /// + /// 致命道具 + /// + Lethal, + /// + /// 连杀奖励,特别的武器 + /// + KillStreak + } + /// + /// 玩家武器控制器 + /// + public interface IPlayerWeaponController:IStateAsync{} + /// + /// 玩家枪支控制器 + /// + public interface IPlayerGunController:IPlayerWeaponController{} + /// + /// 玩家近战武器控制器 + /// + public interface IPlayerMeleeController:IPlayerWeaponController{} + /// + /// 玩家武器库存,与背包不是一个东西 + /// + public interface IPlayerWeaponInventory + { + /// + /// 武器槽 + /// + public IReadOnlyDictionary WeaponSlots { get; } + /// + /// 武器控制器状态机 + /// + public IStateMachine StateMachine { get; } + /// + /// 武器槽更新回调,参数为:slot,ItemId,IsAdd + /// + public event Action OnWeaponSlotChanged; + /// + /// 丢下武器 + /// + /// + void Drop(PlayerWeaponSlot slot); + void Use(PlayerWeaponSlot slot); + void Use(int id); + } + +} diff --git a/Src/Inventory/IPlayerWeaponInventory.cs.meta b/Src/Inventory/IPlayerWeaponInventory.cs.meta new file mode 100644 index 0000000..85589f5 --- /dev/null +++ b/Src/Inventory/IPlayerWeaponInventory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d7346ddba01563842a9e9c4b3438609b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Item.meta b/Src/Item.meta new file mode 100644 index 0000000..06ece3c --- /dev/null +++ b/Src/Item.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2d0475018ba6c5c43b43ff42a24e7bd3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Item/IManagedItemService.cs b/Src/Item/IManagedItemService.cs new file mode 100644 index 0000000..bfe9fa5 --- /dev/null +++ b/Src/Item/IManagedItemService.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using BITKit; +using Cysharp.Threading.Tasks; +using Unity.Mathematics; + +namespace Net.Project.B.Item +{ + public interface IManagedItemService + { + public IReadOnlyDictionary Items { get; } + public void AddOrUpdateItem(IRuntimeItem item); + public void InstanceItem(float3 position, quaternion rotation, IRuntimeItem item); + public void DisposeItem(IRuntimeItem item); + public void DisposeWorldObject(IRuntimeItem item); + public UniTask ReloadAsync(); + public event Action OnItemAddedOrUpdated; + public event Action OnItemDisposed; + } +} diff --git a/Src/Item/IManagedItemService.cs.meta b/Src/Item/IManagedItemService.cs.meta new file mode 100644 index 0000000..164b500 --- /dev/null +++ b/Src/Item/IManagedItemService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f492654306a018c429fdc97ef6abef58 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Item/Net.Project.B.Item.asmdef b/Src/Item/Net.Project.B.Item.asmdef new file mode 100644 index 0000000..5d2f12a --- /dev/null +++ b/Src/Item/Net.Project.B.Item.asmdef @@ -0,0 +1,19 @@ +{ + "name": "Net.Project.B.Item", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:677cd05ca06c46b4395470200b1acdad", + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "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/Item/Net.Project.B.Item.asmdef.meta b/Src/Item/Net.Project.B.Item.asmdef.meta new file mode 100644 index 0000000..934dad9 --- /dev/null +++ b/Src/Item/Net.Project.B.Item.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f3613c0168f084d4e85ef0501bfa7392 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Lobby.meta b/Src/Lobby.meta new file mode 100644 index 0000000..0570d4c --- /dev/null +++ b/Src/Lobby.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a4084d10e7034699950a1b849cc65eac +timeCreated: 1724412982 \ No newline at end of file diff --git a/Src/Lobby/Com.Project.B.Lobby.asmdef b/Src/Lobby/Com.Project.B.Lobby.asmdef new file mode 100644 index 0000000..0705d5c --- /dev/null +++ b/Src/Lobby/Com.Project.B.Lobby.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.Lobby", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Lobby/Com.Project.B.Lobby.asmdef.meta b/Src/Lobby/Com.Project.B.Lobby.asmdef.meta new file mode 100644 index 0000000..66e8186 --- /dev/null +++ b/Src/Lobby/Com.Project.B.Lobby.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9bf0c8dbe7a241c4e8aaeb76035bfdaf +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Lobby/ILobbyData.cs b/Src/Lobby/ILobbyData.cs new file mode 100644 index 0000000..41918b4 --- /dev/null +++ b/Src/Lobby/ILobbyData.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Com.Project.B.Lobby +{ + /// + /// 大厅授权 + /// + public enum LobbyAccessMode + { + /// + /// 私密大厅 + /// + Private, + /// + /// 公开,可被搜索到 + /// + Public, + /// + /// 仅好友可见 + /// + FriendsOnly, + /// + /// 仅邀请可见 + /// + InviteOnly, + /// + /// 好友和邀请 + /// + FriendAndInvite, + } + /// + /// 大厅数据 + /// + public interface ILobbyData + { + /// + /// 大厅ID,通常是玩家ID + /// + public Guid Id { get; } + /// + /// 开放模式 + /// + LobbyAccessMode LobbyAccess { get; } + /// + /// 选择的场景 + /// + public string Map { get; } + /// + /// 大厅名称 + /// + public string Name { get; } + /// + /// 描述 + /// + public string Description { get; } + /// + /// 主机ID,通常是玩家ID + /// + public Guid HostId { get; } + /// + /// 玩家ID + /// + public Guid[] PlayerIds { get; } + + public bool Contain(Guid player); + } + public sealed class LobbyData:ILobbyData + { + public Guid Id { get; set; } + public LobbyAccessMode LobbyAccess { get; set; } = LobbyAccessMode.Public; + public string Map { get; set; } + public string Name { get; set; } = "Project B Lobby"; + public string Description { get; set; }="Welcome"; + public Guid HostId { get; set; } + [JsonIgnore] + Guid[] ILobbyData.PlayerIds=>Players.ToArray(); + + public bool Contain(Guid player) + { + return Players.Contains(player) || HostId == player; + } + + public List Players = new(); + } +} \ No newline at end of file diff --git a/Src/Lobby/ILobbyData.cs.meta b/Src/Lobby/ILobbyData.cs.meta new file mode 100644 index 0000000..e807079 --- /dev/null +++ b/Src/Lobby/ILobbyData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 32934edab554437a8cfe71b1e7691b4f +timeCreated: 1724413203 \ No newline at end of file diff --git a/Src/Lobby/ILobbyServices.cs b/Src/Lobby/ILobbyServices.cs new file mode 100644 index 0000000..d83c156 --- /dev/null +++ b/Src/Lobby/ILobbyServices.cs @@ -0,0 +1,99 @@ +using System; +using BITKit; +using Cysharp.Threading.Tasks; + +namespace Com.Project.B.Lobby +{ + /// + /// 大厅服务 + /// + public interface ILobbyServices + { + /// + /// 获取玩家所在的大厅 + /// + /// + /// + UniTask GetPlayerLobbyAsync(Guid playerId); + /// + /// 获取所有大厅 + /// + /// + UniTask GetAllLobbyDataAsync(); + /// + /// 创建大厅 + /// + /// + /// + UniTask CreateLobbyAsync(ILobbyData data); + /// + /// 加入大厅 + /// + /// + /// + /// + UniTask JoinLobbyAsync(Guid playerId,Guid lobbyId); + /// + /// 离开大厅 + /// + /// + /// + /// + UniTask LeaveLobbyAsync(Guid playerId,Guid lobbyId); + /// + /// 更新大厅信息 + /// + /// + /// + UniTask UpdateLobbyAsync(ILobbyData data); + /// + /// 正式释放大厅,通常是游戏开始后 + /// + /// + /// + UniTask ReleaseLobbyAsync(Guid lobbyId); + /// + /// 释放大厅,通常是主机离线或加入其他人的大厅 + /// + /// + /// + UniTask DisposeLobbyAsync(Guid lobbyId); + /// + /// 邀请玩家加入大厅 + /// + /// + UniTask InviteToLobbyAsync(Guid inviterId,Guid inviteeId,Guid lobbyId); + /// + /// 是否接受邀请 + /// + /// + /// + /// + /// + UniTask AccessLobbyInviteAsync(Guid playerId,Guid lobbyId,bool accept); + /// + /// 当大厅创建时 + /// + event Action OnLobbyCreated; + /// + /// 当大厅更新时 + /// + event Action OnLobbyUpdated; + /// + /// 当大厅正式释放时 + /// + event Action OnLobbyReleased; + /// + /// 当大厅释放时 + /// + event Action OnLobbyDisposed; + /// + /// 当邀请加入大厅时 + /// + event Action OnInviteToLobby; + /// + /// 当拒绝或接受邀请时 + /// + event Action OnAccessLobbyInvite; + } +} \ No newline at end of file diff --git a/Src/Lobby/ILobbyServices.cs.meta b/Src/Lobby/ILobbyServices.cs.meta new file mode 100644 index 0000000..fdb8d30 --- /dev/null +++ b/Src/Lobby/ILobbyServices.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2ca5119e773d49159573f88c6d35f987 +timeCreated: 1724413181 \ No newline at end of file diff --git a/Src/Net.meta b/Src/Net.meta new file mode 100644 index 0000000..8823ffa --- /dev/null +++ b/Src/Net.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 781f78b6186d76441831eb8d0f3c6854 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Net/Com.Project.B.Net.asmdef b/Src/Net/Com.Project.B.Net.asmdef new file mode 100644 index 0000000..fd279c3 --- /dev/null +++ b/Src/Net/Com.Project.B.Net.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Com.Project.B.Net", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Net/Com.Project.B.Net.asmdef.meta b/Src/Net/Com.Project.B.Net.asmdef.meta new file mode 100644 index 0000000..8f7bd53 --- /dev/null +++ b/Src/Net/Com.Project.B.Net.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a4033552c5c40fa408838a1ce2b1b215 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Net/IGameNetService.cs b/Src/Net/IGameNetService.cs new file mode 100644 index 0000000..ec9b3af --- /dev/null +++ b/Src/Net/IGameNetService.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit; +using BITKit.StateMachine; + +namespace Project.B.Net +{ + public interface IGameNetState:IState{} + public interface IGameNetOffline:IGameNetState{} + public interface IGameNetAsHost : IGameNetState + { + } + public interface IGameNetAsClient : IGameNetState + { + } + public interface IGameNetService:IStateMachine,IDisposable + { + public INetServer Server { get; } + public INetClient Client { get; } + public INetClient LobbyClient { get; } + } + +} diff --git a/Src/Net/IGameNetService.cs.meta b/Src/Net/IGameNetService.cs.meta new file mode 100644 index 0000000..76f12e3 --- /dev/null +++ b/Src/Net/IGameNetService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b586b11f2d79b8b4fbe7c50bb4ae851f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Player.meta b/Src/Player.meta new file mode 100644 index 0000000..5c240b9 --- /dev/null +++ b/Src/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 166a2e39de2fd344cb5419c5e4fe22ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Player/Com.Project.B.Player.asmdef b/Src/Player/Com.Project.B.Player.asmdef new file mode 100644 index 0000000..d99d57e --- /dev/null +++ b/Src/Player/Com.Project.B.Player.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.Player", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Player/Com.Project.B.Player.asmdef.meta b/Src/Player/Com.Project.B.Player.asmdef.meta new file mode 100644 index 0000000..e646941 --- /dev/null +++ b/Src/Player/Com.Project.B.Player.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2d0943973658ff5419a52132fdc2812c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Player/IPlayerData.cs b/Src/Player/IPlayerData.cs new file mode 100644 index 0000000..46818b1 --- /dev/null +++ b/Src/Player/IPlayerData.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using MemoryPack; + +namespace Project.B.Player +{ + public interface IPlayerData + { + /// + /// 用户ID + /// + Guid PlayerId { get; } + /// + /// 是否是机器人 + /// + bool IsBot { get; } + /// + /// Steam64位ID + /// + long Steam64Id { get; } + /// + /// https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/xx/xx.jpg + /// + string AvatarUrl { get; } + /// + /// 用户名 + /// + string NickName { get; } + /// + /// 许可证状态 + /// + int LicenseLevel { get; } + } + [MemoryPackable] + public partial struct PlayerData:IPlayerData + { + public Guid PlayerId { get; set; } + public bool IsBot { get; set; } + public long Steam64Id { get; set; } + public string AvatarUrl { get; set; } + public string NickName { get; set; } + public int LicenseLevel { get; set; } + } +} diff --git a/Src/Player/IPlayerData.cs.meta b/Src/Player/IPlayerData.cs.meta new file mode 100644 index 0000000..c2eeb1d --- /dev/null +++ b/Src/Player/IPlayerData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5643896287a5a394799a8172a15485d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Player/IPlayerService.cs b/Src/Player/IPlayerService.cs new file mode 100644 index 0000000..d1a7536 --- /dev/null +++ b/Src/Player/IPlayerService.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cysharp.Threading.Tasks; + +namespace Project.B.Player +{ + public interface IPlayerService + { + /// + /// 获取玩家信息 + /// + /// + /// + UniTask GetPlayerDataAsync(Guid id); + /// + /// 获取玩家信息 + /// + /// + /// + UniTask> GetPlayersDataAsync(IReadOnlyCollection ids); + /// + /// 创建或更新玩家信息 + /// + /// + /// + UniTask CreateOrUpdatePlayerAsync(IPlayerData playerData); + } +} + diff --git a/Src/Player/IPlayerService.cs.meta b/Src/Player/IPlayerService.cs.meta new file mode 100644 index 0000000..5b60f22 --- /dev/null +++ b/Src/Player/IPlayerService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8de5d3a0ae5b33947ae38fe3e415dae3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings.meta b/Src/PlayerSettings.meta new file mode 100644 index 0000000..a0665c7 --- /dev/null +++ b/Src/PlayerSettings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2229713342b60434b949bf1a30a64614 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef b/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef new file mode 100644 index 0000000..2f443f5 --- /dev/null +++ b/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.PlayerSettings", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:d8b63aba1907145bea998dd612889d6b" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef.meta b/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef.meta new file mode 100644 index 0000000..335ed30 --- /dev/null +++ b/Src/PlayerSettings/Com.Project.B.PlayerSettings.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a3cd7886d0941284aa4f5e020270c73a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings/IKeyMap.cs b/Src/PlayerSettings/IKeyMap.cs new file mode 100644 index 0000000..2e7639d --- /dev/null +++ b/Src/PlayerSettings/IKeyMap.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Project.B.Player +{ + public interface IKeyMap + { + /// + /// 键位字典 + /// + public IReadOnlyDictionary KeyDictionary { get; } + } +} \ No newline at end of file diff --git a/Src/PlayerSettings/IKeyMap.cs.meta b/Src/PlayerSettings/IKeyMap.cs.meta new file mode 100644 index 0000000..90958e4 --- /dev/null +++ b/Src/PlayerSettings/IKeyMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1b454bfee320d94da7750e207baeefb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings/IPlayerKeyMap.cs b/Src/PlayerSettings/IPlayerKeyMap.cs new file mode 100644 index 0000000..9d1c7e2 --- /dev/null +++ b/Src/PlayerSettings/IPlayerKeyMap.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; + +namespace Project.B.Player +{ + /// + /// 玩家键位 + /// + public interface IPlayerKeyMap:IKeyMap + { + /// + /// 移动 + /// + public string MovementKey { get; set; } + /// + /// 视角 + /// + public string ViewKey { get; set; } + /// + /// 跳跃 + /// + public string JumpKey { get; set; } + /// + /// 奔跑 + /// + public string RunKey{ get; set; } + /// + /// 蹲下 + /// + public string CrouchKey { get; set; } + /// + /// 切换第三人称相机 + /// + public string ToggleCameraKey { get; set; } + /// + /// 互动 + /// + public string InteractiveKey { get; } + /// + /// 收起武器 + /// + public string HolsterKey { get; } + /// + /// 主武器 + /// + public string PrimaryWeaponKey { get; } + /// + /// 副武器 + /// + public string SecondaryWeaponKey { get; } + /// + /// 随身武器 + /// + public string SidearmKey { get; } + /// + /// 消耗品 + /// + public string SuppliesKey { get; } + /// + /// 战术道具 + /// + public string TacticalKey { get; } + /// + /// 致命道具 + /// + public string LethalKey { get; } + /// + /// 连杀道具 + /// + public string KillStreakKey { get; } + /// + /// 滚轮缩放,在不同状态下有不同的表现 + /// + public string ScrollKey { get; } + /// + /// 近战 + /// + public string MeleeKey { get; } + /// + /// 重装 + /// + public string ReloadKey { get; } + /// + /// 瞄准 + /// + public string AimKey { get; } + /// + /// 开火 + /// + public string FireKey { get; } + } +} + + diff --git a/Src/PlayerSettings/IPlayerKeyMap.cs.meta b/Src/PlayerSettings/IPlayerKeyMap.cs.meta new file mode 100644 index 0000000..8435f02 --- /dev/null +++ b/Src/PlayerSettings/IPlayerKeyMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b96b94748c46abe48a458c08828b3aa0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings/IPlayerSettings.cs b/Src/PlayerSettings/IPlayerSettings.cs new file mode 100644 index 0000000..f59b1a5 --- /dev/null +++ b/Src/PlayerSettings/IPlayerSettings.cs @@ -0,0 +1,34 @@ +using Unity.Mathematics; + +namespace Project.B.Player +{ + /// + /// 玩家设置 + /// + public interface IPlayerSettings + { + /// + /// 灵敏度 + /// + public float Sensitivity { get; set; } + public float GamePadSensitivity { get; set; } + /// + /// 视野 + /// + public int Fov { get; set; } + /// + /// 刷新率 + /// + public int Freq { get; } + /// + /// 分辨率 + /// + public int2 Resolution { get; set; } + /// + /// 是否全屏 + /// + public bool IsFullScreen { get; set; } + } + +} + diff --git a/Src/PlayerSettings/IPlayerSettings.cs.meta b/Src/PlayerSettings/IPlayerSettings.cs.meta new file mode 100644 index 0000000..f225f21 --- /dev/null +++ b/Src/PlayerSettings/IPlayerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08583ca0424969648b301dfc107f50c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/PlayerSettings/IUXKeyMap.cs b/Src/PlayerSettings/IUXKeyMap.cs new file mode 100644 index 0000000..7be2305 --- /dev/null +++ b/Src/PlayerSettings/IUXKeyMap.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Project.B.Player +{ + public interface IUXKeyMap : IKeyMap + { + public string CancelKey { get; set; } + public string InventoryKey { get; set; } + public string ConfirmKey { get; set; } + } +} diff --git a/Src/PlayerSettings/IUXKeyMap.cs.meta b/Src/PlayerSettings/IUXKeyMap.cs.meta new file mode 100644 index 0000000..e7f25a4 --- /dev/null +++ b/Src/PlayerSettings/IUXKeyMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4170bfefe0abf124fb011de09b00705a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Quest.meta b/Src/Quest.meta new file mode 100644 index 0000000..0d07bb8 --- /dev/null +++ b/Src/Quest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2be7fa32eabfab4bb7cd5a7a70750e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Quest/IQuestData.cs b/Src/Quest/IQuestData.cs new file mode 100644 index 0000000..43abf76 --- /dev/null +++ b/Src/Quest/IQuestData.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Net.Project.B.Quest +{ + public enum QuestState + { + Inactive, + Active, + Completed, + Canceled, + Failed + } + public interface IQuestData + { + public int Identity { get; } + public string Name { get; } + public string Description { get; } + public bool IsCompleted { get; } + public QuestState CurrentState { get; } + } + public struct QuestData : IQuestData + { + public int Identity { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public bool IsCompleted { get; set; } + public QuestState CurrentState { get; set; } + } +} diff --git a/Src/Quest/IQuestData.cs.meta b/Src/Quest/IQuestData.cs.meta new file mode 100644 index 0000000..0385189 --- /dev/null +++ b/Src/Quest/IQuestData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fde0215d2d5e254580d8747f34f43a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Quest/IQuestService.cs b/Src/Quest/IQuestService.cs new file mode 100644 index 0000000..fc59f19 --- /dev/null +++ b/Src/Quest/IQuestService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; + +namespace Net.Project.B.Quest +{ + public interface IQuestService + { + public IReadOnlyDictionary Quests { get; } + public event Action OnQuestCreatedOrUpdated; + IQuestData AddOrUpdateQuest(IQuestData questData); + } + public class QuestService : IQuestService + { + //自动实现 + private readonly ILogger _logger; + public IReadOnlyDictionary Quests => _quests; + public event Action OnQuestCreatedOrUpdated; + private readonly ConcurrentDictionary _quests = new(); + + public QuestService(ILogger logger) + { + _logger = logger; + } + + public IQuestData AddOrUpdateQuest(IQuestData questData) + { + if (_quests.TryAdd(questData.Identity, questData)) + { + OnQuestCreatedOrUpdated?.Invoke(questData,QuestState.Inactive,questData.CurrentState); + _logger.LogInformation($"任务:{questData.Name}已创建"); + } + else + { + var currentState = _quests[questData.Identity].CurrentState; + _quests[questData.Identity] = questData; + OnQuestCreatedOrUpdated?.Invoke(questData,currentState,questData.CurrentState); + _logger.LogInformation($"任务:{questData.Name}已更新状态,从{currentState}更新为{questData.CurrentState}"); + } + return questData; + } + } +} \ No newline at end of file diff --git a/Src/Quest/IQuestService.cs.meta b/Src/Quest/IQuestService.cs.meta new file mode 100644 index 0000000..58ffd69 --- /dev/null +++ b/Src/Quest/IQuestService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d132a501f9e537b479368d38dce91e44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Quest/Net.Project.B.Quest.asmdef b/Src/Quest/Net.Project.B.Quest.asmdef new file mode 100644 index 0000000..d600cbf --- /dev/null +++ b/Src/Quest/Net.Project.B.Quest.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Net.Project.B.Quest", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Quest/Net.Project.B.Quest.asmdef.meta b/Src/Quest/Net.Project.B.Quest.asmdef.meta new file mode 100644 index 0000000..30da430 --- /dev/null +++ b/Src/Quest/Net.Project.B.Quest.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b93d14745ae2c064fb21541ca62ad9de +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Skin.meta b/Src/Skin.meta new file mode 100644 index 0000000..616196f --- /dev/null +++ b/Src/Skin.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1bf3c23536696d24ab5bd115c126c540 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Skin/Com.Project.B.Skin.asmdef b/Src/Skin/Com.Project.B.Skin.asmdef new file mode 100644 index 0000000..6e37295 --- /dev/null +++ b/Src/Skin/Com.Project.B.Skin.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Com.Project.B.Skin", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:f51ebe6a0ceec4240a699833d6309b23" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Src/Skin/Com.Project.B.Skin.asmdef.meta b/Src/Skin/Com.Project.B.Skin.asmdef.meta new file mode 100644 index 0000000..f27d9c0 --- /dev/null +++ b/Src/Skin/Com.Project.B.Skin.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c95e23613aa3d05469c7fb568e04243c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Skin/IPlayerSkinData.cs b/Src/Skin/IPlayerSkinData.cs new file mode 100644 index 0000000..a43130f --- /dev/null +++ b/Src/Skin/IPlayerSkinData.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Project.B.Skin +{ + public interface IPlayerSkinSocket{} + /// + /// 玩家武器皮肤 + /// + public struct PlayerSkinWeaponSocket : IPlayerSkinSocket{} + /// + /// 玩家角色皮肤 + /// + public struct PlayerOperatorSkinSocket : IPlayerSkinSocket{} + /// + /// 玩家已装备皮肤数据 + /// + public interface IPlayerReplacedSkinData:IReadOnlyDictionary + { + + } + /// + /// 玩家皮肤数据 + /// + public interface IPlayerSkinData + { + public int Id { get; } + public int ConfigId { get; } + } +} diff --git a/Src/Skin/IPlayerSkinData.cs.meta b/Src/Skin/IPlayerSkinData.cs.meta new file mode 100644 index 0000000..520cfc1 --- /dev/null +++ b/Src/Skin/IPlayerSkinData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: de24d0a11c0575d449218df10eb83a1e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Skin/IPlayerSkinService.cs b/Src/Skin/IPlayerSkinService.cs new file mode 100644 index 0000000..271e73d --- /dev/null +++ b/Src/Skin/IPlayerSkinService.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cysharp.Threading.Tasks; + +namespace Project.B.Skin +{ + /// + /// 玩家皮肤服务 + /// + public interface IPlayerSkinService + { + /// + /// 获取玩家已装备皮肤数据 + /// + /// + /// + public UniTask GetPlayerReplacedSkinDataAsync(Guid playerId); + /// + /// 获取玩家已装备皮肤数据 + /// + /// + /// + public UniTask GetPlayersReplacedSkinDataAsync(params Guid[] playerIds); + /// + /// 获取玩家皮肤数据 + /// + /// + /// + public UniTask GetPlayerSkinDataAsync(Guid playerId); + } +} diff --git a/Src/Skin/IPlayerSkinService.cs.meta b/Src/Skin/IPlayerSkinService.cs.meta new file mode 100644 index 0000000..5987acd --- /dev/null +++ b/Src/Skin/IPlayerSkinService.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 350ce8452677ca543bcdbea74519a858 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/WorldNode.meta b/Src/WorldNode.meta new file mode 100644 index 0000000..8440552 --- /dev/null +++ b/Src/WorldNode.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6fa9e34a87e1dc842be4b549685afb45 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/WorldNode/Net.Project.B.WorldNode.asmdef b/Src/WorldNode/Net.Project.B.WorldNode.asmdef new file mode 100644 index 0000000..561c5d1 --- /dev/null +++ b/Src/WorldNode/Net.Project.B.WorldNode.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Net.Project.B.WorldNode", + "rootNamespace": "", + "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", + "GUID:d750d221812bb1d48baff92e6ef73e28", + "GUID:49b49c76ee64f6b41bf28ef951cb0e50" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Src/WorldNode/Net.Project.B.WorldNode.asmdef.meta b/Src/WorldNode/Net.Project.B.WorldNode.asmdef.meta new file mode 100644 index 0000000..853f2a4 --- /dev/null +++ b/Src/WorldNode/Net.Project.B.WorldNode.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aab9e82873ffb00498c7fcaca7aee8ca +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/WorldNode/UnityDoorNode.cs b/Src/WorldNode/UnityDoorNode.cs new file mode 100644 index 0000000..ed5e4b2 --- /dev/null +++ b/Src/WorldNode/UnityDoorNode.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit.WorldNode; +#if UNITY_5_3_OR_NEWER +using UnityEngine; +#endif + +namespace Net.Project.B.WorldNode +{ + public enum UnityDoorState + { + NoState, + Opened, + Closed, + Disabled, + Locked, + } + [Serializable] + public struct UnityDoorNode:IWorldNode + { + public int Id { get; set; } + public object WorldObject { get; set; } + public UnityDoorState State; +#if UNITY_5_3_OR_NEWER + public Vector3 OpenPosition; + public Vector3 ClosePosition; + public Vector3 OpenEulerAngles; + public Vector3 CloseEulerAngles; +#endif + } +} diff --git a/Src/WorldNode/UnityDoorNode.cs.meta b/Src/WorldNode/UnityDoorNode.cs.meta new file mode 100644 index 0000000..040e8dc --- /dev/null +++ b/Src/WorldNode/UnityDoorNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2a37e0529e2612444907c25dbbbc5565 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/WorldNode/UnityItemNode.cs b/Src/WorldNode/UnityItemNode.cs new file mode 100644 index 0000000..cdd4897 --- /dev/null +++ b/Src/WorldNode/UnityItemNode.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BITKit; +using BITKit.WorldNode; +#if UNITY_5_3_OR_NEWER +using UnityEngine; +#endif +namespace Net.Project.B.WorldNode +{ + [Serializable] + public struct UnityItemNode : IWorldNode + { + public int Id { get; set; } + public object WorldObject { get; set; } +#if UNITY_5_3_OR_NEWER + [SerializeReference, SubclassSelector] +#endif + private IReference itemPath; + public string ItemPath => itemPath.Value; + } +} diff --git a/Src/WorldNode/UnityItemNode.cs.meta b/Src/WorldNode/UnityItemNode.cs.meta new file mode 100644 index 0000000..894c2db --- /dev/null +++ b/Src/WorldNode/UnityItemNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b4152eadbfda5584889fc1debfcae88a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/package.json b/Src/package.json new file mode 100644 index 0000000..05401c2 --- /dev/null +++ b/Src/package.json @@ -0,0 +1,10 @@ +{ + "name": "com.project.b", + "displayName": "Project B", + "version": "2024.3.31", + "unity": "2022.3", + "description": "Project B 类库与接口", + "keywords": [], + "license": "MIT", + "dependencies": {} +} \ No newline at end of file diff --git a/Src/package.json.meta b/Src/package.json.meta new file mode 100644 index 0000000..548d513 --- /dev/null +++ b/Src/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 88a809f143aa4d348a45c1519c254d1f +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: