Files
SVSimServer/SVSim.BattleEngine/Engine/MyPageItem.cs

100 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using Cute;
using UnityEngine;
public class MyPageItem : MonoBehaviour
{
[SerializeField]
private MyPageCardPanelAnimation _cardMove;
[SerializeField]
private MyPageCardPanel[] _cardPanelList;
private MyPageMenu _parent;
private bool cardAnimationInitialized;
protected MyPageCardPanelAnimation CardAnimation => _cardMove;
protected MyPageMenu Parent => _parent;
public bool IsEnableFooterCurrentMenu { get; set; }
public virtual void Initialize(MyPageMenu parent)
{
_parent = parent;
SaveCardPanelDefaultPosition();
if (cardAnimationInitialized)
{
return;
}
cardAnimationInitialized = true;
if (_cardMove != null)
{
GameObject[] array = new GameObject[_cardPanelList.Length];
for (int i = 0; i < _cardPanelList.Length; i++)
{
array[i] = _cardPanelList[i].gameObject;
}
_cardMove.SetCardPanelList(array);
}
}
public virtual void Show(bool skipCardAnimation = false)
{
base.gameObject.SetActive(value: true);
IsEnableFooterCurrentMenu = false;
}
public virtual void Hide()
{
base.gameObject.SetActive(value: false);
}
protected void SaveCardPanelDefaultPosition()
{
int num = _cardPanelList.Length;
if (num > 0)
{
Vector3[] array = new Vector3[num];
for (int i = 0; i < num; i++)
{
array[i] = _cardPanelList[i].SavePosition();
}
CardAnimation.UpdateCardPanelDefaultPosition(array);
}
}
public virtual void OnMyPageInfoReceive()
{
if (_cardPanelList == null)
{
return;
}
for (int i = 0; i < _cardPanelList.Length; i++)
{
if (_cardPanelList[i] != null)
{
_cardPanelList[i].CheckMaintenanceType();
}
}
}
protected void RemoveITween(GameObject obj)
{
iTween component = obj.GetComponent<iTween>();
if (component != null)
{
UnityEngine.Object.Destroy(component);
}
}
protected static void FadeOutObject(UITweenAlpha tweenAlpha, Action onFinish = null)
{
tweenAlpha.End();
FadeUtility.FadeOutObject(tweenAlpha, onFinish);
}
}