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,31 @@
using System;
using System.Collections.Generic;
using Wizard.Battle.View;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public interface IMulliganMgr
{
Action OnSubmit { get; set; }
PlayerMulliganCtrl PlayerMlgCtrl { get; }
OpponentMulliganCtrl OpponentMlgCtrl { get; }
VfxBase StartDeal(List<int> playerDealIdxList, List<int> oppoDealIdxList, SkillProcessor skillProcessor);
VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor);
VfxBase Submit(BattleManagerBase m_BtlMgrIns);
VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns);
VfxBase CompleteMulligan(BattleManagerBase m_BtlMgrIns);
VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view);
VfxBase RecoverMulligan(bool didPlayerSubmitMulligan, BattleManagerBase battleMgr);
MulliganInfoControl GetMulliganInfo();
}

View File

@@ -0,0 +1,259 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public abstract class MulliganCtrl
{
public const int MULLIGAN_CARD_MAX = 3;
public const int MULLIGAN_FIRST_EXCHANGE_MAX = 6;
public const int MULLIGAN_CHANGED_NUM_NULL = -1;
protected BattlePlayerBase _battlePlayer;
protected MulliganViewBase _mulliganView;
protected List<BattleCardBase> _firstDrawList = new List<BattleCardBase>(3);
protected List<BattleCardBase> _stockList = new List<BattleCardBase>(3);
protected List<int> _mulliganAfterCardIndexList;
protected int _mulliganChangedNum = -1;
public List<int> DealIdxList = new List<int>();
public MulliganCtrl(BattlePlayerBase player)
{
_battlePlayer = player;
}
public abstract VfxBase StartMulliganVfx(SkillProcessor skillProcessor);
public abstract VfxBase SubmitMulliganVfx(IList<BattleCardBase> abandonCards);
protected VfxBase _MulliganCardChange(IList<BattleCardBase> AbandonCards)
{
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
if (AbandonCards.Count > 0)
{
IDictionary<int, BattleCardBase> newList = _MoveNewCardToHand(AbandonCards);
_ReturnAbandonToDeck(AbandonCards);
sequentialVfxPlayer.Register(_MulliganSwap(newList, AbandonCards));
}
return sequentialVfxPlayer;
}
protected void _ReturnAbandonToDeck(IList<BattleCardBase> AbandonCards)
{
List<BattleCardBase> list = AbandonCards.Where((BattleCardBase c) => c != null).ToList();
for (int num = 0; num < list.Count(); num++)
{
GetBattlePlayer().AddToDeck(list[num]);
}
}
protected virtual IDictionary<int, BattleCardBase> _MoveNewCardToHand(IList<BattleCardBase> AbandonCards)
{
List<BattleCardBase> list = _stockList.Take(AbandonCards.Count).ToList();
_stockList.RemoveRange(0, AbandonCards.Count);
BattlePlayerBase player = GetBattlePlayer();
for (int i = 0; i < AbandonCards.Count; i++)
{
player.DeckCardList.Remove(list[i]);
int index = player.HandCardList.IndexOf(AbandonCards[i]);
player.HandCardList[index] = list[i];
}
return list.ToDictionary((BattleCardBase card) => player.HandCardList.IndexOf(card));
}
protected IDictionary<int, BattleCardBase> NetworkMoveNewCardToHand(IList<BattleCardBase> AbandonCards)
{
BattlePlayerBase player = GetBattlePlayer();
List<BattleCardBase> list = new List<BattleCardBase>();
for (int i = 0; i < _mulliganAfterCardIndexList.Count; i++)
{
int num = _mulliganAfterCardIndexList[i];
if (!DealIdxList.Contains(num))
{
list.Add(BattleManagerBase.GetIns().GetBattleCardIdx(player.DeckCardList, num));
}
}
if (AbandonCards.Count != list.Count)
{
string text = "";
for (int j = 0; j < AbandonCards.Count; j++)
{
if (j > 0)
{
text += ",";
}
text += AbandonCards[j].Index;
}
string text2 = "";
for (int k = 0; k < list.Count; k++)
{
if (k > 0)
{
text2 += ",";
}
text2 += list[k].Index;
}
throw new Exception($"Card swap failedAbandonCards【{text}】/DrawCards【{text2}】");
}
SortedList<int, BattleCardBase> sortedList = new SortedList<int, BattleCardBase>();
for (int l = 0; l < AbandonCards.Count; l++)
{
int key = DealIdxList.IndexOf(AbandonCards[l].Index);
sortedList.Add(key, AbandonCards[l]);
}
IList<int> keys = sortedList.Keys;
for (int m = 0; m < keys.Count; m++)
{
int key2 = keys[m];
player.DeckCardList.Remove(list[m]);
int index = player.HandCardList.IndexOf(sortedList[key2]);
player.HandCardList[index] = list[m];
}
return list.ToDictionary((BattleCardBase card) => player.HandCardList.IndexOf(card));
}
protected abstract VfxBase _MulliganSwap(IDictionary<int, BattleCardBase> newList, IList<BattleCardBase> oldList);
protected VfxBase _CardSwapAndMoveToStaticPositionVfx(IDictionary<int, BattleCardBase> newList, IList<BattleCardBase> oldList, bool isCardHolderPlayer, bool isHideMulliganTitle)
{
List<int> list = newList.Keys.ToList();
List<BattleCardBase> list2 = newList.Values.ToList();
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
_mulliganView.HideMulliganUIAbandonZone();
if (isHideMulliganTitle)
{
_mulliganView.HideMulliganTitle();
}
}));
sequentialVfxPlayer.Register(new PlayerMulliganSwapVfx(list2, list, oldList, isCardHolderPlayer));
int count = newList.Count;
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
for (int num = 0; num < count; num++)
{
BattleCardBase card = list2[num];
int posIndex = list[num];
parallelVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(card, posIndex, isAbandon: false));
}
parallelVfxPlayer.Register(InstantVfx.Create(delegate
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HAND_MOVE_RIGHT);
}));
sequentialVfxPlayer.Register(parallelVfxPlayer);
return sequentialVfxPlayer;
}
public void GetAbandonCardList(BattleManagerBase battleMgr, ref List<BattleCardBase> retCardList, ref List<int> retPosList)
{
IEnumerable<int> source = DealIdxList.Where((int index) => !_mulliganAfterCardIndexList.Contains(index));
retPosList = source.Select((int index) => DealIdxList.IndexOf(index)).ToList();
retCardList = source.Select((int index) => battleMgr.GetBattleCardIdx(GetBattlePlayer().AllCards.ToList(), index)).ToList();
}
public SequentialVfxPlayer MoveCardToStaticPosition(BattleCardBase card, int posIndex, bool isAbandon)
{
return _mulliganView.MoveCardToStaticPosition(card, posIndex, isAbandon);
}
public VfxBase MoveMulliganUIOutWhenSubmitMulligan()
{
return _mulliganView.MoveMulliganUIOutWhenSubmitMulligan();
}
public VfxBase DrawFirstMulliganCard()
{
SkillProcessor skillProcessor = new SkillProcessor();
return GetBattlePlayer().DrawCards(_firstDrawList, skillProcessor, isOpen: false, isMulligan: true).Vfx;
}
protected List<int> _LotMulliganCardIndex(int maxNum)
{
List<int> list = new List<int>(6);
List<int> list2 = Enumerable.Range(1, maxNum).ToList();
if (BattleManagerBase.IsRandomDraw || GameMgr.GetIns().IsNetworkBattle)
{
for (int i = 0; i < 6; i++)
{
int index = BattleManagerBase.GetIns().StableRandom(list2.Count);
list.Add(list2[index]);
list2.Remove(list2[index]);
}
}
else
{
for (int j = 0; j < 6; j++)
{
list.Add(list2[j]);
}
}
return list;
}
protected void _CreateMulliganCardList(List<int> indexList)
{
List<BattleCardBase> deckCardList = GetBattlePlayer().DeckCardList;
for (int i = 0; i < 3; i++)
{
BattleCardBase battleCardIdx = BattleManagerBase.GetIns().GetBattleCardIdx(deckCardList, indexList[i]);
BattleCardBase battleCardIdx2 = BattleManagerBase.GetIns().GetBattleCardIdx(deckCardList, indexList[i + 3]);
_firstDrawList.Add(battleCardIdx);
_stockList.Add(battleCardIdx2);
}
}
public void CreateMulliganDealList(List<int> indexList)
{
List<BattleCardBase> deckCardList = GetBattlePlayer().DeckCardList;
for (int i = 0; i < 3; i++)
{
BattleCardBase battleCardIdx = BattleManagerBase.GetIns().GetBattleCardIdx(deckCardList, indexList[i]);
_firstDrawList.Add(battleCardIdx);
}
}
public List<BattleCardBase> GetFirstDrawList()
{
return _firstDrawList;
}
public List<BattleCardBase> GetStockList()
{
return _stockList;
}
public List<int> GetMulliganAfterCardIndexList()
{
return _mulliganAfterCardIndexList;
}
public void SetMulliganAfterCardIndexList(List<int> indexList)
{
_mulliganAfterCardIndexList = indexList;
}
public int GetChangedNum()
{
return _mulliganChangedNum;
}
public BattlePlayerBase GetBattlePlayer()
{
return _battlePlayer;
}
public MulliganInfoControl GetMulliganInfo()
{
return _mulliganView.MulliganInfo;
}
}

View File

@@ -0,0 +1,778 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public class MulliganInfoControl : UIBase
{
public enum ViewType
{
Normal,
Watch
}
private enum TitleType
{
MulliganHelp,
WaitOpponent,
Watch
}
[Serializable]
private class MulliganParts
{
public UIWidget _keepZone;
public UISprite _keepBG;
public UISprite _keepText;
public UIWidget _abandonZone;
public UISprite _abandonBG;
public UISprite _abandonText;
public UISprite[] _exchangeMark;
}
private static readonly string MARIGAN_PANEL_CLASS = "battle_marigan_panel_class_";
private static readonly Vector3 ALL_UI_ROTATION = new Vector3(-10f, 0f, 0f);
private static readonly Vector3 ALL_UI_POSITION = new Vector3(0f, 0f, -80f);
private static readonly Vector3 SUBMIT_BUTTON_SCALE = new Vector3(1.4f, 1.4f, 1f);
private const float ZONE_VERTICAL_OFFSET_INNER = 50f;
private const float ZONE_VERTICAL_OFFSET_OUTSIDE = 80f;
private const float TITLEBAR_VERTICAL_OFFSET = 40f;
private const float TITLEBAR_HORIZONTAL_OFFSET_BASE = 180f;
private const float WATCH_BATTLE_TITLEBAR_HORIZONTAL_OFFSET_BASE = 0f;
private static readonly float[] ABANDON_TEXT_OFFSET_BOTTOM = new float[2] { -5f, -50f };
private static readonly float[] ABANDON_TEXT_OFFSET_TOP = new float[2] { 55f, 10f };
private static readonly float[] KEEP_TEXT_OFFSET_BOTTOM = new float[2] { -5f, -50f };
private static readonly float[] KEEP_TEXT_OFFSET_TOP = new float[2] { 55f, 10f };
private const float FADEIN_SEC = 0.5f;
private const float FADEIN_ALPHA = 1f;
private const float FADEOUT_SEC = 0.5f;
private const float FADEOUT_ALPHA = 0f;
private const float CARD_POS_Z = -10f;
private static readonly int[] CARD_POS_Y = new int[2] { -25, 25 };
private const float CHANGEMARK_POS_Z = -12f;
private static readonly float[][] CHANGEMARK_POS_Y = new float[2][]
{
new float[2] { -25f, 0f },
new float[2] { 25f, -25f }
};
private static readonly Vector3[] CHANGEMARK_SCALE = new Vector3[2]
{
new Vector3(1f, 1f, 1f),
new Vector3(0.92f, 0.92f, 1f)
};
private static readonly float[] CARD_POS_OFFSET_X = new float[2] { 400f, 260f };
private static readonly Vector3[] CARD_SCALE = new Vector3[2]
{
new Vector3(1.2f, 1.2f, 1f),
new Vector3(1.1f, 1.1f, 1f)
};
private static readonly int[] ZONE_WIDTH = new int[2] { 1240, 819 };
private static readonly int[] ZONE_POS_X = new int[2] { 0, 416 };
private const float HIDE_TOP_PANEL_DURATION = 0.3f;
private static readonly Vector3 ENEMY_CLASS_ICON_POSITION = new Vector3(-274.2f, -33f, 0f);
private static readonly Vector3[] ENEMY_CLASS_ICON_POSITION_2 = new Vector3[2]
{
new Vector3(-274.2f, -21.9f, 0f),
new Vector3(-274.2f, -58f, 0f)
};
private static readonly Vector3 ENEMY_CLASS_ICON_POSITION_MY_ROTATION = new Vector3(-274.2f, -50f, 0f);
private static readonly Vector3 ENEMY_CLASS_ICON_SCALE = new Vector3(1.2f, 1.2f, 1.2f);
private static readonly Vector2[] ENEMY_CLASS_INFO_LABEL_SIZE = new Vector2[2]
{
new Vector2(300f, 66f),
new Vector2(300f, 80f)
};
private static readonly Vector2 ENEMY_CLASS_INFO_LABEL_SIZE_MY_ROTATION = new Vector2(300f, 100f);
private static readonly Vector3[] ENEMY_CLASS_INFO_LABEL_POSITION = new Vector3[2]
{
new Vector3(-47f, -36f, 0f),
new Vector3(-47f, -43f, 0f)
};
private static readonly Vector2 ENEMY_CLASS_INFO_LABEL_POSITION_MY_ROTATION = new Vector3(-47f, -70f, 0f);
private static readonly Vector3 MY_ROTATION_INFO_POSITION = new Vector3(-246f, -21.9f, 0f);
private const int MY_ROTATION_PACK_RABEL_WIDTH_SHORT = 50;
private const int MY_ROTATION_PACK_RABEL_WIDTH_LONG = 80;
private static readonly string[] USE_SHORT_WIDTH_LANGUAGE = new string[2] { "Jpn", "Kor" };
[SerializeField]
public UISprite TurnImg;
[SerializeField]
public UILabel TurnLabel;
[SerializeField]
public UISprite TitleBar;
[SerializeField]
private UILabel TitleLabel;
[SerializeField]
private UILabel WatchBattleTitleLabel;
[SerializeField]
private UILabel WatchBattleOrderLabel;
[SerializeField]
public UISprite EnemyInfo;
[SerializeField]
private UILabel EnemyInfoLabel;
[SerializeField]
private UISprite EnemyInfoClassIcon_1;
[SerializeField]
private UISprite EnemyInfoClassIcon_2;
[SerializeField]
private GameObject _enemyInfoMyRotationInfo;
[SerializeField]
private UILabel _packName;
[SerializeField]
private UIGrid _myRotationIconGrid;
[SerializeField]
private GameObject _myRotationIconOriginal;
[SerializeField]
private GameObject TimerObj;
[SerializeField]
private UILabel TimerLabel;
[SerializeField]
public UIButton SubmitBtn;
[SerializeField]
private UILabel SubmitBtnLabel;
[SerializeField]
private MulliganParts _partsPlayer;
[SerializeField]
private MulliganParts _partsOpponent;
[SerializeField]
private UIAnchor AnchorTL;
[SerializeField]
private UIAnchor AnchorTR;
[SerializeField]
private UIAnchor AnchorBR;
private ViewType _viewType;
private Camera m_3DCamera;
private BattleManagerBase m_BtlMgrIns;
private long startTicks;
private int passageStartSecond;
private float maxSecond;
private bool isTimerOn;
private int StateCnt;
public const float ENEMY_INFO_HIDE_POS = 340f;
private float extendTime;
private Color TIMER_COLOR_RED = new Color(0.85490197f, 0.2901961f, 0.2509804f);
private Color TIMER_COLOR_YELLOW = new Color(1f, 41f / 51f, 23f / 85f);
private Color TIMER_COLOR_WHITE = new Color(1f, 0.99215686f, 47f / 51f);
public bool IsEnd { get; private set; }
public bool IsShowingMulliganSelect { get; private set; }
private int SCREEN_HEIGHT => m_3DCamera.pixelHeight;
public event Action OnStartMulligan;
public event Func<VfxBase> OnEndMulligan;
public event Func<VfxBase> OnTimeUp;
public void SetExtendTime(float leftTime)
{
extendTime = leftTime;
}
public void InitMulliganInfo()
{
m_BtlMgrIns = BattleManagerBase.GetIns();
base.gameObject.SetActive(value: false);
m_3DCamera = m_BtlMgrIns.Battle3DContainer.transform.Find("Camera").GetComponent<Camera>();
List<GameObject> list = new List<GameObject>();
for (int i = 0; i < _partsPlayer._exchangeMark.Length; i++)
{
list.Add(_partsPlayer._exchangeMark[i].gameObject);
}
for (int j = 0; j < _partsOpponent._exchangeMark.Length; j++)
{
list.Add(_partsOpponent._exchangeMark[j].gameObject);
}
UIManager.GetInstance().AttachAtlas(list);
}
private void Update()
{
if (GameMgr.GetIns().IsAINetwork && m_BtlMgrIns.IsRecovery)
{
return;
}
long ticks = TimeUtil.GetAbsoluteTime().Ticks - startTicks;
TimeSpan timeSpan = new TimeSpan(ticks);
if (!isTimerOn)
{
return;
}
float num = maxSecond - (float)timeSpan.TotalMilliseconds / 1000f + extendTime;
SetTimerLabel(num);
if (num <= 0f)
{
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
VfxBase[] allFuncCallResults = this.OnTimeUp.GetAllFuncCallResults();
foreach (VfxBase vfx in allFuncCallResults)
{
sequentialVfxPlayer.Register(vfx);
}
sequentialVfxPlayer.Register(m_BtlMgrIns.MulliganMgr.Submit(m_BtlMgrIns));
m_BtlMgrIns.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer);
}
}
public override void assetBundleEnd()
{
base.assetBundleEnd();
StartCoroutine(assetSetting());
}
public void Show(ViewType type)
{
_viewType = type;
InitiallizeView();
TweenAlpha.Begin(TitleBar.gameObject, 0f, 0f);
TweenAlpha.Begin(_partsPlayer._keepBG.gameObject, 0f, 0f);
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0f, 0f);
TweenAlpha.Begin(_partsOpponent._keepBG.gameObject, 0f, 0f);
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0f, 0f);
TimerObj.SetActive(value: false);
EnableButton(on: false);
if (m_BtlMgrIns.IsFirst)
{
TurnLabel.text = Data.SystemText.Get("Battle_0430");
}
else
{
TurnLabel.text = Data.SystemText.Get("Battle_0431");
}
TweenAlpha.Begin(TurnImg.gameObject, 0f, 0f);
TweenAlpha.Begin(EnemyInfo.gameObject, 0f, 0f);
isTimerOn = false;
StateCnt = 0;
base.gameObject.SetActive(value: true);
SetSubmitLabel();
if (GameMgr.GetIns().IsWatchBattle)
{
_SetTitleLabel(TitleType.Watch);
}
else
{
_SetTitleLabel(TitleType.MulliganHelp);
}
SetEnemyClassInfo();
this.OnStartMulligan.Call();
this.OnStartMulligan = null;
}
public void HideButtons()
{
isTimerOn = false;
TimerObj.SetActive(value: false);
EnableButton(on: false);
if (GameMgr.GetIns().IsNetworkBattle && StateCnt < 2 && !GameMgr.GetIns().IsWatchBattle)
{
_SetTitleLabel(TitleType.WaitOpponent);
}
}
public void HideTopPanels()
{
iTween.MoveTo(TurnImg.gameObject, iTween.Hash("x", -120f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
iTween.MoveTo(EnemyInfo.gameObject, iTween.Hash("x", 340f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
}
public void HideMulliganTitle()
{
TweenAlpha.Begin(TitleBar.gameObject, 0.5f, 0f);
}
public void HideMulliganChangeUI()
{
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 0f);
}
public void HideMulliganCenterUI()
{
TweenAlpha.Begin(_partsPlayer._keepBG.gameObject, 0.5f, 0f);
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 0f);
}
public void HideMulliganOpponentChangeUI()
{
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 0f);
}
public void HideMulliganOpponentCenterUI()
{
TweenAlpha.Begin(_partsOpponent._keepBG.gameObject, 0.5f, 0f);
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 0f);
}
public void InitiallizeView()
{
AnchorTL.uiCamera = m_3DCamera;
AnchorTR.uiCamera = m_3DCamera;
AnchorBR.uiCamera = m_3DCamera;
SubmitBtn.gameObject.GetComponent<UIAnchor>().uiCamera = m_3DCamera;
SubmitBtn.transform.localScale = SUBMIT_BUTTON_SCALE;
Vector3 localPosition = SubmitBtn.transform.localPosition;
SubmitBtn.transform.localPosition = new Vector3(localPosition.x, localPosition.y, -1f);
base.transform.localRotation = Quaternion.Euler(ALL_UI_ROTATION);
base.transform.localPosition = ALL_UI_POSITION;
int width = ZONE_WIDTH[(int)_viewType];
float num = ZONE_POS_X[(int)_viewType];
float num2 = CARD_POS_OFFSET_X[(int)_viewType];
float[] array = CHANGEMARK_POS_Y[(int)_viewType];
for (int i = 0; i < 3; i++)
{
_partsPlayer._exchangeMark[i].transform.localPosition = new Vector3(num2 * (float)(i - 1), array[0], -12f);
_partsOpponent._exchangeMark[i].transform.localPosition = new Vector3(num2 * (float)(i - 1), array[1], -12f);
}
for (int j = 0; j < 3; j++)
{
_partsPlayer._exchangeMark[j].transform.localScale = CHANGEMARK_SCALE[(int)_viewType];
_partsOpponent._exchangeMark[j].transform.localScale = CHANGEMARK_SCALE[(int)_viewType];
}
_partsPlayer._keepZone.width = width;
_partsPlayer._abandonZone.width = width;
_partsOpponent._keepZone.width = width;
_partsOpponent._abandonZone.width = width;
_partsPlayer._keepZone.transform.localPosition = new Vector3(0f - num, 0f, 0f);
_partsPlayer._abandonZone.transform.localPosition = new Vector3(num, 0f, 0f);
_partsOpponent._keepZone.transform.localPosition = new Vector3(0f - num, 0f, 0f);
_partsOpponent._abandonZone.transform.localPosition = new Vector3(num, 0f, 0f);
Transform target = m_BtlMgrIns.Battle3DContainer.transform;
_partsPlayer._keepZone.topAnchor.target = target;
_partsPlayer._keepZone.bottomAnchor.target = target;
_partsPlayer._abandonZone.topAnchor.target = target;
_partsPlayer._abandonZone.bottomAnchor.target = target;
_partsOpponent._keepZone.topAnchor.target = target;
_partsOpponent._keepZone.bottomAnchor.target = target;
_partsOpponent._abandonZone.topAnchor.target = target;
_partsOpponent._abandonZone.bottomAnchor.target = target;
_partsPlayer._keepZone.topAnchor.Set(0.5f, -50f);
_partsPlayer._keepZone.bottomAnchor.Set(0f, 80f);
if (_viewType == ViewType.Normal)
{
_partsPlayer._abandonZone.topAnchor.Set(1f, -80f);
_partsPlayer._abandonZone.bottomAnchor.Set(0.5f, 50f);
}
else
{
_partsPlayer._abandonZone.topAnchor.Set(0.5f, -50f);
_partsPlayer._abandonZone.bottomAnchor.Set(0f, 80f);
_partsOpponent._keepZone.topAnchor.Set(1f, -80f);
_partsOpponent._keepZone.bottomAnchor.Set(0.5f, 50f);
_partsOpponent._abandonZone.topAnchor.Set(1f, -80f);
_partsOpponent._abandonZone.bottomAnchor.Set(0.5f, 50f);
_partsPlayer._abandonText.bottomAnchor.Set(0f, ABANDON_TEXT_OFFSET_BOTTOM[0]);
_partsPlayer._abandonText.topAnchor.Set(0f, ABANDON_TEXT_OFFSET_TOP[0]);
_partsPlayer._abandonText.spriteName = "battle_mulligan_change_2";
_partsOpponent._abandonText.bottomAnchor.Set(1f, ABANDON_TEXT_OFFSET_BOTTOM[1]);
_partsOpponent._abandonText.topAnchor.Set(1f, ABANDON_TEXT_OFFSET_TOP[1]);
_partsOpponent._abandonText.spriteName = "battle_mulligan_change_1";
_partsOpponent._keepText.bottomAnchor.Set(1f, KEEP_TEXT_OFFSET_BOTTOM[1]);
_partsOpponent._keepText.topAnchor.Set(1f, KEEP_TEXT_OFFSET_TOP[1]);
}
TitleBar.topAnchor.target = target;
TitleBar.topAnchor.Set(0.5f, 40f);
TitleBar.bottomAnchor.target = target;
TitleBar.bottomAnchor.Set(0.5f, -40f);
TitleBar.leftAnchor.target = target;
TitleBar.rightAnchor.target = target;
float num3 = ((GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle) ? 0f : 180f);
TitleBar.leftAnchor.Set(0f, num3 * m_3DCamera.aspect);
TitleBar.rightAnchor.Set(1f, (0f - num3) * m_3DCamera.aspect);
}
public void ShowMulliganUI()
{
if (GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsReplayBattle)
{
isTimerOn = true;
startTicks = TimeUtil.GetAbsoluteTime().Ticks;
if (ToolboxGame.RealTimeNetworkAgent != null)
{
passageStartSecond = ToolboxGame.RealTimeNetworkAgent.GetPreparedStartTimer();
}
if ((float)passageStartSecond <= 25f)
{
maxSecond = 60f;
}
else
{
maxSecond = 60f - ((float)passageStartSecond - 25f);
if (maxSecond <= 0f)
{
maxSecond = 0f;
}
}
}
bool active = true;
bool active2 = true;
bool flag = true;
if (ViewType.Watch == _viewType)
{
active = false;
active2 = false;
flag = false;
}
TurnImg.gameObject.SetActive(active);
EnemyInfo.gameObject.SetActive(active2);
EnableButton(flag);
TweenAlpha.Begin(TitleBar.gameObject, 0.5f, 1f);
TweenAlpha.Begin(_partsPlayer._keepBG.gameObject, 0.5f, 1f);
TweenAlpha.Begin(_partsPlayer._abandonBG.gameObject, 0.5f, 1f);
if (ViewType.Watch == _viewType)
{
TweenAlpha.Begin(_partsOpponent._keepBG.gameObject, 0.5f, 1f);
TweenAlpha.Begin(_partsOpponent._abandonBG.gameObject, 0.5f, 1f);
}
TweenAlpha.Begin(TurnImg.gameObject, 0.5f, 1f);
TweenAlpha.Begin(EnemyInfo.gameObject, 0.5f, 1f);
SetEnemyReady(-1);
SetTimerLabel(maxSecond);
IsShowingMulliganSelect = true;
}
public void ShowTimerUI()
{
TimerObj.SetActive(ViewType.Watch != _viewType && isTimerOn);
}
private void EnableButton(bool on)
{
SubmitBtn.gameObject.SetActive(on);
}
public VfxBase SetPlayerReady()
{
StateCnt++;
IsEnd = true;
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
VfxBase[] allFuncCallResults = this.OnEndMulligan.GetAllFuncCallResults();
foreach (VfxBase vfx in allFuncCallResults)
{
sequentialVfxPlayer.Register(vfx);
}
return sequentialVfxPlayer;
}
public void SetMulliganEnd()
{
IsEnd = true;
}
public void SetEnemyReady(int num)
{
SystemText systemText = Data.SystemText;
if (num > 0)
{
EnemyInfoLabel.text = systemText.Get("Battle_0107", num.ToString());
StateCnt++;
}
else if (num == 0)
{
EnemyInfoLabel.text = systemText.Get("Battle_0106");
StateCnt++;
}
else
{
EnemyInfoLabel.text = systemText.Get("Battle_0105");
}
}
private void SetEnemyClassInfo()
{
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
MyRotationInfo myRotationInfo;
if (dataMgr.GetEnemySubClassId() != 10)
{
EnemyInfoClassIcon_1.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)dataMgr.GetEnemyClassId());
EnemyInfoClassIcon_2.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)dataMgr.GetEnemySubClassId());
EnemyInfoClassIcon_1.transform.localPosition = ENEMY_CLASS_ICON_POSITION_2[0];
EnemyInfoClassIcon_2.transform.localPosition = ENEMY_CLASS_ICON_POSITION_2[1];
EnemyInfoClassIcon_1.transform.localScale = ENEMY_CLASS_ICON_SCALE;
EnemyInfoClassIcon_2.transform.localScale = ENEMY_CLASS_ICON_SCALE;
EnemyInfoClassIcon_2.transform.gameObject.SetActive(value: true);
_enemyInfoMyRotationInfo.SetActive(value: false);
EnemyInfo.width = (int)ENEMY_CLASS_INFO_LABEL_SIZE[1].x;
EnemyInfo.height = (int)ENEMY_CLASS_INFO_LABEL_SIZE[1].y;
EnemyInfoLabel.transform.localPosition = ENEMY_CLASS_INFO_LABEL_POSITION[1];
}
else if (dataMgr.TryGetEnemyMyRotationInfo(out myRotationInfo))
{
EnemyInfoClassIcon_1.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)dataMgr.GetEnemyClassId());
EnemyInfoClassIcon_1.transform.localPosition = ENEMY_CLASS_ICON_POSITION_MY_ROTATION;
EnemyInfoClassIcon_1.transform.localScale = ENEMY_CLASS_ICON_SCALE;
EnemyInfoClassIcon_2.transform.gameObject.SetActive(value: false);
_enemyInfoMyRotationInfo.SetActive(value: true);
_enemyInfoMyRotationInfo.transform.localPosition = MY_ROTATION_INFO_POSITION;
_packName.text = myRotationInfo.LastPackText;
_packName.width = (USE_SHORT_WIDTH_LANGUAGE.Contains(CustomPreference.GetTextLanguage()) ? 50 : 80);
_myRotationIconOriginal.SetActive(value: false);
_myRotationIconGrid.transform.DestroyChildren();
for (int i = 0; i < myRotationInfo.Abilities.Count; i++)
{
GameObject obj = NGUITools.AddChild(_myRotationIconGrid.gameObject, _myRotationIconOriginal);
obj.GetComponent<UISprite>().spriteName = myRotationInfo.Abilities[i].IconName;
obj.SetActive(value: true);
}
_myRotationIconGrid.Reposition();
EnemyInfo.width = (int)ENEMY_CLASS_INFO_LABEL_SIZE_MY_ROTATION.x;
EnemyInfo.height = (int)ENEMY_CLASS_INFO_LABEL_SIZE_MY_ROTATION.y;
EnemyInfoLabel.transform.localPosition = ENEMY_CLASS_INFO_LABEL_POSITION_MY_ROTATION;
}
else
{
EnemyInfoClassIcon_1.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)dataMgr.GetEnemyClassId());
EnemyInfoClassIcon_1.transform.localPosition = ENEMY_CLASS_ICON_POSITION;
EnemyInfoClassIcon_1.transform.localScale = ENEMY_CLASS_ICON_SCALE;
EnemyInfoClassIcon_2.transform.gameObject.SetActive(value: false);
_enemyInfoMyRotationInfo.SetActive(value: false);
EnemyInfo.width = (int)ENEMY_CLASS_INFO_LABEL_SIZE[0].x;
EnemyInfo.height = (int)ENEMY_CLASS_INFO_LABEL_SIZE[0].y;
EnemyInfoLabel.transform.localPosition = ENEMY_CLASS_INFO_LABEL_POSITION[0];
}
EnemyInfo.spriteName = MARIGAN_PANEL_CLASS + dataMgr.GetEnemyClassId().ToString("00");
}
private void SetTimerLabel(float milliseconds)
{
if (GameMgr.GetIns().IsNetworkBattle)
{
float num = Mathf.Max(0f, Mathf.Ceil(milliseconds));
if (num <= 10f)
{
TimerLabel.color = TIMER_COLOR_RED;
}
else if (num <= 30f)
{
TimerLabel.color = TIMER_COLOR_YELLOW;
}
else
{
TimerLabel.color = TIMER_COLOR_WHITE;
}
TimerLabel.text = num.ToString();
}
else
{
TimerLabel.text = "";
TimerObj.SetActive(value: false);
}
}
private void SetSubmitLabel()
{
SystemText systemText = Data.SystemText;
SubmitBtnLabel.text = systemText.Get("Battle_0102");
}
public VfxBase OnMulliganSubmit()
{
HideButtons();
for (int i = 0; i < _partsPlayer._exchangeMark.Length; i++)
{
_partsPlayer._exchangeMark[i].gameObject.SetActive(value: false);
}
for (int j = 0; j < _partsOpponent._exchangeMark.Length; j++)
{
_partsOpponent._exchangeMark[j].gameObject.SetActive(value: false);
}
return InstantVfx.Create(delegate
{
if (!BattleManagerBase.GetIns().IsRecovery)
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.MULLIGAN_DECIDE);
}
});
}
private void _SetTitleLabel(TitleType type)
{
TitleLabel.text = string.Empty;
WatchBattleTitleLabel.text = string.Empty;
WatchBattleOrderLabel.text = string.Empty;
switch (type)
{
case TitleType.MulliganHelp:
TitleLabel.text = Data.SystemText.Get("Battle_0101");
break;
case TitleType.WaitOpponent:
TitleLabel.text = Data.SystemText.Get("Battle_0104");
break;
case TitleType.Watch:
if (GameMgr.GetIns().IsReplayBattle)
{
TitleLabel.text = Data.SystemText.Get("Battle_0467");
break;
}
WatchBattleTitleLabel.text = Data.SystemText.Get("Battle_0467");
WatchBattleOrderLabel.text = (m_BtlMgrIns.IsFirst ? Data.SystemText.Get("Battle_0514") : Data.SystemText.Get("Battle_0515"));
break;
}
}
public VfxBase DestroyMulliganUIVfx()
{
return InstantVfx.Create(delegate
{
UnityEngine.Object.Destroy(base.gameObject);
});
}
public RaycastHit[] GetRaycastHitFromPosition(Vector3 position)
{
Ray ray = m_3DCamera.ScreenPointToRay(position);
return Physics.RaycastAll(ray.origin, ray.direction, float.PositiveInfinity);
}
public RaycastHit[] Get2DRaycastHitFromPosition(Vector3 position)
{
Ray ray = UIManager.GetInstance().getCamera().ScreenPointToRay(position);
return Physics.RaycastAll(ray.origin, ray.direction, float.PositiveInfinity);
}
public Vector3 ScreenToWorldPoint3D(Vector3 position)
{
return m_3DCamera.ScreenToWorldPoint(position);
}
public bool IsLeavingKeepZone(Vector3 mousePosition)
{
float num = 30f;
float num2 = (float)SCREEN_HEIGHT / 2f - num;
return mousePosition.y - num2 > 0f;
}
public bool IsLeavingAbandonZone(Vector3 mousePosition)
{
float num = 30f;
float num2 = (float)SCREEN_HEIGHT / 2f + num;
return mousePosition.y - num2 < 0f;
}
public UIWidget GetKeepZonePlayer()
{
return _partsPlayer._keepZone;
}
public UIWidget GetAbandonZonePlayer()
{
return _partsPlayer._abandonZone;
}
public UIWidget GetKeepZoneOpponent()
{
return _partsOpponent._keepZone;
}
public UIWidget GetAbandonZoneOpponent()
{
return _partsOpponent._abandonZone;
}
public Vector3 GetMulliganZoneCardScale()
{
return CARD_SCALE[(int)_viewType];
}
public Vector3 GetMulliganZoneCardPos(int index, bool isAbandon, bool isPlayer)
{
float num = ((isAbandon && _viewType == ViewType.Normal) ? CARD_POS_Y[0] : CARD_POS_Y[1]);
if (_viewType == ViewType.Watch && !isPlayer)
{
num *= -1f;
}
return new Vector3(CARD_POS_OFFSET_X[(int)_viewType] * (float)(index - 1), num, -10f);
}
public void SetExchangeMarkPlayer(int index, bool on)
{
_partsPlayer._exchangeMark[index].gameObject.SetActive(on);
}
public void SetExchangeMarkOpponent(int index, bool on)
{
_partsOpponent._exchangeMark[index].gameObject.SetActive(on);
}
}

View File

@@ -0,0 +1,135 @@
using System.Collections.Generic;
using UnityEngine;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public abstract class MulliganViewBase
{
public static readonly Vector3 CARD_ROTATION = new Vector3(0f, 0f, 0f);
public static readonly Vector3 CARD_ROTATION_OPPO = new Vector3(0f, 180f, 0f);
protected MulliganInfoControl m_MlgUI;
public MulliganInfoControl MulliganInfo => m_MlgUI;
public MulliganViewBase(MulliganInfoControl mulliganInfo)
{
m_MlgUI = mulliganInfo;
}
public VfxBase UpdateOpponentMulliganStatusLabel(int Count)
{
return InstantVfx.Create(delegate
{
m_MlgUI.SetEnemyReady(Count);
});
}
public VfxBase MoveMulliganUIOutWhenSubmitMulligan()
{
return m_MlgUI.OnMulliganSubmit();
}
public VfxBase SortFirstDrawsToKeepZone(IList<BattleCardBase> firstDraws)
{
return new PlayerMulliganCardSortOutVfx(GetMulliganUIKeepZone(), firstDraws, m_MlgUI);
}
public static VfxBase MoveCardToMulliganZone(BattleCardBase target, GameObject mulliganZone, int posIndex, MulliganInfoControl mulliganUI, bool isAbandon)
{
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
GameObject gameObject = target.BattleCardView.GameObject;
target.BattleCardView.GameObject.transform.parent = mulliganZone.transform;
Vector3 mulliganZoneCardPos = mulliganUI.GetMulliganZoneCardPos(posIndex, isAbandon, target.IsPlayer);
Vector3 mulliganZoneCardScale = mulliganUI.GetMulliganZoneCardScale();
if (BattleManagerBase.GetIns().IsRecovery)
{
gameObject.transform.localScale = mulliganZoneCardScale;
}
else
{
iTween.ScaleTo(gameObject, iTween.Hash("scale", mulliganZoneCardScale, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
}
if (GameMgr.GetIns().IsWatchBattle)
{
if (GameMgr.GetIns().IsAdmin)
{
RotatePlayer(gameObject);
}
else if (!BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.HandControl.IsVisibleHand())
{
RotateEnemy(gameObject);
}
else if (target.IsPlayer)
{
RotatePlayer(gameObject);
}
else
{
RotateEnemy(gameObject);
}
}
else
{
RotatePlayer(gameObject);
}
if (BattleManagerBase.GetIns().IsRecovery)
{
gameObject.transform.localPosition = mulliganZoneCardPos;
}
else
{
iTween.MoveTo(gameObject, iTween.Hash("position", mulliganZoneCardPos, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
}
}));
return sequentialVfxPlayer;
}
private static void RotatePlayer(GameObject cardObj)
{
if (BattleManagerBase.GetIns().IsRecovery)
{
cardObj.transform.localRotation = Quaternion.Euler(CARD_ROTATION);
return;
}
iTween.RotateTo(cardObj, iTween.Hash("rotation", CARD_ROTATION, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
}
private static void RotateEnemy(GameObject cardObj)
{
if (BattleManagerBase.GetIns().IsRecovery)
{
cardObj.transform.localRotation = Quaternion.Euler(CARD_ROTATION_OPPO);
return;
}
iTween.RotateTo(cardObj, iTween.Hash("rotation", CARD_ROTATION_OPPO, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
}
public virtual SequentialVfxPlayer MoveCardToStaticPosition(BattleCardBase card, int posIndex, bool isAbandon)
{
GameObject mulliganZone = (isAbandon ? GetMulliganUIAbandonZone() : GetMulliganUIKeepZone());
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
card.SetOnMove(move: true);
}));
sequentialVfxPlayer.Register(MoveCardToMulliganZone(card, mulliganZone, posIndex, m_MlgUI, isAbandon));
sequentialVfxPlayer.Register(WaitVfx.Create(0.3f));
return sequentialVfxPlayer;
}
protected abstract GameObject GetMulliganUIKeepZone();
protected abstract GameObject GetMulliganUIAbandonZone();
public abstract void HideMulliganUIAbandonZone();
public void HideMulliganTitle()
{
m_MlgUI.HideMulliganTitle();
}
}

View File

@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Linq;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public class OpponentMulliganCtrl : MulliganCtrl
{
protected List<int> opponentIndexList = new List<int>();
protected bool _isHideCard = true;
public OpponentMulliganCtrl(BattlePlayerBase player, MulliganInfoControl mulliganInfo, bool isUseExchangeMark)
: base(player)
{
_mulliganView = new OpponentMulliganView(mulliganInfo, isUseExchangeMark);
_isHideCard = true;
}
public override VfxBase StartMulliganVfx(SkillProcessor skillProcessor)
{
BattlePlayerBase battlePlayer = GetBattlePlayer();
opponentIndexList = _LotMulliganCardIndex(battlePlayer.DeckCardList.Count);
_CreateMulliganCardList(opponentIndexList);
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(battlePlayer.BattleMgr.LoadCardResources(_firstDrawList));
sequentialVfxPlayer.Register(new EnemyMulliganDrawVfx(_firstDrawList, GetMulliganInfo()));
return sequentialVfxPlayer;
}
public override VfxBase SubmitMulliganVfx(IList<BattleCardBase> abandonCards)
{
_mulliganChangedNum = abandonCards.Count;
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
if (abandonCards.Count > 0)
{
parallelVfxPlayer.Register(_MulliganCardChange(abandonCards));
}
parallelVfxPlayer.Register(new DummyDeckRemoveCardVfx(isPlayer: false, 3));
parallelVfxPlayer.Register(_mulliganView.UpdateOpponentMulliganStatusLabel(abandonCards.Count));
return parallelVfxPlayer;
}
public List<int> GetOpponentIndexList()
{
return opponentIndexList;
}
protected override VfxBase _MulliganSwap(IDictionary<int, BattleCardBase> newList, IList<BattleCardBase> oldList)
{
return new EnemyMulliganSwapVfx(newList.Values.ToList(), newList.Keys.ToList(), oldList);
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using Cute;
using Wizard.Battle.View;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public class PlayerMulliganCtrl : MulliganCtrl
{
protected PlayerMulliganView _playerMulliganView;
protected IList<BattleCardBase> m_AbandonList;
public Action OnMulliganLaunchComplete;
protected bool _isSetOnCard;
public IList<BattleCardBase> AbandonList => m_AbandonList;
public bool IsSetOnCard => _isSetOnCard;
public PlayerMulliganCtrl(BattlePlayerBase player, MulliganInfoControl mulliganInfo, IPlayerView view)
: base(player)
{
_playerMulliganView = new PlayerMulliganView(mulliganInfo, view);
_mulliganView = _playerMulliganView;
m_AbandonList = new List<BattleCardBase>();
}
public override VfxBase StartMulliganVfx(SkillProcessor skillProcessor)
{
BattlePlayerBase battlePlayer = GetBattlePlayer();
List<int> indexList = _LotMulliganCardIndex(battlePlayer.DeckCardList.Count);
_CreateMulliganCardList(indexList);
DrawFirstMulliganCard();
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(new PlayerMulliganDrawVfx(_firstDrawList, GetMulliganInfo()));
sequentialVfxPlayer.Register(_playerMulliganView.SortFirstDrawsToKeepZone(_firstDrawList));
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
for (int i = 0; i < _firstDrawList.Count; i++)
{
_firstDrawList[i].SetOnDraw(draw: false);
}
_isSetOnCard = true;
OnMulliganLaunchComplete.Call();
}));
return sequentialVfxPlayer;
}
public override VfxBase SubmitMulliganVfx(IList<BattleCardBase> abandonCards)
{
_mulliganChangedNum = abandonCards.Count;
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
if (abandonCards.Count > 0)
{
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
sequentialVfxPlayer.Register(_MulliganCardChange(abandonCards));
parallelVfxPlayer.Register(sequentialVfxPlayer);
}
parallelVfxPlayer.Register(new DummyDeckRemoveCardVfx(isPlayer: true, 3));
return parallelVfxPlayer;
}
protected override VfxBase _MulliganSwap(IDictionary<int, BattleCardBase> newList, IList<BattleCardBase> oldList)
{
return _CardSwapAndMoveToStaticPositionVfx(newList, oldList, isCardHolderPlayer: true, isHideMulliganTitle: true);
}
public PlayerMulliganView GetPlayerMulliganView()
{
return _playerMulliganView;
}
public void RegisterAbandonCard(BattleCardBase card)
{
if (_firstDrawList.Contains(card) && !m_AbandonList.Contains(card))
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_1);
m_AbandonList.Add(card);
}
}
public void TakeOutAbandonCard(BattleCardBase card)
{
if (m_AbandonList.Contains(card))
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_1);
m_AbandonList.Remove(card);
}
}
}

View File

@@ -0,0 +1,125 @@
using System;
using UnityEngine;
using Wizard.Battle.View;
using Wizard.Battle.View.Vfx;
namespace Wizard.Battle.Mulligan;
public class PlayerMulliganView : MulliganViewBase
{
private IPlayerView m_PlayerBattleView;
public event Func<VfxBase> OnMulliganDragSuccess;
public PlayerMulliganView(MulliganInfoControl mlgInfoCtrl, IPlayerView view)
: base(mlgInfoCtrl)
{
m_PlayerBattleView = view;
m_MlgUI.InitMulliganInfo();
m_MlgUI.OnTimeUp += OnTimeUp;
}
public void DragCardStart(BattleCardBase card)
{
m_PlayerBattleView.MoveCardStart(card, isEffectAndSoundOn: false);
}
public void DragCard(BattleCardBase card, Vector3 Pos)
{
m_PlayerBattleView.MoveCard(card, Pos);
}
public void DragCardStop(BattleCardBase card)
{
m_PlayerBattleView.CardMoveEffectSwitch(on: false);
GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_DRAG_SLIDE);
card.SetOnMove(move: false);
}
public override SequentialVfxPlayer MoveCardToStaticPosition(BattleCardBase card, int posIndex, bool isAbandon)
{
VfxBase vfx = NullVfx.GetInstance();
if (isAbandon)
{
vfx = this.OnMulliganDragSuccess.GetAllFuncVfxResults();
}
SequentialVfxPlayer sequentialVfxPlayer = base.MoveCardToStaticPosition(card, posIndex, isAbandon);
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
DragCardStop(card);
if (isAbandon)
{
m_MlgUI.SetExchangeMarkPlayer(posIndex, on: true);
}
}));
sequentialVfxPlayer.Register(vfx);
return sequentialVfxPlayer;
}
public void ShowCardDetail(BattleCardBase card)
{
bool flag = !GameMgr.GetIns().IsWatchBattle && Mathf.Approximately(card.BattleCardView.Transform.localPosition.x, 0f);
m_PlayerBattleView.SetDetailScreenPosition(!flag && _IsDetailScreenRight());
m_PlayerBattleView.ShowDetailPanel(null, null, card, DetailPanelControl.ShowRequest.MULLIGAN);
}
private bool _IsDetailScreenRight()
{
if (InputMgr.ShowDetailLeftAndRight || GameMgr.GetIns().IsWatchBattle)
{
return Input.mousePosition.x < (float)Screen.width / 2f;
}
return false;
}
public void ShutDownCardDetail()
{
m_PlayerBattleView.HideDetailPanel();
}
public RaycastHit[] ConvertMousePositionToRayCastHits(Vector3 position)
{
return m_MlgUI.GetRaycastHitFromPosition(position);
}
public RaycastHit[] ConvertMousePositionToFrontUIRaycastHits(Vector3 position)
{
return m_MlgUI.Get2DRaycastHitFromPosition(position);
}
public Vector3 GetWorldPointInMulliganUICamera(Vector3 position)
{
return m_MlgUI.ScreenToWorldPoint3D(position);
}
private VfxBase OnTimeUp()
{
return InstantVfx.Create(ShutDownCardDetail);
}
protected override GameObject GetMulliganUIKeepZone()
{
return m_MlgUI.GetKeepZonePlayer().gameObject;
}
protected override GameObject GetMulliganUIAbandonZone()
{
return m_MlgUI.GetAbandonZonePlayer().gameObject;
}
public override void HideMulliganUIAbandonZone()
{
m_MlgUI.HideMulliganChangeUI();
}
public void SelectEffectOn(BattleCardBase targetCard)
{
m_PlayerBattleView.DetailPanelSelectEffectOff();
m_PlayerBattleView.DetailPanelSelectEffectOn(targetCard, DetailPanelControl.ShowRequest.MULLIGAN);
}
public void SelectEffectOff()
{
m_PlayerBattleView.DetailPanelSelectEffectOff();
}
}