コード例 #1
0
        public bool SetUIPageToLayerTop(string UIPageName, e_UILayer UILayer)
        {
            UIPageBase page;

            if (GetUIPage(UIPageName, out page))
            {
                _UIPages[UILayer.ToString()].Component.AddChildAt(page.Component, _UIPages[UILayer.ToString()].Component.numChildren - 1);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public bool SetUIPageLayer(string UIPageName, e_UILayer UILayer, int index = 0)
        {
            UIPageBase page;

            if (GetUIPage(UIPageName, out page))
            {
                _UIPages[UILayer.ToString()].Component.AddChildAt(page.Component, index);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public UIPageBase CreateUIPage <T, T2>(StUserData userData, e_UILayer UILayer = e_UILayer.Middle)
            where T : UIPageBase, new()
            where T2 : GComponent
        {
            UIPageBase page;

            string[] TypeName        = typeof(T2).ToString().Split('.');
            string   UIPackageName   = TypeName[0];
            string   UIComponentName = TypeName[1];
            string   UIPageName      = typeof(T).ToString();

            if (!GetUIPage(UIPageName, out page))
            {
                AddUIPackage(string.Format("FGUI/{0}", UIPackageName));
                GComponent UIComponent;
                try
                {
                    UIComponent = (T2)UIPackage.CreateObject(UIPackageName, UIComponentName);
                }
                catch (Exception)
                {
                    throw new Exception("转换失败,你是否未进行类型绑定");
                }

                _UIPages[UILayer.ToString()].Component.AddChild(UIComponent);

                page = new T();
                _UIPages.Add(UIPageName, page);
                page.UIPageBaseInit(UIPageName, UIComponent, userData);
                page.OpenUIPage();
                return(page);
            }
            else
            {
                if (CloseUIPage(UIPageName))
                {
                    return(CreateUIPage <T, T2>(userData, UILayer));
                }
                else
                {
                    return(page);
                }
            }
        }
コード例 #4
0
        public UIPageBase CreateUIPage(string UIPageName, string UIPackageName, string UIComponentName, StUserData userData, e_UILayer UILayer = e_UILayer.Middle)
        {
            UIPageBase page;

            if (!GetUIPage(UIPageName, out page))
            {
                AddUIPackage(string.Format("FGUI/{0}", UIPackageName));
                GComponent UIComponent;
                try
                {
                    UIComponent = (GComponent)UIPackage.CreateObject(UIPackageName, UIComponentName);
                }
                catch (Exception)
                {
                    throw new Exception("转换失败,你是否未进行类型绑定");
                }

                _UIPages[UILayer.ToString()].Component.AddChild(UIComponent);

                page = (UIPageBase)Assembly.GetExecutingAssembly().CreateInstance(UIPageName);
                _UIPages.Add(UIPageName, page);
                page.UIPageBaseInit(UIPageName, UIComponent, userData);
                page.OpenUIPage();
                return(page);
            }
            else
            {
                if (CloseUIPage(UIPageName))
                {
                    return(CreateUIPage(UIPageName, UIPackageName, UIComponentName, userData, UILayer));
                }
                else
                {
                    return(page);
                }
            }
        }