/// <summary> /// 绑定跳转逻辑 /// </summary> /// <param name="selfPanel"></param> /// <param name="btn"></param> /// <typeparam name="T"></typeparam> public static System.Action Transition <TDstPanel>(this UIPanel selfBehaviour, IUIData uidata = null) where TDstPanel : UIPanel { return(() => { UIKit.ClosePanel(selfBehaviour.name); UIKit.OpenPanel <TDstPanel>(uidata); }); }
/// <summary> /// 绑定跳转逻辑 /// </summary> /// <param name="selfPanel"></param> /// <param name="btn"></param> /// <typeparam name="T"></typeparam> public static void BindTransition <TSrcPanel, TDstPanel>(this UnityEngine.UI.Button btn) where TSrcPanel : UIPanel where TDstPanel : UIPanel { btn.onClick.AddListener(() => { UIKit.ClosePanel <TSrcPanel>(); UIKit.OpenPanel <TDstPanel>(); }); }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as UISomePanelFromResourcesData ?? new UISomePanelFromResourcesData(); // please add init code here BtnCloseSelf.onClick.AddListener(() => { // UIMgr.CloseAllPanel(); UIKit.ClosePanel("resources://" + typeof(UISomePanelFromResources).Name); }); }
public static void ClosePanel <T>() where T : ILUIPanel { var panelName = typeof(T).Name; var panel = UIKit.GetPanel(panelName); if (panel) { UIKit.ClosePanel(panelName); var ilPanel = panel.GetILComponent <ILUIPanelInterface>(); ilPanel.Close(); } }
void Start() { stageId = transform.GetSiblingIndex(); btn = transform.GetComponent <Button>(); mytag = transform.GetChild(1).GetComponent <Image>(); text = transform.GetComponentInChildren <Text>(); info = StageDefine.Instance.stages[stageId]; text.text = info.StageName; mytag.gameObject.SetActive(GameDataManager.GetBool(stageId + "cleared")); btn.onClick.AddListener(() => { //切换到对应关卡 UIKit.ClosePanel <UISelectStage>(); MyAudioPlayer.Instance.PlayVoice("Spacey"); GameMode1Manager.Instance.GameStart(stageId); }); }
public void UIKit_OpenPanelDefaultTest() { ResKit.Init(); var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>(); Assert.IsTrue(uiKitTestPanel); Assert.AreEqual(uiKitTestPanel.State, PanelState.Opening); Assert.AreEqual(uiKitTestPanel.Info.Level, UILevel.Common); Assert.AreEqual(uiKitTestPanel.Data.OnInitCalledCount, 1); Assert.AreEqual(uiKitTestPanel.Data.OnOpenCalledCount, 1); Assert.AreEqual(uiKitTestPanel.Data.OnShowCalledCount, 1); UIKit.ClosePanel <UIKitTestPanel>(); UIKit.CloseAllPanel(); }
public void UIKit_GetPanelTest() { var uiKitTestPanel = UIKit.GetPanel <UIKitTestPanel>(); Assert.IsFalse(uiKitTestPanel); ResKit.Init(); UIKit.OpenPanel("UIKitTestPanel"); uiKitTestPanel = UIKit.GetPanel <UIKitTestPanel>(); Assert.IsTrue(uiKitTestPanel); Assert.AreEqual(uiKitTestPanel.State, PanelState.Opening); UIKit.ClosePanel("UIKitTestPanel"); UIKit.CloseAllPanel(); }
public void UIKit_ClosePanelTest() { ResKit.Init(); var uiKitTestPanel = UIKit.OpenPanel <UIKitTestPanel>(); var data = uiKitTestPanel.Data; UIKit.ClosePanel <UIKitTestPanel>(); Assert.AreEqual(data.OnInitCalledCount, 1); Assert.AreEqual(data.OnOpenCalledCount, 1); Assert.AreEqual(data.OnShowCalledCount, 1); Assert.AreEqual(data.OnHideCalledCount, 1); Assert.AreEqual(data.OnCloseCalledCount, 1); Assert.AreEqual(uiKitTestPanel.State, PanelState.Closed); UIKit.CloseAllPanel(); }
private void OnGUI() { if (GUILayout.Button("打开")) { mUIMultiPanel = UIKit.OpenPanel <UIMultiPanel>(new UIMultiPanelData() { PageIndex = mPageIndex }, PanelOpenType.Multiple); mPageIndex++; } if (GUILayout.Button("关闭")) { UIKit.ClosePanel <UIMultiPanel>(); } if (mUIMultiPanel && GUILayout.Button("关闭当前")) { UIKit.ClosePanel(mUIMultiPanel); mUIMultiPanel = null; } }