添加模块退出消息

This commit is contained in:
李浩 2025-04-23 10:33:15 +08:00
parent b372746eab
commit 0429bc8739
2 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using QFramework; using QFramework;
using TMPro; using TMPro;
using static OperationController;
namespace QFramework.Example namespace QFramework.Example
{ {
@ -14,6 +15,8 @@ namespace QFramework.Example
Button curBtn; Button curBtn;
protected override void OnInit(IUIData uiData = null) protected override void OnInit(IUIData uiData = null)
{ {
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
mData = uiData as UIChangeOperationData ?? new UIChangeOperationData(); mData = uiData as UIChangeOperationData ?? new UIChangeOperationData();
// please add init code here // please add init code here
for (int i = 0; i < Content.childCount; i++) for (int i = 0; i < Content.childCount; i++)
@ -48,10 +51,18 @@ namespace QFramework.Example
protected override void OnHide() protected override void OnHide()
{ {
} }
protected override void OnClose() protected override void OnClose()
{ {
}
public void OnModuleQuit(OnModuleQuit arg)
{
Hide();
} }
} }
} }

View File

@ -25,6 +25,9 @@
<Knowledge bgImage="Knowledge/ChangTu.png"> <Knowledge bgImage="Knowledge/ChangTu.png">
<Item title="项目简介" setPos="0,0"> <Item title="项目简介" setPos="0,0">
<Item title="实验名称" bgImage="" setPos="0,67.59607"> <Item title="实验名称" bgImage="" setPos="0,67.59607">
<Action type="Audio" audioType="Voice" value="二、shiyanlilunrenzhi/sound_1.mp3" loop="false" waitFinished="false" volumen="1" isPlay="true"></Action>
<!--<Component type="Button" size="200,200" pos="200,-200"> <!--<Component type="Button" size="200,200" pos="200,-200">
<Action type="Log" value="第二步_第二个子步骤"></Action> <Action type="Log" value="第二步_第二个子步骤"></Action>
</Component> </Component>