示例#1
0
        //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);
            }
        }
示例#2
0
        public IUIBehaviour GetBehaviour(string name)
        {
            IUIBehaviour uiBehaviour = null;

            if (Behaviours.TryGetValue(name, out uiBehaviour))
            {
                return(uiBehaviour);
            }
            return(null);
        }
示例#3
0
        /// <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;
            }
        }