添加全屏显示的ui父节点,并将所有弹窗都放入该节点

dev_chengFeng
gaoxin 2020-09-01 16:10:36 +08:00
parent b939439eb2
commit ad887c2b7f
2 changed files with 62 additions and 5 deletions

View File

@ -107,6 +107,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 224217409807388486}
- {fileID: 2468602470498420626}
- {fileID: 224956310800866852}
- {fileID: 8247171532164343885}
- {fileID: 1753025320175095487}
@ -312,7 +313,7 @@ RectTransform:
m_LocalScale: {x: 1.0000799, y: 1.0000799, z: 1.0000799}
m_Children: []
m_Father: {fileID: 224437101117242940}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -358,7 +359,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224437101117242940}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -454,7 +455,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224437101117242940}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -519,3 +520,47 @@ Canvas:
m_SortingLayerID: 0
m_SortingOrder: 10000
m_TargetDisplay: 0
--- !u!1 &5850975074544207647
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2468602470498420626}
- component: {fileID: 7419171340251329912}
m_Layer: 5
m_Name: FullNode
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2468602470498420626
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5850975074544207647}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224437101117242940}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
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_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7419171340251329912
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5850975074544207647}
m_CullTransparentMesh: 0

View File

@ -63,6 +63,7 @@ function UIManager.Initialize()
this.eventSystem = GameObject.Find("EventSystem")
this.uiRoot = gameObj
this.uiNode = gameObj.transform:Find("UIRoot/UINode")
this.fullNode = gameObj.transform:Find("UIRoot/FullNode")
this.fixedNode = gameObj.transform:Find("UIRoot/FixedNode")
this.screenMask1 = gameObj.transform:Find("UIRoot/ScreenMask1").gameObject
this.screenMask2 = gameObj.transform:Find("UIRoot/ScreenMask2").gameObject
@ -320,11 +321,22 @@ function UIManager.GetPanel(id, isSync, func, ...)
panel = reimport("Modules/"..uiConfig.script)
this.openedList[uiConfig.id] = panel
panel.uiConfig = uiConfig
local rootNode = this.fixedNode
if isStackPanel then
if uiConfig.type == UIType.FullType then
rootNode = this.uiNode
elseif uiConfig.type == UIType.Popup then
rootNode = this.fullNode
end
end
if isSync then
local gameObject = this.CreatePanel(uiConfig, isStackPanel and this.uiNode or this.fixedNode)
local gameObject = this.CreatePanel(uiConfig, rootNode)
panel:CreateUI(gameObject)
else
this.CreatePanelAsync(uiConfig, isStackPanel and this.uiNode or this.fixedNode, function (gameObject)
this.CreatePanelAsync(uiConfig, rootNode, function (gameObject)
panel:CreateUI(gameObject)
SetSortingOrder(uiConfig, panel, isStackPanel,unpack(args, 1, table.maxn(args)))
if func then