Example #1
0
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
            try
            {
                ResourcesComponent resourcesComponent = ETModel.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 = ComponentFactory.Create <UI, GameObject>(lobby);

                ui.AddComponent <UILobbyComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e.ToStr());
                return(null);
            }
        }
Example #2
0
 public void Add(UIType type, UI ui)
 {
     this.uis.Add(type, ui);
 }
Example #3
0
 public void Remove(UIType type)
 {
     ETModel.Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle($"{type}.unity3d");
 }
Example #4
0
        public void Remove(int type)
        {
            string uiName = UIType.GetUIName(type);

            ETModel.Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle($"{uiName}.unity3d");
        }