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().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); } } } 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); } } }