1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using ShadowStudio.Model;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- using XRTool.WorldUI;
- namespace ShadowStudio.UI
- {
- [RequireComponent(typeof(WorldDlg))]
- public class PiZhuDlg : UnitySingleton<PiZhuDlg>
- {
- private Transform piZhuGroupTran;
- private ToggleGroup piZhuGroup;
- // Start is called before the first frame update
- void Start()
- {
- WorldDlg dlg = GetComponent<WorldDlg>();
- piZhuGroupTran = dlg.GetBreadthChild<Transform>("PiZhuGroup");
- piZhuGroup = dlg.GetBreadthChild<ToggleGroup>("PiZhuGroup");
- Toggle[] toggles = piZhuGroupTran.GetComponentsInChildren<Toggle>(true);
- for (int i = 0; i < toggles.Length; i++)
- {
- Toggle toggle = toggles[i];
- toggles[i].onValueChanged.AddListener((bool isOn) => { OnToggle(isOn, toggle); });
- }
- }
- private void OnToggle(bool isOn, Toggle toggle)
- {
- if (isOn)
- {
- switch (toggle.name)
- {
- case "Up":
- NotePadComponent.CreateLocalNotePad();
- //Debug.Log(toggle.name);
- break;
- case "Down":
- Debug.Log(toggle.name);
- break;
- case "Left":
- Debug.Log(toggle.name);
- break;
- case "Right":
- Debug.Log(toggle.name);
- break;
- case "RightUp":
- Debug.Log(toggle.name);
- break;
- }
- }
- if (!piZhuGroup.AnyTogglesOn())
- {
- gameObject.SetActive(false);
- }
- }
- }
- }
|