| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- namespace SmartBow
- {
- public class SettingsView : MonoBehaviour, MenuBackInterface
- {
- [SerializeField] Transform panelLeftContent;
- [SerializeField] Transform BtnNewUserObj;
- [SerializeField] Text GameVersionText;
- void Start()
- {
- PersistenHandler.ins?.menuBackCtr.views.Add(this);
- //ShowBoxSound(true);
- if (CommonConfig.bInfraredApp) {
- //隐藏弓到屏幕的距离
- foreach (Transform item in panelLeftContent)
- {
- if (item.name == "BtnScreenDistance") {
- item.gameObject.SetActive(false);
- }
- }
- ShowBoxScreenDistance(false);
- }
- }
- void OnDestroy()
- {
- PersistenHandler.ins?.menuBackCtr.views.Remove(this);
- }
- public bool OnMenuBack()
- {
- ViewManager2.HideView(ViewManager2.Path_SettingsView);
- return true;
- }
- //模拟点击新手教程按钮
- public void OnClick_BtnNewUser() {
- this.OnClick_PanelLeftItem(BtnNewUserObj.transform);
- }
- public void OnClick_PanelLeftItem(Transform target)
- {
- foreach (Transform item in panelLeftContent)
- {
- if (item.name == "BtnSignOut") continue;
- 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);
- }
- }
- }
- void ShowBox(string itemName)
- {
- ShowBoxSound(itemName == "BtnSound");
- ShowBoxLevel(itemName == "BtnLevel");
- ShowBoxNewUser(itemName == "BtnNewUser");
- if (!CommonConfig.bInfraredApp)ShowBoxScreenDistance(itemName == "BtnScreenDistance");
- ShowBoxLanguage(itemName == "BtnLanguage");
- ShowBoxUserAgreement(itemName == "BtnUserAgreement");
- ShowBoxPrivacyPolicy(itemName == "BtnPrivacyPolicy");
- ShowBoxAboutUs(itemName == "BtnAboutUs");
- }
- public void ShowBoxSound(bool show)
- {
- transform.Find("PanelContent/BoxSound").gameObject.SetActive(show);
- }
- void ShowBoxLevel(bool show)
- {
- transform.Find("PanelContent/BoxLevel").gameObject.SetActive(show);
- }
- void ShowBoxNewUser(bool show)
- {
- transform.Find("PanelContent/BoxNewUser").gameObject.SetActive(show);
- }
- void ShowBoxScreenDistance(bool show)
- {
- transform.Find("PanelContent/BoxScreenDistance").gameObject.SetActive(show);
- }
- void ShowBoxLanguage(bool show)
- {
- transform.Find("PanelContent/BoxLanguage").gameObject.SetActive(show);
- }
- void ShowBoxUserAgreement(bool show)
- {
- transform.Find("PanelContent/BoxUserAgreement").gameObject.SetActive(show);
- }
- void ShowBoxPrivacyPolicy(bool show)
- {
- transform.Find("PanelContent/BoxPrivacyPolicy").gameObject.SetActive(show);
- }
- void ShowBoxAboutUs(bool show)
- {
- transform.Find("PanelContent/BoxAboutUs").gameObject.SetActive(show);
- GameVersionText.text = "V" + Application.version;
- }
- public void ShowModalConfirmSignOut(bool show)
- {
- transform.Find("ModalConfirmSignOut").gameObject.SetActive(show);
- }
- public void OnClick_QuitGame()
- {
- AudioMgr.ins.PlayBtn();
- Application.Quit();
- }
- public void OnClick_SignOut()
- {
- AudioMgr.ins.PlayBtn();
- ShowModalConfirmSignOut(true);
- }
- public void OnClick_Back()
- {
- AudioMgr.ins.PlayBtn();
- ViewManager2.HideView(ViewManager2.Path_SettingsView);
- }
-
- }
- }
|