public override void DrawMouseAttachments()
        {
            base.DrawMouseAttachments();
            Map currentMap = Find.CurrentMap;

            currentMap.deepResourceGrid.DrawPlacingMouseAttachments(PlacingDef);
            ThingDef thingDef;

            if (currentMap == null || (thingDef = PlacingDef as ThingDef) == null || thingDef.displayNumbersBetweenSameDefDistRange.max <= 0f)
            {
                return;
            }
            IntVec3 intVec = UI.MouseCell();

            tmpThings.Clear();
            tmpThings.AddRange(currentMap.listerThings.ThingsOfDef(thingDef));
            tmpThings.AddRange(currentMap.listerThings.ThingsInGroup(ThingRequestGroup.Blueprint));
            foreach (Thing tmpThing in tmpThings)
            {
                if ((tmpThing.def == thingDef || tmpThing.def.entityDefToBuild == thingDef) && (tmpThing.Position.x == intVec.x || tmpThing.Position.z == intVec.z) && CanDrawNumbersBetween(tmpThing, thingDef, intVec, tmpThing.Position, currentMap))
                {
                    IntVec3 intVec2 = tmpThing.Position - intVec;
                    intVec2.x = Mathf.Abs(intVec2.x) + 1;
                    intVec2.z = Mathf.Abs(intVec2.z) + 1;
                    if (intVec2.x >= 3)
                    {
                        Vector2 screenPos = (tmpThing.Position.ToUIPosition() + intVec.ToUIPosition()) / 2f;
                        screenPos.y = tmpThing.Position.ToUIPosition().y;
                        Color textColor = (thingDef.displayNumbersBetweenSameDefDistRange.Includes(intVec2.x) ? Color.white : Color.red);
                        Widgets.DrawNumberOnMap(screenPos, intVec2.x, textColor);
                    }
                    if (intVec2.z >= 3)
                    {
                        Vector2 screenPos2 = (tmpThing.Position.ToUIPosition() + intVec.ToUIPosition()) / 2f;
                        screenPos2.x = tmpThing.Position.ToUIPosition().x;
                        Color textColor2 = (thingDef.displayNumbersBetweenSameDefDistRange.Includes(intVec2.z) ? Color.white : Color.red);
                        Widgets.DrawNumberOnMap(screenPos2, intVec2.z, textColor2);
                    }
                }
            }
            tmpThings.Clear();
        }
Beispiel #2
0
 public void DraggerOnGUI()
 {
     if (dragging && SelDes != null && SelDes.DragDrawMeasurements)
     {
         IntVec3 intVec = startDragCell - UI.MouseCell();
         intVec.x = Mathf.Abs(intVec.x) + 1;
         intVec.z = Mathf.Abs(intVec.z) + 1;
         if (intVec.x >= 3)
         {
             Vector2 screenPos = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             screenPos.y = startDragCell.ToUIPosition().y;
             Widgets.DrawNumberOnMap(screenPos, intVec.x, Color.white);
         }
         if (intVec.z >= 3)
         {
             Vector2 screenPos2 = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             screenPos2.x = startDragCell.ToUIPosition().x;
             Widgets.DrawNumberOnMap(screenPos2, intVec.z, Color.white);
         }
     }
 }