feat(eye): 眨眼仅用于想象上色并关闭自动眨眼
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,11 +52,10 @@ namespace AibisDream
|
||||
|
||||
public float GetEffectTransitionDuration() => visualSettings.GetDurationForState(_currentState);
|
||||
|
||||
private bool ShouldPreBlinkForFocusedEffect()
|
||||
/// <summary>仅「可想象色彩」上色时眨眼;无 autoBlink / 失焦眨眼。</summary>
|
||||
private bool ShouldBlinkForImagine()
|
||||
{
|
||||
return _currentState is EyeColorState.CanImagineColor
|
||||
or EyeColorState.CannotImagineColor
|
||||
or EyeColorState.CanSeeColor;
|
||||
return _currentState == EyeColorState.CanImagineColor;
|
||||
}
|
||||
|
||||
private IEnumerator WaitForFocusMovement(float moveDuration)
|
||||
@@ -79,25 +78,14 @@ namespace AibisDream
|
||||
float duration = GetEffectTransitionDuration();
|
||||
EyeViewportOverlay overlay = EnsureViewportOverlay();
|
||||
|
||||
if (overlay != null && Application.isPlaying && ShouldPreBlinkForFocusedEffect())
|
||||
if (overlay != null && Application.isPlaying && ShouldBlinkForImagine())
|
||||
{
|
||||
if (_currentState == EyeColorState.CanImagineColor)
|
||||
{
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
2,
|
||||
visualSettings,
|
||||
() => eyeStateEffect?.ApplyFocusedEffect(target, this),
|
||||
visualSettings.imagineEffectAtBlinkOpen,
|
||||
visualSettings.imagineBlinkGap);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
1,
|
||||
visualSettings,
|
||||
() => eyeStateEffect?.ApplyFocusedEffect(target, this),
|
||||
visualSettings.focusEffectAtBlinkOpen);
|
||||
}
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
2,
|
||||
visualSettings,
|
||||
() => eyeStateEffect?.ApplyFocusedEffect(target, this),
|
||||
visualSettings.imagineEffectAtBlinkOpen,
|
||||
visualSettings.imagineBlinkGap);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -107,19 +95,9 @@ namespace AibisDream
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
|
||||
private IEnumerator RunBlurOutWithPreBlink(EyeTarget target, float duration)
|
||||
private IEnumerator RunBlurOut(EyeTarget target, float duration)
|
||||
{
|
||||
EyeViewportOverlay overlay = EnsureViewportOverlay();
|
||||
|
||||
if (overlay != null && Application.isPlaying)
|
||||
{
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
1,
|
||||
visualSettings,
|
||||
() => target.BlurOut(duration),
|
||||
visualSettings.focusEffectAtBlinkOpen);
|
||||
}
|
||||
else
|
||||
if (target != null)
|
||||
{
|
||||
target.BlurOut(duration);
|
||||
}
|
||||
@@ -127,42 +105,34 @@ namespace AibisDream
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
|
||||
private IEnumerator RunUnfocusedEffectWithPreBlink(EyeTarget target)
|
||||
/// <summary>
|
||||
/// 换目标时的失焦:只做效果,不眨眼(眨眼仅在想象上色 FadeIn)。
|
||||
/// </summary>
|
||||
private void ApplyUnfocusedEffectSilent(EyeTarget target)
|
||||
{
|
||||
if (target == null || eyeStateEffect == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentState == EyeColorState.CanImagineColor
|
||||
&& target.IsAtUnfocusedColorState(visualSettings))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
eyeStateEffect.ApplyUnfocusedEffect(target, this);
|
||||
}
|
||||
|
||||
private IEnumerator RunUnfocusedEffect(EyeTarget target)
|
||||
{
|
||||
if (target == null || eyeStateEffect == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
float duration = GetEffectTransitionDuration();
|
||||
EyeViewportOverlay overlay = EnsureViewportOverlay();
|
||||
|
||||
if (overlay != null && Application.isPlaying && ShouldPreBlinkForFocusedEffect())
|
||||
{
|
||||
if (_currentState == EyeColorState.CanImagineColor)
|
||||
{
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
2,
|
||||
visualSettings,
|
||||
() => eyeStateEffect.ApplyUnfocusedEffect(target, this),
|
||||
visualSettings.imagineEffectAtBlinkOpen,
|
||||
visualSettings.imagineBlinkGap);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return overlay.PlayPreEffectBlinkThen(
|
||||
1,
|
||||
visualSettings,
|
||||
() => eyeStateEffect.ApplyUnfocusedEffect(target, this),
|
||||
visualSettings.focusEffectAtBlinkOpen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eyeStateEffect.ApplyUnfocusedEffect(target, this);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(duration);
|
||||
eyeStateEffect.ApplyUnfocusedEffect(target, this);
|
||||
yield return new WaitForSeconds(GetEffectTransitionDuration());
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
@@ -347,6 +317,14 @@ namespace AibisDream
|
||||
EnsureViewportOverlay()?.EnterModule(visualSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UF 等密集演出:抑制非显式眨眼(含想象过渡眨眼);Yarn EyeBlink 仍可用。
|
||||
/// </summary>
|
||||
public void SetNonExplicitBlinkSuppressed(bool suppressed)
|
||||
{
|
||||
EnsureViewportOverlay()?.SetNonExplicitBlinkSuppressed(suppressed);
|
||||
}
|
||||
|
||||
private void InitializeAllTargets()
|
||||
{
|
||||
foreach (EyeTarget target in targets)
|
||||
@@ -442,7 +420,7 @@ namespace AibisDream
|
||||
if (startDialogue)
|
||||
{
|
||||
DialogController.Instance.StartDialogNode("重复看同一个目标");
|
||||
yield return RunBlurOutWithPreBlink(currentTarget, visualSettings.targetSwitchDuration);
|
||||
yield return RunBlurOut(currentTarget, visualSettings.targetSwitchDuration);
|
||||
}
|
||||
|
||||
yield break;
|
||||
@@ -451,7 +429,7 @@ namespace AibisDream
|
||||
EyeTarget leavingTarget = currentTarget;
|
||||
if (leavingTarget != null)
|
||||
{
|
||||
StartCoroutine(EyeEffect_FadeOut());
|
||||
ApplyUnfocusedEffectSilent(leavingTarget);
|
||||
}
|
||||
|
||||
const float focusMoveDuration = 1f;
|
||||
@@ -461,7 +439,7 @@ namespace AibisDream
|
||||
|
||||
currentTarget = target;
|
||||
mouseFollowAndZoom.SetIndicatorTarget(currentTarget);
|
||||
yield return RunBlurOutWithPreBlink(currentTarget, visualSettings.targetSwitchDuration);
|
||||
yield return RunBlurOut(currentTarget, visualSettings.targetSwitchDuration);
|
||||
|
||||
if (startDialogue)
|
||||
{
|
||||
@@ -513,7 +491,7 @@ namespace AibisDream
|
||||
}
|
||||
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/color_imagine");
|
||||
yield return RunUnfocusedEffectWithPreBlink(currentTarget);
|
||||
yield return RunUnfocusedEffect(currentTarget);
|
||||
}
|
||||
|
||||
[YarnCommand("EyeEffect_Init")]
|
||||
|
||||
Reference in New Issue
Block a user