Example #1
0
 public static UI Create()
 {
     try
     {
         GameObject bundleGameObject = ((GameObject)ResourcesHelper.Load("KV")).Get <GameObject>(UIType.UILoading);
         GameObject go = UnityEngine.Object.Instantiate(bundleGameObject);
         go.layer = LayerMask.NameToLayer(LayerNames.UI);
         UI ui = ComponentFactory.Create <UI, string, GameObject>(UIType.UILoading, go, false);
         ui.AddComponent <UILoadingComponent>();
         return(ui);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(null);
     }
 }
        public static UI Create(string type, UI parent)
        {
            ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();

            resourcesComponent.LoadBundle($"{type}.unity3d");
            GameObject prefab      = (GameObject)resourcesComponent.GetAsset($"{type}.unity3d", $"{type}");
            GameObject interaction = UnityEngine.Object.Instantiate(prefab);

            interaction.layer = LayerMask.NameToLayer("UI");

            UI ui = ComponentFactory.Create <UI, GameObject>(interaction);

            parent.Add(ui);
            ui.GameObject.transform.SetParent(parent.GameObject.transform, false);

            ui.AddComponent <LandInteractionComponent>();
            return(ui);
        }
Example #3
0
        public UI Create(Scene scene, string type, GameObject gameObject)
        {
            try
            {
                GameObject bundleGameObject = ((GameObject)Resources.Load("KV")).Get <GameObject>(type);
                GameObject go = UnityEngine.Object.Instantiate(bundleGameObject);
                go.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = ComponentFactory.Create <UI, GameObject>(go);

                ui.AddComponent <UILoadingComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }
Example #4
0
        public static UI Create()
        {
            try
            {
                ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();
                resourcesComponent.LoadBundle(UIType.UILobby.StringToAB());
                GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
                GameObject gameObject       = UnityEngine.Object.Instantiate(bundleGameObject);
                UI         ui = ComponentFactory.Create <UI, string, GameObject>(UIType.UILobby, gameObject, false);

                ui.AddComponent <UILobbyComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }