Exemple #1
0
        private void CreateUI_Internal(GameObject go, UIInfoBase uiNode, Bridge bridge, Transform parent, IUIPanel parentPanel)
        {
            if (go == null)
            {
                return;
            }

            var parentDic = GetParentDic(parent);

            Utility.SetTranform(go.transform, uiNode.type.layer, uiNode.type.layerIndex, Trans, parent, parentDic, transRefDic);

            go.name = uiNode.panelName;
            go.SetActive(true);

            IUIPanel panel = GetPanelFromPool(go);

            InitPanelInformation(panel, uiNode);
            panel.Binding(go);
            panel.HandleData(bridge);
            transRefDic.Add(go.transform.GetInstanceID(), panel);
            createdPanels.Add(panel);

            if (parentPanel != null)
            {
                parentPanel.RecordChild(panel);
            }

            if (bridge != null)
            {
                bridge.OnCreatePanel(panel);
            }

            HandBridgeOptions(panel, bridge);
        }
        public Bridge InstencePanel(IUIPanel parentPanel, string panelName, int index, Transform root)
        {
            Bridge     bridge = null;
            UIInfoBase uiNode = null;

            if (TryMatchPanel(parentPanel, panelName, index, out bridge, out uiNode))
            {
                uiNode.OnCreate = (go) =>
                {
                    Utility.SetTranform(go.transform, uiNode.type.layer, uiNode.type.layerIndex, root == null ? Trans : root);
                    go.SetActive(true);
                    var panel = go.GetComponent <IUIPanel>();
                    if (panel != null)
                    {
                        createdPanels.Add(panel);
                        if (parentPanel != null)
                        {
                            parentPanel.RecordChild(panel);
                        }
                        bridgeDic.Add(panel, bridge);
                        InitPanel(panel, bridge, uiNode);
                        HandBridgeOptions(panel, bridge);
                    }
                };
                creater.CreatePanel(uiNode);
            }
            return(bridge);
        }
Exemple #3
0
        public bool TryOpenOldPanel(string panelName, UIInfoBase uiNode, IUIPanel parentPanel, out Bridge bridgeObj)
        {
            bridgeObj = null;

            if (uiNode == null)
            {
                return(false);
            }

            var oldPanels = createdPanels.FindAll(x => x.Name == panelName);

            for (int i = 0; i < oldPanels.Count; i++)
            {
                var oldPanel = oldPanels[i];

                if (oldPanel != null)
                {
                    bridgeObj = createdBridges.Find(x => x.OutPanel == oldPanel);

                    if (bridgeObj != null)
                    {
                        if (oldPanel.UType.form == UIFormType.Fixed)
                        {
                            bridgeObj.SetInPanel(parentPanel);

                            if (parentPanel != null)
                            {
                                parentPanel.RecordChild(oldPanel);
                            }

                            if (!oldPanel.IsShowing)
                            {
                                oldPanel.UnHide();
                            }
                            HandBridgeOptions(oldPanel, bridgeObj);
                            return(true);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        Debug.LogError("目标面板信息丢失,请检查逻辑!!!" + parentPanel);
                        for (int j = 0; j < createdBridges.Count; j++)
                        {
                            var item = createdBridges[j];
                            Debug.Log(item.OutPanel.Name);
                        }
                    }
                }
            }

            return(false);
        }
        private void CreateUI(GameObject go, UIInfoBase uiNode, Bridge bridge, Transform parent, IUIPanel parentPanel)
        {
            Utility.SetTranform(go.transform, uiNode.type.layer, uiNode.type.layerIndex, Trans, parent, ref childParentDic);
            go.SetActive(true);

            var panel = go.GetComponent <IUIPanel>();

            if (panel == null)
            {
                panel = go.AddComponent <PanelCore>();
            }

            createdPanels.Add(panel);
            if (parentPanel != null)
            {
                parentPanel.RecordChild(panel);
            }
            if (bridge != null)
            {
                bridge.OnCreatePanel(panel);
            }
            InitPanel(panel, bridge, uiNode);
            HandBridgeOptions(panel, bridge);
        }