您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
727 B
33 行
727 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace HuaweiServiceDemo
|
|
{
|
|
public class TestBtn : MonoBehaviour
|
|
{
|
|
public Text t;
|
|
public Button btn;
|
|
|
|
public void Init(string text,UnityAction action)
|
|
{
|
|
t.text = text;
|
|
btn.onClick.AddListener(()=>{tryAction(action);});
|
|
}
|
|
|
|
public static void tryAction(UnityAction action)
|
|
{
|
|
try
|
|
{
|
|
action.Invoke();
|
|
}
|
|
catch (System.Exception e)
|
|
{
|
|
TestTip.Inst.ShowText(e.ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|