Example #1
0
        public static async ETTask <FUI> Create()
        {
            await ETTask.CompletedTask;

            // 可以同步或者异步加载,异步加载需要搞个转圈圈,这里为了简单使用同步加载
            // await ETModel.Game.Scene.GetComponent<FUIPackageComponent>().AddPackageAsync(FUIType.Login);
            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(FUIType.Shop);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Shop, FUIType.Shop));

            fui.Name = FUIType.Shop;

            // 挂上窗口组件就成了窗口
            FUIWindowComponent fWindow = fui.AddComponent <FUIWindowComponent>();

            fWindow.Modal = true;
            fWindow.Show();

            // 这里可以根据UI逻辑的复杂度关联性,拆分成多个小组件来写逻辑,这里逻辑比较简单就只使用一个组件了
            fui.AddComponent <FUIShopComponent>();

            fui.Name = "Window - Shop";

            return(fui);
        }
        public override void Run()
        {
            FUI fUI = UIFactory.CreateFUI(FUIType.UILogin);

            fUI.AddComponent <UILobbyComponent>();
            Game.Scene.GetComponent <FUIComponent>().Add(fUI);
        }
Example #3
0
        public override void Run()
        {
            FUI ui = UIFactory.CreateFUI(FUIType.UIChessStore);

            ui.AddComponent <FUIChessStoreComponent>();
            Game.Scene.GetComponent <FUIComponent>().Add(ui);
        }
Example #4
0
        public static async ETTask <FUI> Create <T, P1, P2, P3>(string packageName, P1 p1, P2 p2, P3 p3) where T : FUIBase
        {
            await ETTask.CompletedTask;

            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(packageName);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(packageName, packageName));

            fui.Name = packageName;

            fui.AddComponent(typeof(T), p1, p2, p3);

            Game.Scene.GetComponent <FUIComponent>().Add(fui);

            return(fui);
        }
Example #5
0
        public static async ETTask <FUI> Create()
        {
            await ETTask.CompletedTask;

            // 可以同步或者异步加载,异步加载需要搞个转圈圈,这里为了简单使用同步加载
            // await ETModel.Game.Scene.GetComponent<FUIPackageComponent>().AddPackageAsync(FUIType.Login);
            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(FUIType.Login);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Login, FUIType.Login));

            fui.Name = FUIType.Login;

            // 这里可以根据UI逻辑的复杂度关联性,拆分成多个小组件来写逻辑,这里逻辑比较简单就只使用一个组件了
            fui.AddComponent <FUILoginComponent>();

            return(fui);
        }
Example #6
0
        public static async ETTask <FUI> Create <T>(string packageName) where T : FUIBase
        {
            await ETTask.CompletedTask;



            // 可以同步或者异步加载,异步加载需要搞个转圈圈,这里为了简单使用同步加载
            // await ETModel.Game.Scene.GetComponent<FUIPackageComponent>().AddPackageAsync(FUIType.Login);
            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(packageName);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(packageName, packageName));

            fui.Name = packageName;

            // 这里可以根据UI逻辑的复杂度关联性,拆分成多个小组件来写逻辑,这里逻辑比较简单就只使用一个组件了
            fui.AddComponent(typeof(T));

            Game.Scene.GetComponent <FUIComponent>().Add(fui);

            return(fui);
        }
Example #7
0
        public static FUI CreateFUI(string uiType)
        {
            try
            {
                ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(uiType);

                FUI fui = EntityFactory.Create <FUI, string, GObject>(Game.Scene, uiType, UIPackage.CreateObject(uiType, uiType));
                fui.Name = uiType;

                // 挂上窗口组件就成了窗口
                FUIWindowComponent fWindow = fui.AddComponent <FUIWindowComponent>();
                fWindow.Modal = true;
                fWindow.Show();

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