예제 #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
파일: UIRoomFactory.cs 프로젝트: skyole/ET
 public void Remove(UIType type)
 {
 }