protected bool mUseAnchor; // 是否启用锚点来自动调节窗口的大小和位置 public LayoutManager() { mUseAnchor = true; mScriptMappingList = new Dictionary <Type, List <int> >(); mScriptRegisteList = new Dictionary <int, Type>(); mLayoutTypeToPath = new Dictionary <int, string>(); mLayoutPathToType = new Dictionary <string, int>(); mLayoutList = new SafeDictionary <int, GameLayout>(); mLayoutAsyncList = new Dictionary <string, LayoutInfo>(); mBackBlurLayoutList = new List <GameLayout>(); mLayoutLoadCallback = onLayoutPrefabLoaded; // 在构造中获取UI根节点,确保其他组件能在任意时刻正常访问 mUGUIRoot = LayoutScript.newUIObject <myUGUICanvas>(null, null, getGameObject(FrameDefine.UGUI_ROOT, true)); }
public override void destroy() { var updateList = mLayoutList.getUpdateList(); foreach (var item in updateList) { item.Value.destroy(); } mLayoutList.clear(); mLayoutTypeToPath.Clear(); mLayoutPathToType.Clear(); mLayoutAsyncList.Clear(); // 销毁UI摄像机 mCameraManager.destroyCamera(mCameraManager.getUICamera()); myUIObject.destroyWindowSingle(mUGUIRoot, false); mUGUIRoot = null; base.destroy(); }
public void destroy() { if (mScript != null) { int count = mLayoutScriptCallback.Count; for (int i = 0; i < count; ++i) { mLayoutScriptCallback[i].Invoke(mScript, false); } mScript.destroy(); mScript = null; } myUIObject.destroyWindow(mRoot, true); mRoot = null; if (mPrefab != null) { mResourceManager.unload(ref mPrefab); } }