Files
SVSimServer/SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs
gamer147 824309ec44 feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the
AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed
the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
2026-06-05 20:30:59 -04:00

429 lines
14 KiB
C#

using System.Collections.Generic;
using Cute;
using UnityEngine;
using Wizard.Battle.UI;
using Wizard.Battle.View;
using Wizard.Battle.View.Vfx;
public class EnemyStatusPanelControl : MonoBehaviour, IStatusPanelControl
{
private BattleManagerBase _battleMgr;
[SerializeField]
private GameObject StatusPanel;
[SerializeField]
private GameObject PPPanel;
[SerializeField]
private GameObject StatusPanelAllwaysDisp;
[SerializeField]
private UISprite EpPanel;
[SerializeField]
private UISprite DeckIconSprite;
[SerializeField]
private UILabel DeckLabelAlwaysDisp;
[SerializeField]
private UISprite GraveIconSprite;
[SerializeField]
private UILabel GraveLabelAlwaysDisp;
[SerializeField]
private UILabel DeckLabel;
[SerializeField]
private UILabel GraveLabel;
[SerializeField]
private UILabel PPLabel;
[SerializeField]
private UILabel PPLineLabel;
[SerializeField]
private UILabel PPMaxLabel;
[SerializeField]
private UILabel EpLabel;
[SerializeField]
private UISprite[] EpList;
[SerializeField]
private UISprite EpIcon;
[SerializeField]
private UILabel HandCountLabel;
[SerializeField]
private UILabel HandCountLabelAlwaysDisp;
[SerializeField]
private UISprite HandCountIconSpriteAlwaysDisp;
private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_OFFSET = 350f;
private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_SECOND = 0.5f;
private readonly Vector3 EP_PANEL_POSITION = new Vector3(235f, -90f, 0f);
private readonly Vector3 ANYA_EP_PANEL_POSITION = new Vector3(207f, -90f, 0f);
private const float EP_PANEL_OFFSET = 350f;
private const float PP_PANEL_OFFSET = 300f;
private const int ANYA_HIGH_RANK_SKIN_ID = 4413;
private ParticleSystem[] GaugeShiftEfcChild;
private bool isPlayer;
private IDictionary<string, Vector3> DefaultPosDict;
private Vector3 EpPanelPosition
{
get
{
if (GameMgr.GetIns().GetDataMgr().GetEnemySkinId() != 4413)
{
return EP_PANEL_POSITION;
}
return ANYA_EP_PANEL_POSITION;
}
}
public Vector3 EpPanelOffScreenPosition => EpPanelPosition + Vector3.up * 350f;
public Vector3 BpPanelOffScreenPosition => DefaultPosDict["BPPanel"] + Vector3.up * 350f;
private void Start()
{
string text = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng");
if (text == Global.LANG_TYPE.Eng.ToString() || text == Global.LANG_TYPE.Ger.ToString())
{
PPPanel.transform.Find("PPIcon/PPSprite").gameObject.SetActive(value: false);
Vector3 vector = new Vector3(0f, 11f, 0f);
PPLabel.transform.localPosition += vector;
PPLineLabel.transform.localPosition += vector;
PPMaxLabel.transform.localPosition += vector;
}
PPPanel.transform.parent = BattleManagerBase.GetIns().Battle3DContainer.transform;
DefaultPosDict = new Dictionary<string, Vector3>();
DefaultPosDict["StatusPanel"] = StatusPanel.transform.localPosition;
DefaultPosDict["PPPanel"] = new Vector3(PPPanel.transform.localPosition.x, 460f, PPPanel.transform.localPosition.z);
DefaultPosDict["StatusPanelAllwaysDisp"] = StatusPanelAllwaysDisp.transform.localPosition;
SetPp(0, 0);
SetDeck(0);
SetGrave(0);
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
EpPanel.transform.localPosition = EpPanelOffScreenPosition;
PPPanel.SetActive(value: false);
EpPanel.gameObject.SetActive(value: false);
PPPanel.SetActive(value: false);
EpPanel.gameObject.SetActive(value: false);
StatusPanelAllwaysDisp.gameObject.SetActive(value: false);
List<GameObject> list = new List<GameObject>();
list.Add(base.gameObject);
list.Add(PPPanel);
list.Add(EpPanel.gameObject);
UIManager.GetInstance().AttachAtlas(list);
}
public void ChangePPPanelParent(Transform parent, Vector3 position)
{
PPPanel.transform.parent = parent;
DefaultPosDict["PPPanel"] = position;
if (PPPanel.GetComponent<iTween>() != null)
{
StartPPPanelAnimation();
}
else
{
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
}
}
public void SetUp(BattleManagerBase battleMgr)
{
_battleMgr = battleMgr;
}
public void ShowStatus(bool isNewReplayMoveTurn)
{
if (BattlePlayerViewBase.AlwaysShowStatusPanel && !isNewReplayMoveTurn)
{
ShowStatusPanelAlways();
}
else
{
StatusPanel.SetActive(value: true);
}
}
public void ShowStatusPanelOnBattle()
{
StatusPanelAllwaysDisp.gameObject.SetActive(BattlePlayerViewBase.AlwaysShowStatusPanel);
}
public void ShowStatusPanelAlways()
{
if (BattlePlayerViewBase.AlwaysShowStatusPanel)
{
StatusPanelAllwaysDisp.gameObject.SetActive(value: true);
Vector3 localPosition = DefaultPosDict["StatusPanelAllwaysDisp"] + Vector3.up * 350f;
StatusPanelAllwaysDisp.transform.localPosition = localPosition;
iTween.MoveTo(StatusPanelAllwaysDisp, iTween.Hash("position", DefaultPosDict["StatusPanelAllwaysDisp"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
}
}
public void HideStatusPanelAlways()
{
if (BattlePlayerViewBase.AlwaysShowStatusPanel)
{
StatusPanelAllwaysDisp.gameObject.SetActive(value: false);
}
}
public void ShowPpEp(bool isNotEPMax3, bool fixDirection = false, bool isNewReplay = false, bool isBanmenkun = false)
{
if (fixDirection)
{
isNotEPMax3 = false;
}
EpPanel.spriteName = GetEvoPanelSprite(isNotEPMax3);
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
if (isNotEPMax3)
{
EpIcon.transform.localPosition = new Vector3(-7.5f, -3.6f, 0f);
EpList[0].spriteName = "battle_icon_evo_off_mini";
EpList[1].spriteName = "battle_icon_evo_off_mini";
EpList[2].spriteName = "battle_icon_evo_off_mini";
EpList[0].transform.localPosition = new Vector3(5.1f, -59.2f, 0f);
EpList[1].transform.localPosition = new Vector3(23.8f, -59.2f, 0f);
EpList[2].gameObject.SetActive(value: false);
if (isNewReplay)
{
EpPanel.transform.localScale = new Vector3(Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
EpIcon.transform.localScale = new Vector3(Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
}
if (flag)
{
EpPanel.transform.localScale = new Vector3(0f - Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
EpIcon.transform.localScale = new Vector3(0f - Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
}
}
else
{
EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f);
EpList[0].spriteName = "battle_icon_evo_off_mini";
EpList[1].spriteName = "battle_icon_evo_off_mini";
EpList[2].spriteName = "battle_icon_evo_off_mini";
EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f);
EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f);
EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f);
if (isNewReplay)
{
EpList[2].gameObject.SetActive(value: true);
}
float x = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpPanel.transform.localScale.x)) : (0f - EpPanel.transform.localScale.x));
if (flag)
{
x = Mathf.Abs(EpPanel.transform.localScale.x);
}
EpPanel.transform.localScale = new Vector3(x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
float x2 = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpIcon.transform.localScale.x)) : (0f - EpIcon.transform.localScale.x));
if (flag)
{
x2 = Mathf.Abs(EpIcon.transform.localScale.x);
}
EpIcon.transform.localScale = new Vector3(x2, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
}
if (!isNewReplay)
{
StartPPPanelAnimation();
EpPanel.transform.localPosition = EpPanelOffScreenPosition;
iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelPosition, "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
}
else
{
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"];
EpPanel.transform.localPosition = EpPanelPosition;
}
EpPanel.gameObject.SetActive(value: true);
}
private void StartPPPanelAnimation()
{
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
PPPanel.SetActive(value: true);
}
public void HideUI()
{
iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"] + Vector3.up * 300f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelOffScreenPosition, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
}
public void SetDeck(int num)
{
DeckLabel.text = num.ToString();
DeckLabelAlwaysDisp.text = num.ToString();
}
public void SetGrave(int num)
{
GraveLabel.text = num.ToString();
GraveLabelAlwaysDisp.text = num.ToString();
}
public void SetHandCount(int num)
{
HandCountLabelAlwaysDisp.text = num.ToString();
UISprite handCountIconSpriteAlwaysDisp = HandCountIconSpriteAlwaysDisp;
Color color = (HandCountLabelAlwaysDisp.color = ClassInfomationUIBase.GetHandCardCountColor(num));
handCountIconSpriteAlwaysDisp.color = color;
}
public void SetPp(int num, int max, bool isNewReplayMoveTurn = false)
{
PPLabel.text = num.ToString();
PPMaxLabel.text = max.ToString();
}
public void PlayIncreasePpAnimation(int oldPp, int newPp)
{
}
public void SetEp(int evo, int cnt)
{
if (evo > 0)
{
EpIcon.spriteName = "battle_icon_evo_off";
EpLabel.gameObject.SetActive(value: true);
EpLabel.text = evo.ToString();
return;
}
if (!_battleMgr.BattleEnemy.IsEpEvolveThisTurn)
{
EpIcon.spriteName = "battle_icon_evo_on";
}
else
{
EpIcon.spriteName = "battle_icon_evo_off";
}
EpLabel.gameObject.SetActive(value: false);
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
for (int i = 0; i < 3; i++)
{
if (EpList[i] != null && EpList[i].gameObject.activeSelf)
{
if (flag)
{
EpList[i].spriteName = ((i < _battleMgr.BattleEnemy.EpTotal - cnt) ? "battle_icon_evo_off_mini" : "battle_icon_evo_on_mini");
}
else
{
EpList[i].spriteName = ((i < cnt) ? "battle_icon_evo_on_mini" : "battle_icon_evo_off_mini");
}
}
}
if (cnt <= 0)
{
EpIcon.spriteName = "battle_icon_evo_off";
}
}
public VfxBase PlayIncreaseMaxEpAnimation(int oldMaxEp, int newMaxEp)
{
return InstantVfx.Create(delegate
{
EpPanel.spriteName = GetEvoPanelSprite(isNotEpMax3: false);
EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f);
EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f);
EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f);
EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f);
EpList[2].gameObject.SetActive(value: true);
EpPanel.transform.localScale = new Vector3(0f - EpPanel.transform.localScale.x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
EpIcon.transform.localScale = new Vector3(0f - EpIcon.transform.localScale.x, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
});
}
public VfxBase PlayIncreaseUsableEpAnimation(int oldUsableEpAmount, int amountOfUsableEpGained, int maxEp)
{
return InstantVfx.Create(delegate
{
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
for (int i = oldUsableEpAmount; i < oldUsableEpAmount + amountOfUsableEpGained; i++)
{
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_UI_EP_5, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position);
}
});
}
public VfxBase PlayDecreaseUsableEpAnimation(int oldUsableEpAmount, int usedEp)
{
return InstantVfx.Create(delegate
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CMN_UI_EP_6);
int num = Mathf.Max(oldUsableEpAmount - usedEp, 0);
EffectMgr effectMgr = GameMgr.GetIns().GetEffectMgr();
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
for (int i = num; i < oldUsableEpAmount; i++)
{
effectMgr.Start(EffectMgr.EffectType.CMN_UI_EP_6, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position);
}
});
}
public void ChangeColor(Color color, float time)
{
TweenColor.Begin(StatusPanel, time, color);
TweenColor.Begin(DeckLabel.gameObject, time, color);
TweenColor.Begin(GraveLabel.gameObject, time, color);
TweenColor.Begin(DeckIconSprite.gameObject, time, color);
TweenColor.Begin(GraveIconSprite.gameObject, time, color);
}
public Transform GetClassInfoAnchor()
{
return base.gameObject.transform.Find("AnchorTR");
}
public GameObject GetPPPanel()
{
return PPPanel;
}
public GameObject GetEPIcon()
{
return EpIcon.gameObject;
}
private string GetEvoPanelSprite(bool isNotEpMax3)
{
string text = "battle_evo_";
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
int enemySkinId = dataMgr.GetEnemySkinId();
if (dataMgr.IsHighRankSkinEnemy())
{
text = text + enemySkinId + "_";
}
else if (dataMgr.Is3DSkin(isPlayer: false))
{
text += "uma_";
}
else if (Global.IsSnCollabSkin(enemySkinId))
{
text += "sn_";
}
return text + "base_" + (isNotEpMax3 ? "02" : "01");
}
}