internal void SetPriorityLayer(WindowParaLayer priorityParaLayer) { this.priorityParaLayer = priorityParaLayer; priorityParaLayer.BackgroundClicked -= OnPopupsBackgroundClicked; priorityParaLayer.BackgroundClicked += OnPopupsBackgroundClicked; }
public static UiFrame CreateDefaultUIFrame() { GameObject uiFrame = new GameObject("UI Frame"); UiFrame result = uiFrame.AddComponent <UiFrame>(); Camera camera = CreateCamera(); camera.transform.SetParent(uiFrame.transform); EventSystem eventSystem = CreateEventSystem(); eventSystem.transform.SetParent(uiFrame.transform); Canvas mainCanvas = CreateCanvas(camera); mainCanvas.transform.SetParent(uiFrame.transform); PanelLayer panelLayer = CreatePanelLayer(); panelLayer.transform.SetParent(mainCanvas.transform, false); WindowLayer windowLayer = CreateWindowLayer(); windowLayer.transform.SetParent(mainCanvas.transform, false); GameObject priorityPanelLayer = CreateUIObject("Priority Panel Layer"); priorityPanelLayer.transform.SetParent(mainCanvas.transform, false); WindowParaLayer priorityWindowLayer = CreatePriorityWindowLayer(); priorityWindowLayer.transform.SetParent(mainCanvas.transform, false); windowLayer.SetPriorityLayer(priorityWindowLayer); GameObject overlayPanelLayer = CreateUIObject("Overlay Panel Layer"); overlayPanelLayer.transform.SetParent(mainCanvas.transform, false); GameObject tutorialPanelLayer = CreateUIObject("Tutorial Panel Layer"); tutorialPanelLayer.transform.SetParent(mainCanvas.transform, false); GameObject blockerPanelLayer = CreateUIObject("Blocker Panel Layer"); blockerPanelLayer.transform.SetParent(mainCanvas.transform, false); panelLayer.PriorityLayers = new PanelPriorityLayerList(new List <PanelPriorityLayerListEntry> { new PanelPriorityLayerListEntry(PanelPriority.Prioritary, priorityPanelLayer.transform), new PanelPriorityLayerListEntry(PanelPriority.Overlay, overlayPanelLayer.transform), new PanelPriorityLayerListEntry(PanelPriority.Tutorial, tutorialPanelLayer.transform), new PanelPriorityLayerListEntry(PanelPriority.Blocker, blockerPanelLayer.transform) }); return(result); }
private static WindowParaLayer CreatePriorityWindowLayer() { WindowParaLayer result = CreateUIObject <WindowParaLayer>("Priority Window Layer"); Widget backgroundWidget = CreateUIObject <Widget>("Background Widget"); FadeTransition inTransition = backgroundWidget.gameObject.AddComponent <FadeTransition>(); inTransition.FadeTypeInternal = FadeTransition.FadeType.In; FadeTransition outTransition = backgroundWidget.gameObject.AddComponent <FadeTransition>(); outTransition.FadeTypeInternal = FadeTransition.FadeType.Out; backgroundWidget.ShowTransition = inTransition; backgroundWidget.HideTransition = outTransition; Image backgroundImage = backgroundWidget.gameObject.AddComponent <Image>(); backgroundImage.color = new Color(0, 0, 0, 0.7f); backgroundImage.transform.SetParent(result.transform, false); backgroundImage.gameObject.SetActive(false); result.SetBackgroundWidget(backgroundWidget); return(result); }