using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class RankingView : MonoBehaviour, MenuBackInterface { [SerializeField] Transform panelLeftContent; void Start() { PersistenHandler.ins?.menuBackCtr.views.Add(this); } void OnDestroy() { PersistenHandler.ins?.menuBackCtr.views.Remove(this); } public bool OnMenuBack() { ViewManager2.HideView(ViewManager2.Path_RankingView); return true; } public void OnClick_PanelLeftItem(Transform target) { foreach (Transform item in panelLeftContent) { if (item == target) { item.Find("Text").GetComponent().fontStyle = FontStyle.Bold; item.Find("Text").GetComponent().color = Color.white; bool oldActive = item.Find("LightMask").gameObject.activeSelf; item.Find("LightMask").gameObject.SetActive(true); if (!oldActive) { AudioMgr.ins.PlayBtn(); ShowBox(item.name); } } else { item.Find("Text").GetComponent().fontStyle = FontStyle.Normal; item.Find("Text").GetComponent().color = Color.gray; item.Find("LightMask").gameObject.SetActive(false); } } } int _btnIndex = 0; public int currentBtnIndex { get => _btnIndex; } void ShowBox(string itemName) { if (itemName == "BtnGlobalRanking") _btnIndex = 0; else if (itemName == "BtnCountryRanking") _btnIndex = 1; RefreshBoxRankList(); } public void RefreshBoxRankList() { GetComponentInChildren().Refresh(); } public void OnClick_Back() { AudioMgr.ins.PlayBtn(); ViewManager2.HideView(ViewManager2.Path_RankingView); } }