Example #1
0
        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);
            }

            //加载一次UI资源
            await Game.Scene.GetComponent <FUIPackageComponent>().AddPackageAsync(FUIType.Sekia);

            //创建登陆界面
            SekiaLoginFactory.Create();
        }
 //返回角色界面或者返回登陆界面
 public void OnBack()
 {
     if (messageUser.Characters.Count == 0)
     {
         SekiaLoginFactory.Create();
         Game.EventSystem.Run(EventIdType.CreateCharacterFinish);
     }
     else
     {
         SelectCharacterFactory.Create(messageUser);
         Game.EventSystem.Run(EventIdType.CreateCharacterFinish);
     }
 }