Exemple #1
0
        /// <summary>/// 不会检测是否有缓存 每次都是重新创建 不受UIPageManager 管理生命周期,只受到父级页面管理/// </summary>
        public static T CreateWidgetInstance <T>(string pageName, string pagePath, UIBasePage parentPage, Transform parentTrans, LoadAssetChannelUsage loadAssetChannel = LoadAssetChannelUsage.Default) where T : UIBaseWidget, new()
        {
            if (string.IsNullOrEmpty(pageName) || string.IsNullOrEmpty(pageName))
            {
                Debug.LogError("CreateWidgetPage Fail,Parameter is null");
                return(null);
            }

            T targetWidget = null;

            CreateUIPageInstance(pageName, pagePath, parentTrans, (gameObjectReference) =>
            {
                if (gameObjectReference != null)
                {
                    targetWidget = new T();

                    targetWidget.UIPageInitialed(pageName, UIPageTypeEnum.Widget, parentPage, gameObjectReference);
                    targetWidget.InstantiatePage(); //初始化

#if UNITY_EDITOR
                    //var debugShowScript = gameObjectReference.GetAddComponentEx<Debug_ShowUIPageInfor>();
                    //debugShowScript.Initialed(targetWidget);
#endif
                }
            }, loadAssetChannel);

            targetWidget?.ShowPage();
            return(targetWidget);
        }
Exemple #2
0
 public PageEffectMgr(UIBasePage page, string nodeName)
 {
     mEffectCfg = page.FindElement <UIEffectCfg> (nodeName);
     if (mEffectCfg != null)
     {
         mEffects = new Dictionary <string, GameObject> ();
     }
 }
Exemple #3
0
        //查找指定父页面中的指定名称和类型的组件
        public static T GetWidgetInstanceOfTargetParent <T>(string pageName, UIBasePage parentPage) where T : UIBaseWidget, new()
        {
            if (parentPage == null)
            {
                Debug.LogError($"关联的参数为null");
                return(null);
            }

            if (string.IsNullOrEmpty(pageName))
            {
                Debug.LogError($"查找的组件名为null");
                return(null);
            }

            return(parentPage.FindSpecialWidget <T>(pageName));
        }
Exemple #4
0
        //创建或者获取
        public static T GetOrCreateWidgetInstance <T>(string pageName, string pagePath, UIBasePage parentPage, Transform parentTrans, LoadAssetChannelUsage loadAssetChannel = LoadAssetChannelUsage.Default) where T : UIBaseWidget, new()
        {
            T widget = GetWidgetInstanceOfTargetParent <T>(pageName, parentPage);

            if (widget != null)
            {
                return(widget);
            }
            return(CreateWidgetInstance <T>(pageName, pagePath, parentPage, parentTrans, loadAssetChannel));
        }