protected bool mUseAnchor; // 是否启用锚点来自动调节窗口的大小和位置 public GameLayoutManager(string name) : base(name) { mUseAnchor = true; mScriptMappingList = new Dictionary <Type, List <LAYOUT> >(); mScriptRegisteList = new Dictionary <LAYOUT, Type>(); mLayoutTypeToName = new Dictionary <LAYOUT, string>(); mLayoutNameToType = new Dictionary <string, LAYOUT>(); mLayoutList = new Dictionary <LAYOUT, GameLayout>(); mLayoutAsyncList = new Dictionary <string, LayoutAsyncInfo>(); mBackBlurLayoutList = new List <GameLayout>(); // 在构造中获取UI根节点,确保其他组件能在任意时刻正常访问 mUGUIRoot = LayoutScript.newUIObject <txUGUICanvas>(null, null, getGameObject(null, CommonDefine.UGUI_ROOT, true)); #if USE_NGUI mNGUIRoot = LayoutScript.newUIObject <txNGUIObject>(null, null, getGameObject(null, CommonDefine.NGUI_ROOT, true)); mNGUIRootComponent = mNGUIRoot.getUnityComponent <UIRoot>(false); #endif }
public void destroy() { if (mLayoutPanel != null) { mLayoutPanel.destroy(); mLayoutPanel = null; } if (mLayoutCanvas != null) { mLayoutCanvas.destroy(); mLayoutCanvas = null; } if (mScript != null) { mScript.destroy(); mScript = null; } }
public override void destroy() { foreach (var item in mLayoutList) { item.Value.destroy(); } mLayoutList.Clear(); mLayoutTypeToName.Clear(); mLayoutNameToType.Clear(); mLayoutAsyncList.Clear(); // 销毁UI摄像机 mCameraManager.destroyCamera(mCameraManager.getUICamera(true)); mCameraManager.destroyCamera(mCameraManager.getUICamera(false)); #if USE_NGUI txUIObject.destroyWindowSingle(mNGUIRoot, false); mNGUIRoot = null; #endif txUIObject.destroyWindowSingle(mUGUIRoot, false); mUGUIRoot = null; base.destroy(); }