//public void InitLoadingBG(Action action) //{ // ResourceLoader.Instance.LoadAssetAsync("Assets/Res/UI/Textures/Background/New_Loading_2.jpg", (ar) => // { // if( ar.asset_ != null) // { // mLoadingBgImage.texture = (Texture)ar.asset_; // mLoadingBg.SetActive(true); // } // action(); // }); //} public void EnableLuaBehaviour(bool isEnable) { if (luabehaviour == null) { luabehaviour = AddBehaviour("UILoadingWindowBehaviour"); if (luabehaviour != null) { luabehaviour.EnableBehaviour(isEnable); } } else { luabehaviour.EnableBehaviour(isEnable); } if (mPeak3PLoadingWindowBehaviour == null) { mPeak3PLoadingWindowBehaviour = AddBehaviour("Peak3P/UIPeak3PLoadingWindowBehaviour"); if (mPeak3PLoadingWindowBehaviour != null) { mPeak3PLoadingWindowBehaviour.EnableBehaviour(isEnable); } } else { mPeak3PLoadingWindowBehaviour.EnableBehaviour(isEnable); } }
public IUIBehaviour GetBehaviour(string name) { IUIBehaviour uiBehaviour = null; if (Behaviours.TryGetValue(name, out uiBehaviour)) { return(uiBehaviour); } return(null); }
/// <summary> /// 添加命名空间为xc.ui.ugui.name的组件,无返回值 /// </summary> /// <param name="name"></param> public void AppendBehaviour(string name) { IUIBehaviour uiBehaviour = null; System.Type t = System.Type.GetType("xc.ui.ugui." + name); if (t != null && t.IsSubclassOf(typeof(IUIBehaviour))) { uiBehaviour = (IUIBehaviour)System.Activator.CreateInstance(t); uiBehaviour.Window = this; Behaviours.Add(name, uiBehaviour); return; } if (LuaScriptMgr.Instance == null || !LuaScriptMgr.Instance.IsLoaded()) { return; } string lua_script = ""; if (LuaPath.CompareTo(string.Empty) == 0) { lua_script = string.Format("newUI.{0}", name); } else { lua_script = string.Format("newUI.{0}.{1}", LuaPath, name); } if (LuaScriptMgr.Instance.IsLuaScriptExist(lua_script)) { uiBehaviour = new UILuaBehaviour(this, lua_script); Behaviours.Add(name, uiBehaviour); return; } else { Debug.LogError(string.Format("{0}未找到名字为{1}的组件", mWndName, name)); return; } }