private void RenderMouseAttachments() { IntVec3 c = UI.MouseCell(); if (!c.InBounds(map)) { return; } ThingDef thingDef = map.deepResourceGrid.ThingDefAt(c); if (thingDef != null) { int num = map.deepResourceGrid.CountAt(c); if (num > 0) { Vector2 vector = c.ToVector3().MapToUIPosition(); GUI.color = Color.white; Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleLeft; float num2 = (UI.CurUICellSize() - 27f) / 2f; Rect rect = new Rect(vector.x + num2, vector.y - UI.CurUICellSize() + num2, 27f, 27f); Widgets.ThingIcon(rect, thingDef); Widgets.Label(new Rect(rect.xMax + 4f, rect.y, 999f, 29f), "DeepResourceRemaining".Translate(NamedArgumentUtility.Named(thingDef, "RESOURCE"), num.Named("COUNT"))); Text.Anchor = TextAnchor.UpperLeft; } } }
public void CameraDriverOnGUI() { if (Find.CurrentMap == null) { return; } mouseCoveredByUI = false; if (Find.WindowStack.GetWindowAt(UI.MousePositionOnUIInverted) != null) { mouseCoveredByUI = true; } if (AnythingPreventsCameraMotion) { return; } if (Event.current.type == EventType.MouseDrag && Event.current.button == 2) { Vector2 currentEventDelta = UnityGUIBugsFixer.CurrentEventDelta; Event.current.Use(); if (currentEventDelta != Vector2.zero) { currentEventDelta.x *= -1f; desiredDollyRaw += currentEventDelta / UI.CurUICellSize() * Prefs.MapDragSensitivity; } } float num = 0f; if (Event.current.type == EventType.ScrollWheel) { num -= Event.current.delta.y * 0.35f; PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraZoom, KnowledgeAmount.TinyInteraction); } if (KeyBindingDefOf.MapZoom_In.KeyDownEvent) { num += 4f; PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraZoom, KnowledgeAmount.SmallInteraction); } if (KeyBindingDefOf.MapZoom_Out.KeyDownEvent) { num -= 4f; PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraZoom, KnowledgeAmount.SmallInteraction); } desiredSize -= num * config.zoomSpeed * rootSize / 35f; desiredSize = Mathf.Clamp(desiredSize, config.minSize, 60f); desiredDolly = Vector3.zero; if (KeyBindingDefOf.MapDolly_Left.IsDown) { desiredDolly.x = 0f - config.dollyRateKeys; } if (KeyBindingDefOf.MapDolly_Right.IsDown) { desiredDolly.x = config.dollyRateKeys; } if (KeyBindingDefOf.MapDolly_Up.IsDown) { desiredDolly.y = config.dollyRateKeys; } if (KeyBindingDefOf.MapDolly_Down.IsDown) { desiredDolly.y = 0f - config.dollyRateKeys; } config.ConfigOnGUI(); }