void GameTest() { if (GUILayout.Button("游戏测试")) { UI.UIBase pUI = GameInstance.getInstance().uiManager.GetUI((ushort)UI.EUIType.DefeatPanel); if (pUI != null) { pUI.Show(); } } }
/// <summary> /// 设置UI实例到指定的UI节点下 /// </summary> public static void SetToUIRoot(UI.UIBase ui) { var tran = ui.UITransform; switch (ui.Layer) { case UI.UILayerEnum.Normal: tran.SetParent(GlobalInstance.NormalUILayer); break; case UI.UILayerEnum.Guide: tran.SetParent(GlobalInstance.GuideUILayer); break; default: tran.SetParent(GlobalInstance.UIRoot); break; } tran.localScale = Vector3.one; tran.localPosition = Vector3.zero; }