diff --git a/Entity/Skill/Effect.cs b/Entity/Skill/Effect.cs
index d6801bb..57755bb 100644
--- a/Entity/Skill/Effect.cs
+++ b/Entity/Skill/Effect.cs
@@ -890,10 +890,9 @@ namespace Milimoe.FunGame.Core.Entity
/// 在角色取得询问反应的答复时触发
///
///
- ///
- ///
+ ///
///
- public virtual void OnCharacterInquiry(Character character, string topic, Dictionary args, Dictionary response)
+ public virtual void OnCharacterInquiry(Character character, InquiryOptions options, InquiryResponse response)
{
}
@@ -1206,12 +1205,11 @@ namespace Milimoe.FunGame.Core.Entity
/// 向角色发起询问反应事件 [ 尽可能的调用此方法而不是自己实现 ]
///
///
- ///
- ///
+ ///
///
- public Dictionary Inquiry(Character character, string topic, Dictionary args)
+ public InquiryResponse Inquiry(Character character, InquiryOptions options)
{
- return GamingQueue?.Inquiry(character, topic, args) ?? [];
+ return GamingQueue?.Inquiry(character, options) ?? new(options);
}
///
diff --git a/Interface/Base/IGamingQueue.cs b/Interface/Base/IGamingQueue.cs
index dcae70f..e7b2894 100644
--- a/Interface/Base/IGamingQueue.cs
+++ b/Interface/Base/IGamingQueue.cs
@@ -301,9 +301,8 @@ namespace Milimoe.FunGame.Core.Interface.Base
/// 向角色(或控制该角色的玩家)进行询问并取得答复
///
///
- ///
- ///
+ ///
///
- public Dictionary Inquiry(Character character, string topic, Dictionary args);
+ public InquiryResponse Inquiry(Character character, InquiryOptions options);
}
}
diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs
index 1ce0650..f4f03ae 100644
--- a/Library/Constant/TypeEnum.cs
+++ b/Library/Constant/TypeEnum.cs
@@ -1107,4 +1107,15 @@ namespace Milimoe.FunGame.Core.Library.Constant
///
Sector
}
+
+ public enum InquiryType
+ {
+ None,
+ Choice,
+ MultipleChoice,
+ BinaryChoice,
+ TextInput,
+ NumberInput,
+ Custom
+ }
}
diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs
index 16f6ccc..b21ba66 100644
--- a/Model/GamingQueue.cs
+++ b/Model/GamingQueue.cs
@@ -4059,21 +4059,20 @@ namespace Milimoe.FunGame.Core.Model
/// 向角色(或控制该角色的玩家)进行询问并取得答复
///
///
- ///
- ///
+ ///
///
- public Dictionary Inquiry(Character character, string topic, Dictionary args)
+ public InquiryResponse Inquiry(Character character, InquiryOptions options)
{
if (!_decisionPoints.TryGetValue(character, out DecisionPoints? dp) || dp is null)
{
dp = new();
_decisionPoints[character] = dp;
}
- Dictionary response = OnCharacterInquiryEvent(character, dp, topic, args);
+ InquiryResponse response = OnCharacterInquiryEvent(character, dp, options);
Effect[] effects = [.. character.Effects.Where(e => e.IsInEffect)];
foreach (Effect effect in effects)
{
- effect.OnCharacterInquiry(character, topic, args, response);
+ effect.OnCharacterInquiry(character, options, response);
}
return response;
}
@@ -4597,7 +4596,7 @@ namespace Milimoe.FunGame.Core.Model
CharacterDecisionCompletedEvent?.Invoke(this, actor, dp, record);
}
- public delegate Dictionary CharacterInquiryEventHandler(GamingQueue character, Character actor, DecisionPoints dp, string topic, Dictionary args);
+ public delegate InquiryResponse CharacterInquiryEventHandler(GamingQueue character, Character actor, DecisionPoints dp, InquiryOptions options);
///
/// 角色询问反应事件
///
@@ -4607,12 +4606,11 @@ namespace Milimoe.FunGame.Core.Model
///
///
///
- ///
- ///
+ ///
///
- protected Dictionary OnCharacterInquiryEvent(Character character, DecisionPoints dp, string topic, Dictionary args)
+ protected InquiryResponse OnCharacterInquiryEvent(Character character, DecisionPoints dp, InquiryOptions options)
{
- return CharacterInquiryEvent?.Invoke(this, character, dp, topic, args) ?? [];
+ return CharacterInquiryEvent?.Invoke(this, character, dp, options) ?? new(options);
}
#endregion
diff --git a/Model/InquiryOptions.cs b/Model/InquiryOptions.cs
new file mode 100644
index 0000000..b5784e4
--- /dev/null
+++ b/Model/InquiryOptions.cs
@@ -0,0 +1,29 @@
+using Milimoe.FunGame.Core.Library.Constant;
+
+namespace Milimoe.FunGame.Core.Model
+{
+ public class InquiryOptions
+ {
+ public InquiryType InquiryType { get; } = InquiryType.None;
+ public string Topic { get; set; } = "";
+ public string Description { get; set; } = "";
+ public Dictionary Choices { get; set; } = [];
+ public string DefaultChoice { get; set; } = "";
+ public double MinNumberValue { get; set; } = 0;
+ public double MaxNumberValue { get; set; } = 0;
+ public double DefaultNumberValue { get; set; } = 0;
+ public Dictionary CustomArgs { get; set; } = [];
+
+ public InquiryOptions(InquiryType type, string topic)
+ {
+ InquiryType = type;
+ Topic = topic;
+ if (type == InquiryType.BinaryChoice)
+ {
+ Choices.Add("是", "");
+ Choices.Add("否", "");
+ DefaultChoice = "否";
+ }
+ }
+ }
+}
diff --git a/Model/InquiryResponse.cs b/Model/InquiryResponse.cs
new file mode 100644
index 0000000..dbba58e
--- /dev/null
+++ b/Model/InquiryResponse.cs
@@ -0,0 +1,49 @@
+using Milimoe.FunGame.Core.Library.Constant;
+
+namespace Milimoe.FunGame.Core.Model
+{
+ public class InquiryResponse
+ {
+ public InquiryType InquiryType { get; } = InquiryType.None;
+ public string Topic { get; set; } = "";
+ public List Choices { get; set; } = [];
+ public string TextResult { get; set; } = "";
+ public double NumberResult { get; set; } = 0;
+ public Dictionary CustomResponse { get; set; } = [];
+
+ public InquiryResponse(InquiryType type, string topic)
+ {
+ InquiryType = type;
+ Topic = topic;
+ }
+
+ public InquiryResponse(InquiryOptions options)
+ {
+ InquiryType = options.InquiryType;
+ Topic = options.Topic;
+ switch (options.InquiryType)
+ {
+ case InquiryType.Choice:
+ case InquiryType.MultipleChoice:
+ case InquiryType.BinaryChoice:
+ if (options.DefaultChoice != "")
+ {
+ Choices.Add(options.DefaultChoice);
+ }
+ else if (options.Choices.Count > 0)
+ {
+ Choices.Add(options.Choices.Keys.First());
+ }
+ break;
+ case InquiryType.TextInput:
+ TextResult = "";
+ break;
+ case InquiryType.NumberInput:
+ NumberResult = options.DefaultNumberValue;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}