public (double x, double y, double z)? GetDragPosition() { return(MapObject?.GetDragPosition()); }
public void DrawOn2DControl(bool isMainGraphics) { List <MapObject> listOrderOnTop = new List <MapObject>(); List <MapObject> listOrderOnBottom = new List <MapObject>(); List <MapObject> listOrderByY = new List <MapObject>(); MapType mapType = Config.CurrentMapGraphics.IsOrthographicViewEnabled ? MapType.Map2DOrthographic : MapType.Map2DTopDown; lock (_objectLock) { foreach (MapTracker mapTracker in Controls) { List <MapObject> mapObjects = mapTracker.GetMapObjectsToDisplay(mapType); switch (mapTracker.GetOrderType()) { case MapTrackerOrderType.OrderOnTop: listOrderOnTop.AddRange(mapObjects); break; case MapTrackerOrderType.OrderOnBottom: listOrderOnBottom.AddRange(mapObjects); break; case MapTrackerOrderType.OrderByY: listOrderByY.AddRange(mapObjects); break; default: throw new ArgumentOutOfRangeException(); } } } listOrderOnTop.Reverse(); listOrderOnBottom.Reverse(); listOrderByY.Reverse(); listOrderByY = listOrderByY.OrderBy(obj => obj.GetY()).ToList(); List <MapObject> listCombined = listOrderOnBottom.Concat(listOrderByY).Concat(listOrderOnTop).ToList(); if (!Config.MapGui.checkBoxMapOptionsDisableHitboxTris.Checked) { listCombined.Insert(0, _mapObjHitboxTris); } listCombined.Insert(0, _mapObjMap); listCombined.Insert(0, _mapObjBackground); MapObjectHoverData hoverData = null; if (isMainGraphics && !Config.MapGui.checkBoxMapOptionsEnable3D.Checked && Config.MapGui.checkBoxMapOptionsEnableObjectHover.Checked) { for (int i = listCombined.Count - 1; i >= 0; i--) { MapObject mapObject = listCombined[i]; hoverData = mapObject.GetHoverData(false, false); if (hoverData != null) { break; } } if (hoverData == null || KeyboardUtilities.IsCtrlHeld()) { hoverData = MapObjectHoverData.GetMapObjectHoverDataForCursor(false); } if (Config.CurrentMapGraphics.DraggedObject != null) { hoverData = Config.CurrentMapGraphics.DraggedObject; } if (!Equals(PreviousHoverData, hoverData)) { PreviousHoverData = hoverData; MapObjectHoverData.HoverStartTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); if (hoverData != null && hoverData.Tri != null) { MapObjectHoverData.LastTriangleAddress = hoverData.Tri.Address; } } if (hoverData == null) { Config.HideDebugText(); } else { Config.SetDebugText(hoverData); } } if (isMainGraphics) { ObjectDragData = null; if (!Config.MapGui.checkBoxMapOptionsEnable3D.Checked && Config.MapGui.checkBoxMapOptionsEnableObjectDrag.Checked) { for (int i = listCombined.Count - 1; i >= 0; i--) { MapObject mapObject = listCombined[i]; if (mapObject.GetDragPosition().HasValue) { ObjectDragData = mapObject.GetHoverData(true, false); } if (ObjectDragData != null) { break; } } } } foreach (MapObject obj in listCombined) { obj.DrawOn2DControl(hoverData); } }