zoukankan      html  css  js  c++  java
  • UI 界面:技术决定一切

      在我看来,肖恩帕克不仅仅是一位技术天才和远见卓识的移动互联网领域先锋。同时谙熟社会之道,他认为技术才是改变人类生活结构和方式的核心,不是政府。整个世界和人类的生活方式都被技术最牛逼的公司苹果所影响着,我想未来会是一家生物工程公司。iOS平台的UI界面操作比以往的菜单选择和鼠标点击更能引发人们的情绪反馈。因此我将会着手iOS触屏界面系统的技术。

      操作界面在MobileMenuScene中控制,后续有一个MobileMenuBase继承了MobileMenuScene,但是添加了Fade函数。

      1.我写了一个AntMenuSceneMainMenu来定义自己的开始游戏一级菜单。

    class AntMenuSceneMainMenu extends MobileMenuScene;

      var MobilePlayerInput MPI;

      2.在Controller中可以打开这个菜单(当然你可以用你的任何方式在任何时候任何位置打开自己需要的菜单,例如玩家死亡,可以在Pawn中打开菜单)

      var AntMenuSceneMainMenu MainGameMenu;

         MainGameMenu=AntMenuSceneMainMenu(MPI.OpenMenuScene(class'AntMenuSceneMainMenu'));

      3.这样就打开了需要的MobileMenuScene

      在这里的defaultproperties中添加需要的内容,Image,label,button基本上就是这三种内容了,他们都继承自MobileMenuObject

      Button  

    Begin Object Class=MobileMenuButton Name=CloseButton
            Tag="Play"
            bRelativeLeft=true
            bRelativeTop=true
            bRelativeHeight=true
            bRelativeWidth=true
            bHeightRelativeToWidth=true
            Left=0.04
            Top=0
            Width=0.25           
            Height=1.0
            Caption="Play!"
            bCaptionShadow=true
            Images(0)=Texture2D'ChickenHUD.HenIcon'
            Images(1)=Texture2D'ChickenHUD.HenIcon'
            CaptionColor=(R=1.0,G=1.0,B=0.0,A=1.0)
            CaptionScale=1.1
        End Object
        MenuObjects.Add(CloseButton)

      Lebel

    Begin Object Class=MobileMenuLabel Name=HighScoreLabel
            Tag="HighScore"
            bRelativeLeft=true
            bRelativeTop=true
            Left=0.36
            Top=0.37
            TextFont=Font'ChickenFonts.Plump'
            TextColor=(R=50,G=255,B=100,A=255)
            TouchedColor=(R=50,G=255,B=100,A=255)
            Caption="High Score:"
            TextXScale=1.3
            TextYScale=1.3
            ShadowOffsetScale=1.7
        End Object
        MenuObjects.Add(HighScoreLabel)

      Image

    Begin Object Class=MobileMenuImage Name=Background
          Tag="Background"
          Left=0
          Top=0
          Width=1.0
          Height=1.0
          bRelativeWidth=true
          bRelativeHeight=true
          Image=Texture2D'CastleUI.menus.T_CastleMenu2'
          ImageDrawStyle=IDS_Stretched
          ImageUVs=(bCustomCoords=true,U=0,V=30,UL=1024,VL=180)
       End Object
       MenuObjects.Add(Background)

       MobileMenuScene中有需要填充的函数,例如处理Touch的函数

    event OnTouch(MobileMenuObject Sender, ETouchType EventType, float TouchX, float TouchY)
    {
        if(sender==none)
        return;
    
        switch(Sender.tag)
        {
            case "Jump_tag":
            `log("this is work fine aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            InputOwner.Outer.ConsoleCommand("jump");
            break;
    
            case "Weapon_tag":
            InputOwner.Outer.ConsoleCommand("nextweapon");
            break;
    
            case "zone_tag":
            InputOwner.Outer.ConsoleCommand("KillZone");
            break;
    
            case "Auto_tag":
            InputOwner.Outer.ConsoleCommand("AutoShoot");
            break;
        }
    
        if(sender.Tag!="Auto_tag")
        {
            InputOwner.Outer.ConsoleCommand("DisableAutoShoot");
        }
    
    }

      当然你也可以在初始化中显示自己想要布置的内容

    event InitMenuScene(MobilePlayerInput PlayerInput, int ScreenWidth, int ScreenHeight)
    {
        local MobileMenuLabel tLabel;
        super.InitMenuScene(PlayerInput,ScreenWidth,ScreenHeight);
        tLabel = MobileMenuLabel(FindMenuObject("HighScore"));
        tLabel.Caption = tLabel.Caption @ ChickenMenuGame(class'WorldInfo'.static.GetWorldInfo().Game).cHighScore.HighScore;
    }

      4.关闭菜单

      CloseMenuScene

      

      

      

  • 相关阅读:
    dubbo学习总结二 服务端
    dubbo学习总结一 API
    mybatis中的#和$的区别
    Spring boot配置注意事项
    dubbo 学习
    框架发展过程
    使用OkHttp模拟登陆LeetCode
    Java设计模式——建造者模式(创建型模式)
    Java设计模式——单例模式(创建型模式)
    Java中static的用法
  • 原文地址:https://www.cnblogs.com/NEOCSL/p/2811153.html
Copyright © 2011-2022 走看看