Exemple #1
0
        public UI Create(UIType type)
        {
            try
            {
                UI ui = UiTypes[type].Create(this.GetParent <Scene>(), type, Root);
                uis.Add(type, ui);

                // 设置canvas
                string cavasName = ui.GameObject.GetComponent <CanvasConfig>().CanvasName;
                ui.GameObject.transform.SetParent(this.Root.Get <GameObject>(cavasName).transform, false);
                return(ui);
            }
            catch (Exception e)
            {
                throw new Exception($"{type} UI 错误: {e}");
            }
        }
Exemple #2
0
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
            try
            {
                GameObject bundleGameObject = ((GameObject)Resources.Load("KV")).Get <GameObject>("UILoading");
                GameObject go = UnityEngine.Object.Instantiate(bundleGameObject);
                go.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = ComponentFactory.Create <UI, GameObject>(go);

                ui.AddComponent <UILoadingComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
                return(null);
            }
        }
Exemple #3
0
 public void Add(UIType type, UI ui)
 {
     this.uis.Add(type, ui);
 }
Exemple #4
0
 public void Remove(UIType type)
 {
 }
 public UIFactoryAttribute(UIType type)
 {
     this.Type = type;
 }