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,888 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard.DeckCardEdit;
|
||||
|
||||
public abstract class CardSelectListUIBase : MecanimSceneBase
|
||||
{
|
||||
private enum SlideType
|
||||
{
|
||||
None,
|
||||
Next,
|
||||
Prev
|
||||
}
|
||||
|
||||
public const int CARD_PER_PAGE_IN_SELECTION_AREA = 10;
|
||||
|
||||
public const int CARD_PER_PAGE = 8;
|
||||
|
||||
public const float CARD_WIDTH = 120f;
|
||||
|
||||
private const float DRAG_DEGREE = 70f;
|
||||
|
||||
public const float SELECTION_AREA_CARD_SCALE = 0.5f;
|
||||
|
||||
public const float PAGE_CARD_SCALE = 0.6f;
|
||||
|
||||
[SerializeField]
|
||||
protected MecanimStateBase _stateDefaultView;
|
||||
|
||||
[SerializeField]
|
||||
protected CardSelectListUI_State_Edit _stateEdit;
|
||||
|
||||
[SerializeField]
|
||||
protected CardSelectListUI_State_CardDrag _stateCardDrag;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_nextPageBtn;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_prevPageBtn;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite m_nextPageBtnGrayout;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite m_prevPageBtnGrayout;
|
||||
|
||||
private SlideType _slideType;
|
||||
|
||||
private bool _isSlideEnd = true;
|
||||
|
||||
public Action<bool> OnChangeSlideEnd;
|
||||
|
||||
protected CardBundleControllerBase _cardBundle;
|
||||
|
||||
[SerializeField]
|
||||
protected Transform _parentSelectionObj;
|
||||
|
||||
[SerializeField]
|
||||
protected Transform m_parentPagingObj;
|
||||
|
||||
[SerializeField]
|
||||
protected SimpleCardDetail m_simpleDetailPrefab;
|
||||
|
||||
protected SimpleCardDetail _simpleDetail;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel m_labelPageInfo;
|
||||
|
||||
[SerializeField]
|
||||
protected UITexture m_sleeveOriginal;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject m_cardInfoOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _hideFilter;
|
||||
|
||||
[SerializeField]
|
||||
private FilterController _prefabFilter;
|
||||
|
||||
protected FilterController _selectCardFilter;
|
||||
|
||||
protected FilterController _pagingFilter;
|
||||
|
||||
[SerializeField]
|
||||
protected UIInputWizard m_searchInput;
|
||||
|
||||
[SerializeField]
|
||||
protected UIButton m_searchCancelButton;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel m_noEditCardLabel;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject m_PagingDragPanel;
|
||||
|
||||
[SerializeField]
|
||||
protected UILabel _redetherNum;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView _scrollView;
|
||||
|
||||
private bool _isLoading;
|
||||
|
||||
protected bool _isDisableTouchWhileLoading;
|
||||
|
||||
protected List<string> _resourcePathList;
|
||||
|
||||
protected bool _enableSelectSameKindCardNum = true;
|
||||
|
||||
protected bool _isSelectableSpotCard;
|
||||
|
||||
private GameObject _detailTargetObj;
|
||||
|
||||
private MyRotationInfo _myRotationInfoBeforeInitialize;
|
||||
|
||||
private FilterController.MyRotationFilterType _filterType = FilterController.MyRotationFilterType.CARD_POOL_SELECT_ONLY;
|
||||
|
||||
private MyRotationInfo _myRotationInfo;
|
||||
|
||||
protected bool IsSlideEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSlideEnd;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _isSlideEnd)
|
||||
{
|
||||
_isSlideEnd = value;
|
||||
OnChangeSlideEnd.Call(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FilteringCardBundle SelectionAreaList => _cardBundle.SelectionAreaList;
|
||||
|
||||
public CardBundle PagingList => _cardBundle.PagingList;
|
||||
|
||||
public bool IsSetup { get; protected set; }
|
||||
|
||||
public Format Format { get; protected set; }
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isLoading;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
if (_isLoading = value && !IsSetup)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading(notBlack: true, !_isDisableTouchWhileLoading);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSliding => _slideType != SlideType.None;
|
||||
|
||||
protected bool IsShowCardDetailCraftPanel { get; set; } = true;
|
||||
|
||||
public IFormatBehavior FormatBehavior { get; private set; }
|
||||
|
||||
protected FilterController.MyRotationFilterType MyRotationFilterTypeCardPool
|
||||
{
|
||||
get
|
||||
{
|
||||
return _filterType;
|
||||
}
|
||||
set
|
||||
{
|
||||
_filterType = value;
|
||||
_stateCardDrag.SetMyRotationInfo(_myRotationInfo, MyRotationFilterTypeCardPool);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract bool IsEnableSwipeAutoSameBasicCardAdd();
|
||||
|
||||
protected void InitializeBase(Format format, ConventionDeckList conventionDeckList)
|
||||
{
|
||||
FormatBehavior = FormatBehaviorManager.Create(format, conventionDeckList);
|
||||
}
|
||||
|
||||
protected void SetMyRotationData(MyRotationInfo myRotationInfo)
|
||||
{
|
||||
_myRotationInfo = myRotationInfo;
|
||||
_stateCardDrag.SetMyRotationInfo(myRotationInfo, MyRotationFilterTypeCardPool);
|
||||
if (_selectCardFilter != null && _pagingFilter != null && _cardBundle != null)
|
||||
{
|
||||
_selectCardFilter.SetMyRotationData(myRotationInfo, FilterController.MyRotationFilterType.DECK, MyRotationFilterTypeCardPool == FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK);
|
||||
_pagingFilter.SetMyRotationData(myRotationInfo, MyRotationFilterTypeCardPool, isAllBackVisible: false);
|
||||
_isDisableTouchWhileLoading = true;
|
||||
FetchPagingCard();
|
||||
_cardBundle.UpdateMyRotationInfo(myRotationInfo, MyRotationFilterTypeCardPool);
|
||||
_myRotationInfoBeforeInitialize = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_myRotationInfoBeforeInitialize = myRotationInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public override void onFirstStart()
|
||||
{
|
||||
base.IsShowFooterMenu = false;
|
||||
UIEventListener.Get(m_PagingDragPanel).onDrag = OnDragPagingCard;
|
||||
UIEventListener.Get(m_PagingDragPanel).onDragOver = OnDragOverPagingCard;
|
||||
UIEventListener.Get(m_PagingDragPanel).onScroll = OnScrollPagingCard;
|
||||
UIEventListener.Get(m_nextPageBtn.gameObject).onPress = delegate(GameObject g, bool b)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
NextPage();
|
||||
}
|
||||
};
|
||||
UIEventListener.Get(m_prevPageBtn.gameObject).onPress = delegate(GameObject g, bool b)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
PrevPage();
|
||||
}
|
||||
};
|
||||
UIEventListener uIEventListener = UIEventListener.Get(m_nextPageBtn.gameObject);
|
||||
uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, (UIEventListener.VectorDelegate)delegate
|
||||
{
|
||||
if (IsSlideEnd)
|
||||
{
|
||||
m_nextPageBtn.state = UIButtonColor.State.Normal;
|
||||
}
|
||||
});
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(m_prevPageBtn.gameObject);
|
||||
uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, (UIEventListener.VectorDelegate)delegate
|
||||
{
|
||||
if (IsSlideEnd)
|
||||
{
|
||||
m_prevPageBtn.state = UIButtonColor.State.Normal;
|
||||
}
|
||||
});
|
||||
_simpleDetail = UnityEngine.Object.Instantiate(m_simpleDetailPrefab);
|
||||
_simpleDetail.transform.parent = base.transform;
|
||||
_simpleDetail.transform.localPosition = Vector3.zero;
|
||||
_simpleDetail.transform.localScale = Vector3.one;
|
||||
_simpleDetail.OnClickCloseButton += HideDetail;
|
||||
_simpleDetail.OnClickCreateButton += OnCreate;
|
||||
_simpleDetail.OnClickLiquefyButton += OnLiquefy;
|
||||
_cardBundle.OnClickSelectionAreaCard += OnClickSelectionAreaCard;
|
||||
_cardBundle.OnClickPagingCard += OnClickPagingCard;
|
||||
_cardBundle.OnDragPagingCard += OnDragPagingCard;
|
||||
_cardBundle.OnScrollPagingCard += OnScrollPagingCard;
|
||||
_cardBundle.OnDragOverPagingCard += OnDragOverPagingCard;
|
||||
_cardBundle.OnCreatePagingSleeve += OnCreatePagingSleeve;
|
||||
_cardBundle.OnCreatePagingCard += OnCreatePagingCard;
|
||||
Action onInputSearchText = delegate
|
||||
{
|
||||
if (!_isDisableTouchWhileLoading)
|
||||
{
|
||||
SearchApplyOwn(m_searchInput.value);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
}
|
||||
};
|
||||
m_searchInput.onSubmit.Add(new EventDelegate(delegate
|
||||
{
|
||||
if (onInputSearchText != null)
|
||||
{
|
||||
onInputSearchText();
|
||||
}
|
||||
}));
|
||||
m_searchInput.onDeselect.Add(new EventDelegate(delegate
|
||||
{
|
||||
onInputSearchText();
|
||||
}));
|
||||
base.onFirstStart();
|
||||
}
|
||||
|
||||
protected override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
UIManager.GetInstance().ShowFooterMenu(isShow: false);
|
||||
_selectCardFilter = UnityEngine.Object.Instantiate(_prefabFilter);
|
||||
_pagingFilter = UnityEngine.Object.Instantiate(_prefabFilter);
|
||||
_selectCardFilter.Initialize(FormatBehavior);
|
||||
_pagingFilter.Initialize(FormatBehavior);
|
||||
if (_myRotationInfoBeforeInitialize != null)
|
||||
{
|
||||
_selectCardFilter.SetMyRotationData(_myRotationInfoBeforeInitialize, FilterController.MyRotationFilterType.DECK, isAllBackVisible: false);
|
||||
_pagingFilter.SetMyRotationData(_myRotationInfoBeforeInitialize, MyRotationFilterTypeCardPool, isAllBackVisible: false);
|
||||
_cardBundle.UpdateMyRotationInfo(_myRotationInfoBeforeInitialize, MyRotationFilterTypeCardPool);
|
||||
}
|
||||
_selectCardFilter.Hide();
|
||||
_pagingFilter.Hide();
|
||||
RegistFilterEvent();
|
||||
GameMgr.GetIns().GetGameObjMgr().GetUIContainer()
|
||||
.SetActive(value: false);
|
||||
_stateEdit.ResetScroll();
|
||||
m_searchInput.value = "";
|
||||
m_searchCancelButton.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void RegistFilterEvent()
|
||||
{
|
||||
_selectCardFilter.OnValidate += OnValidateSelectionAreaFilter;
|
||||
_pagingFilter.OnValidate += OnValidatePagingFilter;
|
||||
}
|
||||
|
||||
private void ClearFilterEvent()
|
||||
{
|
||||
_selectCardFilter.OnValidate -= OnValidateSelectionAreaFilter;
|
||||
_pagingFilter.OnValidate -= OnValidatePagingFilter;
|
||||
}
|
||||
|
||||
protected List<string> GetEffectAssetPathList()
|
||||
{
|
||||
return new List<string>
|
||||
{
|
||||
Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D),
|
||||
Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D),
|
||||
Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D)
|
||||
};
|
||||
}
|
||||
|
||||
protected void SetupEffect(Action callback)
|
||||
{
|
||||
List<GameObject> effectObjList = new List<GameObject>
|
||||
{
|
||||
Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)),
|
||||
Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)),
|
||||
Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true))
|
||||
};
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectObjList, callback);
|
||||
}
|
||||
|
||||
protected void SetupState()
|
||||
{
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: true);
|
||||
_stateEdit.RefreshPage(isImmediate: true);
|
||||
}
|
||||
|
||||
protected void SetupSimpleDetail()
|
||||
{
|
||||
if (FormatBehavior.IsConventionMode)
|
||||
{
|
||||
_simpleDetail.ActiveCraftPanel(isActive: false);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void onClose()
|
||||
{
|
||||
_cardBundle.DisableNewFlagDisplayedCards();
|
||||
_cardBundle.Destroy();
|
||||
_stateCardDrag.DestroyDragCard();
|
||||
UnityEngine.Object.Destroy(_selectCardFilter.gameObject);
|
||||
UnityEngine.Object.Destroy(_pagingFilter.gameObject);
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(Toolbox.ResourcesManager.Card2DAssetPathList);
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_resourcePathList);
|
||||
Toolbox.ResourcesManager.CardListAssetPathList.Clear();
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: true);
|
||||
_stateEdit.RefreshPage(isImmediate: true);
|
||||
MyPageMenu.SetEnableReloadCard();
|
||||
UIDrawCall.ReleaseInactive();
|
||||
base.onClose();
|
||||
}
|
||||
|
||||
public override void onMove()
|
||||
{
|
||||
if (_cardBundle != null)
|
||||
{
|
||||
_cardBundle.Tick();
|
||||
base.onMove();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnFinishFadeIn()
|
||||
{
|
||||
ChangeState(_stateDefaultView, skipCloseAnim: true);
|
||||
ClearFilterEvent();
|
||||
_selectCardFilter.Reset();
|
||||
_pagingFilter.Reset();
|
||||
RegistFilterEvent();
|
||||
IsSetup = false;
|
||||
}
|
||||
|
||||
public bool LoadPagingCard(int page)
|
||||
{
|
||||
IsLoading = true;
|
||||
HideDetail();
|
||||
return _cardBundle.LoadPagingCard(page, isDestroyImmediate: true);
|
||||
}
|
||||
|
||||
public void FetchPagingCard()
|
||||
{
|
||||
IsLoading = true;
|
||||
HideDetail();
|
||||
_cardBundle.FetchPagingCard();
|
||||
}
|
||||
|
||||
public void NextPage()
|
||||
{
|
||||
if (!IsLoading && m_state != _stateCardDrag && !m_searchInput.isSelected && _cardBundle.CurrentPage + 1 <= _cardBundle.MaxPage)
|
||||
{
|
||||
if (m_searchInput.ClearIMEOnlyOSX())
|
||||
{
|
||||
SearchApplyOwn(m_searchInput.value);
|
||||
return;
|
||||
}
|
||||
IsSlideEnd = false;
|
||||
_slideType = SlideType.Next;
|
||||
IsLoading = true;
|
||||
PagingBase(_stateEdit.NextPage, _cardBundle.CurrentPage + 1, NextPage);
|
||||
}
|
||||
else if (IsLoading)
|
||||
{
|
||||
if (_slideType == SlideType.Prev)
|
||||
{
|
||||
IsSlideEnd = true;
|
||||
m_nextPageBtn.state = UIButtonColor.State.Normal;
|
||||
}
|
||||
}
|
||||
else if (m_searchInput.isSelected)
|
||||
{
|
||||
if (m_searchInput.ClearIMEOnlyOSX())
|
||||
{
|
||||
SearchApplyOwn(m_searchInput.value);
|
||||
}
|
||||
m_searchInput.ClearFocusOnlyOSX();
|
||||
}
|
||||
}
|
||||
|
||||
public void PrevPage()
|
||||
{
|
||||
if (!IsLoading && m_state != _stateCardDrag && !m_searchInput.isSelected && _cardBundle.CurrentPage - 1 >= 0)
|
||||
{
|
||||
if (m_searchInput.ClearIMEOnlyOSX())
|
||||
{
|
||||
SearchApplyOwn(m_searchInput.value);
|
||||
return;
|
||||
}
|
||||
IsSlideEnd = false;
|
||||
_slideType = SlideType.Prev;
|
||||
IsLoading = true;
|
||||
PagingBase(_stateEdit.PrevPage, _cardBundle.CurrentPage - 1, PrevPage);
|
||||
}
|
||||
else if (IsLoading)
|
||||
{
|
||||
if (_slideType == SlideType.Next)
|
||||
{
|
||||
IsSlideEnd = true;
|
||||
m_prevPageBtn.state = UIButtonColor.State.Normal;
|
||||
}
|
||||
}
|
||||
else if (m_searchInput.isSelected)
|
||||
{
|
||||
if (m_searchInput.ClearIMEOnlyOSX())
|
||||
{
|
||||
SearchApplyOwn(m_searchInput.value);
|
||||
}
|
||||
m_searchInput.ClearFocusOnlyOSX();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBtnPushSeachCancelOwn()
|
||||
{
|
||||
if (!IsLoading)
|
||||
{
|
||||
SearchApplyOwn("");
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
private void PagingBase(Action<Action> anim, int page, Action next)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT);
|
||||
GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_CARDLIST_REVERSE);
|
||||
anim.Call(delegate
|
||||
{
|
||||
if (LoadPagingCard(page))
|
||||
{
|
||||
Action replay = null;
|
||||
replay = delegate
|
||||
{
|
||||
_cardBundle.OnCreatePagingCard -= replay;
|
||||
if (Input.GetMouseButton(0) && !IsSlideEnd && (m_nextPageBtn.state == UIButtonColor.State.Pressed || m_prevPageBtn.state == UIButtonColor.State.Pressed))
|
||||
{
|
||||
next();
|
||||
}
|
||||
else
|
||||
{
|
||||
_slideType = SlideType.None;
|
||||
IsSlideEnd = true;
|
||||
}
|
||||
};
|
||||
_cardBundle.OnCreatePagingCard += replay;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public virtual int InsertToSelectionArea(CardObject card)
|
||||
{
|
||||
int num = _cardBundle.InsertToSelectionArea(card);
|
||||
CardObject cardObject = SelectionAreaList.FindWithIndex(num);
|
||||
if (cardObject != null && SelectionAreaList.CountKind > 10)
|
||||
{
|
||||
int num2 = Mathf.Clamp(num, 5, SelectionAreaList.CountKind - 5);
|
||||
if (cardObject.TotalCardNum == 1 && num > 0)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
_stateEdit.CenterOn(num2);
|
||||
}
|
||||
if (_scrollView != null)
|
||||
{
|
||||
_scrollView.customMovement = ((SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public virtual int RemoveFromSelectionArea(CardObject card)
|
||||
{
|
||||
int result = _cardBundle.RemoveFromSelectionArea(card);
|
||||
_stateEdit.Fit();
|
||||
if (_scrollView != null)
|
||||
{
|
||||
_scrollView.customMovement = ((SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool IsMaxCardNumInSelectionArea(int cardId)
|
||||
{
|
||||
if (!_enableSelectSameKindCardNum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int num = GetSameKindNumMaxInFormat(cardId);
|
||||
if (_myRotationInfo != null)
|
||||
{
|
||||
num = _myRotationInfo.GetSameCardCount(CardMaster.GetInstance(FormatBehavior.CardMasterId).GetCardParameterFromId(cardId).BaseCardId);
|
||||
}
|
||||
if (_cardBundle.CountCardNumInSelectionArea(cardId, isStrictSameCard: false) >= num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual int GetSameKindNumMaxInFormat(int cardId)
|
||||
{
|
||||
return FormatBehavior.DeckSameKindCardNumMax;
|
||||
}
|
||||
|
||||
public bool IsExistCardCardPool(int cardId)
|
||||
{
|
||||
if (IsMaxCardNumInSelectionArea(cardId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int num = SelectionAreaList.CardList.Where((CardObject c) => c.CardId == cardId).Sum((CardObject c) => c.TotalCardNum);
|
||||
return FormatBehavior.GetPossessionCardNum(cardId, _isSelectableSpotCard) > num;
|
||||
}
|
||||
|
||||
public bool IsAddableByBaseCardId(int cardId, out int addCardId)
|
||||
{
|
||||
if (IsMaxCardNumInSelectionArea(cardId))
|
||||
{
|
||||
addCardId = 0;
|
||||
return false;
|
||||
}
|
||||
CardMaster instance = CardMaster.GetInstance(FormatBehavior.CardMasterId);
|
||||
List<int> list = new List<int>();
|
||||
foreach (int item in instance.GetSameCardListByBaseCardId(instance.GetCardParameterFromId(cardId).BaseCardId))
|
||||
{
|
||||
if (FormatBehavior.SortedDeckUsableCardList.Contains(item))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
IOrderedEnumerable<int> orderedEnumerable = list.OrderBy((int id) => -id);
|
||||
CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardId);
|
||||
foreach (int item2 in list)
|
||||
{
|
||||
if (instance.GetCardParameterFromId(item2).NormalCardId == cardParameterFromId.NormalCardId && IsExistCardCardPool(item2))
|
||||
{
|
||||
addCardId = item2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
foreach (int item3 in orderedEnumerable)
|
||||
{
|
||||
if (instance.GetCardParameterFromId(item3).IsFoil == cardParameterFromId.IsFoil && IsExistCardCardPool(item3))
|
||||
{
|
||||
addCardId = item3;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
foreach (int item4 in orderedEnumerable)
|
||||
{
|
||||
if (IsExistCardCardPool(item4))
|
||||
{
|
||||
addCardId = item4;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (_cardBundle.CanUseNonPossessionCard)
|
||||
{
|
||||
if (instance.GetCardParameterFromId(cardId).CanCraft)
|
||||
{
|
||||
addCardId = cardId;
|
||||
return true;
|
||||
}
|
||||
foreach (int item5 in list)
|
||||
{
|
||||
if (instance.GetCardParameterFromId(item5).CanCraft)
|
||||
{
|
||||
addCardId = item5;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
addCardId = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsRemainingAddableCardToSelectionArea(int cardId)
|
||||
{
|
||||
if (IsMaxCardNumInSelectionArea(cardId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(FormatBehavior.CardMasterId).GetCardParameterFromId(cardId);
|
||||
if (_cardBundle.CanUseNonPossessionCard && DeckCardEditUI.IsSelectableNonPossessionCard(cardParameterFromId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int num = SelectionAreaList.CardList.Where((CardObject c) => c.CardId == cardId).Sum((CardObject c) => c.TotalCardNum);
|
||||
return FormatBehavior.GetPossessionCardNum(cardId, _isSelectableSpotCard) > num;
|
||||
}
|
||||
|
||||
private void ShowDetail(GameObject obj, int id, bool isSelectionArea)
|
||||
{
|
||||
if (!IsLoading && !UIManager.GetInstance().isOpenDialog())
|
||||
{
|
||||
SelectCard(obj, isSelectionArea);
|
||||
_simpleDetail.ChangeDetail(id, FormatBehavior.CardMasterId, _myRotationInfo);
|
||||
_simpleDetail.ActiveCraftPanel(!isSelectionArea && IsShowCardDetailCraftPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public void HideDetail()
|
||||
{
|
||||
SelectCard(null, isSelectionArea: false);
|
||||
_simpleDetail.HideDetail();
|
||||
}
|
||||
|
||||
private void SelectCard(GameObject obj, bool isSelectionArea)
|
||||
{
|
||||
Se.TYPE setype = Se.TYPE.NONE;
|
||||
CardObject cardObject = SelectionAreaList.FindWithObject(_detailTargetObj);
|
||||
if (cardObject == null)
|
||||
{
|
||||
cardObject = PagingList.FindWithObject(_detailTargetObj);
|
||||
}
|
||||
if (cardObject != null && cardObject.IsVisibleCursorEffect)
|
||||
{
|
||||
cardObject.ChangeSelectingState(isSelect: false);
|
||||
setype = Se.TYPE.SYS_CARD_INFO_CANCEL;
|
||||
}
|
||||
CardObject cardObject2 = (isSelectionArea ? SelectionAreaList.FindWithObject(obj) : PagingList.FindWithObject(obj));
|
||||
if (cardObject2 != null)
|
||||
{
|
||||
cardObject2.ChangeSelectingState(isSelect: true);
|
||||
setype = Se.TYPE.SYS_CARD_INFO_SMALL;
|
||||
}
|
||||
_detailTargetObj = obj;
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(setype);
|
||||
}
|
||||
|
||||
protected virtual void AccordCardInfo()
|
||||
{
|
||||
_cardBundle.AccordCardInfo();
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: false);
|
||||
}
|
||||
|
||||
private void SearchApplyOwn(string word)
|
||||
{
|
||||
SetSearchKeyword(word);
|
||||
_isDisableTouchWhileLoading = true;
|
||||
FetchPagingCard();
|
||||
}
|
||||
|
||||
private void SetSearchKeyword(string word)
|
||||
{
|
||||
if (!(_cardBundle.FilterParameter.Word == word))
|
||||
{
|
||||
m_searchInput.RemoveFocus();
|
||||
m_searchCancelButton.gameObject.SetActive(word.Length > 0);
|
||||
UIBase_CardManager.FilterParameter filterParameter = _cardBundle.FilterParameter;
|
||||
string word2 = (m_searchInput.value = word);
|
||||
filterParameter.Word = word2;
|
||||
_cardBundle.FilterParameter = filterParameter;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowFilterMenu(FilterController filter, string title)
|
||||
{
|
||||
HideDetail();
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.XL);
|
||||
dialogBase.SetTitleLabel(title);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetObj(filter.gameObject);
|
||||
dialogBase.CloseOnOff(flag: false);
|
||||
filter.Show();
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
filter.Hide();
|
||||
filter.transform.parent = _hideFilter.transform;
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual void OnValidateSelectionAreaFilter()
|
||||
{
|
||||
_stateCardDrag.OnChangeSelectionAreaFilter();
|
||||
UIBase_CardManager.FilterParameter filterParameter = _selectCardFilter.GetFilterParameter(new UIBase_CardManager.FilterParameter());
|
||||
SelectionAreaList.ApplyFilter(filterParameter);
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: false);
|
||||
_stateEdit.Fit();
|
||||
}
|
||||
|
||||
protected virtual void OnValidatePagingFilter()
|
||||
{
|
||||
if (!_isDisableTouchWhileLoading)
|
||||
{
|
||||
SetSearchKeyword(m_searchInput.value);
|
||||
_cardBundle.FilterParameter = _pagingFilter.GetFilterParameter(_cardBundle.FilterParameter);
|
||||
_isDisableTouchWhileLoading = true;
|
||||
FetchPagingCard();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnCreatePagingSleeve()
|
||||
{
|
||||
m_labelPageInfo.text = Data.SystemText.Get("Card_0053", (_cardBundle.CurrentPage + 1).ToString(), (_cardBundle.MaxPage + 1).ToString());
|
||||
bool flag = _cardBundle.CurrentPage + 1 <= _cardBundle.MaxPage;
|
||||
bool flag2 = _cardBundle.CurrentPage - 1 >= 0;
|
||||
m_nextPageBtn.gameObject.SetActive(flag);
|
||||
m_prevPageBtn.gameObject.SetActive(flag2);
|
||||
m_nextPageBtnGrayout.gameObject.SetActive(!flag);
|
||||
m_prevPageBtnGrayout.gameObject.SetActive(!flag2);
|
||||
_stateEdit.RefreshPage(isImmediate: false);
|
||||
}
|
||||
|
||||
private void OnCreatePagingCard()
|
||||
{
|
||||
IsLoading = false;
|
||||
_isDisableTouchWhileLoading = false;
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: true);
|
||||
_stateEdit.RefreshPage(isImmediate: true);
|
||||
m_noEditCardLabel.gameObject.SetActive(_cardBundle.PagingList.CountKind <= 0);
|
||||
}
|
||||
|
||||
private void OnCreate()
|
||||
{
|
||||
_cardBundle.OnCreateCard(_simpleDetail.CardID);
|
||||
AccordCardInfo();
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
if (dataMgr.GetPossessionCardNum(_simpleDetail.CardID, _isSelectableSpotCard) == 1)
|
||||
{
|
||||
if (!_cardBundle.IsCraftMode)
|
||||
{
|
||||
_cardBundle.FetchPagingCard();
|
||||
}
|
||||
dataMgr.SetIsNewCard(_simpleDetail.CardID, isNew: false);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnLiquefy(int cardId)
|
||||
{
|
||||
AccordCardInfo();
|
||||
}
|
||||
|
||||
private void OnClickSelectionAreaCard(GameObject obj)
|
||||
{
|
||||
OnClickCard(obj, isSelectionArea: true, isIdCheck: true);
|
||||
}
|
||||
|
||||
private void OnClickPagingCard(GameObject obj)
|
||||
{
|
||||
OnClickCard(obj, isSelectionArea: false, isIdCheck: true);
|
||||
}
|
||||
|
||||
private void OnClickCard(GameObject obj, bool isSelectionArea, bool isIdCheck)
|
||||
{
|
||||
if (!_stateEdit.IsClick && !(m_state == _stateDefaultView))
|
||||
{
|
||||
return;
|
||||
}
|
||||
CharIdx component = obj.GetComponent<CharIdx>();
|
||||
if (component != null)
|
||||
{
|
||||
if (isIdCheck && _simpleDetail.IsVisible && _simpleDetail.CardID == component.GetCardId())
|
||||
{
|
||||
HideDetail();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDetail(obj, component.GetCardId(), isSelectionArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDragPagingCard(GameObject obj, Vector2 dir)
|
||||
{
|
||||
if (Mathf.Abs(dir.x) >= 70f)
|
||||
{
|
||||
RequestChangePage(dir.x);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScrollPagingCard(GameObject o, float factor)
|
||||
{
|
||||
RequestChangePage(factor);
|
||||
}
|
||||
|
||||
private void RequestChangePage(float dir)
|
||||
{
|
||||
if (!(m_state == _stateEdit) || _simpleDetail.IsVisible || IsLoading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (dir > 0f)
|
||||
{
|
||||
if (_cardBundle.CurrentPage > 0)
|
||||
{
|
||||
PrevPage();
|
||||
}
|
||||
}
|
||||
else if (_cardBundle.CurrentPage < _cardBundle.MaxPage)
|
||||
{
|
||||
NextPage();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDragOverPagingCard(GameObject obj)
|
||||
{
|
||||
if (_simpleDetail.IsVisible && !_simpleDetail.IsDetailPanelDragging)
|
||||
{
|
||||
OnClickCard(obj, isSelectionArea: false, isIdCheck: false);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsGetOutOfScene(Action backupExec)
|
||||
{
|
||||
if (IsLoading)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_selectCardFilter.IsShow)
|
||||
{
|
||||
_selectCardFilter.Hide();
|
||||
return false;
|
||||
}
|
||||
if (_pagingFilter.IsShow)
|
||||
{
|
||||
_pagingFilter.Hide();
|
||||
return false;
|
||||
}
|
||||
if (_simpleDetail.IsVisible)
|
||||
{
|
||||
HideDetail();
|
||||
return false;
|
||||
}
|
||||
if (m_state == _stateCardDrag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,629 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard.DeckCardEdit;
|
||||
|
||||
public class CardSelectListUI_State_CardDrag : MecanimStateBase
|
||||
{
|
||||
public enum Mode
|
||||
{
|
||||
OutToIn,
|
||||
InToOut
|
||||
}
|
||||
|
||||
private enum Area
|
||||
{
|
||||
InSelectionArea,
|
||||
OutSelectionArea,
|
||||
NoSelectionArea,
|
||||
SameCardArea
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private string m_closeStateName_Insert;
|
||||
|
||||
[SerializeField]
|
||||
private string m_closeStateName_Remove;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUIBase m_scene;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUI_State_Edit _stateEdit;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject m_parentCloneCard;
|
||||
|
||||
[SerializeField]
|
||||
private UIWidget m_parentClone_Grab;
|
||||
|
||||
[SerializeField]
|
||||
private UIWidget m_parentClone_Insert;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite m_darkMask_Grab;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite m_darkMask_Insert;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _colliderSelectionArea;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _sameCardAddCollider;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _colliderPagingArea;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject m_insertInfo;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject m_removeInfo;
|
||||
|
||||
private CardObject m_grabCardData;
|
||||
|
||||
private GameObject[] m_destroyList;
|
||||
|
||||
private Area _cursorArea;
|
||||
|
||||
private Area _lastDragArea;
|
||||
|
||||
private bool _isFlashWhenInsert = true;
|
||||
|
||||
private MyRotationInfo _myRotationInfo;
|
||||
|
||||
private FilterController.MyRotationFilterType _myRotationFilterType;
|
||||
|
||||
public Mode EditMode { get; set; } = Mode.InToOut;
|
||||
|
||||
public bool ImmediateMove { get; set; }
|
||||
|
||||
public bool IsDraggableMaintenance { get; set; }
|
||||
|
||||
public Action<int> AddCardForSameCardSwipe { get; set; }
|
||||
|
||||
public void SetMyRotationInfo(MyRotationInfo info, FilterController.MyRotationFilterType filterType)
|
||||
{
|
||||
_myRotationInfo = info;
|
||||
_myRotationFilterType = filterType;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_parentCloneCard.gameObject.layer = LayerMask.NameToLayer("Detail");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
MonoBehaviour.print("シーンがセットされていません");
|
||||
}
|
||||
_colliderSelectionArea.gameObject.SetActive(value: false);
|
||||
_colliderPagingArea.gameObject.SetActive(value: false);
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
_sameCardAddCollider.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public override bool onCloseRequest(MecanimStateBase next, bool isSkip)
|
||||
{
|
||||
if (!(next == _stateEdit))
|
||||
{
|
||||
return next == this;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
_colliderSelectionArea.gameObject.SetActive(value: true);
|
||||
_colliderPagingArea.gameObject.SetActive(value: true);
|
||||
switch (EditMode)
|
||||
{
|
||||
case Mode.OutToIn:
|
||||
m_insertInfo.SetActive(value: true);
|
||||
m_removeInfo.SetActive(value: false);
|
||||
_sameCardAddCollider.gameObject.SetActive(value: false);
|
||||
break;
|
||||
case Mode.InToOut:
|
||||
m_insertInfo.SetActive(value: false);
|
||||
m_removeInfo.SetActive(value: true);
|
||||
break;
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DRAG_CARD);
|
||||
}
|
||||
|
||||
public override void onFinishCloseAnim()
|
||||
{
|
||||
base.onFinishCloseAnim();
|
||||
_colliderSelectionArea.gameObject.SetActive(value: false);
|
||||
_colliderPagingArea.gameObject.SetActive(value: false);
|
||||
_sameCardAddCollider.gameObject.SetActive(value: false);
|
||||
DestroyDragCard();
|
||||
}
|
||||
|
||||
public override void onMove()
|
||||
{
|
||||
base.onMove();
|
||||
if (ImmediateMove)
|
||||
{
|
||||
if (EditMode == Mode.OutToIn)
|
||||
{
|
||||
_cursorArea = Area.InSelectionArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cursorArea = Area.OutSelectionArea;
|
||||
}
|
||||
moveCard();
|
||||
ImmediateMove = false;
|
||||
return;
|
||||
}
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
Camera camera = UIManager.GetInstance().getCamera();
|
||||
Vector3 position = camera.ScreenToWorldPoint(Input.mousePosition);
|
||||
m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position);
|
||||
return;
|
||||
}
|
||||
RaycastHit[] array = Physics.RaycastAll(UIManager.GetInstance().getCamera().ScreenPointToRay(Input.mousePosition));
|
||||
_cursorArea = Area.NoSelectionArea;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i].collider.gameObject == _sameCardAddCollider.gameObject)
|
||||
{
|
||||
_cursorArea = Area.SameCardArea;
|
||||
}
|
||||
}
|
||||
if (_cursorArea == Area.NoSelectionArea)
|
||||
{
|
||||
for (int j = 0; j < array.Length; j++)
|
||||
{
|
||||
if (array[j].collider.gameObject == _colliderSelectionArea.gameObject)
|
||||
{
|
||||
_cursorArea = Area.InSelectionArea;
|
||||
break;
|
||||
}
|
||||
if (array[j].collider.gameObject == _colliderPagingArea.gameObject)
|
||||
{
|
||||
_cursorArea = Area.OutSelectionArea;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
moveCard();
|
||||
}
|
||||
|
||||
private void AddSelectionSameCard()
|
||||
{
|
||||
if (AddCardForSameCardSwipe == null)
|
||||
{
|
||||
AddDragCardToDeck();
|
||||
}
|
||||
else if (!m_scene.IsExistCardCardPool(m_grabCardData.CardId))
|
||||
{
|
||||
m_scene.IsAddableByBaseCardId(m_grabCardData.CardId, out var addCardId);
|
||||
if (addCardId == m_grabCardData.CardId)
|
||||
{
|
||||
AddDragCardToDeck();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addCardId == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
CardObject cardObject = m_scene.SelectionAreaList.FindWithCardId(addCardId);
|
||||
int num = cardObject?.MainCardNum ?? 0;
|
||||
int num2 = cardObject?.SubCardNum ?? 0;
|
||||
AddCardForSameCardSwipe(addCardId);
|
||||
DestroyDragCard();
|
||||
if (cardObject != null && (cardObject.MainCardNum != num || cardObject.SubCardNum != num2))
|
||||
{
|
||||
CreateCardAddAnimation(cardObject);
|
||||
}
|
||||
CardObject cardObject2 = m_scene.SelectionAreaList.FindWithCardId(addCardId);
|
||||
if (cardObject2 != null)
|
||||
{
|
||||
int num3 = m_scene.SelectionAreaList.IndexOf(cardObject2);
|
||||
int num4 = Mathf.Clamp(num3, 5, m_scene.SelectionAreaList.CountKind - 5);
|
||||
if (cardObject2.TotalCardNum == 1 && num3 > 0)
|
||||
{
|
||||
num4++;
|
||||
}
|
||||
_stateEdit.CenterOn(num4);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddDragCardToDeck();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDragCardToDeck()
|
||||
{
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
int num = (m_scene.IsRemainingAddableCardToSelectionArea(m_grabCardData.CardId) ? m_scene.InsertToSelectionArea(m_grabCardData) : (-1));
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: false);
|
||||
_stateEdit.RefreshPage(isImmediate: false);
|
||||
bool flag = m_scene.SelectionAreaList.FindWithCardId(m_grabCardData.CardId) != null;
|
||||
if (num >= 0)
|
||||
{
|
||||
m_grabCardData = m_scene.SelectionAreaList.FindWithIndex(num);
|
||||
if (!m_grabCardData.IsNonPossessionCard)
|
||||
{
|
||||
UITexture[] componentsInChildren = m_parentClone_Insert.GetComponentsInChildren<UITexture>();
|
||||
Shader shader = Resources.Load<Shader>("Shader/Effect/Additive");
|
||||
UITexture[] array = componentsInChildren;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i].shader = shader;
|
||||
}
|
||||
}
|
||||
if (m_grabCardData != null)
|
||||
{
|
||||
m_grabCardData.CardObj.SetActive(num >= 0 && flag);
|
||||
}
|
||||
base.CloseStateName = m_closeStateName_Insert;
|
||||
_isFlashWhenInsert = true;
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_IN);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_parentClone_Insert.gameObject.SetActive(value: false);
|
||||
base.CloseStateName = m_closeStateName_Insert;
|
||||
_isFlashWhenInsert = false;
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_IN);
|
||||
}
|
||||
}
|
||||
|
||||
private void moveCard()
|
||||
{
|
||||
_lastDragArea = _cursorArea;
|
||||
switch (EditMode)
|
||||
{
|
||||
case Mode.OutToIn:
|
||||
switch (_cursorArea)
|
||||
{
|
||||
case Area.InSelectionArea:
|
||||
AddSelectionSameCard();
|
||||
break;
|
||||
case Area.OutSelectionArea:
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
m_parentClone_Insert.gameObject.transform.position = m_grabCardData.CardObj.transform.position;
|
||||
m_grabCardData.CardObj.transform.position = m_parentClone_Grab.transform.position;
|
||||
m_parentClone_Grab.alpha = 0f;
|
||||
base.CloseStateName = "";
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Mode.InToOut:
|
||||
switch (_cursorArea)
|
||||
{
|
||||
case Area.SameCardArea:
|
||||
AddSelectionSameCard();
|
||||
break;
|
||||
case Area.InSelectionArea:
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
m_parentClone_Insert.gameObject.transform.position = m_grabCardData.CardObj.transform.position;
|
||||
m_grabCardData.CardObj.transform.position = m_parentClone_Grab.transform.position;
|
||||
m_parentClone_Grab.alpha = 0f;
|
||||
base.CloseStateName = "";
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT);
|
||||
break;
|
||||
case Area.OutSelectionArea:
|
||||
{
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
int num = m_scene.RemoveFromSelectionArea(m_grabCardData);
|
||||
_stateEdit.Fit();
|
||||
if (num >= 0)
|
||||
{
|
||||
m_grabCardData = m_scene.PagingList.FindWithIndex(num);
|
||||
m_darkMask_Insert.gameObject.SetActive(value: true);
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_parentClone_Insert.gameObject.SetActive(value: false);
|
||||
}
|
||||
_stateEdit.RefreshSelectionArea(isImmediate: false);
|
||||
_stateEdit.RefreshPage(isImmediate: true);
|
||||
base.CloseStateName = m_closeStateName_Remove;
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_OUT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_scene.ChangeState(_stateEdit, skipCloseAnim: false, skipOpenAnim: true);
|
||||
}
|
||||
|
||||
public override void onUpdateCloseAnim()
|
||||
{
|
||||
base.onUpdateCloseAnim();
|
||||
if (m_grabCardData != null && m_grabCardData.CardObj != null)
|
||||
{
|
||||
m_parentClone_Insert.transform.position = m_grabCardData.CardObj.transform.position;
|
||||
m_darkMask_Insert.transform.position = m_grabCardData.CardObj.transform.position;
|
||||
}
|
||||
_stateEdit.onMove();
|
||||
}
|
||||
|
||||
public override void onNotify(int value)
|
||||
{
|
||||
base.onNotify(value);
|
||||
if (_isFlashWhenInsert)
|
||||
{
|
||||
if (m_grabCardData != null)
|
||||
{
|
||||
m_grabCardData.CardObj.SetActive(value: true);
|
||||
m_grabCardData.ChangeSelectingState(isSelect: false);
|
||||
}
|
||||
if (_lastDragArea != Area.NoSelectionArea)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CardObject TryGetCard(GameObject cardObj)
|
||||
{
|
||||
if (m_scene.IsLoading)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
CardObject grabCard = null;
|
||||
switch (EditMode)
|
||||
{
|
||||
case Mode.InToOut:
|
||||
grabCard = m_scene.SelectionAreaList.FindWithObject(cardObj);
|
||||
if (!grabCard.IsNonPossessionCard)
|
||||
{
|
||||
CardObject cardObject = m_scene.SelectionAreaList.CardList.Find((CardObject c) => c.IsNonPossessionCard && c.CardId == grabCard.CardId);
|
||||
if (cardObject != null)
|
||||
{
|
||||
return cardObject;
|
||||
}
|
||||
}
|
||||
return grabCard;
|
||||
case Mode.OutToIn:
|
||||
{
|
||||
grabCard = m_scene.PagingList.FindWithObject(cardObj);
|
||||
if (grabCard == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bool flag = !IsDraggableMaintenance && GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(grabCard.CardId);
|
||||
if (grabCard.IsVisibleSleeve || flag)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!m_scene.IsRemainingAddableCardToSelectionArea(grabCard.CardId))
|
||||
{
|
||||
if (m_scene.IsEnableSwipeAutoSameBasicCardAdd() && m_scene.IsAddableByBaseCardId(grabCard.CardId, out var _))
|
||||
{
|
||||
return grabCard;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return grabCard;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsEnableSameCardAddCollider()
|
||||
{
|
||||
if (_myRotationInfo != null && _myRotationFilterType != FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK && !CardMaster.GetInstance(FormatBehaviorManager.GetDefaultBehaviour(Format.MyRotation).CardMasterId).GetCardParameterFromId(m_grabCardData.CardId).IsAvailableFormat(Format.MyRotation, ClassType.None, _myRotationInfo))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (m_scene.IsRemainingAddableCardToSelectionArea(m_grabCardData.CardId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (m_scene.IsEnableSwipeAutoSameBasicCardAdd() && m_scene.IsAddableByBaseCardId(m_grabCardData.CardId, out var _))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void CreateCardAddAnimation(CardObject original)
|
||||
{
|
||||
DestroyDragCard();
|
||||
m_grabCardData = original;
|
||||
m_grabCardData.ActiveCardInfo(isActive: false);
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(m_grabCardData.CardObj);
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(m_scene.FormatBehavior.CardMasterId).GetCardParameterFromId(m_grabCardData.CardId);
|
||||
CardListTemplate component = gameObject.GetComponent<CardListTemplate>();
|
||||
UITexture cardTexture = component._cardTexture;
|
||||
component.HideNum();
|
||||
component.AttachNormalFrame(cardParameterFromId);
|
||||
if ((bool)cardTexture && (bool)cardTexture.material && (bool)cardTexture.material.mainTexture)
|
||||
{
|
||||
Texture mainTexture = cardTexture.material.mainTexture;
|
||||
cardTexture.material = null;
|
||||
cardTexture.mainTexture = mainTexture;
|
||||
}
|
||||
gameObject.transform.localScale = Vector3.one * 0.6f;
|
||||
m_grabCardData.ActiveCardInfo(isActive: true);
|
||||
gameObject.name = "DragCard";
|
||||
Vector3 localScale = gameObject.transform.localScale;
|
||||
gameObject.transform.parent = m_parentClone_Grab.transform;
|
||||
gameObject.transform.localPosition = Vector3.zero;
|
||||
gameObject.transform.localScale = localScale;
|
||||
gameObject.transform.localRotation = Quaternion.identity;
|
||||
GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject);
|
||||
CardListTemplate component2 = gameObject2.GetComponent<CardListTemplate>();
|
||||
component2.HideNum();
|
||||
gameObject2.transform.parent = m_parentClone_Insert.transform;
|
||||
gameObject2.transform.localPosition = Vector3.zero;
|
||||
gameObject2.transform.localScale = localScale;
|
||||
m_parentClone_Insert.gameObject.SetActive(value: true);
|
||||
m_parentClone_Insert.gameObject.transform.position = original.CardObj.transform.position;
|
||||
component2.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard;
|
||||
m_destroyList = new GameObject[2] { gameObject, gameObject2 };
|
||||
Camera camera = UIManager.GetInstance().getCamera();
|
||||
Vector3 position = camera.ScreenToWorldPoint(Input.mousePosition);
|
||||
m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position);
|
||||
m_parentClone_Grab.alpha = 1f;
|
||||
base.CloseStateName = m_closeStateName_Insert;
|
||||
_isFlashWhenInsert = true;
|
||||
}
|
||||
|
||||
public bool CreateDragCard(CardObject original)
|
||||
{
|
||||
DestroyDragCard();
|
||||
m_grabCardData = original;
|
||||
if (original != null && EditMode == Mode.InToOut && IsEnableSameCardAddCollider())
|
||||
{
|
||||
_sameCardAddCollider.gameObject.SetActive(value: true);
|
||||
Vector3 position = _sameCardAddCollider.transform.position;
|
||||
position.x = original.CardObj.transform.position.x;
|
||||
_sameCardAddCollider.transform.position = position;
|
||||
}
|
||||
m_grabCardData.ActiveCardInfo(isActive: false);
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(m_grabCardData.CardObj);
|
||||
gameObject.GetComponent<CardListTemplate>();
|
||||
TweenScale component = gameObject.GetComponent<TweenScale>();
|
||||
if ((bool)component)
|
||||
{
|
||||
UnityEngine.Object.Destroy(component);
|
||||
}
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(m_scene.FormatBehavior.CardMasterId).GetCardParameterFromId(m_grabCardData.CardId);
|
||||
CardListTemplate component2 = gameObject.GetComponent<CardListTemplate>();
|
||||
UITexture cardTexture = component2._cardTexture;
|
||||
component2.HideNum();
|
||||
component2.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard;
|
||||
component2.AttachNormalShaderRotationOnlyIcon();
|
||||
if (m_scene.FormatBehavior.GetPossessionCardNum(m_grabCardData.CardId, isIncludingSpotCard: true) > 0)
|
||||
{
|
||||
component2.AttachNormalFrame(cardParameterFromId);
|
||||
if ((bool)cardTexture && (bool)cardTexture.material && (bool)cardTexture.material.mainTexture)
|
||||
{
|
||||
Texture mainTexture = cardTexture.material.mainTexture;
|
||||
cardTexture.material = null;
|
||||
cardTexture.mainTexture = mainTexture;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
component2.AttachGrayShader();
|
||||
}
|
||||
gameObject.transform.localScale = Vector3.one * 0.6f;
|
||||
m_grabCardData.ActiveCardInfo(isActive: true);
|
||||
gameObject.name = "DragCard";
|
||||
Vector3 localScale = gameObject.transform.localScale;
|
||||
gameObject.transform.parent = m_parentClone_Grab.transform;
|
||||
gameObject.transform.localPosition = Vector3.zero;
|
||||
gameObject.transform.localScale = localScale;
|
||||
gameObject.transform.localRotation = Quaternion.identity;
|
||||
GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject);
|
||||
CardListTemplate component3 = gameObject2.GetComponent<CardListTemplate>();
|
||||
component3.HideNum();
|
||||
gameObject2.transform.parent = m_parentClone_Insert.transform;
|
||||
gameObject2.transform.localPosition = Vector3.zero;
|
||||
gameObject2.transform.localScale = localScale;
|
||||
m_parentClone_Insert.gameObject.SetActive(value: false);
|
||||
component3.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard;
|
||||
m_destroyList = new GameObject[2] { gameObject, gameObject2 };
|
||||
m_darkMask_Grab.transform.position = m_grabCardData.CardObj.transform.position + Vector3.back * 0.01f;
|
||||
m_darkMask_Grab.transform.localScale = m_grabCardData.CardObj.transform.localScale;
|
||||
m_darkMask_Grab.gameObject.SetActive(value: true);
|
||||
m_darkMask_Insert.transform.localScale = m_grabCardData.CardObj.transform.localScale;
|
||||
m_darkMask_Insert.width = cardTexture.width;
|
||||
m_darkMask_Insert.height = cardTexture.height;
|
||||
Camera camera = UIManager.GetInstance().getCamera();
|
||||
Vector3 position2 = camera.ScreenToWorldPoint(Input.mousePosition);
|
||||
m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position2);
|
||||
m_parentClone_Grab.alpha = 1f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DestroyDragCard()
|
||||
{
|
||||
if (m_grabCardData != null && m_grabCardData.CardObj != null)
|
||||
{
|
||||
m_grabCardData.CardObj.SetActive(value: true);
|
||||
}
|
||||
m_grabCardData = null;
|
||||
if (m_destroyList != null)
|
||||
{
|
||||
for (int i = 0; i < m_destroyList.Length; i++)
|
||||
{
|
||||
UnityEngine.Object.Destroy(m_destroyList[i]);
|
||||
}
|
||||
m_destroyList = null;
|
||||
}
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void OnChangeSelectionAreaFilter()
|
||||
{
|
||||
DestroyDragCard();
|
||||
}
|
||||
|
||||
public void DragEmulate(CardObject original, CardObject target)
|
||||
{
|
||||
CloneToGrab(original);
|
||||
StartCoroutine(MoveToTarget(m_parentClone_Grab.transform, target.CardObj.transform));
|
||||
}
|
||||
|
||||
public void DropDown(CardObject original)
|
||||
{
|
||||
CloneToGrab(original);
|
||||
Vector3 point = m_parentClone_Grab.transform.position + Vector3.down * 0.5f;
|
||||
StartCoroutine(MoveToPoint(m_parentClone_Grab.transform, point));
|
||||
TweenAlpha.Begin(m_parentClone_Grab.gameObject, 0.15f, 0f);
|
||||
}
|
||||
|
||||
private void CloneToGrab(CardObject original)
|
||||
{
|
||||
Vector3 position = original.CardObj.transform.position;
|
||||
DestroyDragCard();
|
||||
CreateDragCard(original);
|
||||
m_parentClone_Grab.transform.position = position;
|
||||
m_parentClone_Grab.transform.localScale = Vector3.one;
|
||||
m_parentClone_Grab.alpha = 1f;
|
||||
m_darkMask_Grab.gameObject.SetActive(value: false);
|
||||
m_darkMask_Insert.gameObject.SetActive(value: false);
|
||||
m_parentClone_Insert.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
private IEnumerator MoveToTarget(Transform obj, Transform target)
|
||||
{
|
||||
for (float num = Vector3.Distance(target.position, obj.position); num >= 0.05f; num = Vector3.Distance(target.position, obj.position))
|
||||
{
|
||||
obj.position += (target.position - obj.position) * 0.4f;
|
||||
yield return null;
|
||||
}
|
||||
DestroyDragCard();
|
||||
}
|
||||
|
||||
private IEnumerator MoveToPoint(Transform obj, Vector3 point)
|
||||
{
|
||||
for (float num = Vector3.Distance(point, obj.position); num >= 0.05f; num = Vector3.Distance(point, obj.position))
|
||||
{
|
||||
obj.position += (point - obj.position) * 0.4f;
|
||||
yield return null;
|
||||
}
|
||||
DestroyDragCard();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard.DeckCardEdit;
|
||||
|
||||
[RequireComponent(typeof(CardSelectListUI_Positioning))]
|
||||
public class CardSelectListUI_State_Edit : MecanimStateBase
|
||||
{
|
||||
private const float PRESS_TIME_TO_DRAGMODE = 0.5f;
|
||||
|
||||
private const float PRESS_POINT_DIST_TO_DRAGMODE = 35f;
|
||||
|
||||
private const float PAGING_OFFSET = 1400f;
|
||||
|
||||
private const float PAGING_SPEED = 0.4f;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUIBase m_scene;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUI_State_CardDrag m_stateDragMode;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView m_scrollView;
|
||||
|
||||
private UIPanel _scrollViewPanel;
|
||||
|
||||
private SpringPanel _springPanel;
|
||||
|
||||
[SerializeField]
|
||||
private UICenterOnChild m_scrollViewCenterOnChild;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUI_Positioning _selectionAreaCardPositioning;
|
||||
|
||||
[SerializeField]
|
||||
private CardSelectListUI_Positioning _pagingAreaCardPositioning;
|
||||
|
||||
[SerializeField]
|
||||
private UIPanel _maskPanel;
|
||||
|
||||
private GameObject _pressObj;
|
||||
|
||||
private float _pressTime;
|
||||
|
||||
private Vector2 _pressPoint = Vector2.zero;
|
||||
|
||||
private Coroutine _pagingCoroutine;
|
||||
|
||||
private bool _requestImmediateMove;
|
||||
|
||||
public bool IsClick { get; private set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
MonoBehaviour.print("シーンがセットされていません");
|
||||
}
|
||||
UIScrollView scrollView = m_scrollView;
|
||||
scrollView.onDragStarted = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView.onDragStarted, (UIScrollView.OnDragNotification)delegate
|
||||
{
|
||||
m_scrollViewCenterOnChild.gameObject.SetActive(value: false);
|
||||
});
|
||||
UIScrollView scrollView2 = m_scrollView;
|
||||
scrollView2.onMomentumMove = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView2.onMomentumMove, new UIScrollView.OnDragNotification(Fit));
|
||||
UIScrollView scrollView3 = m_scrollView;
|
||||
scrollView3.onStoppedMoving = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView3.onStoppedMoving, new UIScrollView.OnDragNotification(Fit));
|
||||
}
|
||||
|
||||
public override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
RefreshSelectionArea(isImmediate: false);
|
||||
RefreshPage(isImmediate: false);
|
||||
m_scrollView.enabled = true;
|
||||
_maskPanel.clipping = UIDrawCall.Clipping.None;
|
||||
}
|
||||
|
||||
public override void onClose()
|
||||
{
|
||||
base.onClose();
|
||||
RefreshSelectionArea(isImmediate: false);
|
||||
RefreshPage(isImmediate: false);
|
||||
}
|
||||
|
||||
public void RefreshSelectionArea(bool isImmediate)
|
||||
{
|
||||
RefreshBase(m_scene.SelectionAreaList, onPressSelectionAreaCard, delegate(GameObject o)
|
||||
{
|
||||
onDoubleClick(o, CardSelectListUI_State_CardDrag.Mode.InToOut);
|
||||
}, _selectionAreaCardPositioning, isMerge: false, isImmediate);
|
||||
}
|
||||
|
||||
public void RefreshPage(bool isImmediate)
|
||||
{
|
||||
RefreshBase(m_scene.PagingList, onPressPagingCard, delegate(GameObject o)
|
||||
{
|
||||
onDoubleClick(o, CardSelectListUI_State_CardDrag.Mode.OutToIn);
|
||||
}, _pagingAreaCardPositioning, isMerge: false, isImmediate);
|
||||
}
|
||||
|
||||
private void RefreshBase(CardBundle cardList, UIEventListener.BoolDelegate callback, UIEventListener.VoidDelegate doubleClickCallback, CardSelectListUI_Positioning positioning, bool isMerge, bool isImmediate)
|
||||
{
|
||||
int countKind = cardList.CountKind;
|
||||
GameObject[] array = new GameObject[countKind];
|
||||
for (int i = 0; i < countKind; i++)
|
||||
{
|
||||
array[i] = cardList.FindWithIndex(i).CardObj;
|
||||
if (!(array[i] != null))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BoxCollider component = array[i].GetComponent<BoxCollider>();
|
||||
if (!component)
|
||||
{
|
||||
component = array[i].AddComponent<BoxCollider>();
|
||||
UIWidget component2 = array[i].GetComponent<UIWidget>();
|
||||
if ((bool)component2)
|
||||
{
|
||||
component.size = component2.localSize;
|
||||
}
|
||||
}
|
||||
UIEventListener uIEventListener = UIEventListener.Get(array[i]);
|
||||
uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, callback);
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(array[i]);
|
||||
uIEventListener2.onPressRight = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener2.onPressRight, callback);
|
||||
UIEventListener uIEventListener3 = UIEventListener.Get(array[i]);
|
||||
uIEventListener3.onDoubleClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onDoubleClick, doubleClickCallback);
|
||||
}
|
||||
if (isMerge)
|
||||
{
|
||||
positioning.Add(array);
|
||||
}
|
||||
else
|
||||
{
|
||||
positioning.Change(array);
|
||||
}
|
||||
if (isImmediate)
|
||||
{
|
||||
positioning.Immediate();
|
||||
}
|
||||
}
|
||||
|
||||
public void NextPage(Action onMoved)
|
||||
{
|
||||
if (_pagingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_pagingCoroutine);
|
||||
}
|
||||
_pagingCoroutine = StartCoroutine(PagingBase(-1f, onMoved));
|
||||
}
|
||||
|
||||
public void PrevPage(Action onMoved)
|
||||
{
|
||||
if (_pagingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_pagingCoroutine);
|
||||
}
|
||||
_pagingCoroutine = StartCoroutine(PagingBase(1f, onMoved));
|
||||
}
|
||||
|
||||
private IEnumerator PagingBase(float direction, Action onMoved)
|
||||
{
|
||||
Vector3 offset = _pagingAreaCardPositioning.Offset;
|
||||
offset.x = 1400f * direction;
|
||||
_pagingAreaCardPositioning.Offset = offset;
|
||||
_pagingAreaCardPositioning.Speed = 0.4f;
|
||||
while (_pagingAreaCardPositioning.IsMoving)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
offset.x = 1400f * (0f - direction);
|
||||
_pagingAreaCardPositioning.Offset = offset;
|
||||
_pagingAreaCardPositioning.Speed = 1f;
|
||||
onMoved.Call();
|
||||
yield return null;
|
||||
offset.x = 0f;
|
||||
_pagingAreaCardPositioning.Offset = offset;
|
||||
_pagingAreaCardPositioning.Speed = 0.4f;
|
||||
}
|
||||
|
||||
public void Fit()
|
||||
{
|
||||
SetupScrollComponent();
|
||||
float num = Mathf.Max(0f, _scrollViewPanel.clipOffset.x);
|
||||
int a = Mathf.Max(0, m_scene.SelectionAreaList.CountKind - 10);
|
||||
float breakWidth = _selectionAreaCardPositioning.BreakWidth;
|
||||
int b = Mathf.RoundToInt(num / breakWidth);
|
||||
Fit(Mathf.Min(a, b));
|
||||
m_scrollView.customMovement = ((m_scene.SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero);
|
||||
}
|
||||
|
||||
public void CenterOn(int idx)
|
||||
{
|
||||
SetupScrollComponent();
|
||||
idx -= 5;
|
||||
int a = Mathf.Max(0, m_scene.SelectionAreaList.CountKind - 10);
|
||||
int a2 = 0;
|
||||
Fit(Mathf.Max(a2, Mathf.Min(a, idx)));
|
||||
}
|
||||
|
||||
private void Fit(int idx)
|
||||
{
|
||||
float breakWidth = _selectionAreaCardPositioning.BreakWidth;
|
||||
_springPanel.target.x = (float)(-idx) * breakWidth;
|
||||
_springPanel.enabled = true;
|
||||
}
|
||||
|
||||
public void ResetScroll()
|
||||
{
|
||||
SetupScrollComponent();
|
||||
m_scrollView.ResetPosition();
|
||||
_springPanel.target.x = 0f;
|
||||
_springPanel.enabled = true;
|
||||
}
|
||||
|
||||
private void SetupScrollComponent()
|
||||
{
|
||||
if (_scrollViewPanel == null)
|
||||
{
|
||||
_scrollViewPanel = m_scrollView.GetComponent<UIPanel>();
|
||||
}
|
||||
if (_springPanel == null)
|
||||
{
|
||||
_springPanel = m_scrollView.GetComponent<SpringPanel>();
|
||||
}
|
||||
m_scrollViewCenterOnChild.gameObject.SetActive(value: true);
|
||||
}
|
||||
|
||||
public void RemoveSelectionArea()
|
||||
{
|
||||
_selectionAreaCardPositioning.Clear();
|
||||
}
|
||||
|
||||
public void RemovePaging()
|
||||
{
|
||||
_pagingAreaCardPositioning.Clear();
|
||||
}
|
||||
|
||||
private void StartDragState(bool immediate)
|
||||
{
|
||||
CardObject cardObject = m_stateDragMode.TryGetCard(_pressObj);
|
||||
if (cardObject != null)
|
||||
{
|
||||
m_scene.HideDetail();
|
||||
m_scene.ChangeState(m_stateDragMode, skipCloseAnim: true);
|
||||
m_stateDragMode.ImmediateMove = immediate;
|
||||
m_stateDragMode.CreateDragCard(cardObject);
|
||||
m_scrollView.enabled = false;
|
||||
m_scrollViewCenterOnChild.gameObject.SetActive(value: true);
|
||||
IsClick = false;
|
||||
}
|
||||
_pressObj = null;
|
||||
_pressTime = 0f;
|
||||
}
|
||||
|
||||
public override void onMove()
|
||||
{
|
||||
base.onMove();
|
||||
if (!_pressObj)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_requestImmediateMove)
|
||||
{
|
||||
StartDragState(immediate: true);
|
||||
_requestImmediateMove = false;
|
||||
}
|
||||
else if (Input.GetMouseButton(0))
|
||||
{
|
||||
IsClick = true;
|
||||
_pressTime += Time.deltaTime;
|
||||
Vector2 vector = _pressPoint - (Vector2)Input.mousePosition;
|
||||
vector.Normalize();
|
||||
float num = Mathf.Abs(vector.y);
|
||||
float num2 = Vector2.Distance(_pressPoint, Input.mousePosition);
|
||||
if (num2 >= 35f && num < 0.8f)
|
||||
{
|
||||
_pressObj = null;
|
||||
_pressTime = 0f;
|
||||
}
|
||||
else if (_pressTime >= 0.5f || (num >= 0.8f && num2 >= 35f))
|
||||
{
|
||||
StartDragState(immediate: false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_pressObj = null;
|
||||
_pressTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
private void onPressSelectionAreaCard(GameObject obj, bool state)
|
||||
{
|
||||
if (!m_scene.IsLoading)
|
||||
{
|
||||
bool mouseButton = Input.GetMouseButton(0);
|
||||
bool flag = !mouseButton && Input.GetMouseButtonDown(1);
|
||||
if (mouseButton || flag)
|
||||
{
|
||||
initPress(obj, CardSelectListUI_State_CardDrag.Mode.InToOut);
|
||||
_requestImmediateMove = flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onPressPagingCard(GameObject obj, bool state)
|
||||
{
|
||||
if (!m_scene.IsLoading)
|
||||
{
|
||||
bool mouseButton = Input.GetMouseButton(0);
|
||||
bool flag = !mouseButton && Input.GetMouseButtonDown(1);
|
||||
if (mouseButton || flag)
|
||||
{
|
||||
initPress(obj, CardSelectListUI_State_CardDrag.Mode.OutToIn);
|
||||
_requestImmediateMove = flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initPress(GameObject obj, CardSelectListUI_State_CardDrag.Mode mode)
|
||||
{
|
||||
m_stateDragMode.EditMode = mode;
|
||||
_pressObj = obj;
|
||||
_pressPoint = Input.mousePosition;
|
||||
}
|
||||
|
||||
private void onDoubleClick(GameObject obj, CardSelectListUI_State_CardDrag.Mode mode)
|
||||
{
|
||||
if (!m_scene.IsLoading)
|
||||
{
|
||||
_requestImmediateMove = true;
|
||||
initPress(obj, mode);
|
||||
}
|
||||
}
|
||||
|
||||
public void DragEmulate(CardObject original, CardObject target)
|
||||
{
|
||||
m_stateDragMode.DragEmulate(original, target);
|
||||
}
|
||||
|
||||
public void DropDown(CardObject original)
|
||||
{
|
||||
m_stateDragMode.DropDown(original);
|
||||
}
|
||||
}
|
||||
1961
SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs
Normal file
1961
SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs
Normal file
File diff suppressed because it is too large
Load Diff
278
SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs
Normal file
278
SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.ErrorDialog;
|
||||
|
||||
namespace Wizard.DeckCardEdit;
|
||||
|
||||
public class DeckSave
|
||||
{
|
||||
public class DeckSaveCoroutineMonoBehaviour : MonoBehaviour
|
||||
{
|
||||
private DeckSaveCoroutineMonoBehaviour()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Option
|
||||
{
|
||||
public int[] CardIds;
|
||||
|
||||
public int DeckId;
|
||||
|
||||
public string DeckName;
|
||||
|
||||
public int ClassType;
|
||||
|
||||
public int SubClassType;
|
||||
|
||||
public int RawSkinId;
|
||||
|
||||
public bool IsRandomLeaderSkin;
|
||||
|
||||
public List<int> LeaderSkinIdList;
|
||||
|
||||
public long SleeveId;
|
||||
|
||||
public bool IsNew;
|
||||
|
||||
public Format Format;
|
||||
|
||||
public string MyRotationId;
|
||||
|
||||
public ConventionDeckList ConventionDeckList;
|
||||
|
||||
public Action OnFinish;
|
||||
|
||||
public Action<bool> OnSaveCompleteDialog;
|
||||
}
|
||||
|
||||
private Action _onFinish;
|
||||
|
||||
private int[] _deck;
|
||||
|
||||
private int _id;
|
||||
|
||||
private string _name;
|
||||
|
||||
private string _defaultName;
|
||||
|
||||
private int _class;
|
||||
|
||||
private int _rawSkinId;
|
||||
|
||||
private bool _isRandomLeaderSkin;
|
||||
|
||||
private List<int> _leaderSkinIdList;
|
||||
|
||||
private long _sleeveId;
|
||||
|
||||
private Format _format;
|
||||
|
||||
private ConventionDeckList _conventionDeckList;
|
||||
|
||||
private bool _isNew;
|
||||
|
||||
private string _myRotationId;
|
||||
|
||||
private int _subClass;
|
||||
|
||||
private MonoBehaviour _behaviour;
|
||||
|
||||
private DialogBase _nameEditDialog;
|
||||
|
||||
private IFormatBehavior _formatBehavior;
|
||||
|
||||
private Action<bool> _saveCompleteDialogOverrideAction;
|
||||
|
||||
private bool _isUsableDeck;
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if ((bool)_behaviour)
|
||||
{
|
||||
UnityEngine.Object.Destroy(_behaviour.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(Option option)
|
||||
{
|
||||
IFormatBehavior formatBehavior = FormatBehaviorManager.Create(option.Format, option.ConventionDeckList);
|
||||
_deck = option.CardIds;
|
||||
_name = option.DeckName;
|
||||
_defaultName = option.DeckName;
|
||||
_id = option.DeckId;
|
||||
_format = option.Format;
|
||||
_isNew = option.IsNew;
|
||||
_class = option.ClassType;
|
||||
_subClass = option.SubClassType;
|
||||
_rawSkinId = option.RawSkinId;
|
||||
_isRandomLeaderSkin = option.IsRandomLeaderSkin;
|
||||
_leaderSkinIdList = option.LeaderSkinIdList;
|
||||
_sleeveId = option.SleeveId;
|
||||
_conventionDeckList = option.ConventionDeckList;
|
||||
_myRotationId = option.MyRotationId;
|
||||
_onFinish = option.OnFinish;
|
||||
_saveCompleteDialogOverrideAction = option.OnSaveCompleteDialog;
|
||||
MyRotationInfo myRotationInfo = null;
|
||||
if (!string.IsNullOrEmpty(_myRotationId))
|
||||
{
|
||||
myRotationInfo = Data.MyRotationAllInfo.Get(_myRotationId);
|
||||
}
|
||||
_formatBehavior = formatBehavior;
|
||||
if (_deck.Length < 40)
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0050", 40.ToString()));
|
||||
return;
|
||||
}
|
||||
if (_deck.Length > 50)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_006_Title"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Card_0107", 40.ToString()));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.OnCloseStart = Destroy;
|
||||
return;
|
||||
}
|
||||
if (_deck.Length > 40)
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0138", 41.ToString()));
|
||||
return;
|
||||
}
|
||||
if (_format == Format.Crossover)
|
||||
{
|
||||
CardMaster cardMaster = CardMaster.GetInstance(formatBehavior.CardMasterId);
|
||||
List<int> source = _deck.ToList();
|
||||
CardBasePrm.ClanType mainClass = (CardBasePrm.ClanType)_class;
|
||||
if (source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == mainClass) < 24)
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0279", 24.ToString()));
|
||||
return;
|
||||
}
|
||||
CardBasePrm.ClanType subClass = (CardBasePrm.ClanType)_subClass;
|
||||
if (source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == subClass) < 9)
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0280", 9.ToString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (DeckCardEditUI.IsNotAvailableCardInIds(new List<int>(_deck), _format, formatBehavior, myRotationInfo))
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0191"));
|
||||
return;
|
||||
}
|
||||
if (DeckData.ContainsNonPossessionCard(_deck, formatBehavior))
|
||||
{
|
||||
CreateSaveConfirmDialog(Data.SystemText.Get("Card_0252"));
|
||||
return;
|
||||
}
|
||||
_isUsableDeck = true;
|
||||
CheckNewDeckBeforeSave();
|
||||
}
|
||||
|
||||
private void CreateSaveConfirmDialog(string messageText)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_005_Title"));
|
||||
dialogBase.SetText(messageText);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetButtonText(Data.SystemText.Get("Dia_DeckEdit_005_Button"), Data.SystemText.Get("Dia_DeckEdit_005_Button_2"));
|
||||
dialogBase.onPushButton1 = CheckNewDeckBeforeSave;
|
||||
}
|
||||
|
||||
private void CheckNewDeckBeforeSave()
|
||||
{
|
||||
if (_isNew)
|
||||
{
|
||||
_nameEditDialog = InputDialog.Create(30, 24);
|
||||
_nameEditDialog.InputAreaObjs.labels[0].text = _name;
|
||||
_nameEditDialog.InputAreaObjs.labels[1].text = _id.ToString();
|
||||
_nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0012");
|
||||
_nameEditDialog.InputAreaObjs.labels[3].text = Data.SystemText.Get("Common_0401", 24.ToString());
|
||||
_nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0011"));
|
||||
_nameEditDialog.onPushButton1 = NameSetEnd;
|
||||
_nameEditDialog.onCloseWithoutSelect = Destroy;
|
||||
_nameEditDialog.SetPanelDepth(2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveRequest();
|
||||
}
|
||||
}
|
||||
|
||||
private void NameSetEnd()
|
||||
{
|
||||
_name = _nameEditDialog.InputAreaObjs.labels[0].text;
|
||||
if (string.IsNullOrEmpty(_name))
|
||||
{
|
||||
_name = _defaultName;
|
||||
}
|
||||
SaveRequest();
|
||||
}
|
||||
|
||||
private void SaveRequest()
|
||||
{
|
||||
if (_deck.Length > 50)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GameObject gameObject = new GameObject();
|
||||
_behaviour = gameObject.AddComponent<DeckSaveCoroutineMonoBehaviour>();
|
||||
if (_formatBehavior.IsConventionMode)
|
||||
{
|
||||
DeckConventionUpdateTask deckConventionUpdateTask = new DeckConventionUpdateTask();
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
deckConventionUpdateTask.SetParameterWithSubClass(_id, _class, _subClass, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _conventionDeckList);
|
||||
}
|
||||
else
|
||||
{
|
||||
deckConventionUpdateTask.SetParameter(_id, _class, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _myRotationId, _conventionDeckList);
|
||||
}
|
||||
deckConventionUpdateTask.SkipAllCuteResultCodeCheckErrorPopup();
|
||||
_behaviour.StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionUpdateTask, OnFinishSaveRequest, null, OnFailedSaveRequest));
|
||||
}
|
||||
else
|
||||
{
|
||||
DeckUpdateTask deckUpdateTask = GameMgr.GetIns().GetDeckUpdateTask();
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
deckUpdateTask.SetParameterWithSubClass(_id, _class, _subClass, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, isDelete: false, _deck, _format);
|
||||
}
|
||||
else
|
||||
{
|
||||
deckUpdateTask.SetParameter(_id, _class, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _format, _myRotationId);
|
||||
}
|
||||
deckUpdateTask.SkipAllCuteResultCodeCheckErrorPopup();
|
||||
_behaviour.StartCoroutine(Toolbox.NetworkManager.Connect(deckUpdateTask, OnFinishSaveRequest, null, OnFailedSaveRequest));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFinishSaveRequest(NetworkTask.ResultCode error)
|
||||
{
|
||||
if (_saveCompleteDialogOverrideAction != null)
|
||||
{
|
||||
_saveCompleteDialogOverrideAction(_isUsableDeck);
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_007_Title"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Card_0019"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.OnCloseStart = _onFinish;
|
||||
}
|
||||
Destroy();
|
||||
}
|
||||
|
||||
private void OnFailedSaveRequest(int code)
|
||||
{
|
||||
DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create(code);
|
||||
if (_isNew)
|
||||
{
|
||||
dialogBase.OnCloseStart = CheckNewDeckBeforeSave;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user