纳金网
标题:
鼠标双击的获取!
[打印本页]
作者:
宁唯是宁唯
时间:
2013-9-23 10:33
标题:
鼠标双击的获取!
挣一点金币
public class test : MonoBehaviour
{
public float doubeClickDelay = 0.4f;
bool firstClick = false;
bool secondClick = false;
float firstClickTime;
float secondClickTime;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Time.time - firstClickTime > doubeClickDelay)
{
firstClick = false;
secondClick = false;
}
}
void OnMouseUp()
{
print("up!!");
if (firstClick == false)
{
firstClick = true;
firstClickTime = Time.time;
return;
}
if (firstClick)
{
secondClick = true;
secondClickTime = Time.time;
print("double Click!!!!!!!!!!");
}
}
}
复制代码
作者:
王者再临
时间:
2013-9-23 10:46
不错的分享,谢谢了!
作者:
幸福小猪
时间:
2013-10-28 11:00
感谢楼主分享
作者:
fkun.lam
时间:
2013-10-31 09:20
不错的分享,谢谢了!
作者:
zhangzhen551
时间:
2013-11-12 07:55
非常实用,顶起来!!
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5