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); } }
public void Add(UIType type, UI ui) { this.uis.Add(type, ui); }
public void Remove(UIType type) { ETModel.Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle($"{type}.unity3d"); }
public void Remove(int type) { string uiName = UIType.GetUIName(type); ETModel.Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle($"{uiName}.unity3d"); }