Example #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));
        }
Example #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));
        }
Example #3
0
        /// <inheritdoc />
        public void Init()
        {
            Guard.Verify <ArgumentException>(UIGroupRoot == null, "UIForm root is invaild.");

            // 获取UI管理器
            IUIManager ui = App.Make <IUIManager>();

            // 设置UIForm辅助器
            ui.SetUIFormHelper(new DefaultUIFormHelper(UIGroupRoot));

            // 初始化分组信息
            foreach (var group in UIGroups)
            {
                if (!ui.HasUIGroup(group.Name))
                {
                    ui.AddUIGroup(group.Name, group.Depth);
                }
            }
        }