示例#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.ToStr()}");
            }
        }
示例#2
0
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
            try
            {
                GameObject bundleGameObject = ((GameObject)Resources.Load("UI")).Get <GameObject>("UILogin");
                GameObject login            = UnityEngine.Object.Instantiate(bundleGameObject);
                login.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = EntityFactory.Create <UI, Scene, UI, GameObject>(scene, null, login);

                ui.AddComponent <UILoginComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToStr());
                return(null);
            }
        }
示例#3
0
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
            try
            {
                GameObject bundleGameObject = scene.ModelScene.GetComponent <ResourcesComponent>().GetAsset <GameObject>("uilogin", "UILogin");
                GameObject lobby            = UnityEngine.Object.Instantiate(bundleGameObject);
                lobby.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = new UI(scene, type, null, lobby);

                ui.AddComponent <UILoginComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToStr());
                return(null);
            }
        }
示例#4
0
        public UI Create(Scene scene, UIType type, GameObject parent)
        {
            try
            {
                GameObject prefab = Resources.Load <GameObject>("UI").Get <GameObject>("UILobby");
                GameObject lobby  = UnityEngine.Object.Instantiate(prefab);
                lobby.layer = LayerMask.NameToLayer("UI");
                UI ui = new UI(scene, type, null, lobby);

                ui.AddComponent <UILobbyComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToStr());
                return(null);
            }
        }
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
            try
            {
                ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>();
                resourcesComponent.LoadBundle($"{type}.unity3d");
                GameObject bundleGameObject = resourcesComponent.GetAsset <GameObject>($"{type}.unity3d", $"{type}");
                GameObject lobby            = UnityEngine.Object.Instantiate(bundleGameObject);
                lobby.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = EntityFactory.Create <UI, Scene, UI, GameObject>(scene, null, lobby);

                ui.AddComponent <UILobbyComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToStr());
                return(null);
            }
        }
示例#6
0
 public void Add(UIType type, UI ui)
 {
     this.uis.Add(type, ui);
 }
 public void Remove(UIType type)
 {
     Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle($"{type}.unity3d");
 }
示例#8
0
 public void Remove(UIType type)
 {
 }