158 lines
4.6 KiB
C#
158 lines
4.6 KiB
C#
/*-------------------------------------------------------------------------------------
|
|
--- 创建人:
|
|
--- 描 述:
|
|
--- 创建时间: 2024年10月17日
|
|
-------------------------------------------------------------------------------------*/
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using CaoCao.Runtime;
|
|
using System.Text;
|
|
|
|
namespace Game.HotFix
|
|
{
|
|
|
|
/// <summary>
|
|
/// xx 功能界面
|
|
/// </summary>
|
|
public class TestUI : UIBase
|
|
{
|
|
//UIAutoBuild_CtrlDefine
|
|
public TMP_InputField tiptInput;
|
|
public Button btnTipChoice;
|
|
public Button btnTipDialog;
|
|
public Button btnTipHint;
|
|
public Button btnTipLeftHint;
|
|
public Button btnTipNotRemine;
|
|
public Button btnTipWait;
|
|
public Button btnDaYinLuBanTab;
|
|
public UIInputNumChange numcCount;
|
|
//UIAutoBuild_CtrlDefine
|
|
|
|
|
|
public override void Awake()
|
|
{
|
|
//UIAutoBuild_CtrlBind
|
|
base.Awake();
|
|
Transform tf = transform;
|
|
tiptInput = tf.Find("tiptInput").GetComponent<TMP_InputField>();
|
|
btnTipChoice = tf.Find("btnTipChoice").GetComponent<Button>();
|
|
btnTipDialog = tf.Find("btnTipDialog").GetComponent<Button>();
|
|
btnTipHint = tf.Find("btnTipHint").GetComponent<Button>();
|
|
btnTipLeftHint = tf.Find("btnTipLeftHint").GetComponent<Button>();
|
|
btnTipNotRemine = tf.Find("btnTipNotRemine").GetComponent<Button>();
|
|
btnTipWait = tf.Find("btnTipWait").GetComponent<Button>();
|
|
btnDaYinLuBanTab = tf.Find("btnDaYinLuBanTab").GetComponent<Button>();
|
|
numcCount = tf.Find("numcCount").GetComponent<UIInputNumChange>();
|
|
//UIAutoBuild_CtrlBind
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
//UIAutoBuild_EventReg
|
|
btnTipChoice.onClick.AddListener(OnBtnTipChoiceClick);
|
|
btnTipDialog.onClick.AddListener(OnBtnTipDialogClick);
|
|
btnTipHint.onClick.AddListener(OnBtnTipHintClick);
|
|
btnTipLeftHint.onClick.AddListener(OnBtnTipLeftHintClick);
|
|
btnTipNotRemine.onClick.AddListener(OnBtnTipNotRemineClick);
|
|
btnTipWait.onClick.AddListener(OnBtnTipWaitClick);
|
|
btnDaYinLuBanTab.onClick.AddListener(OnBtnDaYinLuBanTabClick);
|
|
//UIAutoBuild_EventReg
|
|
|
|
PanelInit();
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
//UIAutoBuild_EventUnReg
|
|
btnTipChoice.onClick.RemoveAllListeners();
|
|
btnTipDialog.onClick.RemoveAllListeners();
|
|
btnTipHint.onClick.RemoveAllListeners();
|
|
btnTipLeftHint.onClick.RemoveAllListeners();
|
|
btnTipNotRemine.onClick.RemoveAllListeners();
|
|
btnTipWait.onClick.RemoveAllListeners();
|
|
btnDaYinLuBanTab.onClick.RemoveAllListeners();
|
|
//UIAutoBuild_EventUnReg
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
}
|
|
|
|
// 每次显示都执行, 可定义参数
|
|
public override void Show(params object[] _params)
|
|
{
|
|
base.Show(_params);
|
|
|
|
}
|
|
|
|
void PanelInit()
|
|
{
|
|
numcCount.SetMaxNumAndMinNum(10000, 1);
|
|
numcCount.IptNumShow.text = "1";
|
|
}
|
|
|
|
private void OnBtnTipChoiceClick()
|
|
{
|
|
HotfixEntry.Tips.ShowChoice(tiptInput.text, () =>
|
|
{
|
|
Log.Debug("点击了 BtnTipChoice");
|
|
});
|
|
}
|
|
|
|
private void OnBtnTipDialogClick()
|
|
{
|
|
HotfixEntry.Tips.ShowDialog(tiptInput.text);
|
|
Log.Debug("点击了 BtnTipDialog");
|
|
}
|
|
|
|
private void OnBtnTipHintClick()
|
|
{
|
|
int tNum = Random.Range(1, 10);
|
|
string tStr = $"{tiptInput.text}*****{tNum}";
|
|
HotfixEntry.Tips.ShowHint(tStr);
|
|
Log.Debug("点击了 BtnTipHint");
|
|
}
|
|
|
|
private void OnBtnTipLeftHintClick()
|
|
{
|
|
int tNum = Random.Range(1, 10);
|
|
string tStr = $"{tiptInput.text}*****{tNum}";
|
|
HotfixEntry.Tips.ShowLeftHint(tStr);
|
|
Log.Debug("点击了 BtnTipLeftHint");
|
|
}
|
|
|
|
private void OnBtnTipNotRemineClick()
|
|
{
|
|
HotfixEntry.Tips.ShowNotRemindAgain(tiptInput.text, NotRemindAgainType.Type1, ()=>
|
|
{
|
|
Log.Debug("点击了 BtnTipNotRemine");
|
|
});
|
|
}
|
|
|
|
private void OnBtnTipWaitClick()
|
|
{
|
|
HotfixEntry.Tips.ShowWait(tiptInput.text, 5);
|
|
Log.Debug("点击了 BtnTipWait");
|
|
}
|
|
|
|
|
|
void OnBtnDaYinLuBanTabClick()
|
|
{
|
|
var tDa1 = HotfixEntry.Luban.GetTestMap();
|
|
|
|
Log.Debug("点击了 BtnDaYinLuBanTab");
|
|
|
|
StringBuilder tStr = new StringBuilder();
|
|
tStr.Append($"********* TestMap: \n");
|
|
foreach (var item in tDa1)
|
|
{
|
|
tStr.Append($"Id: {item.Value.Id} , Data: {item.Value.Tab1}\n");
|
|
}
|
|
Log.Debug(tStr.ToString());
|
|
}
|
|
}
|
|
}
|