• Unity3D判断鼠标向右或向左滑动,响应不同的事件


    private var first = Vector2.zero;   
    
    private var second = Vector2.zero;   
    
    function Update ()
    
    {
    
    }   
    
    function OnGUI ()
    
    {
    
        if(Event.current.type == EventType.MouseDown)
    
      {
    
        //记录鼠标按下的位置   
    
         first = Event.current.mousePosition ;
    
        }   
    
       if(Event.current.type == EventType.MouseDrag)
    
      {
    
        //记录鼠标拖动的位置   
    
        second = Event.current.mousePosition ;   
    
        if(second.x<first.x)
    
        {
    
          //拖动的位置的x坐标比按下的位置的x坐标小时,响应向左事件   
    
           print("left");   
    
         }   
    
         if(second.x>first.x)
    
        {
    
          //拖动的位置的x坐标比按下的位置的x坐标大时,响应向右事件   
    
           print("right");   
    
         }   
    
         first = second;   
    
      }   
    
    }
  • 相关阅读:
    正则化--Lambda
    uwsgi配置cheaper模式进行自动弹性
    采集容器内存并写到excel
    通过进程id找到进程对应的容器并统计每个进程的内存占用写到excel里
    基于celery的任务管理
    基于Redis做内存管理
    uWSGI
    nginx
    服务发现
    绑核与巨页
  • 原文地址:https://www.cnblogs.com/123ing/p/3915323.html
Copyright © 2020-2023  润新知