using System; using System.Collections; using System.Collections.Generic; using TMPro; // using TTSDK; // using TTSDK.UNBridgeLib.LitJson; using UnityEngine; using UnityEngine.UI; public class TitlePanel : MonoBehaviour { [SerializeField] private Button _button; [SerializeField] private GameObject _openButton; [SerializeField] private Button _closeButton; [SerializeField] private bool open = false; [SerializeField] private TextMeshProUGUI textPro; [SerializeField] private TextMeshProUGUI buttonText; // Start is called before the first frame update void Start() { textPro.text = "进入侧边栏降低难度"; } private void OnEnable() { _button.onClick.AddListener(ButtonEvent); _closeButton.onClick.AddListener(CloseEvent); } // Update is called once per frame void Update() { } private void OnDisable() { _button.onClick.RemoveListener(ButtonEvent); _closeButton.onClick.AddListener(CloseEvent); } void CloseEvent() { gameObject.SetActive(false); } void ButtonEvent() { if (open) { CloseEvent(); return; } // JsonData data = new JsonData // { // ["scene"] = "sidebar", // }; // TT.NavigateToScene(data, // () => // { // Debug.LogError("打开侧边栏成功"); // }, // () => // { // open = true; // _openButton.SetActive(false); // textPro.text = "难度已降低"; // buttonText.text = "领取奖励"; // }, // (errCode, errMsg) => // { // Debug.Log($"打开侧边栏失败, errCode:{errCode}, errMsg:{errMsg}"); // }); } }