using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Cute; using LitJson; using UnityEngine; using Wizard; public class MyPageCenterCard : MonoBehaviour { private const int CARD_VIEW_STATE_FIRST = 0; private const int CARD_VIEW_STATE_LOAD_WAIT = 1; private const int CARD_VIEW_STATE_CREATE_WAIT = 2; private const int CARD_VIEW_STATE_FINISH = 3; private readonly string CIRCLE_VIEW_LAYER_NAME = "MyPageCardList"; private const float CARD_ROTATION_ANIM_ANGLE_Y = 90f; private const float CARD_ROTATION_ANIM_TIME = 1.5f; private const float TRANSITIONAL_BGM_DELAY_TIME = 0.5f; private readonly Vector3 CARD_SCALE_NORMAL = new Vector3(80f, 80f, 64f); private readonly Vector3 CARD_SCALE_BIG = new Vector3(100f, 100f, 64f); public GameObject CardOyaObj; public GameObject CardDetailOya; [SerializeField] private GameObject CardDetailTweenObj; [SerializeField] private MyPageCardDetail m_CardDetail; private List _cardList; private List _cardListAssetPath = new List(); private CardBasePrm.CharaType _currentCardType = CardBasePrm.CharaType.MAX; private GameObject _followerCardObj; private GameObject _spellCardObj; private GameObject _amuletCardObj; private Transform _followerTransform; private Transform _spellCardTransform; private Transform _amuletCardTransform; private UILabel _followerCostLabel; private UILabel _followerLifeLabel; private UILabel _followerAtkLabel; private UILabel _followerNameLabel; private UILabel _spellNameLabel; private UILabel _spellCostLabel; private UILabel _amuletNameLabel; private UILabel _amuletCostLabel; private GameObject _followerRotationOnlyIcon; private GameObject _spellRotationOnlyIcon; private GameObject _amuletRotationOnlyIcon; private bool _isAfterEvo; [SerializeField] private MyPageCharaMenu cardMoveManager; [SerializeField] private GameObject CameraCard; private Vector3 _cameraCardPos; private bool _cameraPositionInitializeEnd; private int _cardViewState; private int _circleCardLayer; private IList _circleViewCardList = new List(); private int _scene = -1; private int _oldIndex; private int _previousCenterCardId = -1; private DeckGroupListData _deckGroupListData; public MyPageCardDetail CardDetail => m_CardDetail; public bool CardLoadFinish => _cardViewState >= 2; private void Awake() { _circleCardLayer = LayerMask.NameToLayer(CIRCLE_VIEW_LAYER_NAME); } private void Start() { Vector3 localPosition = CardDetailTweenObj.transform.localPosition; localPosition.y = 800f; CardDetailTweenObj.transform.localPosition = localPosition; SaveCameraFirstPosition(); } private void SaveCameraFirstPosition() { if (!_cameraPositionInitializeEnd) { _cameraCardPos = CameraCard.transform.localPosition; _cameraPositionInitializeEnd = true; } } private void initCard() { if (_cardList != null) { CardAllDelete(); } _cardList = UIManager.GetInstance().getCardListObjs(); _isAfterEvo = false; if (_followerCardObj != null) { UnityEngine.Object.Destroy(_followerCardObj.gameObject); } if (_spellCardObj != null) { UnityEngine.Object.Destroy(_spellCardObj.gameObject); } if (_amuletCardObj != null) { UnityEngine.Object.Destroy(_amuletCardObj.gameObject); } _scene = 0; _previousCenterCardId = -1; InstantiateCards(); } private void InstantiateCards() { for (int i = 0; i < _cardList.Count; i++) { GameObject cardObj = _cardList[i].CardObj; BoxCollider[] componentsInChildren = cardObj.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].enabled = false; } cardObj.transform.parent = CardOyaObj.transform; cardObj.transform.localPosition = new Vector3(0f, 0f, 0f); cardObj.transform.localPosition = MoveAngle(cardObj.transform.localPosition, i * (360 / _cardList.Count) + -90, 2650f); cardObj.transform.LookAt(CardOyaObj.transform); cardObj.SetActive(value: true); } SetCardTransform(); _scene++; } private IEnumerator DetailInit(int cardIndex = 0) { while (UIManager.GetInstance().getSelectCardListObjs() == null) { yield return null; } while (!CardLoadFinish) { yield return null; } while (MyPageMenu.Instance == null) { yield return null; } List selectCardListObjs = UIManager.GetInstance().getSelectCardListObjs(); _cardListAssetPath.AddRange(Toolbox.ResourcesManager.CardListAssetPathList); Toolbox.ResourcesManager.CardListAssetPathList.Clear(); Material uIBaseSleeveTexture = UIManager.GetInstance().getUIBase_CardManager().GetUIBaseSleeveTexture(); for (int i = 0; i < selectCardListObjs.Count; i++) { _currentCardType = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(selectCardListObjs[i].ids).CharType; if (_amuletCardObj == null && (_currentCardType == CardBasePrm.CharaType.FIELD || _currentCardType == CardBasePrm.CharaType.CHANT_FIELD)) { CardInitAmulet(i, selectCardListObjs, uIBaseSleeveTexture); } if (_spellCardObj == null && _currentCardType == CardBasePrm.CharaType.SPELL) { CardInitSpell(i, selectCardListObjs, uIBaseSleeveTexture); } if (_followerCardObj == null && _currentCardType == CardBasePrm.CharaType.NORMAL) { CardInitFollower(i, selectCardListObjs, uIBaseSleeveTexture); } if (_followerCardObj != null && _spellCardObj != null && _amuletCardObj != null) { break; } } for (int j = 0; j < selectCardListObjs.Count; j++) { UnityEngine.Object.Destroy(selectCardListObjs[j].CardObj); selectCardListObjs[j] = null; } settingCard(cardIndex); } private GameObject CardBaseInit(Transform card) { card.transform.localPosition = new Vector3(0f, 0f, 0f); card.transform.localScale = new Vector3(510f, 510f, 200f); card.transform.localEulerAngles = Vector3.zero; Transform obj = card.Find("CardBase"); obj.localPosition = Global.CARD_BASE_POS; obj.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT); obj.localScale = new Vector3(1f, 1f, 1f); Transform transform = card.Find("RotationOnlyIcon"); if (transform != null) { return transform.gameObject; } GameObject prefab = Resources.Load("Prefab/CardDeco/RotationOnlyIcon") as GameObject; return NGUITools.AddChild(card.gameObject, prefab); } private void CardInitAmulet(int i, List detailCards, Material BaseTexture) { GameObject gameObject = null; GameObject gameObject2 = null; Material material = null; ResourcesManager resourcesManager = Toolbox.ResourcesManager; Texture texture = null; Texture texture2 = null; _amuletCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); gameObject = _amuletCardObj; gameObject.gameObject.SetActive(value: true); gameObject.name = "AmmuletCard"; _amuletCardTransform = gameObject.transform; _amuletCostLabel = _amuletCardTransform.Find("Cost(Clone)/CostLabel").GetComponent(); _amuletCardTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); _amuletNameLabel = _amuletCardTransform.Find("Name(Clone)/NameLabel").GetComponent(); _amuletCardTransform.Find("Name(Clone)").gameObject.SetActive(value: true); MeshRenderer component = _amuletCardTransform.Find("CardBase").GetComponent(); component.material = BaseTexture; component.material.SetFloat("_CullMode", 2f); component.material.SetFloat("_ZWriteMode", 1f); _amuletRotationOnlyIcon = CardBaseInit(_amuletCardTransform); gameObject2 = _amuletCardTransform.Find("SpecularField").gameObject; material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("FieldCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Field_a_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Field_n_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); CardInitSpecular(gameObject2, material, texture, texture2); } private void CardInitSpell(int i, List detailCards, Material BaseTexture) { GameObject gameObject = null; GameObject gameObject2 = null; Material material = null; ResourcesManager resourcesManager = Toolbox.ResourcesManager; Texture texture = null; Texture texture2 = null; _spellCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); gameObject = _spellCardObj; gameObject.gameObject.SetActive(value: true); gameObject.name = "SpellCard"; _spellCardTransform = gameObject.transform; _spellCostLabel = _spellCardTransform.Find("Cost(Clone)/CostLabel").GetComponent(); _spellCardTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); _spellNameLabel = _spellCardTransform.Find("Name(Clone)/NameLabel").GetComponent(); _spellCardTransform.Find("Name(Clone)").gameObject.SetActive(value: true); MeshRenderer component = _spellCardTransform.Find("CardBase").GetComponent(); component.material = BaseTexture; component.material.SetFloat("_CullMode", 2f); component.material.SetFloat("_ZWriteMode", 1f); _spellRotationOnlyIcon = CardBaseInit(_spellCardTransform); gameObject2 = _spellCardTransform.Find("SpecularSpell").gameObject; material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("SpellCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Spell_a_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Spell_n_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); CardInitSpecular(gameObject2, material, texture, texture2); } private void CardInitFollower(int i, List detailCards, Material BaseTexture) { GameObject gameObject = null; GameObject gameObject2 = null; Material material = null; ResourcesManager resourcesManager = Toolbox.ResourcesManager; Texture texture = null; Texture texture2 = null; _followerCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); gameObject = _followerCardObj; gameObject.gameObject.SetActive(value: true); gameObject.name = "FollowerCard"; _followerTransform = gameObject.transform; _followerAtkLabel = _followerTransform.Find("Atk(Clone)/AtkLabel").GetComponent(); _followerAtkLabel.gameObject.SetActive(value: true); _followerTransform.Find("Atk(Clone)").gameObject.SetActive(value: true); _followerLifeLabel = _followerTransform.Find("Life(Clone)/LifeLabel").GetComponent(); _followerTransform.Find("Life(Clone)").gameObject.SetActive(value: true); _followerCostLabel = _followerTransform.Find("Cost(Clone)/CostLabel").GetComponent(); _followerTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); _followerNameLabel = _followerTransform.Find("Name(Clone)/NameLabel").GetComponent(); _followerTransform.Find("Name(Clone)").gameObject.SetActive(value: true); MeshRenderer component = _followerTransform.Find("CardBase").GetComponent(); component.material = BaseTexture; component.material.SetFloat("_CullMode", 2f); component.material.SetFloat("_ZWriteMode", 1f); _followerRotationOnlyIcon = CardBaseInit(_followerTransform); gameObject2 = _followerTransform.Find("SpecularUnit").gameObject; material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("UnitCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Unit_a_4", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Unit_n_4", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); CardInitSpecular(gameObject2, material, texture, texture2); } private void CardInitSpecular(GameObject specularObj, Material specularMaterial, Texture specularTexture0, Texture specularTexture1) { if (specularObj != null) { specularObj.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); specularMaterial.shader = Shader.Find(specularMaterial.shader.name); specularObj.GetComponent().material = specularMaterial; specularObj.GetComponent().material.SetTexture("_AOREFSPEC", specularTexture0); specularObj.GetComponent().material.SetTexture("_BumpMap", specularTexture1); specularObj.SetActive(value: true); specularObj.layer = 18; } } public bool canMyPageCardMove() { if (_followerCardObj == null && _spellCardObj == null && _amuletCardObj == null) { return false; } return true; } public void UpdateSelectCard() { if (_scene == 1) { int nowSelIndex = cardMoveManager.getNowSelIndex(); if (nowSelIndex > -1 && _oldIndex != nowSelIndex) { bool forceGraphicChange = IsAfterEvolution(_oldIndex); _oldIndex = nowSelIndex; settingCard(nowSelIndex, forceGraphicChange); } } } private void settingCard(int nowIndex, bool forceGraphicChange = false) { if (nowIndex >= _cardList.Count) { return; } int ids = _cardList[nowIndex].ids; if (_previousCenterCardId == ids && !forceGraphicChange) { return; } _previousCenterCardId = ids; CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(ids); CardDetail.UpdateCardData(cardParameterFromId.NormalCardId); _currentCardType = cardParameterFromId.CharType; if (_currentCardType == CardBasePrm.CharaType.NORMAL) { _isAfterEvo = false; _followerAtkLabel.text = _cardList[nowIndex].Atks; _followerLifeLabel.text = _cardList[nowIndex].lifes; _followerCostLabel.text = _cardList[nowIndex].Cost; _followerNameLabel.text = _cardList[nowIndex].Names; Global.SetRepositionNameLabel(_followerNameLabel, _cardList[nowIndex].Names, is2D: false); _followerCardObj.gameObject.SetActive(value: false); UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerAtkLabel, _cardList[nowIndex].isPremiere); UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerCostLabel, _cardList[nowIndex].isPremiere); UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerLifeLabel, _cardList[nowIndex].isPremiere); UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_followerNameLabel, _cardList[nowIndex].isPremiere); _followerCardObj.gameObject.SetActive(value: true); if (_spellCardObj != null) { _spellCardObj.gameObject.SetActive(value: false); } if (_amuletCardObj != null) { _amuletCardObj.gameObject.SetActive(value: false); } _followerRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); } else if (_currentCardType == CardBasePrm.CharaType.SPELL) { _spellNameLabel.text = _cardList[nowIndex].Names; Global.SetRepositionNameLabel(_spellNameLabel, _cardList[nowIndex].Names, is2D: false); _spellCostLabel.text = _cardList[nowIndex].Cost; _spellCardObj.gameObject.SetActive(value: false); UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_spellCostLabel, _cardList[nowIndex].isPremiere); UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_spellNameLabel, _cardList[nowIndex].isPremiere); _spellCardObj.gameObject.SetActive(value: true); if (_followerCardObj != null) { _followerCardObj.gameObject.SetActive(value: false); } if (_amuletCardObj != null) { _amuletCardObj.gameObject.SetActive(value: false); } _spellRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); } else if (_currentCardType == CardBasePrm.CharaType.FIELD || _currentCardType == CardBasePrm.CharaType.CHANT_FIELD) { _amuletNameLabel.text = _cardList[nowIndex].Names; Global.SetRepositionNameLabel(_amuletNameLabel, _cardList[nowIndex].Names, is2D: false); _amuletCostLabel.text = _cardList[nowIndex].Cost; _amuletCardObj.gameObject.SetActive(value: false); UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_amuletCostLabel, _cardList[nowIndex].isPremiere); UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_amuletNameLabel, _cardList[nowIndex].isPremiere); _amuletCardObj.gameObject.SetActive(value: true); if (_followerCardObj != null) { _followerCardObj.gameObject.SetActive(value: false); } if (_spellCardObj != null) { _spellCardObj.gameObject.SetActive(value: false); } _amuletRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); } Transform transform = _cardList[nowIndex].CardObj.transform; GameObject gameObject = null; LODGroup lODGroup = null; LODGroup lODGroup2 = null; switch (_currentCardType) { case CardBasePrm.CharaType.FIELD: case CardBasePrm.CharaType.CHANT_FIELD: gameObject = _amuletCardObj.gameObject; lODGroup = transform.GetComponent(); lODGroup2 = _amuletCardTransform.GetComponent(); break; case CardBasePrm.CharaType.NORMAL: gameObject = _followerCardObj.gameObject; lODGroup = transform.GetComponent(); lODGroup2 = _followerTransform.GetComponent(); break; case CardBasePrm.CharaType.SPELL: gameObject = _spellCardObj.gameObject; lODGroup = transform.GetComponent(); lODGroup2 = _spellCardTransform.GetComponent(); break; } LOD[] lODs = lODGroup2.GetLODs(); LOD[] lODs2 = lODGroup.GetLODs(); int num = lODs.Length; for (int i = 0; i < num; i++) { LOD lOD = lODs[i]; LOD lOD2 = lODs2[i]; lOD.renderers[0].sharedMaterials = lOD2.renderers[0].sharedMaterials; } gameObject.transform.localPosition = Vector3.zero; } public void SetCardTransform() { for (int i = 0; i < _cardList.Count; i++) { float num = ((!(_cardList[i].CardObj.transform.position.z < -7.3f)) ? 0f : MotionUtils.GetEase(Mathf.Abs(_cardList[i].CardObj.transform.position.z + 7.3f), MotionUtils.EaseType.easeInExpo)); _cardList[i].CardObj.transform.localPosition = new Vector3(_cardList[i].CardObj.transform.localPosition.x, 100f * num, _cardList[i].CardObj.transform.localPosition.z); _cardList[i].CardObj.transform.localScale = CARD_SCALE_NORMAL + (CARD_SCALE_BIG - CARD_SCALE_NORMAL) * num; } } public void PlayCardRotationAnime(int index, bool isRightRotate) { StartCoroutine(RunCardRotationAnime(index, isRightRotate)); } private IEnumerator RunCardRotationAnime(int index, bool isRightRotate) { CardDetail.ResetAngleCardObj(); yield return null; if (isRightRotate) { CardDetailTweenObj.transform.rotation = Quaternion.Euler(new Vector3(CardDetailTweenObj.transform.rotation.x, -90f, CardDetailTweenObj.transform.rotation.z)); iTween.RotateTo(CardDetailTweenObj.gameObject, iTween.Hash("y", 0f, "time", 1.5f, "easetype", iTween.EaseType.easeOutExpo)); } else { CardDetailTweenObj.transform.rotation = Quaternion.Euler(new Vector3(CardDetailTweenObj.transform.rotation.x, 90f, CardDetailTweenObj.transform.rotation.z)); iTween.RotateTo(CardDetailTweenObj.gameObject, iTween.Hash("y", 0f, "time", 1.5f, "easetype", iTween.EaseType.easeOutExpo)); } } public void ChangeEvoDisplay(int index) { if (isEvo(index) && index < _cardList.Count && index > -1) { LOD[] lODs = _followerTransform.GetComponent().GetLODs(); Material[] materials = lODs[0].renderers[0].materials; CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(_cardList[index].ids); if (!_isAfterEvo) { _isAfterEvo = true; _followerCostLabel.text = _cardList[index].Evo_Costs; _followerLifeLabel.text = _cardList[index].Evo_lifes; _followerAtkLabel.text = _cardList[index].Evo_Atks; _followerNameLabel.text = _cardList[index].Evo_Names; materials[1] = Toolbox.ResourcesManager.FindCardMaterial(cardParameterFromId.ResourceCardId, ResourcesManager.AssetLoadPathType.UnitCardMaterial, isEvol: true); } else { _isAfterEvo = false; _followerCostLabel.text = _cardList[index].Cost; _followerLifeLabel.text = _cardList[index].lifes; _followerAtkLabel.text = _cardList[index].Atks; _followerNameLabel.text = _cardList[index].Names; materials[1] = Toolbox.ResourcesManager.FindCardMaterial(cardParameterFromId.ResourceCardId, ResourcesManager.AssetLoadPathType.UnitCardMaterial); } materials[2] = CardCreatorBase.GetSharedClassIconMaterial(_cardList[index].clan); LOD[] array = lODs; for (int i = 0; i < array.Length; i++) { Renderer renderer = array[i].renderers[0]; materials[0] = renderer.materials[0]; renderer.sharedMaterials = materials; } } } public bool IsAfterEvolution(int index) { return _isAfterEvo; } public bool isEvo(int index) { if (_cardList == null || index >= _cardList.Count || index <= -1) { return false; } return _cardList[index].EvolOk; } private Vector3 MoveAngle(Vector3 my, float angle, float speed) { float num = Mathf.Cos(angle * (float)Math.PI / 180f) * speed; float num2 = Mathf.Sin(angle * (float)Math.PI / 180f) * speed; return new Vector3(my.x + num, my.y, my.z + num2); } public List getCardList() { return _cardList; } private void OnDestroy() { CardAllDelete(); } private void CardAllDelete() { Toolbox.ResourcesManager.RemoveAssetGroup(_cardListAssetPath); _cardListAssetPath.Clear(); foreach (UIBase_CardManager.CardObjData card in _cardList) { UnityEngine.Object.Destroy(card.CardObj); } for (int i = 0; i < _cardList.Count; i++) { _cardList[i] = null; } _cardList = new List(); UnityEngine.Object.Destroy(_followerCardObj); _followerCardObj = null; UnityEngine.Object.Destroy(_spellCardObj); _spellCardObj = null; } public void MoveInCameraCard() { SaveCameraFirstPosition(); CameraCard.transform.localPosition = _cameraCardPos + Vector3.up * 2000f; iTween.MoveTo(CameraCard.gameObject, iTween.Hash("position", _cameraCardPos, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); } private DeckData GetLastBattleDeck(out Format format) { bool num = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_DEFAULT_DECK_FOR_MYPAGE); int lastDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_ID_FOR_MYPAGE); Format format2 = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_FORMAT_FOR_MYPAGE); if (format2 == Format.Max || format2 == Format.Hof || format2 == Format.Avatar) { format2 = Format.Unlimited; } if (num) { format = Format.Max; DeckData deckData = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).FirstOrDefault((DeckData deck) => deck.GetDeckID() == lastDeckId); if (deckData != null) { return deckData; } int classOffsetId = lastDeckId + 90; deckData = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).FirstOrDefault((DeckData deck) => deck.GetDeckID() == classOffsetId); if (deckData != null) { return deckData; } } else { format = format2; List list = JsonMapper.ToObject>(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_CARD_LIST)); long result; bool flag = long.TryParse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_SLEEVE_ID), out result); bool flag2 = false; if (list != null && list.Count == 40 && flag) { flag2 = true; } DeckData deckData2 = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.CustomDeck, format2).FirstOrDefault((DeckData deck) => deck.GetDeckID() == lastDeckId); if (deckData2 != null && deckData2.IsDisplayable()) { if (flag2) { long.TryParse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_SLEEVE_ID), out result); list = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list, CardMaster.CardMasterId.Default); deckData2.SetCardIdList(list); deckData2.SetDeckSleeveID(result); deckData2.SetDeckIsComplete(isComplete: true); } return deckData2; } } return null; } public int GetDetailCardCount() { return _circleViewCardList.Count; } private void Update() { switch (_cardViewState) { case 0: { UIManager.GetInstance().CreatFadeBlack(); if (!UIManager.GetInstance().IsWizardSetupFinish() || _deckGroupListData == null) { break; } UIManager.GetInstance().Force_Increment_LockCountChangeView(); _cardViewState++; DeckData lastBattleDeck = GetLastBattleDeck(out var format); if (lastBattleDeck != null) { UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, lastBattleDeck, _circleCardLayer); break; } lastBattleDeck = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.CustomDeck, format).FirstOrDefault(); if (lastBattleDeck != null && lastBattleDeck.IsDisplayable()) { UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, lastBattleDeck, _circleCardLayer); } else { UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).First(), _circleCardLayer); } break; } case 1: { if (!UIManager.GetInstance().isCardCreatEnd()) { break; } _cardViewState++; initCard(); List cardListObjs = UIManager.GetInstance().getCardListObjs(); _circleViewCardList = new List(); bool flag = false; bool flag2 = false; bool flag3 = false; for (int i = 0; i < cardListObjs.Count; i++) { CardBasePrm.CharaType charType = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardListObjs[i].ids).CharType; if (!flag && charType == CardBasePrm.CharaType.SPELL) { _circleViewCardList.Add(cardListObjs[i].ids); flag = true; } if (!flag2 && charType == CardBasePrm.CharaType.NORMAL) { _circleViewCardList.Add(cardListObjs[i].ids); flag2 = true; } if (!flag3 && (charType == CardBasePrm.CharaType.FIELD || charType == CardBasePrm.CharaType.CHANT_FIELD)) { _circleViewCardList.Add(cardListObjs[i].ids); flag3 = true; } if (flag2 && flag && flag3) { break; } } UIManager.GetInstance().CardLoadSelect(base.gameObject, _circleViewCardList, _circleCardLayer, is2D: false, null, isDefaultSleeve: true); break; } case 2: if (UIManager.GetInstance().isCardCreatEnd()) { _cardViewState++; UIManager.GetInstance().Force_Decrement_LockCountChangeView(); StartCoroutine(DetailInit(cardMoveManager.getNowSelIndex())); } break; } } public void LoadDeckInfo(Action onFinish = null) { _deckGroupListData = null; DeckInfoTask task = new DeckInfoTask(); task.SetParameter(Format.All); UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate { _deckGroupListData = task.DeckGroupListData; onFinish.Call(); })); } public void ReloadCardCircle() { if (_cardViewState == 3) { LoadDeckInfo(); CardAllDelete(); _cardViewState = 0; } } }