feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public abstract class MulliganMgrBase : IMulliganMgr
|
||||
{
|
||||
protected OpponentMulliganCtrl _opponentMulliganControl;
|
||||
|
||||
private const float MULLIGAN_LIMIT_TIME = 5f;
|
||||
|
||||
private Coroutine mulliganTimeoutCoroutine;
|
||||
|
||||
public PlayerMulliganCtrl PlayerMlgCtrl { get; protected set; }
|
||||
|
||||
public OpponentMulliganCtrl OpponentMlgCtrl => _opponentMulliganControl;
|
||||
|
||||
public IList<BattleCardBase> AbandonList => PlayerMlgCtrl.AbandonList;
|
||||
|
||||
public Action OnSubmit { get; set; }
|
||||
|
||||
public VfxBase StartDeal(List<int> playerDealIdxList, List<int> oppoDealIdxList, SkillProcessor skillProcessor)
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(StopTimeout));
|
||||
PlayerMlgCtrl.DealIdxList = playerDealIdxList;
|
||||
_opponentMulliganControl.DealIdxList = oppoDealIdxList;
|
||||
PlayerMlgCtrl.CreateMulliganDealList(playerDealIdxList);
|
||||
_opponentMulliganControl.CreateMulliganDealList(oppoDealIdxList);
|
||||
VfxBase instance = NullVfx.GetInstance();
|
||||
VfxBase instance2 = NullVfx.GetInstance();
|
||||
instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor);
|
||||
instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor);
|
||||
parallelVfxPlayer.Register(instance);
|
||||
parallelVfxPlayer.Register(instance2);
|
||||
if (BattleManagerBase.GetIns().IsRecovery && Data.BattleRecoveryInfo.IsMulliganEnd)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
protected virtual void StartTimeout()
|
||||
{
|
||||
StopTimeout();
|
||||
mulliganTimeoutCoroutine = BattleCoroutine.GetInstance().StartCoroutine(MulliganNetworkTimeout());
|
||||
}
|
||||
|
||||
protected virtual void StopTimeout()
|
||||
{
|
||||
if (mulliganTimeoutCoroutine != null)
|
||||
{
|
||||
BattleCoroutine.GetInstance().StopCoroutine(mulliganTimeoutCoroutine);
|
||||
mulliganTimeoutCoroutine = null;
|
||||
}
|
||||
BattleManagerBase.GetIns().BattlePlayer.BattleView.HideAlertDialogue();
|
||||
}
|
||||
|
||||
private IEnumerator MulliganNetworkTimeout()
|
||||
{
|
||||
long matchedTimer = TimeUtil.GetAbsoluteTime().Ticks;
|
||||
do
|
||||
{
|
||||
yield return null;
|
||||
if (BattleManagerBase.GetIns().IsBattleEnd)
|
||||
{
|
||||
StopTimeout();
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
while (!((float)NetworkUtility.GetTimeSpanSecond(matchedTimer) >= 5f));
|
||||
BattleManagerBase.GetIns().BattlePlayer.BattleView.ShowAlert(PanelMgr.BattleAlertType.DisconnectInfomationMulligan, isClass: false);
|
||||
}
|
||||
|
||||
public virtual VfxBase Submit(BattleManagerBase m_BtlMgrIns)
|
||||
{
|
||||
OnSubmit.Call();
|
||||
ImmediateVfxMgr.GetInstance().Register(PlayerMlgCtrl.MoveMulliganUIOutWhenSubmitMulligan());
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
private void AddBattleLogMulliganResult(BattleManagerBase battleMgr)
|
||||
{
|
||||
BattleLogManager instance = BattleLogManager.GetInstance();
|
||||
instance.AddLogMulliganChanged(battleMgr.BattlePlayer, PlayerMlgCtrl.GetChangedNum());
|
||||
instance.AddLogMulliganChanged(battleMgr.BattleEnemy, OpponentMlgCtrl.GetChangedNum());
|
||||
}
|
||||
|
||||
public virtual VfxBase PlayerChangeCardVfx(BattleManagerBase btlMgrIns)
|
||||
{
|
||||
VfxBase result = PlayerMlgCtrl.SubmitMulliganVfx(PlayerMlgCtrl.AbandonList);
|
||||
List<int> completeCards = btlMgrIns.BattlePlayer.HandCardList.Select((BattleCardBase c) => c.Index).ToList();
|
||||
btlMgrIns.BattlePlayer.CallRecordingMulligan(PlayerMlgCtrl.AbandonList, completeCards);
|
||||
btlMgrIns.BattlePlayer.CallRecordingMulliganEnd(btlMgrIns.BattlePlayer.HandCardList);
|
||||
return result;
|
||||
}
|
||||
|
||||
public abstract VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns);
|
||||
|
||||
public virtual VfxBase CompleteMulligan(BattleManagerBase battleMgr)
|
||||
{
|
||||
if (!battleMgr.IsVirtualBattle && !GameMgr.GetIns().IsNewReplayBattle)
|
||||
{
|
||||
AddBattleLogMulliganResult(battleMgr);
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public virtual VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view)
|
||||
{
|
||||
PlayerMlgCtrl = new PlayerMulliganCtrl(BattleManagerBase.GetIns().BattlePlayer, mulliganInfo, view);
|
||||
_opponentMulliganControl = new OpponentMulliganCtrl(BattleManagerBase.GetIns().BattleEnemy, mulliganInfo, isUseExchangeMark: false);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public virtual VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor)
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
VfxBase instance = NullVfx.GetInstance();
|
||||
VfxBase instance2 = NullVfx.GetInstance();
|
||||
if (firstAttack)
|
||||
{
|
||||
instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor);
|
||||
instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor);
|
||||
}
|
||||
else
|
||||
{
|
||||
instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor);
|
||||
instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor);
|
||||
}
|
||||
parallelVfxPlayer.Register(instance);
|
||||
parallelVfxPlayer.Register(instance2);
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
public virtual VfxBase RecoverMulligan(bool didPlayerSubmitMulligan, BattleManagerBase battleMgr)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public MulliganInfoControl GetMulliganInfo()
|
||||
{
|
||||
return PlayerMlgCtrl.GetMulliganInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,510 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public class MulliganOperateControl
|
||||
{
|
||||
public enum STATE
|
||||
{
|
||||
WAIT,
|
||||
CARD_SELECTED,
|
||||
EXIT,
|
||||
NONE
|
||||
}
|
||||
|
||||
private STATE _state;
|
||||
|
||||
private InputMgr _inputManager;
|
||||
|
||||
private PlayerMulliganCtrl _playerMulliganCtrl;
|
||||
|
||||
protected PlayerMulliganView _mulliganView;
|
||||
|
||||
protected IList<BattleCardBase> PlayerFirstDrawCards;
|
||||
|
||||
private BattleCardBase _touchingCard;
|
||||
|
||||
private BattleCardBase _showDetailCard;
|
||||
|
||||
private float _timeSamePosition;
|
||||
|
||||
private Vector2 _idlePosition;
|
||||
|
||||
private BattleCardBase _pressedCard;
|
||||
|
||||
private const float SHOW_DETAIL_DELAY = 0f;
|
||||
|
||||
private const int START_CARD_NUMBER = 0;
|
||||
|
||||
private const int END_CARD_NUMBER = 2;
|
||||
|
||||
private const int ENTER_MULLIGAN_NUMBER = 3;
|
||||
|
||||
public STATE State => _state;
|
||||
|
||||
public MulliganOperateControl(PlayerMulliganCtrl mulliganCtrl)
|
||||
{
|
||||
_inputManager = GameMgr.GetIns().GetInputMgr();
|
||||
_state = STATE.WAIT;
|
||||
_playerMulliganCtrl = mulliganCtrl;
|
||||
_mulliganView = mulliganCtrl.GetPlayerMulliganView();
|
||||
PlayerFirstDrawCards = mulliganCtrl.GetFirstDrawList();
|
||||
_mulliganView.MulliganInfo.OnTimeUp += ReturnOnMoveCardWhenMulliganPhaseEnd;
|
||||
}
|
||||
|
||||
public VfxBase Update()
|
||||
{
|
||||
return _state switch
|
||||
{
|
||||
STATE.WAIT => Wait(),
|
||||
STATE.CARD_SELECTED => CardSelected(),
|
||||
_ => Reset(),
|
||||
};
|
||||
}
|
||||
|
||||
private VfxBase Wait()
|
||||
{
|
||||
if (BattleManagerBase.UseCustomMouse)
|
||||
{
|
||||
if (_inputManager.IsDown())
|
||||
{
|
||||
if ((_pressedCard = CheckCardCollision()) == null)
|
||||
{
|
||||
CheckDetailPanelCollision();
|
||||
}
|
||||
}
|
||||
else if (_inputManager.IsNone() || _inputManager.IsUp())
|
||||
{
|
||||
_pressedCard = null;
|
||||
}
|
||||
if (_inputManager.IsDown())
|
||||
{
|
||||
_showDetailCard = null;
|
||||
}
|
||||
if (_inputManager.IsClick() || (_inputManager.IsDownMoved() && _pressedCard != null))
|
||||
{
|
||||
if (CanMoveCard())
|
||||
{
|
||||
CheckSelectCard();
|
||||
}
|
||||
}
|
||||
else if (UseChangeShortcut())
|
||||
{
|
||||
if (!BattleManagerBase.GetIns().VfxMgr.IsEnd)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
BattleCardBase battleCardBase = CheckCardCollision();
|
||||
if (_touchingCard == null && battleCardBase != null && !battleCardBase.IsOnDraw && !IsOnMoveFirstDrawCards())
|
||||
{
|
||||
if (_showDetailCard != null)
|
||||
{
|
||||
_mulliganView.ShutDownCardDetail();
|
||||
_showDetailCard = null;
|
||||
_idlePosition = _inputManager.GetPos();
|
||||
_timeSamePosition = 0f;
|
||||
}
|
||||
_touchingCard = battleCardBase;
|
||||
return ChangeCardSide();
|
||||
}
|
||||
}
|
||||
else if (UseDetailShortcut())
|
||||
{
|
||||
BattleCardBase battleCardBase2 = CheckCardCollision();
|
||||
if (battleCardBase2 != null && !battleCardBase2.IsOnMove && !battleCardBase2.IsOnDraw && battleCardBase2 != _showDetailCard)
|
||||
{
|
||||
_showDetailCard = battleCardBase2;
|
||||
_mulliganView.ShowCardDetail(_showDetailCard);
|
||||
}
|
||||
}
|
||||
else if (_inputManager.IsNone() && BattleManagerBase.GetIns().HasFocus && OptionSettingWindow.ShortcutDetailPanel == OptionSettingWindow.ShortcutDetail.Auto)
|
||||
{
|
||||
RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition);
|
||||
if (!IsTouchingDetail(hits))
|
||||
{
|
||||
if (_idlePosition == _inputManager.GetPos())
|
||||
{
|
||||
_timeSamePosition += Time.deltaTime;
|
||||
if (_timeSamePosition > 0f && _showDetailCard == null)
|
||||
{
|
||||
BattleCardBase battleCardBase3 = CheckCardCollision();
|
||||
if (battleCardBase3 != null && !battleCardBase3.IsOnMove && !battleCardBase3.IsOnDraw)
|
||||
{
|
||||
_showDetailCard = battleCardBase3;
|
||||
_mulliganView.ShowCardDetail(_showDetailCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_showDetailCard != null)
|
||||
{
|
||||
BattleCardBase battleCardBase4 = CheckCardCollision();
|
||||
if (battleCardBase4 != _showDetailCard && battleCardBase4 != null && !battleCardBase4.IsOnDraw)
|
||||
{
|
||||
_showDetailCard = null;
|
||||
_mulliganView.ShutDownCardDetail();
|
||||
_idlePosition = _inputManager.GetPos();
|
||||
_timeSamePosition = 0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_idlePosition = _inputManager.GetPos();
|
||||
_timeSamePosition = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
if (_inputManager.IsDown())
|
||||
{
|
||||
CheckSelectCard();
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
private void CheckSelectCard()
|
||||
{
|
||||
if (_touchingCard != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
BattleCardBase battleCardBase = CheckCardCollision();
|
||||
if (battleCardBase != null)
|
||||
{
|
||||
if (battleCardBase.IsOnMove || battleCardBase.IsOnDraw)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition);
|
||||
if (!IsTouchingDetail(hits))
|
||||
{
|
||||
_touchingCard = battleCardBase;
|
||||
_state = STATE.CARD_SELECTED;
|
||||
if (BattleManagerBase.UseCustomMouse)
|
||||
{
|
||||
SetCardDragable();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckDetailPanelCollision();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckDetailPanelCollision()
|
||||
{
|
||||
RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition);
|
||||
if (!IsTouchingDetail(hits) && !UIManager.GetInstance().isOpenDialog())
|
||||
{
|
||||
_mulliganView.ShutDownCardDetail();
|
||||
}
|
||||
}
|
||||
|
||||
private BattleCardBase CheckCardCollision()
|
||||
{
|
||||
RaycastHit[] hits = _mulliganView.ConvertMousePositionToRayCastHits(Input.mousePosition);
|
||||
if (IsTouchingSystemUI(hits))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return GetTouchedCardFromRaycast(hits);
|
||||
}
|
||||
|
||||
private VfxBase CardSelected()
|
||||
{
|
||||
if (UIManager.GetInstance().IsQuitDialog())
|
||||
{
|
||||
return PutDownCard();
|
||||
}
|
||||
Vector3 mousePosition = Input.mousePosition;
|
||||
if (BattleManagerBase.UseCustomMouse && UseChangeShortcutDoubleClick())
|
||||
{
|
||||
if (_touchingCard != null && !_touchingCard.IsOnDraw)
|
||||
{
|
||||
return ChangeCardSide();
|
||||
}
|
||||
}
|
||||
else if (BattleManagerBase.UseCustomMouse && UseDetailShortcutDoubleClick())
|
||||
{
|
||||
if (_touchingCard != null && !_touchingCard.IsOnDraw)
|
||||
{
|
||||
_mulliganView.ShowCardDetail(_touchingCard);
|
||||
return PutDownCard();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWantToPutDownCard())
|
||||
{
|
||||
return PutDownCard();
|
||||
}
|
||||
if (CanMoveCard())
|
||||
{
|
||||
if (_touchingCard == null)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
if (_touchingCard.IsOnDraw)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
if (_touchingCard.IsOnMove)
|
||||
{
|
||||
MoveMulliganCard(mousePosition);
|
||||
}
|
||||
else if (_inputManager.IsOverDragDistanceMulligan())
|
||||
{
|
||||
SetCardDragable();
|
||||
}
|
||||
else if (BattleManagerBase.UseCustomMouse && UseChangeShortcut())
|
||||
{
|
||||
return ChangeCardSide();
|
||||
}
|
||||
}
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
protected virtual void MoveMulliganCard(Vector3 mousePosition)
|
||||
{
|
||||
Vector3 position = new Vector3(mousePosition.x, mousePosition.y, 1.5f);
|
||||
Vector3 worldPointInMulliganUICamera = _mulliganView.GetWorldPointInMulliganUICamera(position);
|
||||
_mulliganView.DragCard(_touchingCard, worldPointInMulliganUICamera);
|
||||
}
|
||||
|
||||
private VfxBase Reset()
|
||||
{
|
||||
_state = STATE.WAIT;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
protected virtual VfxBase PutDownCard()
|
||||
{
|
||||
_state = STATE.EXIT;
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
if (_touchingCard != null)
|
||||
{
|
||||
BattleCardBase touchingCard = _touchingCard;
|
||||
_touchingCard = null;
|
||||
if (touchingCard.IsOnMove)
|
||||
{
|
||||
bool isAtAbandonZone = _playerMulliganCtrl.AbandonList.Contains(touchingCard);
|
||||
int posIndex = PlayerFirstDrawCards.IndexOf(touchingCard);
|
||||
if (IsTouchingAbandonZone(Input.mousePosition, isAtAbandonZone))
|
||||
{
|
||||
sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, posIndex, isAbandon: true));
|
||||
_playerMulliganCtrl.RegisterAbandonCard(touchingCard);
|
||||
}
|
||||
else
|
||||
{
|
||||
sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, posIndex, isAbandon: false));
|
||||
_playerMulliganCtrl.TakeOutAbandonCard(touchingCard);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mulliganView.ShowCardDetail(touchingCard);
|
||||
}
|
||||
}
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public VfxBase ReturnOnMoveCardWhenMulliganPhaseEnd()
|
||||
{
|
||||
if (_touchingCard != null && _touchingCard.IsOnMove)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
if (_playerMulliganCtrl.AbandonList.Contains(_touchingCard))
|
||||
{
|
||||
_playerMulliganCtrl.AbandonList.Remove(_touchingCard);
|
||||
}
|
||||
int posIndex = PlayerFirstDrawCards.IndexOf(_touchingCard);
|
||||
sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(_touchingCard, posIndex, isAbandon: false));
|
||||
sequentialVfxPlayer.Register(WaitVfx.Create(0.3f));
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
_mulliganView.DragCardStop(_touchingCard);
|
||||
}));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
private BattleCardBase GetTouchedCardFromRaycast(RaycastHit[] hits)
|
||||
{
|
||||
int num = hits.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
RaycastHit hit = hits[i];
|
||||
BattleCardBase hitCard = GetHitCard(hit);
|
||||
if (hitCard != null && IsCardDraggable(hitCard))
|
||||
{
|
||||
return hitCard;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected virtual bool IsCardDraggable(BattleCardBase hitCard)
|
||||
{
|
||||
return PlayerFirstDrawCards.Contains(hitCard);
|
||||
}
|
||||
|
||||
public bool IsOnMoveFirstDrawCards()
|
||||
{
|
||||
return PlayerFirstDrawCards.Any((BattleCardBase c) => c.IsOnMove);
|
||||
}
|
||||
|
||||
private BattleCardBase GetHitCard(RaycastHit hit)
|
||||
{
|
||||
if (hit.collider.CompareTag("Player") || hit.collider.CompareTag("Enemy") || hit.collider.CompareTag("PlayerToken"))
|
||||
{
|
||||
GameObject gameObject = hit.collider.transform.parent.gameObject;
|
||||
if (gameObject.layer == 10)
|
||||
{
|
||||
BattleCardBase battleCard = gameObject.GetBattleCard();
|
||||
if (battleCard != null)
|
||||
{
|
||||
return battleCard;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool IsTouchingDetail(RaycastHit[] hits)
|
||||
{
|
||||
int num = hits.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
RaycastHit raycastHit = hits[i];
|
||||
if (raycastHit.collider.CompareTag("DetailPanel") && raycastHit.collider.gameObject.layer == 26)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsTouchingSystemUI(RaycastHit[] hits)
|
||||
{
|
||||
int num = hits.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
RaycastHit raycastHit = hits[i];
|
||||
if (raycastHit.collider.gameObject.layer == 22)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected bool IsTouchingAbandonZone(Vector3 mousePosition, bool isAtAbandonZone)
|
||||
{
|
||||
if (isAtAbandonZone)
|
||||
{
|
||||
return !_mulliganView.MulliganInfo.IsLeavingAbandonZone(mousePosition);
|
||||
}
|
||||
return _mulliganView.MulliganInfo.IsLeavingKeepZone(mousePosition);
|
||||
}
|
||||
|
||||
private bool IsWantToPutDownCard()
|
||||
{
|
||||
if (BattleManagerBase.UseCustomMouse)
|
||||
{
|
||||
if (!_inputManager.IsUp() && !_inputManager.IsDoubleClick())
|
||||
{
|
||||
return _inputManager.IsClick();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!_inputManager.IsUp())
|
||||
{
|
||||
return _inputManager.IsNone();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool CanMoveCard()
|
||||
{
|
||||
if (BattleManagerBase.UseCustomMouse)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return _inputManager.IsPress();
|
||||
}
|
||||
|
||||
protected virtual VfxBase ChangeCardSide()
|
||||
{
|
||||
_state = STATE.EXIT;
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
BattleCardBase touchingCard = _touchingCard;
|
||||
_touchingCard = null;
|
||||
bool num = _playerMulliganCtrl.AbandonList.Contains(touchingCard);
|
||||
int num2 = PlayerFirstDrawCards.IndexOf(touchingCard);
|
||||
_mulliganView.MulliganInfo.SetExchangeMarkPlayer(num2, on: false);
|
||||
if (!num)
|
||||
{
|
||||
sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, num2, isAbandon: true));
|
||||
_playerMulliganCtrl.RegisterAbandonCard(touchingCard);
|
||||
}
|
||||
else
|
||||
{
|
||||
sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, num2, isAbandon: false));
|
||||
_playerMulliganCtrl.TakeOutAbandonCard(touchingCard);
|
||||
}
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
protected virtual void SetCardDragable()
|
||||
{
|
||||
int index = PlayerFirstDrawCards.IndexOf(_touchingCard);
|
||||
_mulliganView.MulliganInfo.SetExchangeMarkPlayer(index, on: false);
|
||||
_mulliganView.DragCardStart(_touchingCard);
|
||||
_mulliganView.ShutDownCardDetail();
|
||||
}
|
||||
|
||||
private bool UseChangeShortcut()
|
||||
{
|
||||
return OptionSettingWindow.ShortcutPlay switch
|
||||
{
|
||||
OptionSettingWindow.Shortcut.RightClick => Input.GetMouseButtonDown(1),
|
||||
OptionSettingWindow.Shortcut.MiddleClick => Input.GetMouseButtonDown(2),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
private bool UseChangeShortcutDoubleClick()
|
||||
{
|
||||
if (OptionSettingWindow.ShortcutPlay == OptionSettingWindow.Shortcut.DoubleClick)
|
||||
{
|
||||
return _inputManager.IsDoubleClick();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool UseDetailShortcut()
|
||||
{
|
||||
return OptionSettingWindow.ShortcutDetailPanel switch
|
||||
{
|
||||
OptionSettingWindow.ShortcutDetail.RightClick => Input.GetMouseButtonDown(1),
|
||||
OptionSettingWindow.ShortcutDetail.MiddleClick => Input.GetMouseButtonDown(2),
|
||||
OptionSettingWindow.ShortcutDetail.LongPress => _inputManager.IsLongPress(),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
private bool UseDetailShortcutDoubleClick()
|
||||
{
|
||||
if (OptionSettingWindow.ShortcutDetailPanel == OptionSettingWindow.ShortcutDetail.DoubleClick)
|
||||
{
|
||||
return _inputManager.IsDoubleClick();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public class NetworkMulliganMgr : MulliganMgrBase
|
||||
{
|
||||
private readonly NetworkBattleManagerBase _networkBattleManager;
|
||||
|
||||
private readonly NetworkBattleSender _networkBattleSender;
|
||||
|
||||
public NetworkMulliganMgr(NetworkBattleSender sender)
|
||||
{
|
||||
_networkBattleSender = sender;
|
||||
_networkBattleManager = BattleManagerBase.GetIns() as NetworkBattleManagerBase;
|
||||
}
|
||||
|
||||
public override VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view)
|
||||
{
|
||||
base.PlayerMlgCtrl = new NetworkPlayerMulliganCtrl(BattleManagerBase.GetIns().BattlePlayer, mulliganInfo, view);
|
||||
_opponentMulliganControl = new NetworkOpponentMulliganCtrl(BattleManagerBase.GetIns().BattleEnemy, mulliganInfo, isUseExchangeMark: false);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor)
|
||||
{
|
||||
if (_networkBattleManager.OperateReceive.DealVfx != null)
|
||||
{
|
||||
return _networkBattleManager.OperateReceive.DealVfx;
|
||||
}
|
||||
_networkBattleSender.SendDeal();
|
||||
return InstantVfx.Create(StartTimeout);
|
||||
}
|
||||
|
||||
public override VfxBase Submit(BattleManagerBase m_BtlMgrIns)
|
||||
{
|
||||
List<int> swapIndexList = base.PlayerMlgCtrl.AbandonList.Select((BattleCardBase x) => x.Index).ToList();
|
||||
_networkBattleSender.SendSwapInfo(swapIndexList);
|
||||
StartTimeout();
|
||||
return base.Submit(m_BtlMgrIns);
|
||||
}
|
||||
|
||||
public void SetPlayerHandCardIndexList(List<int> list)
|
||||
{
|
||||
base.PlayerMlgCtrl.SetMulliganAfterCardIndexList(list);
|
||||
}
|
||||
|
||||
public void SetOpponentMulliganAfterCardIndexList(List<int> list)
|
||||
{
|
||||
_opponentMulliganControl.SetMulliganAfterCardIndexList(list);
|
||||
}
|
||||
|
||||
public override VfxBase PlayerChangeCardVfx(BattleManagerBase btlMgrIns)
|
||||
{
|
||||
StopTimeout();
|
||||
if (!btlMgrIns.IsRecovery)
|
||||
{
|
||||
return base.PlayerChangeCardVfx(btlMgrIns);
|
||||
}
|
||||
List<BattleCardBase> retCardList = null;
|
||||
List<int> retPosList = null;
|
||||
base.PlayerMlgCtrl.GetAbandonCardList(btlMgrIns, ref retCardList, ref retPosList);
|
||||
btlMgrIns.BattlePlayer.CallRecordingMulligan(retCardList, new int[0]);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.PlayerMlgCtrl.SubmitMulliganVfx(retCardList));
|
||||
btlMgrIns.BattlePlayer.CallRecordingMulliganEnd(btlMgrIns.BattlePlayer.HandCardList);
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns)
|
||||
{
|
||||
List<BattleCardBase> retCardList = null;
|
||||
List<int> retPosList = null;
|
||||
_opponentMulliganControl.GetAbandonCardList(btlMgrIns, ref retCardList, ref retPosList);
|
||||
_opponentMulliganControl.DrawFirstMulliganCard();
|
||||
btlMgrIns.BattleEnemy.CallRecordingMulligan(retCardList, _opponentMulliganControl.GetMulliganAfterCardIndexList());
|
||||
btlMgrIns.BattleEnemy.CallRecordingMulliganEnd(_opponentMulliganControl.GetMulliganAfterCardIndexList());
|
||||
return _opponentMulliganControl.SubmitMulliganVfx(retCardList);
|
||||
}
|
||||
|
||||
public override VfxBase CompleteMulligan(BattleManagerBase battleMgr)
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("CompleteMulligan");
|
||||
VfxBase vfx = base.CompleteMulligan(battleMgr);
|
||||
battleMgr.TouchControl.ResetDetail();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
sequentialVfxPlayer.Register(battleMgr.StartBattle());
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase RecoverMulligan(bool didPlayerSubmitMulligan, BattleManagerBase battleMgr)
|
||||
{
|
||||
if (!didPlayerSubmitMulligan)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
MulliganInfoControl mulliganInfo = GetMulliganInfo();
|
||||
List<BattleCardBase> firstDrawList = base.PlayerMlgCtrl.GetFirstDrawList();
|
||||
List<BattleCardBase> stockList = base.PlayerMlgCtrl.GetStockList();
|
||||
base.OnSubmit.Call();
|
||||
mulliganInfo.HideButtons();
|
||||
if (stockList.Count < 3)
|
||||
{
|
||||
mulliganInfo.GetAbandonZonePlayer().alpha = 0f;
|
||||
}
|
||||
List<BattleCardBase> list = new List<BattleCardBase>();
|
||||
List<BattleCardBase> handCardList = base.PlayerMlgCtrl.GetBattlePlayer().HandCardList;
|
||||
for (int i = 0; i < handCardList.Count; i++)
|
||||
{
|
||||
if (firstDrawList[i] != handCardList[i])
|
||||
{
|
||||
BattleCardBase battleCardBase = firstDrawList[i];
|
||||
battleCardBase.BattleCardView.GameObject.SetActive(value: false);
|
||||
battleCardBase.BattleCardView.Transform.SetParent(battleMgr.CardHolder.transform);
|
||||
battleCardBase.BattleCardView.Transform.position = battleMgr.CardHolder.transform.position;
|
||||
list.Add(handCardList[i]);
|
||||
}
|
||||
IBattleCardView battleCardView = handCardList[i].BattleCardView;
|
||||
battleCardView.Transform.SetParent(mulliganInfo.GetKeepZonePlayer().gameObject.transform);
|
||||
battleCardView.Transform.localPosition = mulliganInfo.GetMulliganZoneCardPos(i, isAbandon: false, handCardList[i].IsPlayer);
|
||||
battleCardView.Transform.localScale = mulliganInfo.GetMulliganZoneCardScale();
|
||||
battleCardView.Transform.localRotation = Quaternion.Euler(MulliganViewBase.CARD_ROTATION);
|
||||
battleCardView.GameObject.SetActive(value: true);
|
||||
}
|
||||
DummyDeckRemoveCardVfx dummyDeckRemoveCardVfx = new DummyDeckRemoveCardVfx(isPlayer: true, 3);
|
||||
return ParallelVfxPlayer.Create(dummyDeckRemoveCardVfx, _networkBattleManager.LoadCardResources(list));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public class OpponentMulliganView : MulliganViewBase
|
||||
{
|
||||
private bool _isUseExchangeMark;
|
||||
|
||||
public OpponentMulliganView(MulliganInfoControl mulliganInfo, bool isUseExchangeMark)
|
||||
: base(mulliganInfo)
|
||||
{
|
||||
_isUseExchangeMark = isUseExchangeMark;
|
||||
}
|
||||
|
||||
public override SequentialVfxPlayer MoveCardToStaticPosition(BattleCardBase card, int posIndex, bool isAbandon)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = base.MoveCardToStaticPosition(card, posIndex, isAbandon);
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
card.SetOnMove(move: false);
|
||||
if (_isUseExchangeMark && isAbandon)
|
||||
{
|
||||
m_MlgUI.SetExchangeMarkOpponent(posIndex, on: true);
|
||||
}
|
||||
}));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
protected override GameObject GetMulliganUIKeepZone()
|
||||
{
|
||||
return m_MlgUI.GetKeepZoneOpponent().gameObject;
|
||||
}
|
||||
|
||||
protected override GameObject GetMulliganUIAbandonZone()
|
||||
{
|
||||
return m_MlgUI.GetAbandonZoneOpponent().gameObject;
|
||||
}
|
||||
|
||||
public override void HideMulliganUIAbandonZone()
|
||||
{
|
||||
m_MlgUI.HideMulliganOpponentChangeUI();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public class PlayerMulliganCardSortOutVfx : SequentialVfxPlayer
|
||||
{
|
||||
public PlayerMulliganCardSortOutVfx(GameObject keepZone, IList<BattleCardBase> firstDraws, MulliganInfoControl mulliganUI)
|
||||
{
|
||||
Register(ShiftParentVfx(keepZone, firstDraws));
|
||||
Register(SortOutCardVfx(keepZone, firstDraws, mulliganUI));
|
||||
}
|
||||
|
||||
private VfxBase ShiftParentVfx(GameObject keepZone, IList<BattleCardBase> firstDraws)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
int count = firstDraws.Count;
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GameObject gameObject = firstDraws[i].BattleCardView.GameObject;
|
||||
gameObject.SetActive(value: false);
|
||||
gameObject.transform.parent = keepZone.transform;
|
||||
MotionUtils.SetLayerAll(gameObject, 10);
|
||||
gameObject.SetActive(value: true);
|
||||
}
|
||||
}));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
private VfxBase SortOutCardVfx(GameObject keepZone, IList<BattleCardBase> firstDraws, MulliganInfoControl mulliganUI)
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("SortOutCardVfx");
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
int count = firstDraws.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
parallelVfxPlayer.Register(MulliganViewBase.MoveCardToMulliganZone(firstDraws[i], keepZone, i, mulliganUI, isAbandon: false));
|
||||
}
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HAND_MOVE_RIGHT);
|
||||
}));
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Mulligan;
|
||||
|
||||
public class SingleMulliganMgr : MulliganMgrBase
|
||||
{
|
||||
public override VfxBase Submit(BattleManagerBase battleManager)
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.Submit(battleManager));
|
||||
if (GameMgr.GetIns().IsAINetwork && !battleManager.IsRecovery)
|
||||
{
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
parallelVfxPlayer.Register(PlayerChangeCardVfx(battleManager));
|
||||
parallelVfxPlayer.Register(EnemyChangeCardVfx(battleManager));
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
sequentialVfxPlayer.Register(CompleteMulligan(battleManager));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view)
|
||||
{
|
||||
VfxBase result = base.InitMulligan(mulliganInfo, view);
|
||||
if (GameMgr.GetIns().IsAINetwork && !BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
((AINetworkBattleManager)BattleManagerBase.GetIns()).SetupMulliganLaunchCompleteEvent();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void AIMulliganEndAction()
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(PlayerChangeCardVfx(ins));
|
||||
parallelVfxPlayer.Register(EnemyChangeCardVfx(ins));
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
sequentialVfxPlayer.Register(CompleteMulligan(ins));
|
||||
ins.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer);
|
||||
}
|
||||
|
||||
public override VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns)
|
||||
{
|
||||
List<BattleCardBase> list = new List<BattleCardBase>();
|
||||
btlMgrIns.EnemyAI.Mulligan(list, btlMgrIns.BattleEnemy, btlMgrIns.BattlePlayer);
|
||||
VfxBase result = _opponentMulliganControl.SubmitMulliganVfx(list);
|
||||
btlMgrIns.BattleEnemy.CallRecordingMulligan(list, btlMgrIns.BattleEnemy.HandCardList.Select((BattleCardBase c) => c.Index).ToList());
|
||||
return result;
|
||||
}
|
||||
|
||||
public override VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.MulliganStartDraw(firstAttack, skillProcessor));
|
||||
_opponentMulliganControl.GetBattlePlayer().DrawCards(_opponentMulliganControl.GetFirstDrawList(), skillProcessor, isOpen: false, isMulligan: true);
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase CompleteMulligan(BattleManagerBase battleMgr)
|
||||
{
|
||||
VfxBase vfx = base.CompleteMulligan(battleMgr);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
sequentialVfxPlayer.Register(battleMgr.StartBattle());
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user