zoukankan      html  css  js  c++  java
  • NGUI Tutorial 3

    一、 Create a Button

       一、(Menu)NGUI -> Create -> Sprite

      

           二、attach box colider to the Sprite , then attach UIButton Script

         

           三、Create - >Lable as Sprite's Child, Set it's Ahchors to it's Parent

     (注意:不要给Lable添加box colider 这样Sprite按钮就接受不到事件了,因为Lable 的Depth 大于 Sprite)

                  

          四、Sprite attach UIButton Script Again ,set target as Lable

          五、Hover the button ,you will seen Sprite and Lable all highlight.

           

    二、Event Trigger -> Use Button Change

          一、create a spirte ,which will be changed by button

         

      二、attach Tween Height and Tween Width ,set valuse like that

      (注意,set two scripts active  false ,这样就不会一开始就变换形状了)

        

         三、attach UIEvent Trigger to button,set event to change sprite,like that

        

       四、now  show the result

        Hover:  Change Size

       

        Leave : Noraml Size

       

    三、UIKeyBinding 

      绑定一个快捷键去激活一个按钮,输入框或选择一个对象。

      一、Attach UIKeyBinding Script to button

      

      二、Attach Test Scrpit to Sprite

      

      三、Set OnClick Event Notify Object reference to Sprite

        

          四、Now , you can enter 1,2,3 to change sprite color.

         

          OfSourse you can alse 使用键盘来控制 UIInput

          liket that

      

      

      你也可以使用UIKeyNavigation ——附加这个脚步到你的控制上去允许使用键盘或控制器来定位UI(3.5.5新增)

  • 相关阅读:
    表示数值的字符串(C++描述)
    单链表是否有环及环入口点
    医院信息运维系统-信息科专用运维系统
    c# List 按类的指定字段排序
    运维系统说明
    更新库下载
    mysql数据库备份
    网络编程基础
    面向对象和过程,一样的价格,不一样的口味
    模块的导入顺序细节
  • 原文地址:https://www.cnblogs.com/chongxin/p/3856563.html
Copyright © 2011-2022 走看看