Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/EmotionBase.cs
gamer147 0d9d8acae0 feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
2026-06-05 16:57:20 -04:00

163 lines
5.3 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
using Wizard.Battle.Player.ClassCharacter;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Player.Emotion;
public abstract class EmotionBase : IEmotion
{
public const float DEFAULT_HIDE_TEXT_TIME = 1.5f;
public const float ICON_HIDE_DURATION_TIME = 0.3f;
public const float ICON_HIDE_DELAY_TIME = 1.2f;
protected readonly string _emotionId;
protected readonly IClassCharacter _classCharacter;
public Vector3 LeaderPosition
{
get
{
if (_classCharacter.GameObject == null)
{
return Vector3.zero;
}
return _classCharacter.GameObject.transform.position;
}
}
public bool Enable { get; set; }
public event Func<ClassCharaPrm.EmotionType, VfxBase> OnPlay;
protected EmotionBase(string emotionId, IClassCharacter classCharacter)
{
Enable = true;
_emotionId = emotionId;
_classCharacter = classCharacter;
}
public VfxBase PlayEmotion(ClassCharaPrm.EmotionType emoteType, float hideTextTime)
{
if (!Enable)
{
return NullVfx.GetInstance();
}
Dictionary<ClassCharaPrm.EmotionType, Wizard.Emotion> emotionDataBySkinId = GameMgr.GetIns().GetDataMgr().GetEmotionDataBySkinId(_emotionId);
if (emotionDataBySkinId.ContainsKey(emoteType))
{
BattleManagerBase.GetIns().GetBattlePlayer(this is PlayerEmotion).CallOnEmotion(emoteType);
return ParallelVfxPlayer.Create(this.OnPlay.GetAllFuncVfxResults(emoteType), PlayEmotion(emotionDataBySkinId[emoteType], hideTextTime));
}
return NullVfx.GetInstance();
}
public VfxBase PlayEmotion(Wizard.Emotion emotionInfo, float hideTextTime)
{
bool flag = false;
ClassCharaPrm.EmotionType emotion_id = (ClassCharaPrm.EmotionType)emotionInfo.emotion_id;
if ((uint)(emotion_id - 15) <= 4u || emotion_id == ClassCharaPrm.EmotionType.STORY_LOSE)
{
flag = true;
}
string voiceId = emotionInfo.GetVoiceId(IsSkinEvolved());
string text = emotionInfo.GetText(IsSkinEvolved());
if (flag)
{
return PlayEmotion(emotionInfo.motion_id, emotionInfo.face_id, voiceId, text, hideTextTime, flag);
}
if (!GameMgr.GetIns().IsWatchBattle || PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE))
{
return PlayEmotion(emotionInfo.motion_id, emotionInfo.face_id, voiceId, text, hideTextTime, flag);
}
return NullVfx.GetInstance();
}
public virtual VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text)
{
return PlayEmotion(motionType, faceType, voiceId, text, 1.5f);
}
public bool IsSkinEvolved()
{
bool isPlayer = this is PlayerEmotion;
return BattleManagerBase.GetIns().GetBattlePlayer(isPlayer).IsSkinEvolved;
}
public virtual VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text, float hideTextTime, bool forcePlay = false)
{
if (!Enable)
{
return NullVfx.GetInstance();
}
if (IsSkinEvolved())
{
switch (motionType)
{
case ClassCharaPrm.MotionType.extra_2:
motionType = ClassCharaPrm.MotionType.z_extra_2;
break;
case ClassCharaPrm.MotionType.damage:
motionType = ClassCharaPrm.MotionType.z_damage;
break;
case ClassCharaPrm.MotionType.greet:
motionType = ClassCharaPrm.MotionType.z_greet;
break;
case ClassCharaPrm.MotionType.idle:
motionType = ClassCharaPrm.MotionType.z_idle;
break;
case ClassCharaPrm.MotionType.negative:
motionType = ClassCharaPrm.MotionType.z_negative;
break;
case ClassCharaPrm.MotionType.negative_2:
motionType = ClassCharaPrm.MotionType.z_negative_2;
break;
case ClassCharaPrm.MotionType.negative_2_a:
motionType = ClassCharaPrm.MotionType.z_negative_2_a;
break;
case ClassCharaPrm.MotionType.positive:
motionType = ClassCharaPrm.MotionType.z_positive;
break;
case ClassCharaPrm.MotionType.positive_2:
motionType = ClassCharaPrm.MotionType.z_positive_2;
break;
case ClassCharaPrm.MotionType.shock:
motionType = ClassCharaPrm.MotionType.z_shock;
break;
case ClassCharaPrm.MotionType.think:
motionType = ClassCharaPrm.MotionType.z_think;
break;
}
}
if (text == "NONE")
{
return SequentialVfxPlayer.Create(_classCharacter.CreateLoadVoiceResource(voiceId), InstantVfx.Create(delegate
{
_classCharacter.PlayMotion(motionType);
_classCharacter.ChangeFace(faceType);
}), _classCharacter.PlayVoice(voiceId, forcePlay), WaitVfx.Create(hideTextTime));
}
VfxBase vfxBase = NullVfx.GetInstance();
VfxBase vfxBase2 = NullVfx.GetInstance();
if (text != string.Empty)
{
vfxBase = _classCharacter.ShowVoiceMessage(text);
vfxBase2 = _classCharacter.HideVoiceMessage();
}
return SequentialVfxPlayer.Create(_classCharacter.CreateLoadVoiceResource(voiceId), InstantVfx.Create(delegate
{
_classCharacter.PlayMotion(motionType);
_classCharacter.ChangeFace(faceType);
}), _classCharacter.PlayVoice(voiceId, forcePlay), vfxBase, (hideTextTime > 0f) ? ((VfxBase)WaitVfx.Create(hideTextTime)) : ((VfxBase)new OpeningVfx.WaitVoiceEndVfx()), vfxBase2);
}
public virtual VfxBase ReceiveOpponentEmotion(ClassCharaPrm.EmotionType emotionType)
{
return NullVfx.GetInstance();
}
}