查看: 1288|回复: 0
打印 上一主题 下一主题

Android touch

[复制链接]

1602

主题

1

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
24658
精华
6

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-4-19 14:01:22 |只看该作者 |倒序浏览
var touch : Touch;

var tCount : GUIText;

var tapcount : GUIText;

var touchPhase : TouchPhase[];

var taps : int[];
function Start () {

for (var j = 0; j < 4; ++j)

  touchPhase[j] = TouchPhase.Stationary;

}
function OnGUI () {

  

for (var i = 0; i < Input.touchCount; ++i) {

   touch = Input.GetTouch(i);

           GUI.Button(Rect((touch.position.x - 120), (Screen.height - touch.position.y - 35), 90, 20), " " + touch.fingerId + " " + touchPhase);

           

           GUI.Button(Rect((touch.position.x - 120), (Screen.height - touch.position.y - 65), 27, 20), " " + taps);

    }



if (GUI.Button(Rect(250, 10, 200, 30), "multiTouch.enabled: " + Input.multiTouchEnabled))

  Input.multiTouchEnabled = !Input.multiTouchEnabled;

  

}
function FixedUpdate () {

  tCount.text = "touchCount: " + Input.touchCount;

  

  for (var i = 0; i < Input.touchCount; ++i) {

   touch = Input.GetTouch(i);

   touchPhase = touch.phase;

   taps = touch.tapCount;

   tapcount.text = "tapCount: " + touch.tapCount;

  }

  

}
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-6-10 06:15 , Processed in 0.058787 second(s), 28 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部