mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
事件系统优化更新
事件系统优化更新 1.使用静态代替单例,静态方法调用时候内存地址无需二次偏移定位 2.UI事件在关闭UI时自动反监听
This commit is contained in:
34
Assets/TEngine.Demo/Demo/TEngine.UIDemo/TestUI.cs
Normal file
34
Assets/TEngine.Demo/Demo/TEngine.UIDemo/TestUI.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using TEngine;
|
||||
using TEngine.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using TEngine.Runtime.UIModule;
|
||||
|
||||
class TestUI : UIWindow
|
||||
{
|
||||
public static int TestEvent = StringId.StringToHash("TestEvent");
|
||||
|
||||
#region 脚本工具生成的代码
|
||||
private Text m_text233;
|
||||
protected override void ScriptGenerator()
|
||||
{
|
||||
m_text233 = FindChildComponent<Text>("m_text233");
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void RegisterEvent()
|
||||
{
|
||||
base.RegisterEvent();
|
||||
AddUIEvent(TestEvent,Test);
|
||||
}
|
||||
|
||||
private void Test()
|
||||
{
|
||||
Log.Fatal("Test Trigger");
|
||||
}
|
||||
|
||||
#region 事件
|
||||
#endregion
|
||||
|
||||
}
|
Reference in New Issue
Block a user