Skip to content

UIFrame 1.1.7

Compare
Choose a tag to compare
@feifeid47 feifeid47 released this 17 Mar 03:22
· 3 commits to main since this release

Added

  • 新增Timer定时器属性
// 实现一
class TestUI : UIBase
{
    private UITimer timer = null;

    protected override void OnBind()
    {
        timer = UIFrame.CreateTimer(delay: 1, UpdateEverySecond, isLoop: true);
    }

    protected override void OnUnbind()
    {
        timer.Cancel();
    }

    private void UpdateEverySecond()
    {
        // 每秒更新
    }
}
// 上面的代码可以使用UITimer属性,简化成下面的
// 实现二
class TestUI: UIBase
{
    [UITimer(delay: 1f, isLoop: true)]
    private void UpdateEverySecond()
    {
        // 每秒更新
    }
}