UI界面:深入最后一次

  UI界面不仅仅能呈现一种渐变效果,如果有推拉效果那就更加的牛逼闪耀。今天我将实现两个内容1.UI的推拉下滑效果 2.kismet中过场动画跳过。我想用一种更为黑客的方式进行下面的工作,一个点一个点的技术攻克每一方面的内容。

  1.在OnTouch中获取Controller

local AntPlayerController PC;

pc=AntPlayerController(InputOwner.Outer);

  2.初始化控件和按钮,为了更加的标准和匹配不同设备的分辨率

var float Scale;


event InitMenuScene(MobilePlayerInput PlayerInput,int ScreenWidth,int ScreenHeight,bool bIsFirstInitialization)
{ 
     local int i;

     super.InitMenuScene(PlayerInput,ScreenWidth,ScreeHeight,bIsFirstInitialization);

     Scale=(ScreenWidth>=960)?1.0:Float(ScreenWidth)/960;
     //resize the scale of button and image
          

  go on bro

for(i=1;i<MenuObjects.length;i++)
{
   MenuObjects[i].Left*=Scale;
   MenuObjects[i].Top*=Scale;
   MenuObjects[i].Width*=Scale;
   MenuObjects[i].Height*=Scale;
}

MenuObjects[0].height*=Scale;
MenuObjects[0].Width*=Scale;

if(ScreenWidth==1024)
{
     MenuObjects[0].Width=2048;
}
else if(ScreenWidth<960)
{
     MobileMenuImage(MenuObjects[0].ImageDrawStyle=IDS_Stretched);
}

//Handle the main window
Width=ScreenWidth;
Height*=Scale;

MenuObjects[1].Left=(ScreenWidth/4)-(MenuObjects[2].width/2);
MenuObjects[2].Left=ScreenWidth-(ScreenWidth/4)-(MenuObjects[2].Width/2);

Top=-Height;
showSize=Height-MenuObjects[1].Top+(8*Scale);
}

  3.抓到了kismet的中心,怎么进入?在PlayerController中研究。两个函数ExitAttractMode(),EnterAttractMode()。后一篇文章专门进入这两个函数研究。

  4.有一个OnSceneTouch函数处理任何在该屏幕上响应的事件,当然可以根据自己的参数设置来规定响应的区域。

if(PC.SliderZone!=none&&X>=PC.SliderZone.CurrentLocation.X&&X<PC.SliderZone.CurrentLocation.x&&Y>=PC.SliderZone.CurrentLocation.Y&&Y<PC.SliderZone.CurrentLocation.Y+PC.SliderZone.ActiveSizeY)

  如此看来,PC.ResetMenu()又是重要的滑动显示效果。

    

    

  

原文地址:https://www.cnblogs.com/NEOCSL/p/2812636.html