| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- 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<string, Transform> 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<TMP_Text>();
- // 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<string, System.Action<bool>>
- // {
- // { "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<SettingsView>();
- ViewManager.HideView(UIViewType.SettingsView);
- return true;
- }
- }
- }
|