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.
488 lines
17 KiB
C#
488 lines
17 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public class PanelMgr : MonoBehaviour
|
|
{
|
|
public enum BattleAlertType
|
|
{
|
|
CannotPlay,
|
|
InPlayIsFull,
|
|
NotEnoughPp,
|
|
NoInPlayTarget,
|
|
NotPassCondition,
|
|
GuardExisted,
|
|
EvoButDrunk,
|
|
CannotAttackNotHasGuard,
|
|
CannotAttackClass,
|
|
CannotAttackAmulet,
|
|
CannotAttackTarget,
|
|
AlreadyAttackedThisTurn,
|
|
CannotAttackOnSameTurn,
|
|
CannotAttackGeneric,
|
|
EmoteLimit,
|
|
ContainRandomElement,
|
|
NoSelectedEvolutionTarget,
|
|
NoSelectedEmotionIcon,
|
|
SelectedEmotionIcon,
|
|
SelectTargetCard,
|
|
SelectTargetCardOver,
|
|
SelectChoiceCard,
|
|
SelectChoiceBraveCard,
|
|
ElfInfomation,
|
|
RoyalInfomation,
|
|
WitchInfomation,
|
|
DragonInfomationNotAwake,
|
|
DragonInfomationAwake,
|
|
VampireInfomationNotRevenge,
|
|
VampireInfomationRevenge,
|
|
NecromanceInfomation,
|
|
BishopInfomation,
|
|
DisconnectInfomation,
|
|
DisconnectInfomationMulligan,
|
|
None
|
|
}
|
|
|
|
private const float AUTOSTOP_SEC_MAX = 3f;
|
|
|
|
private const float SIZE_NORMAL = 1f;
|
|
|
|
private const float SIZE_SMALL = 0.5f;
|
|
|
|
private const int DEPTH_NORMAL = 42;
|
|
|
|
private const int DEPTH_CHOICE = 30;
|
|
|
|
private const float SELECT_POSITION_Y = 0.52f;
|
|
|
|
private const float SELECT_OVER_POSITION_Y = 0.77f;
|
|
|
|
private const float SELECT_CHOICE_Y = 0.65f;
|
|
|
|
private float _autoStopSec;
|
|
|
|
private Coroutine _autoStopCoroutine;
|
|
|
|
private BattleManagerBase _battleMgr;
|
|
|
|
private BattleAlertType _currentAlertType = BattleAlertType.None;
|
|
|
|
private string _currentText = "";
|
|
|
|
private bool _notHideAndNotCreate;
|
|
|
|
private static readonly string INPLAY_TEXT = SkillFilterCreator.ContentKeyword.inplay.ToString();
|
|
|
|
private static readonly string HAND_OTHER_SELF_TEXT = SkillFilterCreator.ContentKeyword.hand_other_self.ToString();
|
|
|
|
private static readonly string CONST_TEXT = SkillFilterCreator.ContentKeyword.count.ToString();
|
|
|
|
private static readonly string TURN_DAMAGE_CONST_TEXT = SkillFilterCreator.ContentKeyword.turn_damage_count.ToString();
|
|
|
|
private static readonly string TURN_HEAL_CONST_TEXT = SkillFilterCreator.ContentKeyword.turn_heal_count.ToString();
|
|
|
|
private static readonly string TURN_SKILL_RETURN_CARD_CONST_TEXT = SkillFilterCreator.ContentKeyword.turn_skill_return_card_count.ToString();
|
|
|
|
private static readonly string TURN_ENHANCE_CARD_COUNT_TEXT = SkillFilterCreator.ContentKeyword.turn_enhance_card_count.ToString();
|
|
|
|
private void Awake()
|
|
{
|
|
_battleMgr = BattleManagerBase.GetIns();
|
|
}
|
|
|
|
public void InfoAlertDialogueAction(BattleAlertType AlertType, int PanelWidth, bool anim, bool isClass, string text)
|
|
{
|
|
if ((_currentAlertType == BattleAlertType.EmoteLimit && (AlertType == BattleAlertType.NoSelectedEmotionIcon || AlertType == BattleAlertType.SelectedEmotionIcon)) || _notHideAndNotCreate)
|
|
{
|
|
return;
|
|
}
|
|
_currentAlertType = AlertType;
|
|
switch (AlertType)
|
|
{
|
|
case BattleAlertType.CannotPlay:
|
|
case BattleAlertType.InPlayIsFull:
|
|
case BattleAlertType.NotEnoughPp:
|
|
case BattleAlertType.NoInPlayTarget:
|
|
case BattleAlertType.NotPassCondition:
|
|
case BattleAlertType.EvoButDrunk:
|
|
case BattleAlertType.AlreadyAttackedThisTurn:
|
|
case BattleAlertType.CannotAttackOnSameTurn:
|
|
case BattleAlertType.CannotAttackGeneric:
|
|
case BattleAlertType.EmoteLimit:
|
|
case BattleAlertType.ElfInfomation:
|
|
case BattleAlertType.RoyalInfomation:
|
|
case BattleAlertType.WitchInfomation:
|
|
case BattleAlertType.DragonInfomationNotAwake:
|
|
case BattleAlertType.DragonInfomationAwake:
|
|
case BattleAlertType.VampireInfomationNotRevenge:
|
|
case BattleAlertType.VampireInfomationRevenge:
|
|
case BattleAlertType.NecromanceInfomation:
|
|
case BattleAlertType.BishopInfomation:
|
|
DialogueReposition(0f, 0f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim);
|
|
break;
|
|
case BattleAlertType.ContainRandomElement:
|
|
case BattleAlertType.NoSelectedEmotionIcon:
|
|
DialogueReposition(0f, 0f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim, isAutoStop: false, 0.5f);
|
|
break;
|
|
case BattleAlertType.NoSelectedEvolutionTarget:
|
|
DialogueReposition(0f, 0.15f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim, isAutoStop: false, 0.5f);
|
|
break;
|
|
case BattleAlertType.SelectedEmotionIcon:
|
|
DialogueReposition(0f, 0f, text, 0, PanelWidth, anim: false, isAutoStop: false, 0.5f);
|
|
break;
|
|
case BattleAlertType.SelectTargetCard:
|
|
DialogueReposition(0f, 0.52f, text, 0, PanelWidth, anim: false, isAutoStop: false, 0.5f);
|
|
break;
|
|
case BattleAlertType.SelectTargetCardOver:
|
|
DialogueReposition(0f, 0.77f, text, 0, PanelWidth, anim: false, isAutoStop: false, 0.5f);
|
|
break;
|
|
case BattleAlertType.SelectChoiceCard:
|
|
case BattleAlertType.SelectChoiceBraveCard:
|
|
DialogueReposition(0f, 0.65f, text, 0, PanelWidth, anim: false, isAutoStop: false, 0.5f, 30);
|
|
break;
|
|
case BattleAlertType.GuardExisted:
|
|
case BattleAlertType.CannotAttackNotHasGuard:
|
|
case BattleAlertType.CannotAttackClass:
|
|
case BattleAlertType.CannotAttackAmulet:
|
|
case BattleAlertType.CannotAttackTarget:
|
|
if (isClass)
|
|
{
|
|
DialogueReposition(-0.8f, 0.8f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim);
|
|
_battleMgr.AlertDialogueLabel.width = 400;
|
|
}
|
|
else
|
|
{
|
|
DialogueReposition(0.01f, 0.58f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim);
|
|
}
|
|
break;
|
|
case BattleAlertType.DisconnectInfomation:
|
|
DialogueReposition(0f, 0f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim, isAutoStop: false, 1f, 42, notHideAndCreate: true);
|
|
break;
|
|
case BattleAlertType.DisconnectInfomationMulligan:
|
|
DialogueReposition(0f, 0f, GetAlertTypeToText(AlertType), 0, PanelWidth, anim, isAutoStop: false);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public static string GetAlertTypeToText(BattleAlertType AlertType)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
switch (AlertType)
|
|
{
|
|
case BattleAlertType.CannotPlay:
|
|
return systemText.Get("Battle_0153");
|
|
case BattleAlertType.InPlayIsFull:
|
|
return systemText.Get("Battle_0154");
|
|
case BattleAlertType.NotEnoughPp:
|
|
return systemText.Get("Battle_0155");
|
|
case BattleAlertType.GuardExisted:
|
|
return systemText.Get("Battle_0156");
|
|
case BattleAlertType.NoInPlayTarget:
|
|
return systemText.Get("Battle_0157");
|
|
case BattleAlertType.NotPassCondition:
|
|
return systemText.Get("Battle_0170");
|
|
case BattleAlertType.AlreadyAttackedThisTurn:
|
|
return systemText.Get("Battle_0166");
|
|
case BattleAlertType.CannotAttackOnSameTurn:
|
|
return systemText.Get("Battle_0167");
|
|
case BattleAlertType.CannotAttackGeneric:
|
|
return systemText.Get("Battle_0168");
|
|
case BattleAlertType.CannotAttackNotHasGuard:
|
|
case BattleAlertType.CannotAttackClass:
|
|
return systemText.Get("Battle_0159");
|
|
case BattleAlertType.EvoButDrunk:
|
|
return systemText.Get("Battle_0160");
|
|
case BattleAlertType.CannotAttackAmulet:
|
|
return systemText.Get("Battle_0169");
|
|
case BattleAlertType.CannotAttackTarget:
|
|
return systemText.Get("Battle_0162");
|
|
case BattleAlertType.EmoteLimit:
|
|
return systemText.Get("Battle_0165");
|
|
case BattleAlertType.ElfInfomation:
|
|
return systemText.Get("Battle_0452");
|
|
case BattleAlertType.RoyalInfomation:
|
|
return systemText.Get("Battle_0453");
|
|
case BattleAlertType.WitchInfomation:
|
|
return systemText.Get("Battle_0454");
|
|
case BattleAlertType.DragonInfomationNotAwake:
|
|
return systemText.Get("Battle_0455");
|
|
case BattleAlertType.DragonInfomationAwake:
|
|
return systemText.Get("Battle_0456");
|
|
case BattleAlertType.VampireInfomationNotRevenge:
|
|
return systemText.Get("Battle_0457");
|
|
case BattleAlertType.VampireInfomationRevenge:
|
|
return systemText.Get("Battle_0458");
|
|
case BattleAlertType.NecromanceInfomation:
|
|
return systemText.Get("Battle_0459");
|
|
case BattleAlertType.BishopInfomation:
|
|
return systemText.Get("Battle_0460");
|
|
case BattleAlertType.ContainRandomElement:
|
|
return systemText.Get("Battle_0449");
|
|
case BattleAlertType.NoSelectedEvolutionTarget:
|
|
return systemText.Get("Battle_0447");
|
|
case BattleAlertType.NoSelectedEmotionIcon:
|
|
return systemText.Get("Battle_0448");
|
|
case BattleAlertType.DisconnectInfomation:
|
|
case BattleAlertType.DisconnectInfomationMulligan:
|
|
return systemText.Get("Battle_0492");
|
|
default:
|
|
return "error not text";
|
|
}
|
|
}
|
|
|
|
private void DialogueReposition(float PanelX, float PanelY, string txt, int spacing, int PanelWidth, bool anim, bool isAutoStop = true, float size = 1f, int depth = 42, bool notHideAndCreate = false)
|
|
{
|
|
if (_currentText == txt)
|
|
{
|
|
return;
|
|
}
|
|
_currentText = txt;
|
|
_notHideAndNotCreate = notHideAndCreate;
|
|
NguiObjs component = _battleMgr.AlertDialogue.GetComponent<NguiObjs>();
|
|
UILabel uILabel = component.labels[0];
|
|
uILabel.text = txt;
|
|
uILabel.spacingX = spacing;
|
|
uILabel.width = PanelWidth;
|
|
uILabel.fontSize = ((size == 1f) ? 32 : 42);
|
|
component.gameObject.SetActive(value: true);
|
|
component.transform.position = new Vector3(PanelX, PanelY, 0f);
|
|
component.transform.localScale = new Vector3(size, size, 1f);
|
|
UIPanel componentInChildren = component.transform.GetComponentInChildren<UIPanel>();
|
|
if (componentInChildren != null)
|
|
{
|
|
componentInChildren.depth = depth;
|
|
}
|
|
if (anim)
|
|
{
|
|
component.transform.position = new Vector3(PanelX - 0.2f, PanelY, 0f);
|
|
iTween.MoveTo(component.gameObject, iTween.Hash("x", PanelX, "y", PanelY, "time", 0.2f, "easetype", iTween.EaseType.easeOutExpo));
|
|
iTween component2 = component.sprites[0].GetComponent<iTween>();
|
|
if (component2 != null)
|
|
{
|
|
UnityEngine.Object.DestroyImmediate(component2);
|
|
}
|
|
component.sprites[0].transform.localScale = new Vector3(1f, 2f, 1f);
|
|
iTween.ScaleTo(component.sprites[0].gameObject, iTween.Hash("scale", Vector3.one, "time", 0.3f, "easetype", iTween.EaseType.easeOutBack));
|
|
}
|
|
else
|
|
{
|
|
component.transform.position = new Vector3(PanelX, PanelY, 0f);
|
|
component.sprites[0].transform.localScale = new Vector3(1f, 1f, 1f);
|
|
}
|
|
uILabel.MarkAsChanged();
|
|
if (isAutoStop)
|
|
{
|
|
AutoStopAlertDialogue();
|
|
}
|
|
}
|
|
|
|
public void AlertActionFalse()
|
|
{
|
|
if (!_notHideAndNotCreate)
|
|
{
|
|
iTween.Stop(_battleMgr.AlertDialogue, includechildren: true);
|
|
_battleMgr.AlertDialogue.SetActive(value: false);
|
|
_currentAlertType = BattleAlertType.None;
|
|
_currentText = "";
|
|
}
|
|
}
|
|
|
|
public void OffNotHideAndNotCreate()
|
|
{
|
|
_notHideAndNotCreate = false;
|
|
}
|
|
|
|
public void Hide(BattleAlertType alertType)
|
|
{
|
|
if (_currentAlertType == alertType)
|
|
{
|
|
AlertActionFalse();
|
|
}
|
|
}
|
|
|
|
private void AutoStopAlertDialogue()
|
|
{
|
|
_autoStopSec = 0f;
|
|
if (_autoStopCoroutine != null)
|
|
{
|
|
StopCoroutine(_autoStopCoroutine);
|
|
_autoStopCoroutine = null;
|
|
}
|
|
_autoStopCoroutine = StartCoroutine(AutoStopAlertDialogueCoroutine());
|
|
}
|
|
|
|
private IEnumerator AutoStopAlertDialogueCoroutine()
|
|
{
|
|
while (_battleMgr.AlertDialogue.activeSelf)
|
|
{
|
|
if (!BattleManagerBase.UseCustomMouse && GameMgr.GetIns().GetInputMgr().IsDown())
|
|
{
|
|
AlertActionFalse();
|
|
break;
|
|
}
|
|
_autoStopSec += Time.deltaTime;
|
|
if (_autoStopSec >= 3f)
|
|
{
|
|
AlertActionFalse();
|
|
break;
|
|
}
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public static BattleAlertType GetCannotAttackAlertType(BattleCardBase attackCard)
|
|
{
|
|
if (!attackCard.IsSelfTurn)
|
|
{
|
|
return BattleAlertType.None;
|
|
}
|
|
if (!attackCard.IsUnit)
|
|
{
|
|
return BattleAlertType.CannotAttackGeneric;
|
|
}
|
|
if (attackCard.AttackableCount <= 0)
|
|
{
|
|
return BattleAlertType.AlreadyAttackedThisTurn;
|
|
}
|
|
if (attackCard.IsSummonDrunkenness)
|
|
{
|
|
return BattleAlertType.CannotAttackOnSameTurn;
|
|
}
|
|
if (!attackCard.AreCanAttackConditionsFulfilled)
|
|
{
|
|
return BattleAlertType.None;
|
|
}
|
|
return BattleAlertType.CannotAttackGeneric;
|
|
}
|
|
|
|
public void ShowAlert(BattleAlertType AlertType, bool isClass, string text = null)
|
|
{
|
|
if ((!GameMgr.GetIns().IsWatchBattle || AlertType == BattleAlertType.SelectChoiceCard) && AlertType != BattleAlertType.None)
|
|
{
|
|
int panelWidth = 0;
|
|
bool anim = true;
|
|
switch (AlertType)
|
|
{
|
|
case BattleAlertType.EvoButDrunk:
|
|
case BattleAlertType.CannotAttackClass:
|
|
case BattleAlertType.DisconnectInfomation:
|
|
case BattleAlertType.DisconnectInfomationMulligan:
|
|
panelWidth = 800;
|
|
break;
|
|
case BattleAlertType.NotEnoughPp:
|
|
case BattleAlertType.GuardExisted:
|
|
case BattleAlertType.CannotAttackNotHasGuard:
|
|
case BattleAlertType.CannotAttackAmulet:
|
|
case BattleAlertType.CannotAttackTarget:
|
|
case BattleAlertType.AlreadyAttackedThisTurn:
|
|
case BattleAlertType.CannotAttackOnSameTurn:
|
|
case BattleAlertType.CannotAttackGeneric:
|
|
panelWidth = 600;
|
|
break;
|
|
case BattleAlertType.CannotPlay:
|
|
case BattleAlertType.NoInPlayTarget:
|
|
case BattleAlertType.NotPassCondition:
|
|
case BattleAlertType.SelectedEmotionIcon:
|
|
panelWidth = 800;
|
|
break;
|
|
case BattleAlertType.InPlayIsFull:
|
|
panelWidth = 700;
|
|
anim = false;
|
|
break;
|
|
case BattleAlertType.SelectTargetCard:
|
|
case BattleAlertType.SelectTargetCardOver:
|
|
case BattleAlertType.SelectChoiceCard:
|
|
panelWidth = 900;
|
|
anim = false;
|
|
break;
|
|
case BattleAlertType.SelectChoiceBraveCard:
|
|
panelWidth = 960;
|
|
anim = false;
|
|
break;
|
|
case BattleAlertType.EmoteLimit:
|
|
case BattleAlertType.ContainRandomElement:
|
|
case BattleAlertType.NoSelectedEvolutionTarget:
|
|
case BattleAlertType.NoSelectedEmotionIcon:
|
|
case BattleAlertType.ElfInfomation:
|
|
case BattleAlertType.RoyalInfomation:
|
|
case BattleAlertType.WitchInfomation:
|
|
case BattleAlertType.DragonInfomationNotAwake:
|
|
case BattleAlertType.DragonInfomationAwake:
|
|
case BattleAlertType.VampireInfomationNotRevenge:
|
|
case BattleAlertType.VampireInfomationRevenge:
|
|
case BattleAlertType.NecromanceInfomation:
|
|
case BattleAlertType.BishopInfomation:
|
|
panelWidth = 1000;
|
|
break;
|
|
}
|
|
InfoAlertDialogueAction(AlertType, panelWidth, anim, isClass, text);
|
|
}
|
|
}
|
|
|
|
public bool ShowAlertTouchCard(ref BattleCardBase hitCard, ref BattleManagerBase battleMgr)
|
|
{
|
|
BattleAlertType battleAlertType = BattleAlertType.None;
|
|
bool isClass = true;
|
|
int pp = _battleMgr.BattlePlayer.Pp;
|
|
Skill_pp_fixeduse mutationSkill = hitCard.GetAccelerateOrCrystallizeSkill(pp);
|
|
bool flag = mutationSkill != null;
|
|
if (hitCard.IsSpell || (flag && mutationSkill.OnWhenAccelerate != 0))
|
|
{
|
|
bool flag2 = hitCard.SelfBattlePlayer.Class.SkillApplyInformation.HasCantPlaySpellFilter();
|
|
if (pp < hitCard.Cost && !flag)
|
|
{
|
|
battleAlertType = BattleAlertType.NotEnoughPp;
|
|
isClass = false;
|
|
}
|
|
else if (hitCard.SelfBattlePlayer.Class.SkillApplyInformation.IsCantPlay(hitCard) || flag2)
|
|
{
|
|
battleAlertType = BattleAlertType.CannotPlay;
|
|
isClass = false;
|
|
}
|
|
else
|
|
{
|
|
BattleCardBase battleCardBase = hitCard;
|
|
Func<SkillVariableComareFilter, bool> isSelectCondition = (SkillVariableComareFilter f) => (f.Lhs.Contains(INPLAY_TEXT) || f.Lhs.Contains(HAND_OTHER_SELF_TEXT)) && f.Lhs.Contains(CONST_TEXT) && f.Compare == ">" && f.Rhs == "0";
|
|
Func<SkillVariableComareFilter, bool> isExceptCondition = (SkillVariableComareFilter f) => !f.Lhs.Contains(TURN_DAMAGE_CONST_TEXT) && !f.Lhs.Contains(TURN_HEAL_CONST_TEXT) && !f.Lhs.Contains(TURN_SKILL_RETURN_CARD_CONST_TEXT) && !f.Lhs.Contains(TURN_ENHANCE_CARD_COUNT_TEXT);
|
|
if ((flag && mutationSkill._fixedUsePP == battleCardBase.CalcFixedUseCost(pp, skipCondition: true) && (mutationSkill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => (!isSelectCondition(f) || !isExceptCondition(f)) && !f.Filtering(mutationSkill.OptionValue)) || mutationSkill.ConditionFilterCollection.ConditionCheckerFilterList.Any((ISkillConditionChecker f) => f is SkillConditionWrath || f is SkillConditionEvolvableTurn))) || hitCard.Skills.Any((SkillBase s) => s is Skill_can_play_self))
|
|
{
|
|
battleAlertType = BattleAlertType.NotPassCondition;
|
|
isClass = false;
|
|
}
|
|
else if (!hitCard.Skills.CheckWhenPlaySelectTargetSkillCondition)
|
|
{
|
|
battleAlertType = BattleAlertType.NoInPlayTarget;
|
|
isClass = false;
|
|
}
|
|
}
|
|
}
|
|
else if (flag && mutationSkill.OnWhenCrystallize != 0 && _battleMgr.BattlePlayer.ClassAndInPlayCardList.Count > 5)
|
|
{
|
|
battleAlertType = BattleAlertType.InPlayIsFull;
|
|
}
|
|
else if (flag && mutationSkill.OnWhenCrystallize != 0 && hitCard.SelfBattlePlayer.Class.SkillApplyInformation.IsCantPlay(hitCard))
|
|
{
|
|
battleAlertType = BattleAlertType.CannotPlay;
|
|
isClass = false;
|
|
}
|
|
else if (pp < hitCard.Cost)
|
|
{
|
|
battleAlertType = BattleAlertType.NotEnoughPp;
|
|
isClass = false;
|
|
}
|
|
else if (_battleMgr.BattlePlayer.ClassAndInPlayCardList.Count > 5)
|
|
{
|
|
battleAlertType = BattleAlertType.InPlayIsFull;
|
|
}
|
|
else if (hitCard.SelfBattlePlayer.Class.SkillApplyInformation.IsCantPlay(hitCard))
|
|
{
|
|
battleAlertType = BattleAlertType.CannotPlay;
|
|
isClass = false;
|
|
}
|
|
ShowAlert(battleAlertType, isClass);
|
|
return battleAlertType != BattleAlertType.None;
|
|
}
|
|
}
|