public UI Create(Scene scene, UIType type, GameObject parent) { 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 <GamerComponent>(); ui.AddComponent <UIRoomComponent>(); return(ui); } catch (Exception e) { Log.Error(e.ToStr()); return(null); } }
public UI Create(Scene scene, int type, UI parent) { GameObject bundleGameObject = scene.ModelScene.GetComponent <ResourcesComponent>().GetAsset <GameObject>("uilobby", "Lobby"); GameObject lobby = UnityEngine.Object.Instantiate(bundleGameObject); lobby.layer = LayerMask.NameToLayer(LayerNames.UI); UI ui = new UI(scene, type, parent, lobby); parent.Add(ui); ui.AddComponent <UILobbyComponent>(); return(ui); }
public static UI Create(Scene scene, UIType type, UI parent, bool isWin) { 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 <UIEndComponent, bool>(isWin); return(ui); }
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); } }
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); } }
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); } }