diff --git a/Src/Dialogue/IDialogueService.cs b/Src/Dialogue/IDialogueService.cs index 661c4a8..71a7d64 100644 --- a/Src/Dialogue/IDialogueService.cs +++ b/Src/Dialogue/IDialogueService.cs @@ -25,10 +25,21 @@ namespace Net.Project.B.Dialogue /// public event Func OnDialogueStart; + public event Action OnDynamicDialogueStart; + /// + /// 动态对话 + /// + public event Func> OnDynamicDialogueStartAsync; + /// /// 对话结束 /// public event Action OnDialogueEnd; + + /// + /// 动态对话结束 + /// + public event Action OnDynamicDialogueEnd; /// /// 对话选择 @@ -48,6 +59,8 @@ namespace Net.Project.B.Dialogue UniTask CreateDialogue(IDialogueData dialogueData); UniTask CreateDialogue(IDialogueData dialogueData, IReadOnlyCollection dialogueChoices); + + UniTask CreateDynamicDialogue(IDialogueData dialogueData); } public class DialogueService : IDialogueService @@ -55,7 +68,10 @@ namespace Net.Project.B.Dialogue public IReadOnlyDictionary Dialogues => _dialogues; public event Func OnDialogueStart; + public event Action OnDynamicDialogueStart; + public event Func> OnDynamicDialogueStartAsync; public event Action OnDialogueEnd; + public event Action OnDynamicDialogueEnd; public event Func, UniTask> OnDialogueChoose; public event Action OnDialogueChose; public async UniTask CreateDialogue(IDialogueData dialogueData) @@ -105,6 +121,19 @@ namespace Net.Project.B.Dialogue return index; } + public async UniTask CreateDynamicDialogue(IDialogueData dialogueData) + { + if (OnDynamicDialogueStartAsync is null)throw new Exception("OnDynamicDialogueStartAsync is not null"); + + OnDialogueStart?.Invoke(dialogueData); + + var result = await OnDynamicDialogueStartAsync.Invoke(dialogueData); + + OnDynamicDialogueEnd?.Invoke(dialogueData,result); + + return result; + } + private readonly ConcurrentDictionary _dialogues = new(); } } \ No newline at end of file diff --git a/Src/Health/KnockedService.cs b/Src/Health/KnockedService.cs index 6a69279..7fd333c 100644 --- a/Src/Health/KnockedService.cs +++ b/Src/Health/KnockedService.cs @@ -21,6 +21,7 @@ namespace Net.Project.B.Health /// public interface IKnockedService { + public bool Enabled { get; set; } /// /// 击倒列表 /// @@ -56,6 +57,8 @@ namespace Net.Project.B.Health private int OnHealthPlus(int id, int oldHp, int plus, object sendor) { + if (Enabled is false) return plus; + if (_entitiesService.TryGetEntity(id, out var entity) is false) return plus; if (entity.ServiceProvider.GetService() is null) return plus; @@ -82,7 +85,8 @@ namespace Net.Project.B.Health _knocked.Add(id); _onKnocked?.Invoke(id, true); // _logger.LogInformation($"Entity {id} 被击倒了"); - return oldHp-1; + //return 0; + return -Math.Abs(oldHp-1); } private void OnHealthChanged(int arg1, int arg2, int arg3, object arg4) @@ -101,6 +105,7 @@ namespace Net.Project.B.Health private static readonly ConcurrentDictionary _knockedHealth = new(); private static event Action _onKnocked; private static event Action _onKnockedHealthChanged; + public bool Enabled { get; set; } = true; public HashSet Knocked=> _knocked; public IReadOnlyDictionary KnockedHealth => _knockedHealth; public event Action OnKnocked diff --git a/Src/Interaction/Com.Project.B.Interaction.asmdef b/Src/Interaction/Com.Project.B.Interaction.asmdef index c816714..c7f6fe9 100644 --- a/Src/Interaction/Com.Project.B.Interaction.asmdef +++ b/Src/Interaction/Com.Project.B.Interaction.asmdef @@ -2,6 +2,7 @@ "name": "Com.Project.B.Interaction", "rootNamespace": "", "references": [ + "GUID:14fe60d984bf9f84eac55c6ea033a8f4", "GUID:d750d221812bb1d48baff92e6ef73e28" ], "includePlatforms": [], diff --git a/Src/Interaction/IDynamicInteractable.cs b/Src/Interaction/IDynamicInteractable.cs new file mode 100644 index 0000000..83978c9 --- /dev/null +++ b/Src/Interaction/IDynamicInteractable.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using BITKit; + +namespace Net.Project.B.Interaction +{ + public class DynamicInteractable:IWorldInteractable + { + public bool Enabled => Allow.Allow; + public readonly ValidHandle Allow=new(); + public object WorldObject { get; set; } + public int Id { get; set; } + } + +} diff --git a/Src/Interaction/IDynamicInteractable.cs.meta b/Src/Interaction/IDynamicInteractable.cs.meta new file mode 100644 index 0000000..f9dc4e2 --- /dev/null +++ b/Src/Interaction/IDynamicInteractable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e5cb35ec740d0fb4483ab848af4a0f19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Src/Interaction/IWorldInteractionService.cs b/Src/Interaction/IWorldInteractionService.cs index 96c6f68..026778c 100644 --- a/Src/Interaction/IWorldInteractionService.cs +++ b/Src/Interaction/IWorldInteractionService.cs @@ -21,7 +21,7 @@ namespace Net.Project.B.Interaction /// public interface IWorldInteractable { - public IWorldInteractionType InteractionType { get; } + public bool Enabled { get; } public object WorldObject { get; set; } public int Id { get; set; } } diff --git a/Src/Interaction/WorldInteractable.cs b/Src/Interaction/WorldInteractable.cs index b3eff72..f67a5c4 100644 --- a/Src/Interaction/WorldInteractable.cs +++ b/Src/Interaction/WorldInteractable.cs @@ -10,7 +10,7 @@ namespace Net.Project.B.Interaction [Serializable] public class WorldInteractable : IWorldInteractable,IWorldNode { - public IWorldInteractionType InteractionType => null; + public bool Enabled { get; set; } = true; public object WorldObject { get; set; } public int Id { get; set; } } diff --git a/Src/PDA/PDAApps.cs b/Src/PDA/PDAApps.cs index 93826a4..ffa3d9e 100644 --- a/Src/PDA/PDAApps.cs +++ b/Src/PDA/PDAApps.cs @@ -43,6 +43,6 @@ namespace Net.Project.B.PDA.App public struct Quest:IApp { public string PackageName => "com.bndroid.quest"; - public string AppName => "人物"; + public string AppName => "任务"; } } diff --git a/Src/PlayerSettings/IUXKeyMap.cs b/Src/PlayerSettings/IUXKeyMap.cs index db5d9d4..2cc1833 100644 --- a/Src/PlayerSettings/IUXKeyMap.cs +++ b/Src/PlayerSettings/IUXKeyMap.cs @@ -8,5 +8,6 @@ namespace Project.B.Player public T CancelKey { get; } public T InventoryKey { get; } public T ConfirmKey { get; } + public T ChatKey { get; } } } diff --git a/Src/UX/UXDefine.cs b/Src/UX/UXDefine.cs index a4a7a2f..26d9e8d 100644 --- a/Src/UX/UXDefine.cs +++ b/Src/UX/UXDefine.cs @@ -20,7 +20,6 @@ namespace Net.Project.B.UX event Func OnSubtitle; public string[] SubtitleLanguages { get; set; } } - public interface IUXInventory : IUXPanel { public ItemQuality AutoInspect { get; set; } @@ -53,4 +52,5 @@ namespace Net.Project.B.UX { public IReadOnlyCollection SurvivalBuffs { get; set; } } + public interface IUXChat:IUXPanel{} } diff --git a/Src/WorldNode/UnitySubwayNode.cs b/Src/WorldNode/UnitySubwayNode.cs index 88df407..7002206 100644 --- a/Src/WorldNode/UnitySubwayNode.cs +++ b/Src/WorldNode/UnitySubwayNode.cs @@ -14,10 +14,15 @@ namespace Net.Project.B.WorldNode [SerializeField] private float speed; [SerializeField] private Transform spline; [SerializeField] private Vector3 offset; + [SerializeField] private Transform frontWheel; + [SerializeField] private Transform backWheel; + public Rigidbody Subway => subway; public float Speed => speed; public Transform Spline => spline; public Vector3 Offset => offset; + public Transform FrontWheel => frontWheel; + public Transform BackWheel => backWheel; } } #endif \ No newline at end of file