public async ETVoid RunAsync() { FUIComponent fuiComponent = Game.Scene.GetComponent <FUIComponent>(); //实际比例 float ratioCurrent = fuiComponent.Root.GObject.actualWidth / fuiComponent.Root.GObject.actualHeight; //设计比例 float ratioDesign = (float)1280 / (float)720; if (ratioCurrent > ratioDesign) //当前屏幕宽度超出 { fuiComponent.Root.GObject.x -= (fuiComponent.Root.GObject.actualHeight * ratioDesign - fuiComponent.Root.GObject.actualWidth) / 2; } else if (ratioCurrent < ratioDesign)//当前屏幕高度超出 { //Log.Debug("物体高度:" + self.Root.GObject.height + "物体宽度:" + self.Root.GObject.width + "真实高度" + self.Root.GObject.actualHeight + "真实宽度" + self.Root.GObject.actualWidth + "屏幕高度" + Screen.height + "屏幕宽度" + Screen.width); //真实设计高度 - 屏幕真实高度 fuiComponent.Root.GObject.y -= (fuiComponent.Root.GObject.actualWidth / ratioDesign - fuiComponent.Root.GObject.actualHeight) / 2; //Log.Debug("理想高度为:" + self.Root.GObject.width / ratioDesign); } //加载一次FUI资源 await Game.Scene.GetComponent <FUIPackageComponent>().AddPackageAsync(FUIType.LandFUI); //创建登陆界面 FUILandLoginFactory.Create(); }
public static void Create(A0008_GetUserInfo_G2C message) { FUIComponent fuiComponent = Game.Scene.GetComponent <FUIComponent>(); FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Sekia, FUIType.CreateCharacter)); fui.Name = FUIType.CreateCharacter; fui.AddComponent <CreateCharacterComponent, A0008_GetUserInfo_G2C>(message); fuiComponent.Add(fui); }
public static void Create() { FUIComponent fuiComponent = Game.Scene.GetComponent <FUIComponent>(); FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Sekia, FUIType.NoneFGUI)); fui.Name = FUIType.NoneFGUI; fui.AddComponent <SelectCharacterComponent>(); fuiComponent.Add(fui); }
public static void Create() { FUIComponent fuiComponent = Game.Scene.GetComponent <FUIComponent>(); FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Sekia, FUIType.SekiaLogin)); //fui.GObject.Center(); fui.Name = FUIType.SekiaLogin; fui.AddComponent <SekiaLoginComponent>(); fuiComponent.Add(fui); }
public static void Create() { FUIComponent fuiComponent = Game.Scene.GetComponent <FUIComponent>(); //从整个LandFUI资源包中取得并创建LandLogin登录界面资源 FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.LandFUI, FUIType.LandLogin)); fui.Name = FUIType.LandLogin; //给fui添加LandLoginComponent组件,此组件是给UI元件添加事件方法 fui.AddComponent <FUILandLoginComponent>(); //把登录界面fui添加到全局的FUI组件中 fuiComponent.Add(fui); }