Beispiel #1
0
 private static bool RecurseMouseDown(int X, int Y, Gump g, int mX, int mY, MouseButtons mb)
 {
     if (g.Visible && (g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height))))))
     {
         Gump[] gumpArray = g.Children.ToArray();
         for (int i = gumpArray.Length - 1; i >= 0; i--)
         {
             Gump gump = gumpArray[i];
             if (RecurseMouseDown(X + gump.X, Y + gump.Y, gump, mX, mY, mb))
             {
                 return true;
             }
         }
         if (!g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height)))))
         {
             if ((m_Modal == null) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_TextFocus != null)
                 {
                     m_TextFocus.Unfocus();
                     m_TextFocus = null;
                 }
                 if (((m_Drag == null) && g.m_CanDrag) && (mb == MouseButtons.Left))
                 {
                     m_StartDrag = g;
                     m_StartDragPoint = new Point(mX, mY);
                     g.m_OffsetX = mX - X;
                     g.m_OffsetY = mY - Y;
                     if (g.m_QuickDrag)
                     {
                         g.m_IsDragging = true;
                         m_Drag = g;
                         g.OnDragStart();
                     }
                 }
                 g.OnMouseDown(mX - X, mY - Y, mb);
                 Focus = g;
                 if (g == m_Drag)
                 {
                     return !IsWorldAt(mX, mY, false);
                 }
                 return true;
             }
             if (((m_Modal != null) && g.IsChildOf(m_Modal)) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_TextFocus != null)
                 {
                     m_TextFocus.Unfocus();
                     m_TextFocus = null;
                 }
                 if (((m_Drag == null) && g.m_CanDrag) && (mb == MouseButtons.Left))
                 {
                     m_StartDrag = g;
                     m_StartDragPoint = new Point(mX, mY);
                     g.m_OffsetX = mX - X;
                     g.m_OffsetY = mY - Y;
                     if (g.m_QuickDrag)
                     {
                         g.m_IsDragging = true;
                         g.OnDragStart();
                         m_Drag = g;
                     }
                 }
                 g.OnMouseDown(mX - X, mY - Y, mb);
                 Focus = g;
                 if (g == m_Drag)
                 {
                     return !IsWorldAt(mX, mY, false);
                 }
                 return true;
             }
         }
     }
     return false;
 }