using System.Collections; using System.Collections.Generic; using UnityEngine; public class SportsPanel : MonoBehaviour { public static SportsPanel Instance; private void Awake() { Instance = this; } private void OnDestroy() { Instance = null; } public enum SportsType { Invalid = -1, FactionChallenge = 0, Yanwu, Guild, Digong, Pvp } private void OnEnable() { ShowDefaultFirst(); } void ShowDefaultFirst() { if(_CurSelectType == SportsType.Invalid) OnMenuItemClick(0); } public List _MarkIconList; public GameObject _FactionChanllengePanel; public GameObject _SoprtsCommonPanel; public GameObject _PvpPanel; public CommonSportsPanel _CommnSoportsPanelScript; public void OnMenuItemClick(int type) { if (_CurSelectType == (SportsType)type) return; _CurSelectType = (SportsType)type; for (int index = 0; index < _MarkIconList.Count; index++) { _MarkIconList[index].SetActive(index == type); } ShowPanel(_CurSelectType); } private SportsType _CurSelectType = SportsType.Invalid; public void ShowPanel(SportsType type) { // Debug.LogError("ShowPanel : " + (SportsType)type) ; if(type != SportsType.Invalid) _CurSelectType = type; switch(_CurSelectType) { case SportsType.FactionChallenge: { _FactionChanllengePanel.SetActive(true); _SoprtsCommonPanel.SetActive(false); _PvpPanel.SetActive(false); } break; case SportsType.Pvp: { _FactionChanllengePanel.SetActive(false); _SoprtsCommonPanel.SetActive(false); _PvpPanel.SetActive(true); } break; default: { _FactionChanllengePanel.SetActive(false); _SoprtsCommonPanel.SetActive(true); _PvpPanel.SetActive(false); _CommnSoportsPanelScript.ShowPanel(_CurSelectType); } break; } } public void OnHelpSprite() { } public void OnCloseBtn() { UIManager.CloseUI(UIInfo.SportsPanel); } }