Пример #1
0
        /// <summary>
        /// Mask是特殊的加载,不会放在UIStack里面,也不会放在对象池里面,只有显示和隐藏
        /// </summary>
        /// <param name="sortingOrder"></param>
        /// <param name="isClick"></param>
        private IEnumerator LoadMask()
        {
            var handle = Addressables.InstantiateAsync(UIPath.MaskUI.loadPath);

            yield return(handle);

            if (handle.Result != null)
            {
                GameObject obj = handle.Result;
                obj.transform.SetParent(m_root);
                m_mask = obj.GetOrAddComponent <MaskManager>();
                m_mask.InitUI(UIPath.MaskUI);
                yield return(m_mask.ShowUI());
            }
            else
            {
                Debug.LogError("load file failur:" + UIPath.MaskUI.loadPath);
            }
        }
Пример #2
0
        /// <summary>
        /// Mask是特殊的加载,不会放在UIStack里面,也不会放在对象池里面,只有显示和隐藏
        /// 所以游戏开始的时候就要开始加载
        /// </summary>
        /// <param name="sortingOrder"></param>
        /// <param name="isClick"></param>
        public IEnumerator LoadMask()
        {
            UIConfig config;

            if (m_dic.TryGetValue(UIName.MaskUI, out config))
            {
                var handle = AddressableResLoader.InstantiateAsync(config.loadPath);
                yield return(handle);

                if (handle.Result != null)
                {
                    GameObject obj = handle.Result;
                    obj.transform.SetParent(root);
                    m_mask = obj.GetOrAddComponent <MaskManager>();
                    m_mask.InitUI();
                    m_mask.clickCloseMaskEvent += CloseCurUI;
                    m_mask.HideUI();
                }
                else
                {
                    Debug.LogError("load file failur:" + config.loadPath);
                }
            }
        }