Пример #1
0
        /// <summary>
        /// 增加界面组。
        /// </summary>
        /// <param name="uiGroupName">界面组名称。</param>
        /// <param name="depth">界面组深度。</param>
        /// <returns>是否增加界面组成功。</returns>
        public bool AddUIGroup(string uiGroupName, int depth)
        {
            if (m_UIManager.HasUIGroup(uiGroupName))
            {
                return(false);
            }

            UIGroupHelperBase uiGroupHelper = Helper.CreateHelper(m_UIGroupHelperTypeName, m_CustomUIGroupHelper, UIGroupCount);

            if (uiGroupHelper == null)
            {
                Log.Error("Can not create UI group helper.");
                return(false);
            }

            uiGroupHelper.name             = Utility.Text.Format("UI Group - {0}", uiGroupName);
            uiGroupHelper.gameObject.layer = LayerMask.NameToLayer("UI");
            Transform transform = uiGroupHelper.transform;

            transform.SetParent(m_InstanceRoot);
            transform.localScale    = Vector3.one;
            transform.localPosition = Vector3.zero;

            return(m_UIManager.AddUIGroup(uiGroupName, depth, uiGroupHelper));
        }
Пример #2
0
        /// <summary>
        /// 增加界面组。
        /// </summary>
        /// <param name="uiGroupName">界面组名称。</param>
        /// <param name="depth">界面组深度。</param>
        /// <returns>是否增加界面组成功。</returns>
        public bool AddUIGroup(string uiGroupName, int depth)
        {
            if (m_UIManager.HasUIGroup(uiGroupName))
            {
                return(false);
            }

            UIGroupHelperBase helper = null;

            if (m_UIGroupHelperTemplate != null)
            {
                helper = Instantiate(m_UIGroupHelperTemplate);
            }
            else
            {
                helper = (new GameObject()).AddComponent <DefaultUIGroupHelper>();
            }

            helper.name             = string.Format("UI Group - {0}", uiGroupName);
            helper.gameObject.layer = LayerMask.NameToLayer("UI");
            Transform transform = helper.transform;

            transform.SetParent(m_InstanceRoot);
            transform.localScale = Vector3.one;

            return(m_UIManager.AddUIGroup(uiGroupName, depth, helper));
        }