예제 #1
0
        public UI Create(Scene scene, string type, GameObject gameObject)
        {
            try
            {
                GameObject bundleGameObject = ((GameObject)ResourcesHelper.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.AddUIBaseComponent <UIDialogComponent>();

                AddSubComponent(ui);

                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }
예제 #2
0
        public async Task <UI> CreateAsync(Scene scene, string type, GameObject parent)
        {
            try
            {
                UnityEngine.Object obj = await ResourcesHelper.LoadAsync("KV");

                GameObject bundleGameObject = ((GameObject)obj).Get <GameObject>(type);
                GameObject go = UnityEngine.Object.Instantiate(bundleGameObject);
                go.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = ComponentFactory.Create <UI, GameObject>(go);

                ui.AddUIBaseComponent <UILoadingComponent>();

                AddSubComponent(ui);

                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }