Files
JJBB/Assets/Project/Script/GUI/VIP/PrivilegeVipRoot.cs

87 lines
1.8 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PrivilegeVipRoot : MonoBehaviour {
private static int defaultPageIndex = 1;
public static int DefaultPageIndex
{
set
{
if(value >= 1 && value < 3)
{
defaultPageIndex = value;
}
}
}
public GameObject _menuItemMarkIcon;
public Text _remainTimes;
public static PrivilegeVipRoot Instance;
private void Awake()
{
Instance = this;
}
private void OnDestroy()
{
Instance = null;
}
#region
public List<GameObject> _PanelList;
public List<GameObject> _MenuItemMarkIconList;
#endregion
public enum PRIVILEGE_VIP_TYPE
{
SHABI = -1,
Sliver = 1,
Gloden,
Diamond,
}
private void OnEnable()
{
ShowDefaultFirst();
}
private void ShowDefaultFirst()
{
OnMenuItemClick(defaultPageIndex);
defaultPageIndex = 1;
ShowMarkIconAndRemainTime(GlobalData.PrivilegeVipCanGetRewCount);
}
private void OnDisable()
{
_CurSelectIndex = -1;
}
private int _CurSelectIndex = -1;
public void OnMenuItemClick(int _Index)
{
if(_Index == _CurSelectIndex)
{
return;
}
_CurSelectIndex = _Index;
for(int index = 0; index < _PanelList.Count; index++)
{
_PanelList[index].SetActive(index == _Index);
_MenuItemMarkIconList[index].SetActive(index == _Index);
}
}
public void ShowMarkIconAndRemainTime(int state)
{
_menuItemMarkIcon.SetActive(state > 0);
//_remainTimes.text = (state >= 99 ? 99 : state).ToString();
}
}