public void DispenseAllThingTooltips()
 {
     if (Event.current.type == EventType.Repaint && Find.WindowStack.FloatMenu == null)
     {
         CellRect currentViewRect = Find.CameraDriver.CurrentViewRect;
         float    cellSizePixels  = Find.CameraDriver.CellSizePixels;
         Vector2  vector          = new Vector2(cellSizePixels, cellSizePixels);
         Rect     rect            = new Rect(0f, 0f, vector.x, vector.y);
         int      num             = 0;
         for (int i = 0; i < this.givers.Count; i++)
         {
             Thing thing = this.givers[i];
             if (currentViewRect.Contains(thing.Position) && !thing.Position.Fogged(thing.Map))
             {
                 Vector2 vector2 = thing.DrawPos.MapToUIPosition();
                 rect.x = (float)(vector2.x - vector.x / 2.0);
                 rect.y = (float)(vector2.y - vector.y / 2.0);
                 if (rect.Contains(Event.current.mousePosition))
                 {
                     string text = (!this.ShouldShowShotReport(thing)) ? null : TooltipUtility.ShotCalculationTipString(thing);
                     if (thing.def.hasTooltip || !text.NullOrEmpty())
                     {
                         TipSignal tooltip = thing.GetTooltip();
                         if (!text.NullOrEmpty())
                         {
                             tooltip.text = tooltip.text + "\n\n" + text;
                         }
                         TooltipHandler.TipRegion(rect, tooltip);
                     }
                 }
                 num++;
             }
         }
     }
 }
예제 #2
0
        public void DispenseAllThingTooltips()
        {
            if (Event.current.type != EventType.Repaint || Find.WindowStack.FloatMenu != null)
            {
                return;
            }
            CellRect currentViewRect = Find.CameraDriver.CurrentViewRect;
            float    cellSizePixels  = Find.CameraDriver.CellSizePixels;
            Vector2  vector          = new Vector2(cellSizePixels, cellSizePixels);
            Rect     rect            = new Rect(0f, 0f, vector.x, vector.y);
            int      num             = 0;

            for (int i = 0; i < givers.Count; i++)
            {
                Thing thing = givers[i];
                if (!currentViewRect.Contains(thing.Position) || thing.Position.Fogged(thing.Map))
                {
                    continue;
                }
                Vector2 vector2 = thing.DrawPos.MapToUIPosition();
                rect.x = vector2.x - vector.x / 2f;
                rect.y = vector2.y - vector.y / 2f;
                if (rect.Contains(Event.current.mousePosition))
                {
                    string text = ShouldShowShotReport(thing) ? TooltipUtility.ShotCalculationTipString(thing) : null;
                    if (thing.def.hasTooltip || !text.NullOrEmpty())
                    {
                        TipSignal tooltip = thing.GetTooltip();
                        if (!text.NullOrEmpty())
                        {
                            ref string text2 = ref tooltip.text;
                            text2 = text2 + "\n\n" + text;
                        }
                        TooltipHandler.TipRegion(rect, tooltip);
                    }
                }
                num++;
            }