using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using SmartBow; using TMPro; using AppUI.Manager.View; namespace AppUI.View.Home.SettingsView { public class SettingsView : MonoBehaviour, MenuBackInterface { //[SerializeField] Transform panelLeftContent; // Start is called before the first frame update void Start() { PersistenHandler.ins?.menuBackCtr.views.Add(this); } void OnDestroy() { PersistenHandler.ins?.menuBackCtr.views.Remove(this); } public void OnClick_Back() { AudioMgr.ins.PlayBtn(); ViewManager.HideView(UIViewType.SettingsView); } //void SortChildObjects(Dictionary actionMap) //{ // // 查找子对象并按名称填充 actionMap // foreach (Transform child in panelLeftContent) // { // if (actionMap.ContainsKey(child.name)) // { // actionMap[child.name] = child; // } // else // { // // 如果子对象不在 actionMap 中,则隐藏它 // child.gameObject.SetActive(false); // } // } // // 获取按字典定义顺序的子对象列表(过滤掉未找到的对象) // var sortedChildren = actionMap.Values.Where(child => child != null).ToList(); // // 重新排列子对象 // for (int i = 0; i < sortedChildren.Count; i++) // { // sortedChildren[i].SetSiblingIndex(i); // } //} // Update is called once per frame void Update() { } //public void OnClick_PanelLeftItem(Transform target) //{ // foreach (Transform item in panelLeftContent) // { // if (item.name == "BtnSignOut") continue; // TMP_Text text = item.Find("Text").GetComponent(); // if (item == target) // { // Color oldColor = text.color; // if (oldColor != Color.white) // { // text.color = Color.white; // AudioMgr.ins.PlayBtn(); // ShowBox(item.name); // } // } // else // { // text.color = new Color32(153, 153, 153, 255); // } // } //} //void ShowBox(string itemName) //{ // // 定义所有 ShowBox 方法,并将初始状态设为 false // var actionMap = new Dictionary> // { // { "BtnCommon", ShowBoxCommon }, // { "BtnBows", ShowBoxBows } // }; // // 先将所有状态设为 false // foreach (var action in actionMap.Values) // { // action(false); // } // // 将指定的 itemName 对应的按钮设为 true // if (actionMap.TryGetValue(itemName, out var selectedAction)) // { // selectedAction(true); // } //} //public void ShowBoxCommon(bool show) //{ // transform.Find("PanelContent/BoxCommon").gameObject.SetActive(show); //} //void ShowBoxBows(bool show) //{ // transform.Find("PanelContent/BoxBows").gameObject.SetActive(show); //} public bool OnMenuBack() { //ViewManager2.HideView(); ViewManager.HideView(UIViewType.SettingsView); return true; } } }