- 最后登录
- 2017-4-1
- 注册时间
- 2011-7-26
- 阅读权限
- 90
- 积分
- 24690
  
- 纳金币
- 24658
- 精华
- 6
|
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;
}
} |
|