Beispiel #1
0
 public void UIPageBaseInit(string pageName, GComponent component, StUserData userData)
 {
     _pageName  = pageName;
     _component = component;
     _userData  = userData;
     InitUIPage();
 }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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);
                }
            }
        }
Beispiel #4
0
 public UIPageBase(string pageName, GComponent component, StUserData userData)
 {
     _pageName  = pageName;
     _component = component;
     _userData  = userData;
 }