| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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<Text>().fontStyle = FontStyle.Bold;
- item.Find("Text").GetComponent<Text>().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<Text>().fontStyle = FontStyle.Normal;
- item.Find("Text").GetComponent<Text>().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<BoxRankList>().Refresh();
- }
- public void OnClick_Back()
- {
- AudioMgr.ins.PlayBtn();
- ViewManager2.HideView(ViewManager2.Path_RankingView);
- }
- }
|