UILoginFactory.cs 795 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. public static class UILoginFactory
  6. {
  7. public static UI Create()
  8. {
  9. try
  10. {
  11. ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
  12. resourcesComponent.LoadBundle(UIType.UILogin.StringToAB());
  13. GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
  14. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
  15. UI ui = EntityFactory.Create<UI, string, GameObject>(Game.Scene, UIType.UILogin, gameObject);
  16. ui.AddComponent<UILoginComponent>();
  17. return ui;
  18. }
  19. catch (Exception e)
  20. {
  21. Log.Error(e);
  22. return null;
  23. }
  24. }
  25. }
  26. }