コード例 #1
0
ファイル: ClickHandler.cs プロジェクト: mattgaut/CardCreator
 IEnumerator ClickListener()
 {
     while (mouse_over)
     {
         if (clickable.can_click && Input.GetMouseButtonDown(0))
         {
             clickable.OnLeftClickDown();
             bool mouse_left = false;
             while (clickable.can_click && !Input.GetMouseButtonUp(0))
             {
                 mouse_left = !mouse_over || mouse_left || clickable.must_drag;
                 if (mouse_left)
                 {
                     clickable.OnHoldDrag(OverObject(), OverPosition());
                 }
                 yield return(null);
             }
             if (!mouse_left)
             {
                 clickable.OnClick();
             }
             else
             {
                 clickable.OnFinishDrag(OverObject(), OverPosition());
             }
             clickable.OnEndClick();
         }
         yield return(null);
     }
 }