修复bug

This commit is contained in:
shenjianxing 2025-01-08 15:11:32 +08:00
parent f118173ae7
commit cdc5a49106

View File

@ -17,6 +17,7 @@ namespace QFramework.Example
public partial class UIHint : UIPanel public partial class UIHint : UIPanel
{ {
ResLoader loader; ResLoader loader;
IAction curAction;
protected override void OnInit(IUIData uiData = null) protected override void OnInit(IUIData uiData = null)
{ {
mData = uiData as UIHintData ?? new UIHintData(); mData = uiData as UIHintData ?? new UIHintData();
@ -31,16 +32,22 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null) protected override void OnOpen(IUIData uiData = null)
{ {
mData = uiData as UIHintData ?? new UIHintData(); mData = uiData as UIHintData ?? new UIHintData();
if (curAction != null)
{
curAction.Deinit();
curAction = null;
}
Icon.gameObject.SetActive(mData.isShowIcon); Icon.gameObject.SetActive(mData.isShowIcon);
Label.text = mData.txt; Label.text = mData.txt;
SetItem(1); SetItem(1);
if (mData.time != -1) if (mData.time != -1)
{ {
ActionKit.Delay(mData.time, () => curAction = ActionKit.Delay(mData.time, () =>
{ {
SetItem(0); SetItem(0);
});
}).Start(this); curAction.Start(this);
} }
if (string.IsNullOrEmpty(mData.audio) == false) if (string.IsNullOrEmpty(mData.audio) == false)
{ {