public string getLayoutNameByType(LAYOUT type) { if (!mLayoutTypeToName.ContainsKey(type)) { logError("can not find LayoutType: " + type); return(null); } return(mLayoutTypeToName[type]); }
public override void init() { base.init(); mLayoutType = LAYOUT.L_MAX; mParam = null; mForce = false; mImmediately = false; mVisibility = true; }
public void registeLayout(Type classType, LAYOUT type, string name) { mLayoutTypeToName.Add(type, name); mLayoutNameToType.Add(name, type); mScriptRegisteList.Add(type, classType); if (!mScriptMappingList.ContainsKey(classType)) { mScriptMappingList.Add(classType, new List <LAYOUT>()); } mScriptMappingList[classType].Add(type); }
public void destroyLayout(LAYOUT type) { GameLayout layout = getGameLayout(type); if (layout == null) { return; } removeLayoutFromList(layout); layout.destroy(); }
public GameLayout createLayout(LAYOUT type, int renderOrder, bool async, LayoutAsyncDone callback, bool isNGUI, bool isScene) { if (mLayoutList.ContainsKey(type)) { if (async && callback != null) { callback(mLayoutList[type]); return(null); } return(mLayoutList[type]); } string name = getLayoutNameByType(type); string path = isNGUI ? CommonDefine.R_NGUI_PREFAB_PATH : CommonDefine.R_UGUI_PREFAB_PATH; GameObject layoutParent = getRootObject(isNGUI); if (isScene) { layoutParent = null; } // 如果是异步加载则,则先加入列表中 if (async) { LayoutAsyncInfo info = new LayoutAsyncInfo(); info.mName = name; info.mType = type; info.mRenderOrder = renderOrder; info.mLayout = null; info.mLayoutObject = null; info.mIsNGUI = isNGUI; info.mIsScene = isScene; info.mCallback = callback; mLayoutAsyncList.Add(info.mName, info); bool ret = mResourceManager.loadResourceAsync <GameObject>(path + name + "/" + name, onLayoutPrefabAsyncDone, null, true); if (!ret) { logError("can not find layout : " + name); } return(null); } else { GameObject prefab = mResourceManager.loadResource <GameObject>(path + name + "/" + name, true); instantiatePrefab(layoutParent, prefab, name, true); GameLayout layout = new GameLayout(); layout.setPrefab(prefab); addLayoutToList(layout, type); layout.init(type, name, renderOrder, isNGUI, isScene); return(layout); } }
public override void init() { base.init(); mCallback = null; mResultLayout = null; mLayoutType = LAYOUT.L_MAX; mParam = null; mVisible = true; mAsync = false; mImmediatelyShow = false; mIsNGUI = true; mIsScene = false; mRenderOrder = 0; }
public void Update() { Type = mLayout.getType(); Name = mLayout.getName(); ScriptControlHide = mLayout.isScriptControlHide(); IsNGUI = mLayout.isNGUI(); IsScene = mLayout.isScene(); CheckBoxAnchor = mLayout.isCheckBoxAnchor(); IgnoreTimeScale = mLayout.isIgnoreTimeScale(); BlurBack = mLayout.isBlurBack(); AnchorApplied = mLayout.isAnchorApplied(); RenderOrder = mLayout.getRenderOrder(); DefaultLayer = mLayout.getDefaultLayer(); }
public void init(LAYOUT type, string name, int renderOrder, bool isNGUI, bool isScene) { mName = name; mType = type; mIsNGUI = isNGUI; mIsScene = isScene; mScript = mLayoutManager.createScript(this); mLayoutScriptCallback?.Invoke(mScript, true); if (mScript == null) { logError("can not create layout script! type : " + mType); } // 初始化布局脚本 if (!mIsScene) { mScript.newObject(out mRoot, mLayoutManager.getUIRoot(mIsNGUI), mName); } else { mScript.newObject(out mRoot, null, mName); } mRoot?.setDestroyImmediately(true); mDefaultLayer = mRoot.getObject().layer; setRenderOrder(renderOrder); mScript.setRoot(mRoot); mScript.assignWindow(); // 查找完窗口后设置所有窗口的深度 if (!mIsNGUI) { setUIChildDepth(mRoot, 0, false); } // 布局实例化完成,初始化之前,需要调用自适应组件的更新 if (mLayoutManager.isUseAnchor()) { applyAnchor(mRoot.getObject(), true, this); } mAnchorApplied = true; mScript.init(); mScriptInited = true; // 加载完布局后强制隐藏 setVisibleForce(false); #if UNITY_EDITOR mRoot.getObject().AddComponent <LayoutDebug>().setLayout(this); #endif }
public void setLayout(GameLayout layout) { mLayout = layout; mType = mLayout.getType(); }
public override void init() { base.init(); mLayoutType = LAYOUT.L_MAX; }
//---------------------------------------------------------------------------------------------------------------------------------------------------- protected void addLayoutToList(GameLayout layout, LAYOUT type) { mLayoutList.Add(type, layout); }
public T getScript <T>(LAYOUT type) where T : LayoutScript { GameLayout layout = getGameLayout(type); return(layout != null?layout.getScript() as T : null); }
public GameLayout getGameLayout(LAYOUT type) { return(mLayoutList.ContainsKey(type) ? mLayoutList[type] : null); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------- protected static void registeLayout <T>(LAYOUT layout, string name) where T : LayoutScript { mLayoutManager.registeLayout(typeof(T), layout, name); }