public static void ReorderableWidgetOnGUI_BeforeWindowStack()
 {
     if (ReorderableWidget.dragBegun && ReorderableWidget.draggingReorderable >= 0 && ReorderableWidget.draggingReorderable < ReorderableWidget.reorderables.Count)
     {
         int groupID = ReorderableWidget.reorderables[ReorderableWidget.draggingReorderable].groupID;
         if (groupID >= 0 && groupID < ReorderableWidget.groups.Count && ReorderableWidget.groups[groupID].extraDraggedItemOnGUI != null)
         {
             ReorderableWidget.groups[groupID].extraDraggedItemOnGUI(ReorderableWidget.GetIndexWithinGroup(ReorderableWidget.draggingReorderable), ReorderableWidget.dragStartPos);
         }
     }
 }
 public static void ReorderableWidgetOnGUI_AfterWindowStack()
 {
     if (Event.current.rawType == EventType.MouseUp)
     {
         ReorderableWidget.released = true;
     }
     if (Event.current.type == EventType.Repaint)
     {
         if (ReorderableWidget.clicked)
         {
             ReorderableWidget.StopDragging();
             for (int i = 0; i < ReorderableWidget.reorderables.Count; i++)
             {
                 if (ReorderableWidget.reorderables[i].rect == ReorderableWidget.clickedInRect)
                 {
                     ReorderableWidget.draggingReorderable = i;
                     ReorderableWidget.dragStartPos        = Event.current.mousePosition;
                     break;
                 }
             }
             ReorderableWidget.clicked = false;
         }
         if (ReorderableWidget.draggingReorderable >= ReorderableWidget.reorderables.Count)
         {
             ReorderableWidget.StopDragging();
         }
         if (ReorderableWidget.reorderables.Count != ReorderableWidget.lastFrameReorderableCount)
         {
             ReorderableWidget.StopDragging();
         }
         ReorderableWidget.lastInsertNear = ReorderableWidget.CurrentInsertNear(out ReorderableWidget.lastInsertNearLeft);
         if (ReorderableWidget.released)
         {
             ReorderableWidget.released = false;
             if (ReorderableWidget.dragBegun && ReorderableWidget.draggingReorderable >= 0)
             {
                 int indexWithinGroup = ReorderableWidget.GetIndexWithinGroup(ReorderableWidget.draggingReorderable);
                 int num;
                 if (ReorderableWidget.lastInsertNear == ReorderableWidget.draggingReorderable)
                 {
                     num = indexWithinGroup;
                 }
                 else if (ReorderableWidget.lastInsertNearLeft)
                 {
                     num = ReorderableWidget.GetIndexWithinGroup(ReorderableWidget.lastInsertNear);
                 }
                 else
                 {
                     num = ReorderableWidget.GetIndexWithinGroup(ReorderableWidget.lastInsertNear) + 1;
                 }
                 if (num >= 0 && num != indexWithinGroup && num != indexWithinGroup + 1)
                 {
                     SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                     try
                     {
                         ReorderableWidget.groups[ReorderableWidget.reorderables[ReorderableWidget.draggingReorderable].groupID].reorderedAction(indexWithinGroup, num);
                     }
                     catch (Exception ex)
                     {
                         Log.Error(string.Concat(new object[]
                         {
                             "Could not reorder elements (from ",
                             indexWithinGroup,
                             " to ",
                             num,
                             "): ",
                             ex
                         }), false);
                     }
                 }
             }
             ReorderableWidget.StopDragging();
         }
         ReorderableWidget.lastFrameReorderableCount = ReorderableWidget.reorderables.Count;
         ReorderableWidget.groups.Clear();
         ReorderableWidget.reorderables.Clear();
     }
 }