Пример #1
0
        public async Task <UI> CreateAsync(Scene scene, string type, GameObject parent)
        {
            try
            {
                UI ui = await SingleFactory.mInstance.SingleCreateAsync(type);

                ui.AddUIBaseComponent <UIPrivacyPolicyComponent>();
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }
Пример #2
0
        //若有子结构,在add完base下再调用 此方法
        public void AddSubComponent(UI ui)
        {
            if (subs == null)
            {
                subs = new List <string>();
            }
            else
            {
                subs.Clear();
            }
            UIComponent uiComponent = Game.Scene.GetComponent <UIComponent>();
            GameObject  go          = ui.GameObject.transform.Find(UIType.UIHall_LeftMenu).gameObject;
            UI          subUi       = ComponentFactory.Create <UI, GameObject>(go);

            subUi.AddUIBaseComponent <UIHall_LeftMenuComponent>();
            uiComponent.Add(UIType.UIHall_LeftMenu, subUi);
            subs.Add(UIType.UIHall_LeftMenu);
        }
Пример #3
0
 public UI Create(Scene scene, string type, GameObject gameObject)
 {
     try
     {
         ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();
         resourcesComponent.LoadBundle($"{type}.unity3d");
         GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset($"{type}.unity3d", $"{type}");
         GameObject club             = UnityEngine.Object.Instantiate(bundleGameObject);
         club.layer = LayerMask.NameToLayer(LayerNames.UI);
         UI ui = ComponentFactory.Create <UI, GameObject>(club);
         ui.AddUIBaseComponent <UILogin_ForgetComponent>();
         AddSubComponent(ui);
         return(ui);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(null);
     }
 }
Пример #4
0
        public async Task <UI> CreateAsync(Scene scene, string type, GameObject parent)
        {
            try
            {
                ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();
                await resourcesComponent.LoadBundleAsync($"{type}.unity3d");

                GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset($"{type}.unity3d", $"{type}");
                GameObject login            = UnityEngine.Object.Instantiate(bundleGameObject);
                login.layer = LayerMask.NameToLayer(LayerNames.UI);
                UI ui = ComponentFactory.Create <UI, GameObject>(login);

                ui.AddUIBaseComponent <UILoginComponent>();

                AddSubComponent(ui);
                return(ui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }
Пример #5
0
        public UI Create(Scene scene, string type, GameObject gameObject)
        {
            try
            {
                //ResourcesComponent resourcesComponent = Game.Scene.ModelScene.GetComponent<ResourcesComponent>();
                //resourcesComponent.LoadBundle($"{type}.unity3d");
                //GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset($"{type}.unity3d", $"{type}");
                //GameObject login = UnityEngine.Object.Instantiate(bundleGameObject);
                //login.layer = LayerMask.NameToLayer(LayerNames.UI);
                //UI ui = ComponentFactory.Create<UI, GameObject>(login);

                UI ui = SingleFactory.mInstance.SingleCreate(type);
                ui.AddUIBaseComponent <UIToastComponent>();

                this.AddSubComponent(ui);

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