using System.Collections; using System.Collections.Generic; using UnityEngine; namespace SFramework { public class SUIPanelTips : SUIObjectBase { private GameObject _textTitle; private GameObject _textInfo; System.Action _clickYesCallBack; System.Action _clickNoCallBack; public override void UI_Awake() { Debug.Log("SUIPanelTips -> Awake()"); GameObject rootCanvas = GameObject.Find("Canvas_Update(Clone)"); Debug.Assert(rootCanvas != null); _rootPanel = rootCanvas.transform.Find("Panel_Tips").gameObject; Debug.Assert(_rootPanel != null); _textTitle = GetSubUI("Text_Title"); _textInfo = GetSubUI("Text_Info"); _rootPanel.SetActive(false); } public override void UI_Start() { } public override void UI_RefreshInfo() { _textTitle.GetComponent().text = "UpdateTips"; _textInfo.GetComponent().text = "Prepare For Update."; } public override void UI_BindTouchEvent() { BindButtonClick("Button_Yes", onClickButtonYes); BindButtonClick("Button_No", onClickButtonNo); } private void onClickButtonYes(GameObject buttonObject) { Debug.Log("SUIPanelTips -> onClickButtonYes"); _rootPanel.SetActive(false); if (_clickYesCallBack != null) { _clickYesCallBack(); _clickYesCallBack = null; } } private void onClickButtonNo(GameObject buttonObject) { Debug.Log("SUIPanelTips -> onClickButtonNo"); _rootPanel.SetActive(false); if (_clickNoCallBack != null) { _clickNoCallBack(); _clickNoCallBack = null; } } public void ShowTips(string tipsTitle, string tipsInfo, System.Action yesAction, System.Action noAction) { _rootPanel.SetActive(true); _textTitle.GetComponent().text = tipsTitle; _textInfo.GetComponent().text = tipsInfo; _clickYesCallBack = yesAction; _clickNoCallBack = noAction; } } }