Ejemplo n.º 1
0
        private T _OpenUI_LauncherMode_Default <T>(UIViewConfigElement configElement, params object[] values) where T : IUIViewListener
        {
            GameObject src = Resources.Load <GameObject>(configElement.UIPath);

            if (src != null)
            {
                GameObject one = GameObject.Instantiate(src);
                one.name = typeof(T).Name;
                one.transform.SetParent(Canvas.transform, true);
                one.transform.localPosition = Vector3.zero;
                one.transform.localRotation = Quaternion.identity;
                one.transform.localScale    = Vector3.one;
                // ==================================
                IUIViewListener view = one.GetComponent <IUIViewListener>();
                if (view == null)
                {
                    view = (IUIViewListener)one.AddComponent(typeof(T));
                }
                mStack.Push(view);
                // ==================================
                view.onInit();
                view.onCreate(values);
                return((T)view);
            }
            return(default(T));
        }
Ejemplo n.º 2
0
        private UIViewConfigElement DefaultConfig(string name)
        {
            UIViewConfigElement configElement = new UIViewConfigElement();

            configElement.UIPath     = string.Format(GameServiceDefine.Resources_UI_XXX, name);
            configElement.UIName     = name;
            configElement.LaunchMode = System.Enum.GetName(typeof(UIViewLaunchMode), UIViewLaunchMode.Default);
            configElement.Layer      = System.Enum.GetName(typeof(UIViewLayer), UIViewLayer.Common);
            return(configElement);
        }
Ejemplo n.º 3
0
 private T _OpenUI_ByConfig <T>(UIViewConfigElement configElement, params object[] values) where T : IUIViewListener
 {
     if (configElement.ConvertLaunchMode == UIViewLaunchMode.Default)
     {
         return(_OpenUI_LauncherMode_Default <T>(configElement, values));
     }
     else
     {
         return(_OpenUI_LauncherMode_SingleTop <T>(configElement, values));
     }
 }
Ejemplo n.º 4
0
 private T _OpenUI_LauncherMode_SingleTop <T>(UIViewConfigElement configElement, params object[] values) where T : IUIViewListener
 {
     if (HasExsit <T>())
     {
         return(_OpenUI_StackTop <T>(values));
     }
     else
     {
         return(_OpenUI_LauncherMode_Default <T>(configElement, values));
     }
 }
Ejemplo n.º 5
0
        public T OpenUI <T>(params object[] values) where T : IUIViewListener
        {
            string typeName = typeof(T).Name;

            if (UIViewConfig == null)
            {
                return(_OpenUI_ByDefault <T>(values));
            }
            else
            {
                UIViewConfigElement configElement = UIViewConfig.FindUIViewConfigElement(typeName);
                if (configElement == null)
                {
                    return(_OpenUI_ByDefault <T>(values));
                }
                else
                {
                    return(_OpenUI_ByConfig <T>(configElement, values));
                }
            }
        }