Exemplo n.º 1
0
        /// <summary>
        /// 关闭UI实体
        /// </summary>
        /// <param name="uILogic">UI逻辑类对象</param>
        private void CloseUIEntity(UILogicBase uILogic)
        {
            if (!uILogic.IsCreated)
            {
                return;
            }

            if (!uILogic.IsOpened)
            {
                return;
            }

            uILogic.UIEntity.SetActive(false);
            uILogic.OnClose();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 关闭UI
        /// </summary>
        /// <param name="type">UI逻辑类</param>
        public void CloseUI(Type type)
        {
            if (_worldUIs.ContainsKey(type))
            {
                UILogicBase ui = _worldUIs[type];

                if (!ui.IsCreated)
                {
                    return;
                }

                if (!ui.IsOpened)
                {
                    return;
                }

                ui.UIEntity.SetActive(false);
                ui.OnClose();
            }
        }
Exemplo n.º 3
0
            /// <summary>
            /// 关闭UI
            /// </summary>
            /// <param name="type">UI逻辑类</param>
            public void CloseUI(Type type)
            {
                if (_worldUIs.ContainsKey(type))
                {
                    UILogicBase ui = _worldUIs[type];

                    if (!ui.IsCreated)
                    {
                        return;
                    }

                    if (!ui.IsOpened)
                    {
                        return;
                    }

                    ui.UIEntity.SetActive(false);
                    ui.OnClose();
                }
                else
                {
                    throw new HTFrameworkException(HTFrameworkModule.UI, "关闭UI失败:UI对象 " + type.Name + " 并未存在!");
                }
            }
Exemplo n.º 4
0
            /// <summary>
            /// 关闭UI
            /// </summary>
            /// <param name="type">UI逻辑类</param>
            public void CloseUI(Type type)
            {
                if (_worldUIs.ContainsKey(type))
                {
                    UILogicBase ui = _worldUIs[type];

                    if (!ui.IsCreated)
                    {
                        return;
                    }

                    if (!ui.IsOpened)
                    {
                        return;
                    }

                    ui.UIEntity.SetActive(false);
                    ui.OnClose();
                }
                else
                {
                    GlobalTools.LogError(string.Format("关闭UI失败:UI对象 {0} 并未存在!", type.Name));
                }
            }
Exemplo n.º 5
0
        /// <summary>
        /// 关闭UI
        /// </summary>
        /// <param name="type">UI逻辑类</param>
        public void CloseUI(Type type)
        {
            UIResourceAttribute attribute = type.GetCustomAttribute <UIResourceAttribute>();

            if (attribute != null)
            {
                switch (attribute.EntityType)
                {
                case UIType.Overlay:
                    if (OverlayUIs.ContainsKey(type))
                    {
                        UILogicBase ui = OverlayUIs[type];

                        if (!ui.IsCreated)
                        {
                            return;
                        }

                        if (!ui.IsOpened)
                        {
                            return;
                        }

                        ui.UIEntity.SetActive(false);
                        ui.OnClose();
                    }
                    else
                    {
                        throw new HTFrameworkException(HTFrameworkModule.UI, "关闭UI失败:UI对象 " + type.Name + " 并未存在!");
                    }
                    break;

                case UIType.Camera:
                    if (CameraUIs.ContainsKey(type))
                    {
                        UILogicBase ui = CameraUIs[type];

                        if (!ui.IsCreated)
                        {
                            return;
                        }

                        if (!ui.IsOpened)
                        {
                            return;
                        }

                        ui.UIEntity.SetActive(false);
                        ui.OnClose();
                    }
                    else
                    {
                        throw new HTFrameworkException(HTFrameworkModule.UI, "关闭UI失败:UI对象 " + type.Name + " 并未存在!");
                    }
                    break;

                case UIType.World:
                    if (WorldUIs.ContainsKey(attribute.WorldUIDomainName))
                    {
                        WorldUIs[attribute.WorldUIDomainName].CloseUI(type);
                    }
                    else
                    {
                        throw new HTFrameworkException(HTFrameworkModule.UI, "关闭UI失败:UI对象 " + type.Name + " 的域 " + attribute.WorldUIDomainName + " 并未存在!");
                    }
                    break;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 关闭UI
        /// </summary>
        /// <param name="type">UI逻辑类</param>
        public void CloseUI(Type type)
        {
            UIResourceAttribute attribute = type.GetCustomAttribute <UIResourceAttribute>();

            if (attribute != null)
            {
                switch (attribute.EntityType)
                {
                case UIType.Overlay:
                    if (_overlayUIs.ContainsKey(type))
                    {
                        UILogicBase ui = _overlayUIs[type];

                        if (!ui.IsCreated)
                        {
                            return;
                        }

                        if (!ui.IsOpened)
                        {
                            return;
                        }

                        ui.UIEntity.SetActive(false);
                        ui.OnClose();
                    }
                    else
                    {
                        GlobalTools.LogError(string.Format("关闭UI失败:UI对象 {0} 并未存在!", type.Name));
                    }
                    break;

                case UIType.Camera:
                    if (_cameraUIs.ContainsKey(type))
                    {
                        UILogicBase ui = _cameraUIs[type];

                        if (!ui.IsCreated)
                        {
                            return;
                        }

                        if (!ui.IsOpened)
                        {
                            return;
                        }

                        ui.UIEntity.SetActive(false);
                        ui.OnClose();
                    }
                    else
                    {
                        GlobalTools.LogError(string.Format("关闭UI失败:UI对象 {0} 并未存在!", type.Name));
                    }
                    break;

                case UIType.World:
                    if (_worldUIs.ContainsKey(attribute.WorldUIDomainName))
                    {
                        _worldUIs[attribute.WorldUIDomainName].CloseUI(type);
                    }
                    else
                    {
                        GlobalTools.LogError(string.Format("关闭UI失败:UI对象 {0} 的域 {1} 并未存在!", type.Name, attribute.WorldUIDomainName));
                    }
                    break;
                }
            }
        }