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.
This commit is contained in:
gamer147
2026-06-05 16:57:20 -04:00
parent 23a6596558
commit 0d9d8acae0
778 changed files with 165107 additions and 0 deletions

View File

@@ -0,0 +1,162 @@
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();
}
}

View File

@@ -0,0 +1,20 @@
using System;
using UnityEngine;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Player.Emotion;
public interface IEmotion
{
Vector3 LeaderPosition { get; }
bool Enable { get; set; }
event Func<ClassCharaPrm.EmotionType, VfxBase> OnPlay;
VfxBase PlayEmotion(ClassCharaPrm.EmotionType emoteType, float hideTextTime);
VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text);
VfxBase ReceiveOpponentEmotion(ClassCharaPrm.EmotionType emotionType);
}

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
using UnityEngine;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Player.Emotion;
public interface IPlayerEmotion : IEmotion
{
IEnumerable<GameObject> IconObjects { get; }
VfxBase LoadResource();
VfxBase ShowButtons();
VfxBase HideButtons();
VfxBase HideButtons(GameObject iconObject);
void CancelShowButtons();
void ResetPlayCount();
void AddPlayCount();
void FocusIcon(GameObject go);
void UnfocusAllIcons();
VfxBase PlayEmotionFromIconObject(GameObject iconObject);
string GetVoiceTextFromIconObject(GameObject iconObject);
bool IsContainsEmotionType(ClassCharaPrm.EmotionType type);
void DebugLogNotHiddenEmoteButton(TouchControl touchControl, VfxMgr emotionVfxMgr, SequentialVfxPlayer currentVfx);
}

View File

@@ -0,0 +1,343 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Wizard.Battle.Player.ClassCharacter;
using Wizard.Battle.Resource;
using Wizard.Battle.Touch;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Player.Emotion;
public class PlayerEmotion : EmotionBase, IPlayerEmotion, IEmotion
{
private class WaitFlagChangeVfx : VfxBase
{
private readonly Func<bool> _isEnd;
public override bool IsEnd
{
get
{
return _isEnd();
}
protected set
{
}
}
public WaitFlagChangeVfx(Func<bool> isEnd)
{
_isEnd = isEnd;
}
}
private const int MAX_PLAY_COUNT = 3;
private const int EMOTION_KIND_COUNT = 7;
private const string ICON_PREFAB_PATH = "UI/Battle/EmotionIcon";
private const int ICON_DEPTH = 13;
private const float ICON_DISTANCE = 240f;
private static readonly string[] FOCUS_ICON_NAMES = new string[7] { "battle_btn_emote_greet_on", "battle_btn_emote_thank_on", "battle_btn_emote_apology_on", "battle_btn_emote_praise_on", "battle_btn_emote_surprise_on", "battle_btn_emote_confuse_on", "battle_btn_emote_provocation_on" };
private static readonly string[] UNFOCUS_ICON_NAMES = new string[7] { "battle_btn_emote_greet_off", "battle_btn_emote_thank_off", "battle_btn_emote_apology_off", "battle_btn_emote_praise_off", "battle_btn_emote_surprise_off", "battle_btn_emote_confuse_off", "battle_btn_emote_provocation_off" };
private int _playCount;
private readonly IBattleResourceMgr _resourceMgr;
private GameObject[] _iconObjects;
private GameObject _currentFocusIconObject;
private bool _isIconShowReserve;
private bool _isActiveHideTween;
private bool _debugLogLimitter;
public IEnumerable<GameObject> IconObjects => _iconObjects;
public PlayerEmotion(string emotionId, IClassCharacter classCharacter, IBattleResourceMgr resourceMgr)
: base(emotionId, classCharacter)
{
_resourceMgr = resourceMgr;
}
public VfxBase LoadResource()
{
if (_iconObjects != null)
{
return InstantVfx.Create(UnfocusAllIcons);
}
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(_resourceMgr.LoadShardObject("UI/Battle/EmotionIcon", isAddUIContainer: false));
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
GameObject sharedObject = _resourceMgr.GetSharedObject("UI/Battle/EmotionIcon");
List<GameObject> list = new List<GameObject>();
_iconObjects = new GameObject[7];
for (int i = 0; i < 7; i++)
{
GameObject gameObject = UnityEngine.Object.Instantiate(sharedObject);
gameObject.SetActive(value: true);
gameObject.transform.parent = _classCharacter.GameObject.transform;
gameObject.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
float f = (float)Math.PI * (1f - (float)i / 6f);
float x = Mathf.Cos(f) * 240f;
float y = Mathf.Sin(f) * 240f;
gameObject.transform.localPosition = new Vector3(x, y, -35f);
_iconObjects[i] = gameObject;
list.Add(gameObject.transform.Find("Icon").gameObject);
SetIconFocus(_iconObjects[i], focus: false);
}
UIManager.GetInstance().AttachAtlas(list);
}));
return sequentialVfxPlayer;
}
public VfxBase ShowButtons()
{
if (_iconObjects == null || _iconObjects[0].activeSelf)
{
return NullVfx.GetInstance();
}
_isIconShowReserve = true;
return InstantVfx.Create(delegate
{
if (_isIconShowReserve)
{
for (int i = 0; i < _iconObjects.Length; i++)
{
TweenAlpha.Begin(_iconObjects[i], 0f, 1f);
_iconObjects[i].SetActive(value: true);
}
}
_isIconShowReserve = false;
});
}
public VfxBase HideButtons()
{
return SequentialVfxPlayer.Create(new WaitFlagChangeVfx(() => !_isIconShowReserve), InstantVfx.Create(delegate
{
if (_iconObjects != null)
{
for (int i = 0; i < _iconObjects.Length; i++)
{
_iconObjects[i].SetActive(value: false);
}
}
_isActiveHideTween = false;
}), new Debug722006NullVfx());
}
public VfxBase HideButtons(GameObject iconObject)
{
return SequentialVfxPlayer.Create(new WaitFlagChangeVfx(() => !_isIconShowReserve), InstantVfx.Create(delegate
{
if (_iconObjects != null)
{
for (int i = 0; i < _iconObjects.Length; i++)
{
if (iconObject != _iconObjects[i])
{
_iconObjects[i].SetActive(value: false);
}
}
}
}), InstantVfx.Create(delegate
{
_isActiveHideTween = true;
TweenAlpha tweenAlpha = TweenAlpha.Begin(iconObject, 0.3f, 0f);
tweenAlpha.delay = 1.2f;
tweenAlpha.onFinished.Clear();
tweenAlpha.onFinished.Add(new EventDelegate(delegate
{
iconObject.SetActive(value: false);
_isActiveHideTween = false;
}));
}), new Debug722006NullVfx());
}
public void CancelShowButtons()
{
_isIconShowReserve = false;
}
public void AddPlayCount()
{
_playCount++;
}
public void ResetPlayCount()
{
_playCount = 0;
}
public void FocusIcon(GameObject go)
{
if (!(go == _currentFocusIconObject))
{
_currentFocusIconObject = go;
UnfocusAllIcons();
SetIconFocus(go, focus: true);
}
}
private void SetIconFocus(GameObject focusIconObject, bool focus)
{
if (!(focusIconObject == null))
{
string[] array = (focus ? FOCUS_ICON_NAMES : UNFOCUS_ICON_NAMES);
int iconIndex = GetIconIndex(focusIconObject);
focusIconObject.transform.Find("Icon").GetComponent<UISprite>().spriteName = array[iconIndex];
focusIconObject.layer = 12;
}
}
public void UnfocusAllIcons()
{
if (_iconObjects != null)
{
for (int i = 0; i < 7; i++)
{
SetIconFocus(_iconObjects[i], focus: false);
}
}
}
public VfxBase PlayEmotionFromIconObject(GameObject iconObject)
{
if (++_playCount > 3)
{
BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.ShowAlert(PanelMgr.BattleAlertType.EmoteLimit, isClass: false);
return NullVfx.GetInstance();
}
ClassCharaPrm.EmotionType emoteType = IndexToEmotionType(GetIconIndex(iconObject));
return PlayEmotion(emoteType, 1.5f);
}
public string GetVoiceTextFromIconObject(GameObject iconObject)
{
ClassCharaPrm.EmotionType key = IndexToEmotionType(GetIconIndex(iconObject));
Dictionary<ClassCharaPrm.EmotionType, Wizard.Emotion> emotionDataBySkinId = GameMgr.GetIns().GetDataMgr().GetEmotionDataBySkinId(_emotionId);
if (emotionDataBySkinId.ContainsKey(key))
{
return emotionDataBySkinId[key].GetText(IsSkinEvolved());
}
return string.Empty;
}
private int GetIconIndex(GameObject iconObject)
{
for (int i = 0; i < _iconObjects.Length; i++)
{
if (_iconObjects[i] == iconObject)
{
return i;
}
}
return -1;
}
public static ClassCharaPrm.EmotionType IndexToEmotionType(int index)
{
return index switch
{
0 => ClassCharaPrm.EmotionType.GREET,
1 => ClassCharaPrm.EmotionType.THANK,
2 => ClassCharaPrm.EmotionType.APOLOGY,
3 => ClassCharaPrm.EmotionType.PRAISE,
4 => ClassCharaPrm.EmotionType.SURPRISE,
5 => ClassCharaPrm.EmotionType.CONFUSE,
6 => ClassCharaPrm.EmotionType.PROVOCATION,
_ => ClassCharaPrm.EmotionType.GREET,
};
}
public bool IsContainsEmotionType(ClassCharaPrm.EmotionType type)
{
return GameMgr.GetIns().GetDataMgr().GetEmotionDataBySkinId(_emotionId)
.ContainsKey(type);
}
public void DebugLogNotHiddenEmoteButton(TouchControl touchControl, VfxMgr emotionVfxMgr, SequentialVfxPlayer currentVfx)
{
if (_iconObjects == null || _iconObjects.Length == 0)
{
if (!_debugLogLimitter)
{
LocalLog.AccumulateTraceLog("#722006(0)");
_debugLogLimitter = true;
}
}
else
{
if (touchControl != null && touchControl.HasTouchProcessor && touchControl._touchProcessor is EmotionTouchProcessor)
{
return;
}
List<VfxBase> vfxList = emotionVfxMgr.GetVfxList<ParallelVfxPlayer>();
for (int i = 0; i < vfxList.Count; i++)
{
List<VfxBase> vfxList2 = (vfxList[i] as ParallelVfxPlayer).GetVfxList();
for (int j = 0; j < vfxList2.Count; j++)
{
if (!(vfxList2[j] is SequentialVfxPlayer))
{
continue;
}
SequentialVfxPlayer sequentialVfxPlayer = vfxList2[j] as SequentialVfxPlayer;
if (sequentialVfxPlayer == currentVfx || sequentialVfxPlayer.IsEnd)
{
continue;
}
List<VfxBase> allVfxAsList = sequentialVfxPlayer.GetAllVfxAsList();
for (int k = 0; k < allVfxAsList.Count; k++)
{
if (allVfxAsList[k] is Debug722006NullVfx)
{
return;
}
}
}
}
if (_isActiveHideTween)
{
return;
}
bool flag = false;
for (int l = 0; l < _iconObjects.Length; l++)
{
if (_iconObjects[l].activeSelf)
{
flag = true;
break;
}
}
if (flag)
{
if (!_debugLogLimitter)
{
if (_isIconShowReserve)
{
LocalLog.AccumulateTraceLog("#722006(1)");
}
else
{
LocalLog.AccumulateTraceLog("#722006(2)");
}
_debugLogLimitter = true;
}
}
else
{
_debugLogLimitter = false;
}
}
}
}