...
class test : IRLMonoBehaviour
{
...
//主工程调用到热更新层 OnAwake
protected override void OnAwake()
{
...
//加入update注册
ILRuntimeWrapper.Instance.RegistUpdate(Update);
...
}
//主工程调用到热更新层 OnClose
public override void OnClose()
{
//关闭update方法注册
ILRuntimeWrapper.Instance.RemoveUpdate(Update);
}
...
public void startCountDown(string str,int time_)//time_秒数,可以改为float变量
{
Debug.Log("test startCountDown time1:" + time);
time = time_*50;//update每帧 大约为 0.02秒,20ms
Debug.Log("test startCountDown time2:" + time);
if (time > 0)
{
text.text = str;
}
}
//UI层注册update方法
void Update()
{
Debug.Log("test startCountDown Update time:" + time);
//Debug.Log("测试update的调用");
if (time == -11)
{
return;
}
if (time > 0)
{
Debug.Log("test startCountDown Update time:" + time+ "/time:" + Time.time+ "/deltaTime:" + Time.deltaTime);
time--;
}
else
{//执行倒计时 完毕 的事件
Debug.Log("test startCountDown 完毕");
}
}
...
}
|