完善框架通用性功能

This commit is contained in:
shenjianxing 2025-01-09 10:08:22 +08:00
parent 1fab8f8e19
commit 92ebf0bcc9
4 changed files with 17 additions and 13 deletions

View File

@ -403,7 +403,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: -30, y: -30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7870331819941572208
CanvasRenderer:
@ -433,7 +433,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u6A21\u5757\u540D\u79F0"
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2}
m_sharedMaterial: {fileID: 5103963756306747964, guid: 9bbfb1bdb0251664eb0932e39724900e, type: 2}

View File

@ -46,6 +46,7 @@ public class OperationController : MonoSingleton<OperationController>
{
Refresh();
}).UnRegisterWhenGameObjectDestroyed(gameObject);
}
public void Refresh()
@ -66,18 +67,24 @@ public class OperationController : MonoSingleton<OperationController>
}
TypeEventSystem.Global.Register<StepExecute>(OnExecute);
TypeEventSystem.Global.Register<OnNextStep>(OnNext);
TypeEventSystem.Global.Register<OnModuleQuit>(arg => Clear());
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuitHandler);
}
}
}
private void OnModuleQuitHandler(OnModuleQuit quit)
{
Clear();
}
public void Clear()
{
index = -1;
curAction.Deinit();
steps.Clear();
TypeEventSystem.Global.UnRegister<OnModuleQuit>(arg => Clear());
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnModuleQuitHandler);
TypeEventSystem.Global.UnRegister<StepExecute>(OnExecute);
TypeEventSystem.Global.UnRegister<OnNextStep>(OnNext);

View File

@ -20,7 +20,6 @@ namespace QFramework.Example
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIOperationListData ?? new UIOperationListData();
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
TypeEventSystem.Global.Register<OnModuleQuit>((arg)=>Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
}
@ -83,6 +82,8 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null)
{
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(this);
btns.Clear();
op = OperationController.Instance.operation;
StepContent.RemoveAllChildren();
foreach (var item in op.Steps)
@ -139,13 +140,9 @@ namespace QFramework.Example
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
}
}
}

View File

@ -25,7 +25,7 @@ namespace QFramework.Example
data.btns.Add(new UITipWindowData.ItemData() { txt = "·ñ" });
UIKit.OpenPanelAsync<UITipWindow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
});
closeBtn.onClick.AddListener(Home);
backBtn.onClick.AddListener(Home);
homeBtn.onClick.AddListener(Home);
desBtn.onClick.AddListener(() =>
@ -45,7 +45,7 @@ namespace QFramework.Example
data.txt = "ÊÇ·ñÍ˳öµ±Ç°Ä£¿é£¿";
data.btns.Add(new UITipWindowData.ItemData()
{
txt = "È·¶¨",
txt = "",
OnClick = () =>
{
Hide();
@ -53,7 +53,7 @@ namespace QFramework.Example
UIKit.OpenPanelAsync<UIModeSelect>().ToAction().StartGlobal();
}
});
data.btns.Add(new UITipWindowData.ItemData() { txt = "È¡Ïû" });
data.btns.Add(new UITipWindowData.ItemData() { txt = "" });
UIKit.OpenPanelAsync<UITipWindow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
}