feat(huoshan): 增强表达模块干扰表现与完成释放效果

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 20:56:00 +08:00
co-authored by Cursor
parent ee1d100fb5
commit 1422161844
7 changed files with 700 additions and 104 deletions
@@ -19,27 +19,32 @@ namespace AibisDream.MiniGame.Language
/// 注意:Yarn Spinner 2.x 对同名 <see cref="YarnCommand"/> 重载支持不可靠,只保留一个注册入口,用可选参数区分 3/4 参调用。
/// <<start_expression "哈哈|嘿嘿|呵呵" "我很害怕" "ExpressionCompleted">>
/// <<start_expression "哈哈|嘿嘿|呵呵" "我很害怕" "ExpressionCompleted" 24>>
/// <<start_expression "哈哈|嘿嘿|呵呵" "我很害怕" "ExpressionCompleted" 24 1>>
/// (第四项为「非目标」候选粒子总数,候选池 = 目标句字数 + 该值;不写第四项则用 Inspector 的 Candidate Count
/// (第五项为干扰表现档位索引:变字节奏/抖动/glitch联动按档递进,不写则用 Inspector 全局干扰参数)
/// </summary>
/// <param name="anxietyPhrasesStr">干扰短句(笑话等),用 | 分隔,用于非目标粒子字符池,如:"哈哈|嘿嘿|呵呵"</param>
/// <param name="targetSentence">目标句子</param>
/// <param name="completionNode">完成时触发的对话节点(可空字符串)</param>
/// <param name="nonTargetParticleTotal">非目标候选粒子总数;&lt;0 表示使用 Inspector 默认</param>
/// <param name="interferencePresetIndex">干扰表现档位索引;&lt;0 表示使用 Inspector 全局干扰参数</param>
[YarnCommand("start_expression")]
public static IEnumerator StartExpression(
string anxietyPhrasesStr,
string targetSentence,
string completionNode = "",
float nonTargetParticleTotal = -1f)
float nonTargetParticleTotal = -1f,
float interferencePresetIndex = -1f)
{
return RunStartExpression(
anxietyPhrasesStr,
targetSentence,
completionNode ?? "",
UnityEngine.Mathf.RoundToInt(nonTargetParticleTotal));
UnityEngine.Mathf.RoundToInt(nonTargetParticleTotal),
UnityEngine.Mathf.RoundToInt(interferencePresetIndex));
}
private static IEnumerator RunStartExpression(string anxietyPhrasesStr, string targetSentence, string completionNode, int nonTargetParticleTotal)
private static IEnumerator RunStartExpression(string anxietyPhrasesStr, string targetSentence, string completionNode, int nonTargetParticleTotal, int interferencePresetIndex)
{
if (ExpressionManager == null)
{
@@ -60,7 +65,7 @@ namespace AibisDream.MiniGame.Language
// 先淡出上一轮文字/连线等,再淡入火山释放 log,最后开新一轮粒子(避免 log 与旧字叠在一起)
yield return ExpressionManager.FadeOutParticlesBeforeNewRound(0f);
yield return ExpressionManager.EnsureReleaseLogFadedIn(1f);
ExpressionManager.StartSystem(phrases, targetSentence, completionNode, nonTargetParticleTotal);
ExpressionManager.StartSystem(phrases, targetSentence, completionNode, nonTargetParticleTotal, interferencePresetIndex);
yield return ExpressionManager.WaitUntilExpressionFlowReady();
}