Beispiel #1
0
        /// <summary>
        /// 注册ui事件
        /// </summary>
        private void RegistUIEvents()
        {
            foreach (var item in bridges)
            {
                var bridgeInfo = item;

                if (!string.IsNullOrEmpty(bridgeInfo.inNode) && !string.IsNullOrEmpty(bridgeInfo.outNode))
                {
                    Func <PanelBase, object, IUIHandle> action = (x, y) =>
                    {
                        var parentPanel = x;
                        var panelName   = bridgeInfo.outNode;
                        return(UIFacade.Instence.Open(parentPanel, panelName, y));
                    };

                    UIBindingController.RegistPanelEvent(bridgeInfo.inNode, bridgeInfo.index, action);

                    this.onDestroy += () =>
                    {
                        //在本组合关闭时销毁事件
                        UIBindingController.RemovePanelEvent(bridgeInfo.inNode, bridgeInfo.index, action);
                    };
                }
            }
        }
Beispiel #2
0
 protected virtual void Awake()
 {
     bridgePool      = new BridgePool();
     transDicCatch   = new Dictionary <Transform, Dictionary <int, Transform> >();
     createdPanels   = new List <IUIPanel>();
     panelPool       = new Dictionary <string, List <IUIPanel> >();
     createdBridges  = new List <Bridge>();
     hidedPanelStack = new Dictionary <IUIPanel, Stack <IUIPanel> >();
     transRefDic     = new Dictionary <int, IUIPanel>();
     createRule      = new PanelCreateRule(bundleCreateRule);
     bindingCtrl     = new UIBindingController();
     Utility.RegistPanelGroup(this);
 }
        /// <summary>
        /// 注册ui事件
        /// </summary>
        protected void RegistUIEvents()
        {
            if (bindingCtrl == null)
            {
                bindingCtrl = new UIBindingController();
            }
            foreach (var item in Bridges)
            {
                var bridgeInfo = item;

                if (!string.IsNullOrEmpty(bridgeInfo.inNode) && !string.IsNullOrEmpty(bridgeInfo.outNode))
                {
                    UIBindingItem bindingItem = new UIBindingItem();

                    var index = item.index;

                    bindingItem.openAction = (x, y) =>
                    {
                        var parentPanel = x;
                        var panelName   = bridgeInfo.outNode;
                        return(UIFacade.Instence.Open(parentPanel, panelName, index, y));
                    };

                    bindingItem.closeAction = () =>
                    {
                        var panelName = bridgeInfo.outNode;
                        UIFacade.Instence.Close(this, panelName);
                    };

                    bindingItem.hideAction = () =>
                    {
                        var panelName = bridgeInfo.outNode;
                        UIFacade.Instence.Hide(this, panelName);
                    };

                    bindingItem.isOpenAction = () =>
                    {
                        var panelName = bridgeInfo.outNode;
                        return(UIFacade.Instence.IsPanelOpen(this, panelName));
                    };

                    bindingCtrl.RegistPanelEvent(bridgeInfo.inNode, bridgeInfo.index, bindingItem);

                    this.onDestroy += () =>
                    {
                        //在本组合关闭时销毁事件
                        bindingCtrl.RemovePanelEvent(bridgeInfo.inNode, bridgeInfo.index, bindingItem);
                    };
                }
            }
        }
 public static IUIHandle OpenSubPanel(this PanelBase panel, int index, object data = null)
 {
     return(UIBindingController.InvokePanelEvent(panel, index, data));
 }