Exemple #1
0
        // Token: 0x0600008D RID: 141 RVA: 0x00004E7C File Offset: 0x0000307C
        private static void DoAreaSelector(Rect rect, Building_Bell b, Area area, Func <Area, string> getLabel)
        {
            rect = GenUI.ContractedBy(rect, 1f);
            GUI.DrawTexture(rect, (area == null) ? BaseContent.GreyTex : area.ColorTexture);
            Text.Anchor = TextAnchor.MiddleLeft;
            string text  = getLabel(area);
            Rect   rect2 = rect;

            rect2.xMin += 3f;
            rect2.yMin += 2f;
            Widgets.Label(rect2, text);
            bool flag = b.FightingArea == area;

            if (flag)
            {
                Widgets.DrawBox(rect, 2);
            }
            bool flag2 = Mouse.IsOver(rect);

            if (flag2)
            {
                if (area != null)
                {
                    area.MarkForDraw();
                }
                bool flag3 = Input.GetMouseButton(0) && b.FightingArea != area;
                if (flag3)
                {
                    b.FightingArea = area;
                    SoundDefOf.Designate_DragStandard_Changed.PlayOneShotOnCamera(null);
                }
            }
            Text.Anchor = 0;
            TooltipHandler.TipRegion(rect, text);
        }
        protected override void FillTab()
        {
            IStoreSettingsParent selStoreSettingsParent = SelStoreSettingsParent;
            StorageSettings      storeSettings          = selStoreSettingsParent.GetStoreSettings();
            Rect rect = GenUI.ContractedBy(new Rect(0f, 0f, WinSize.x, WinSize.y), 10f);

            GUI.BeginGroup(rect);
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(new Rect(rect)
            {
                height = 32f
            }, Translator.Translate("RefuelTitle"));
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            ThingFilter thingFilter = null;

            if (selStoreSettingsParent.GetParentStoreSettings() != null)
            {
                thingFilter = selStoreSettingsParent.GetParentStoreSettings().filter;
            }
            Rect rect2 = new Rect(0f, 40f, rect.width, rect.height - 40f);

            ThingFilterUI.DoThingFilterConfigWindow(rect2, ref scrollPosition, storeSettings.filter, thingFilter, 8, null, null, false, null, null);
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.StorageTab, KnowledgeAmount.FrameDisplayed);
            GUI.EndGroup();
        }
        protected override void FillTab()
        {
            IStoreSettingsParent selStoreSettingsParent = SelStoreSettingsParent;

            if (selStoreSettingsParent == null)
            {
                return;
            }
            StorageSettings storeSettings = selStoreSettingsParent.GetStoreSettings();
            Rect            rect          = GenUI.ContractedBy(new Rect(0f, 0f, WinSize.x, WinSize.y), 10f);

            GUI.BeginGroup(rect);
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            //Widgets.Label(new Rect(rect)
            //{
            //    height = 32f
            //}, "RefuelTitle");
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            ThingFilter thingFilter = null;

            if (selStoreSettingsParent.GetParentStoreSettings() != null)
            {
                thingFilter = selStoreSettingsParent.GetParentStoreSettings().filter;
            }
            Rect rect2 = new Rect(0f, 40f, rect.width, rect.height - 40f);

            ThingFilterUI.DoThingFilterConfigWindow(rect2, ref scrollPosition, storeSettings.filter, thingFilter, 8, null, null, false, null, null);
            GUI.EndGroup();
        }
Exemple #4
0
        // Token: 0x06000081 RID: 129 RVA: 0x000046AC File Offset: 0x000028AC
        protected override void FillTab()
        {
            float            num   = 50f;
            Rect             rect  = GenUI.ContractedBy(new Rect(0f, num, this.size.x, this.size.y), 5f);
            List <TabRecord> pages = new List <TabRecord>();
            TabRecord        item  = new TabRecord("Manage", delegate()
            {
                ITab_BellManager.tab = ITab_BellManager.ArenaCardTab.Manager;
            }, ITab_BellManager.tab == ITab_BellManager.ArenaCardTab.Manager);

            pages.Add(item);
            TabRecord item2 = new TabRecord("Leaderboard", delegate()
            {
                ITab_BellManager.tab = ITab_BellManager.ArenaCardTab.Leaderboard;
            }, ITab_BellManager.tab == ITab_BellManager.ArenaCardTab.Leaderboard);

            pages.Add(item2);
            TabDrawer.DrawTabs(rect, pages, 200f);
            Rect rectTabs = new Rect(0f, num, rect.width, rect.height - num);

            bool flag = ITab_BellManager.tab == ITab_BellManager.ArenaCardTab.Manager;

            if (flag)
            {
                this.FillTabManager(rectTabs);
            }
            else
            {
                bool flag2 = ITab_BellManager.tab == ITab_BellManager.ArenaCardTab.Leaderboard;
                if (flag2)
                {
                    this.FillTabLeaderboard(rectTabs);
                }
            }
        }
Exemple #5
0
        // Token: 0x0600001B RID: 27 RVA: 0x0000294C File Offset: 0x00000B4C
        public static bool CustomDrawer_Filter(Rect rect, SettingHandle <float> slider, bool def_isPercentage, float def_min, float def_max, Color background)
        {
            DrawUtility.drawBackground(rect, background);
            int  num   = 50;
            Rect rect2 = new Rect(rect);

            rect2.width -= (float)num;
            Rect rect3 = new Rect(rect);

            rect3.width    = (float)num;
            rect3.position = new Vector2(rect2.position.x + rect2.width + 5f, rect2.position.y + 4f);
            rect2          = GenUI.ContractedBy(rect2, 2f);
            if (def_isPercentage)
            {
                Widgets.Label(rect3, Mathf.Round(slider.Value * 100f).ToString("F0") + "%");
            }
            else
            {
                Widgets.Label(rect3, slider.Value.ToString("F2"));
            }
            float num2   = Widgets.HorizontalSlider(rect2, slider.Value, def_min, def_max, true, null, null, null, -1f);
            bool  result = false;
            bool  flag   = slider.Value != num2;

            if (flag)
            {
                result = true;
            }
            slider.Value = num2;
            return(result);
        }
        public static void DrawRestAndFoodBars(Pawn p, Rect rect, float needWidth)
        {
            Rect needBar = new Rect(rect.x + rect.width, rect.y, needWidth, rect.height);

            if (TacticalGroupsSettings.DisplayFood && p.needs?.food != null)
            {
                float num   = Mathf.Clamp(p.needs.food.CurLevelPercentage, 0f, 1f);
                Rect  rect3 = GenUI.ContractedBy(needBar, 1f);
                float num5  = rect3.height * num;
                rect3.yMin   = rect3.yMax - num5;
                rect3.height = num5;

                GUI.DrawTexture(rect3, Textures.FoodNeedBar, ScaleMode.ScaleAndCrop);
                GUI.DrawTexture(needBar, Textures.RestFood, ScaleMode.StretchToFill);
                needBar.x += needWidth;
            }
            if (TacticalGroupsSettings.DisplayRest && p.needs?.rest != null)
            {
                float num   = Mathf.Clamp(p.needs.rest.CurLevelPercentage, 0f, 1f);
                Rect  rect3 = GenUI.ContractedBy(needBar, 1f);
                float num5  = rect3.height * num;
                rect3.yMin   = rect3.yMax - num5;
                rect3.height = num5;

                GUI.DrawTexture(rect3, Textures.RestNeedBar, ScaleMode.ScaleAndCrop);
                GUI.DrawTexture(needBar, Textures.RestFood, ScaleMode.StretchToFill);
            }
        }
Exemple #7
0
            public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
            {
                Rect rect = new Rect(topLeft.x, topLeft.y, this.GetWidth(140f), 75f);

                Widgets.DrawWindowBackground(rect);

                Rect rect2 = GenUI.ContractedBy(rect, 6f);
                Rect rect3 = rect2;

                rect3.height = rect.height / 2f;

                Text.Font = GameFont.Tiny;
                Widgets.Label(rect3, this.shield.LabelCap);

                Rect rect4 = rect2;

                rect4.yMin = rect.y + rect.height / 2f;
                float num = this.shield.MaxHitPoints / this.shield.HitPoints;

                Widgets.FillableBar(rect4, num, Apparel_Shield.Gizmo_ShieldStatus.FullTex, Apparel_Shield.Gizmo_ShieldStatus.EmptyTex, false);
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleCenter;

                Widgets.Label(rect4, (this.shield.HitPoints).ToString() + " / " + (this.shield.MaxHitPoints).ToString());
                Text.Anchor = TextAnchor.UpperLeft;

                return(new GizmoResult(0));
            }
Exemple #8
0
        public static void Postfix(object customPawn)
        {
            var  trv  = Traverse.Create(customPawn);
            Pawn pawn = trv.Field <Pawn>("pawn").Value;

            bool  enabled;
            Color color;

            if (!PublicApi.GetGradientHair(pawn, out enabled, out color))
            {
                return;
            }

            Rect rectToggle = enabled ? rectToggleSmall : rectToggleFull;

            TooltipHandler.TipRegion(rectToggle, "GradientHairEnable".Translate());
            bool enable = GUI.Toggle(rectToggle, enabled, enabled ? "".Translate() : "GradientHairEnable".Translate());

            if (enable != enabled)
            {
                PublicApi.SetGradientHair(pawn, enable, color);
                trv.Method("MarkPortraitAsDirty").GetValue();
            }

            if (!enable)
            {
                return;
            }

            Rect rect = new Rect(40, 381, 27, 27);

            GUI.color = Color.white;
            GUI.DrawTexture(rect, BaseContent.WhiteTex);
            GUI.color = color;
            GUI.DrawTexture(GenUI.ContractedBy(rect, 1f), BaseContent.WhiteTex);

            GUI.color = Color.red;
            float r  = color.r;
            float vr = GUI.HorizontalSlider(new Rect(rect.x + 34f, rect.y - 3f, 136f, 11f), color.r, 0f, 1f);

            GUI.color = Color.green;
            float g  = color.g;
            float vg = GUI.HorizontalSlider(new Rect(rect.x + 34f, rect.y + 8f, 136f, 11f), color.g, 0f, 1f);

            GUI.color = Color.blue;
            float b  = color.b;
            float vb = GUI.HorizontalSlider(new Rect(rect.x + 34f, rect.y + 19f, 136f, 11f), color.b, 0f, 1f);

            if (!CloseEnough(vr, r) || !CloseEnough(vg, g) || !CloseEnough(vb, b))
            {
                PublicApi.SetGradientHair(pawn, true, new Color(vr, vg, vb));
                trv.Method("MarkPortraitAsDirty").GetValue();
            }

            GUI.color = Color.white;
        }
        protected override void FillTab()
        {
            ThingFilter allowances;

            ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.StorageTab, KnowledgeAmount.GuiFrame);
            ConceptDecider.TeachOpportunity(ConceptDefOf.StorageTabCategories, OpportunityType.GuiFrame);
            ConceptDecider.TeachOpportunity(ConceptDefOf.StoragePriority, OpportunityType.GuiFrame);
            allowances = ((Vehicle_Cart)Enumerable.First <object>(Find.Selector.SelectedObjects)).allowances;
            Rect position = GenUI.ContractedBy(new Rect(0.0f, 0.0f, Itab_Pawn_Vehicle_Storage.WinSize.x, Itab_Pawn_Vehicle_Storage.WinSize.y), 10f);

            GUI.BeginGroup(position);

            ThingFilterUI.DoThingFilterConfigWindow(new Rect(0.0f, 35f, position.width, position.height - 35f), ref this.scrollPosition, allowances, null);
            GUI.EndGroup();
        }
        public static void DrawHealthBar(Pawn p, Rect rect)
        {
            if (TacticalGroupsSettings.DisplayHealth)
            {
                Rect  healthBar = new Rect(rect.x - Textures.HealthBar.width, rect.y, Textures.HealthBar.width, rect.height);
                float num       = Mathf.Clamp(p.health.summaryHealth.SummaryHealthPercent, 0f, 1f);
                Rect  rect3     = GenUI.ContractedBy(healthBar, 1f);
                float num5      = rect3.height * num;
                rect3.yMin   = rect3.yMax - num5;
                rect3.height = num5;

                GUI.DrawTexture(rect3, Textures.HealthNeedBar, ScaleMode.ScaleAndCrop);
                GUI.DrawTexture(healthBar, Textures.HealthBar, ScaleMode.StretchToFill);
            }
        }
Exemple #11
0
 internal void DoWindowContents(Rect canvas)
 {
     this.listing_Standard = new Listing_Standard();
     this.listing_Standard.Begin(GenUI.ContractedBy(canvas, 60f));
     this.listing_Standard.CheckboxLabeled("Display wild animal's death?", ref DisplayWildAnimalDeath, "Display wild animal's death in kill feed");
     this.listing_Standard.CheckboxLabeled("Display ally's death?", ref DisplayAllyDeath, "Display ally's death in kill feed");
     this.listing_Standard.CheckboxLabeled("Display enemy's death?", ref DisplayEnemyDeath, "Display enemy's death in kill feed");
     this.listing_Standard.GapLine(12f);
     this.listing_Standard.CheckboxLabeled("Display killfeed on up right?", ref DisplayPositionRight, "Whether or not display kill feed on up right. Will reset the offset setting below to default value.");
     this.listing_Standard.Label("if above setting is checked, custom offset will be ignored.");
     this.listing_Standard.CheckboxLabeled("Use custom offset Left/Right position?", ref UseLeftRightPos, "Whether or not display using below left/right custom offset");
     this.listing_Standard.TextFieldNumericLabeled <int>("Left offset", ref LeftOffset, ref LeftOffsetBuffer, 0);
     this.listing_Standard.TextFieldNumericLabeled <int>("Top offset", ref TopOffset, ref RightOffsetBuffer, 0);
     this.listing_Standard.GapLine(12f);
     this.listing_Standard.Label("Width and Height of the notification box");
     this.listing_Standard.TextFieldNumericLabeled <int>("Width", ref Width, ref WidthBuffer, 0);
     this.listing_Standard.TextFieldNumericLabeled <int>("Height", ref Height, ref HeightBuffer, 0);
     this.listing_Standard.GapLine(12f);
     this.listing_Standard.TextFieldNumericLabeled <int>("Killfeed's message appear duration (second)", ref ExpirationTime, ref ExpirationTimeBuffer, 1);
     this.listing_Standard.End();
 }
Exemple #12
0
        public virtual GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Rect overRect = new Rect((float)topLeft.x, (float)topLeft.y, base.GetWidth(maxWidth), 75f);

            Find.get_WindowStack().ImmediateWindow(942612547, overRect, (WindowLayer)0, (Action)(() =>
            {
                Rect rect1 = GenUI.ContractedBy(GenUI.AtZero(overRect), 6f);
                Rect rect2 = rect1;
                ((Rect) ref rect2).set_height(((Rect) ref overRect).get_height() / 2f);
                Text.set_Font((GameFont)0);
                Widgets.Label(rect2, ((Def)((Hediff)this.shield).def).get_LabelCap());
                Rect rect3 = rect1;
                ((Rect) ref rect3).set_yMin(((Rect) ref overRect).get_height() / 2f);
                float num = ((Hediff)this.shield).get_Severity() / (float)((HediffDef)((Hediff)this.shield).def).maxSeverity;
                Widgets.FillableBar(rect3, num, Gizmo_ShieldHediff.FullShieldBarTex, Gizmo_ShieldHediff.EmptyShieldBarTex, false);
                Text.set_Font((GameFont)1);
                Text.set_Anchor((TextAnchor)4);
                Widgets.Label(rect3, ((int)((Hediff)this.shield).get_Severity()).ToString() + " \\ " + (object)(int)((HediffDef)((Hediff)this.shield).def).maxSeverity);
                Text.set_Anchor((TextAnchor)0);
            }), true, false, 1f);
            return(new GizmoResult((GizmoState)0));
        }
Exemple #13
0
        // Token: 0x06000002 RID: 2 RVA: 0x00002080 File Offset: 0x00000280
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Rect overRect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f);

            Find.WindowStack.ImmediateWindow(942612547, overRect, 0, delegate()
            {
                Rect rect    = GenUI.ContractedBy(GenUI.AtZero(overRect), 6f);
                Rect rect2   = rect;
                rect2.height = overRect.height / 2f;
                Text.Font    = 0;
                Widgets.Label(rect2, this.shield.def.LabelCap);
                Rect rect3 = rect;
                rect3.yMin = overRect.height / 2f;
                float num  = this.shield.Severity / this.shield.def.maxSeverity;
                Widgets.FillableBar(rect3, num, Gizmo_ShieldHediff.FullShieldBarTex, Gizmo_ShieldHediff.EmptyShieldBarTex, false);
                Text.Font   = (GameFont)1;
                Text.Anchor = (TextAnchor)4;
                Widgets.Label(rect3, (int)this.shield.Severity + " \\ " + (int)this.shield.def.maxSeverity);
                Text.Anchor = 0;
            }, true, false, 1f);
            return(new GizmoResult(0));
        }
Exemple #14
0
        // Token: 0x06000005 RID: 5 RVA: 0x00002098 File Offset: 0x00000298
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Rect overRect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f);

            Find.WindowStack.ImmediateWindow(1523289473, overRect, 0, delegate()
            {
                Rect rect    = GenUI.ContractedBy(GenUI.AtZero(overRect), 6f);
                Rect rect2   = rect;
                rect2.height = overRect.height / 2f;
                Text.Font    = 0;
                Widgets.Label(rect2, Translator.Translate("HealthShardUses"));
                Rect rect3 = rect;
                rect3.yMin = overRect.height / 2f;
                float num  = (float)this.kit.uses / (float)this.kit.kitComp.Props.Uses;
                Widgets.FillableBar(rect3, num, Gizmo_InjectorStatus.FullBarTex, Gizmo_InjectorStatus.EmptyBarTex, false);
                Text.Font   = (GameFont)1;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect3, this.kit.uses.ToString("F0") + " / " + this.kit.kitComp.Props.Uses.ToString("F0"));
                Text.Anchor = TextAnchor.UpperLeft;
            }, true, false, 1f);
            return(new GizmoResult(0));
        }
Exemple #15
0
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Rect overRect = new Rect(topLeft.x, topLeft.y, this.Width, 75f);

            Find.WindowStack.ImmediateWindow(984688, overRect, WindowLayer.GameUI, delegate()
            {
                Rect rect    = GenUI.ContractedBy(GenUI.AtZero(overRect), 6f);
                Rect rect2   = rect;
                rect2.height = overRect.height / 2f;
                Text.Font    = GameFont.Tiny;
                Widgets.Label(rect2, this.shield.LabelCap);
                Rect rect3 = rect;
                rect3.yMin = overRect.height / 2f;
                float num  = this.shield.Energy / Mathf.Max(1f, this.shield.GetStatValue(StatDefOf.EnergyShieldEnergyMax, true));
                Widgets.FillableBar(rect3, num, Gizmo_Vanya_EnergyShieldStatus.FullShieldBarTex, Gizmo_Vanya_EnergyShieldStatus.EmptyShieldBarTex, false);
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect3, (this.shield.Energy * 100f).ToString("F0") + " / " + (this.shield.GetStatValue(StatDefOf.EnergyShieldEnergyMax, true) * 100f).ToString("F0"));
                Text.Anchor = 0;
            }, true, false, 1f);
            return(new GizmoResult(GizmoState.Clear));
        }
        // Token: 0x0600005C RID: 92 RVA: 0x0000609C File Offset: 0x0000429C
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Rect rect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f);

            Widgets.DrawWindowBackground(rect);
            Rect rect3;
            Rect rect2 = rect3 = GenUI.ContractedBy(rect, 6f);

            rect3.height = rect.height / 2f;
            Text.Font    = 0;
            Widgets.Label(rect3, this.camo.LabelCap);
            Rect rect4 = rect2;

            rect4.yMin   = rect3.yMin + rect.height / 2f - 6f;
            rect4.height = rect.height / 2f - 6f;
            float num = this.camo.energy / Mathf.Max(1f, ThingCompUtility.TryGetComp <CompGearCamo>(this.camo).Props.CamoEnergyMax);

            Widgets.FillableBar(rect4, num, Gizmo_EnergyActiveCamoStatus.FullCamoBarTex, Gizmo_EnergyActiveCamoStatus.EmptyCamoBarTex, false);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect4, (this.camo.energy * 100f).ToString("F0") + " / " + (ThingCompUtility.TryGetComp <CompGearCamo>(this.camo).Props.CamoEnergyMax * 100f).ToString("F0"));
            Text.Anchor = 0;
            return(new GizmoResult(0));
        }
            public override GizmoResult GizmoOnGUI(Vector2 topLeft)
            {
                Rect rect = new Rect(topLeft.x, topLeft.y, this.Width, 75f);

                Widgets.DrawBox(rect, 1);
                GUI.DrawTexture(rect, BGTex);
                Rect rect2 = GenUI.ContractedBy(rect, 6f);
                Rect rect3 = rect2;

                rect3.height = rect.height / 2f;
                Text.Font    = GameFont.Tiny;
                Widgets.Label(rect3, this.compAmmo.parent.def.LabelCap);
                Rect rect4 = rect2;

                rect4.yMin = rect.y + rect.height / 2f;
                float num = (float)this.compAmmo.count / (float)this.compAmmo.reloaderProp.roundPerMag;

                Widgets.FillableBar(rect4, num, CompReloader.GizmoAmmoStatus.FullTex, CompReloader.GizmoAmmoStatus.EmptyTex, false);
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect4, this.compAmmo.count + " / " + this.compAmmo.reloaderProp.roundPerMag);
                Text.Anchor = TextAnchor.UpperLeft;
                return(new GizmoResult(0));
            }
Exemple #18
0
        public bool SelectColor(Rect rect, bool enableSelection, string caption, ref Color color, ref bool enable)
        {
            bool res = false;

            GUI.BeginGroup(rect);

            Text.Font = GameFont.Medium;
            if (enableSelection)
            {
                bool toggle = enable;
                Widgets.CheckboxLabeled(new Rect(18, 2, rect.width - 18 * 2, 33), caption, ref enable);
                if (toggle != enable)
                {
                    res = true;
                }
            }
            else
            {
                Widgets.Label(new Rect(18, 2, rect.width - 18 * 2, 33), caption);
            }
            Text.Font = GameFont.Small;

            if (enable)
            {
                Rect rectColor = new Rect(17, 36, 46, 46);
                GUI.color = Color.white;
                GUI.DrawTexture(rectColor, BaseContent.WhiteTex);
                GUI.color = color;
                GUI.DrawTexture(GenUI.ContractedBy(rectColor, 1f), BaseContent.WhiteTex);

                GUI.color = Color.red;
                float r  = color.r;
                float vr = GUI.HorizontalSlider(new Rect(72, 38, 276, 9), color.r, 0f, 1f);

                GUI.color = Color.green;
                float g  = color.g;
                float vg = GUI.HorizontalSlider(new Rect(72, 54, 276, 9), color.g, 0f, 1f);

                GUI.color = Color.blue;
                float b  = color.b;
                float vb = GUI.HorizontalSlider(new Rect(72, 70, 276, 9), color.b, 0f, 1f);

                if (!CloseEnough(vr, r) || !CloseEnough(vg, g) || !CloseEnough(vb, b))
                {
                    color = new Color(vr, vg, vb);
                    res   = true;
                }
            }


            /*
             * for (int i = 0; i < swatches.Length; i++) {
             *  float x = 256 + 25 * (i % 4);
             *  float y = 12 + 25 * (i / 4);
             *  Rect rectSwatch = new Rect(x, y, 20, 20);
             *
             *  GUI.color = Color.white;
             *  GUI.DrawTexture(rectSwatch, BaseContent.WhiteTex);
             *  GUI.color = swatches[i];
             *  GUI.DrawTexture(GenUI.ContractedBy(rectSwatch, 1f), BaseContent.WhiteTex);
             *
             *  if (Widgets.ButtonInvisible(rectSwatch, true))
             *  {
             *      if (Event.current.type == EventType.MouseUp && Event.current.button == 1)
             *      {
             *          swatches[i] = color;
             *      }
             *      else
             *      {
             *          color = swatches[i];
             *          res = true;
             *      }
             *  }
             * }*/

            GUI.color = Color.white;

            GUI.EndGroup();

            return(res);
        }
Exemple #19
0
        public static void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering, bool showSlaveSuppresion = false)
        {
            float alpha = TacticUtils.TacticalColonistBar.GetEntryRectAlpha(rect);

            TacticUtils.TacticalColonistBar.drawer.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color2 = GUI.color = new Color(1f, 1f, 1f, alpha);

            GUI.DrawTexture(rect, TacticalColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                if (TacticalGroupsSettings.DisplayColorBars)
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.GetMoodBarTexture(colonist));
                }
                else
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
                }
            }
            if (highlight)
            {
                int thickness = (rect.width <= 22f) ? 2 : 3;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color2;
            }
            Rect rect2 = rect.ContractedBy(-2f * TacticUtils.TacticalColonistBar.Scale);

            if ((colonist.Dead ? Find.Selector.SelectedObjects.Contains(colonist.Corpse) : Find.Selector.SelectedObjects.Contains(colonist)) && !WorldRendererUtility.WorldRenderedNow)
            {
                TacticUtils.TacticalColonistBar.drawer.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                TacticUtils.TacticalColonistBar.drawer.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, PawnTextureSize, Rot4.South, PawnTextureCameraOffset, PawnTextureCameraZoom));
            if (colonist.Drafted)
            {
                GUI.DrawTexture(rect, Textures.PawnDrafted);
            }
            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            TacticUtils.TacticalColonistBar.drawer.DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num2 = 4f * TacticUtils.TacticalColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + TacticUtils.TacticalColonistBar.SpaceBetweenColonistsHorizontal - 2f, TacticUtils.TacticalColonistBar.drawer.pawnLabelsCache);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            if (showSlaveSuppresion && colonist.needs.TryGetNeed <Need_Suppression>() is Need_Suppression need_Suppression)
            {
                Rect  suppressionBar = new Rect(rect.x + rect.width, rect.y, Textures.RestFood.width, rect.height);
                float num            = Mathf.Clamp(need_Suppression.CurLevelPercentage, 0f, 1f);
                Rect  rect3          = GenUI.ContractedBy(suppressionBar, 1f);
                float num5           = rect3.height * num;
                rect3.yMin   = rect3.yMax - num5;
                rect3.height = num5;
                GUI.DrawTexture(rect3, Textures.SlaveSuppressionBar, ScaleMode.ScaleAndCrop);
                GUI.DrawTexture(suppressionBar, Textures.RestFood, ScaleMode.StretchToFill);
            }
            else
            {
                ColonistBarColonistDrawer.DrawHealthBar(rect, colonist, Textures.HealthBar.width);
                ColonistBarColonistDrawer.DrawRestAndFoodBars(rect, colonist, Textures.RestFood.width);
            }
        }
Exemple #20
0
        protected override void FillTab()
        {
            CompEnchantedItem enchantedItem = ThingCompUtility.TryGetComp <CompEnchantedItem>(Find.Selector.SingleSelectedThing);
            Rect rect  = GenUI.ContractedBy(new Rect(0f, 0f, ITab_Enchantment.WinSize.x, ITab_Enchantment.WinSize.y), 10f);
            Rect rect2 = rect;

            Text.Font = GameFont.Small;
            string rectLabel = "Enchantments:";

            Widgets.Label(rect2, rectLabel);
            int num = 2;

            Text.Font = GameFont.Tiny;
            Rect rect3 = GetRowRect(rect2, num);

            if (enchantedItem.Props.maxMP != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.Props.maxMPTier);
                rectLabel = enchantedItem.Props.MaxMPLabel;
                Widgets.Label(rect3, rectLabel);
                num++;
            }
            Rect rect4 = GetRowRect(rect3, num);

            if (enchantedItem.Props.mpCost != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.Props.mpCostTier);
                rectLabel = enchantedItem.Props.MPCostLabel;
                Widgets.Label(rect4, rectLabel);
                num++;
            }
            Rect rect5 = GetRowRect(rect4, num);

            if (enchantedItem.Props.mpRegenRate != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.Props.mpRegenRateTier);
                rectLabel = enchantedItem.Props.MPRegenRateLabel;
                Widgets.Label(rect5, rectLabel);
                num++;
            }
            Rect rect6 = GetRowRect(rect5, num);

            if (enchantedItem.Props.coolDown != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.Props.coolDownTier);
                rectLabel = enchantedItem.Props.CoolDownLabel;
                Widgets.Label(rect6, rectLabel);
                num++;
            }
            Rect rect7 = GetRowRect(rect6, num);

            if (enchantedItem.Props.xpGain != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.Props.xpGainTier);
                rectLabel = enchantedItem.Props.XPGainLabel;
                Widgets.Label(rect7, rectLabel);
                num++;
            }
            //rect3.yMin += Text.CalcHeight(rectLabel, rect.width);

            //QualityCategory qualityCategory;
            //QualityUtility.TryGetQuality(ITab_Enchantment.SelectedCompEnchantment.parent, out qualityCategory);
            //StringBuilder stringBuilder = new StringBuilder();
            //stringBuilder.Append(GenText.CapitalizeFirst(QualityUtility.GetLabel(qualityCategory))).Append(" ").Append(ResourceBank.StringQuality).Append(" ");
            //if (ITab_Enchantment.SelectedCompEnchantment.parent.Stuff != null)
            //{
            //    stringBuilder.Append(ITab_Enchantment.SelectedCompEnchantment.parent.Stuff.LabelAsStuff).Append(" ");
            //}
            //stringBuilder.Append(ITab_Enchantment.SelectedCompEnchantment.parent.def.label);
            //string text = stringBuilder.ToString();
            //Widgets.Label(rect3, text);
            //GUI.color = Color.white;
            //Text.Anchor = TextAnchor.UpperLeft;
            //Rect rect4 = rect;
            //rect4.yMin += rect3.yMin + Text.CalcHeight(text, rect.width);
            //Text.Font = GameFont.Tiny;
            //Widgets.Label(rect4, ITab_Enchantment.SelectedCompEnchantment.parent.GetInfusionDesc());
        }
Exemple #21
0
        protected override void FillTab()
        {
            float fieldHeight = 30.0f;

            Vehicle_Cart cart = this.SelThing as Vehicle_Cart;

            ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);
            Text.Font = GameFont.Small;
            Rect innerRect1 = GenUI.ContractedBy(new Rect(0.0f, 0.0f, this.size.x, this.size.y), 10f);

            GUI.BeginGroup(innerRect1);
            Rect  mountedRect  = new Rect(0.0f, 30.0f, innerRect1.width, fieldHeight);
            float mountedRectY = mountedRect.y;

            Widgets.ListSeparator(ref mountedRectY, innerRect1.width, txtDriver.Translate());
            mountedRect.y += fieldHeight;
            Rect thingIconRect   = new Rect(mountedRect.x, mountedRect.y, 30f, fieldHeight);
            Rect thingLabelRect  = new Rect(mountedRect.x + 35f, mountedRect.y + 5.0f, innerRect1.width - 35f, fieldHeight);
            Rect thingButtonRect = new Rect(mountedRect.x, mountedRect.y, innerRect1.width, fieldHeight);

            if (cart.mountableComp.IsMounted)
            {
                Pawn driver = cart.mountableComp.Driver;
                Widgets.ThingIcon(thingIconRect, driver);
                Widgets.Label(thingLabelRect, driver.Label);
                if (Event.current.button == 1 && Widgets.InvisibleButton(thingButtonRect))
                {
                    List <FloatMenuOption> options  = new List <FloatMenuOption>();
                    FloatMenuOption        dismount = new FloatMenuOption(txtDismount.Translate(driver.LabelBase), () =>
                    {
                        cart.mountableComp.Dismount();
                    });
                    options.Add(dismount);

                    Find.WindowStack.Add(new FloatMenu(options));
                }
                thingIconRect.y  += fieldHeight;
                thingLabelRect.y += fieldHeight;
            }
            Rect  storageRect  = new Rect(0.0f, thingIconRect.y, innerRect1.width, fieldHeight);
            float storageRectY = storageRect.y;

            Widgets.ListSeparator(ref storageRectY, innerRect1.width, txtStorage.Translate());
            storageRect.y    += fieldHeight;
            thingIconRect.y   = storageRect.y;
            thingLabelRect.y  = storageRect.y;
            thingButtonRect.y = storageRect.y;
            foreach (var thing in cart.storage)
            {
                if ((thing.ThingID.IndexOf("Human_Corpse") <= -1) ? false : true)
                {
                    Widgets.DrawTextureFitted(thingIconRect, ContentFinder <Texture2D> .Get("Things/Pawn/IconHuman_Corpse"), 1.0f);
                }
                else if ((thing.ThingID.IndexOf("Corpse") <= -1) ? false : true)
                {
                    Corpse corpse = thing as Corpse;
                    Widgets.ThingIcon(thingIconRect, corpse.innerPawn.def);
                }
                else
                {
                    Widgets.ThingIcon(thingIconRect, thing);
                }
                Widgets.Label(thingLabelRect, thing.Label.Translate());
                if (Event.current.button == 1 && Widgets.InvisibleButton(thingButtonRect))
                {
                    List <FloatMenuOption> options = new List <FloatMenuOption>();
                    options.Add(new FloatMenuOption(Translator.Translate("ThingInfo"), () =>
                    {
                        Find.WindowStack.Add((Window) new Dialog_InfoCard(thing));
                    }));
                    options.Add(new FloatMenuOption(Translator.Translate("DropThing"), () =>
                    {
                        Thing dummy;
                        cart.storage.TryDrop(thing, cart.Position, ThingPlaceMode.Near, out dummy);
                    }));

                    Find.WindowStack.Add((Window) new FloatMenu(options, thing.LabelCap, false, false));
                }
                thingIconRect.y  += fieldHeight;
                thingLabelRect.y += fieldHeight;
            }
            if (Widgets.TextButton(new Rect(180f, 400f, 100f, 30f), "Drop All"))
            {
                cart.storage.TryDropAll(cart.Position, ThingPlaceMode.Near);
            }

            GUI.EndGroup();
        }
Exemple #22
0
        protected override void FillTab()
        {
            CompEnchantedItem enchantedItem         = ThingCompUtility.TryGetComp <CompEnchantedItem>(Find.Selector.SingleSelectedThing);
            float             enchantmentMultiplier = 1f;

            if (Find.Selector.SingleSelectedThing.Stuff != null && Find.Selector.SingleSelectedThing.Stuff.defName == "TM_Manaweave")
            {
                enchantmentMultiplier = 1.2f;
            }
            Rect rect  = GenUI.ContractedBy(new Rect(0f, 0f, ITab_Enchantment.WinSize.x, ITab_Enchantment.WinSize.y), 10f);
            Rect rect2 = rect;

            Text.Font = GameFont.Small;
            string rectLabel = "Enchantments:";

            Widgets.Label(rect2, rectLabel);
            int num = 2;

            Text.Font = GameFont.Tiny;
            Rect rect3 = GetRowRect(rect2, num);

            if (enchantedItem.maxMP != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.maxMPTier);
                rectLabel = enchantedItem.MaxMPLabel;
                Widgets.Label(rect3, rectLabel);
                num++;
            }
            Rect rect4 = GetRowRect(rect3, num);

            if (enchantedItem.mpCost != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.mpCostTier);
                rectLabel = enchantedItem.MPCostLabel;
                Widgets.Label(rect4, rectLabel);
                num++;
            }
            Rect rect5 = GetRowRect(rect4, num);

            if (enchantedItem.mpRegenRate != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.mpRegenRateTier);
                rectLabel = enchantedItem.MPRegenRateLabel;
                Widgets.Label(rect5, rectLabel);
                num++;
            }
            Rect rect6 = GetRowRect(rect5, num);

            if (enchantedItem.coolDown != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.coolDownTier);
                rectLabel = enchantedItem.CoolDownLabel;
                Widgets.Label(rect6, rectLabel);
                num++;
            }
            Rect rect7 = GetRowRect(rect6, num);

            if (enchantedItem.xpGain != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.xpGainTier);
                rectLabel = enchantedItem.XPGainLabel;
                Widgets.Label(rect7, rectLabel);
                num++;
            }
            Rect rect71 = GetRowRect(rect7, num);

            if (enchantedItem.arcaneRes != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.arcaneResTier);
                rectLabel = enchantedItem.ArcaneResLabel;
                Widgets.Label(rect71, rectLabel);
                num++;
            }
            Rect rect72 = GetRowRect(rect71, num);

            if (enchantedItem.arcaneDmg != 0)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.arcaneDmgTier);
                rectLabel = enchantedItem.ArcaneDmgLabel;
                Widgets.Label(rect72, rectLabel);
                num++;
            }
            Rect rect8 = GetRowRect(rect72, num);

            if (enchantedItem.arcaneSpectre != false)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                rectLabel = enchantedItem.ArcaneSpectreLabel;
                Widgets.Label(rect8, rectLabel);
                num++;
            }
            Rect rect9 = GetRowRect(rect8, num);

            if (enchantedItem.phantomShift != false)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                rectLabel = enchantedItem.PhantomShiftLabel;
                Widgets.Label(rect9, rectLabel);
                num++;
            }
            Rect rect10 = GetRowRect(rect9, num);

            if (enchantedItem.hediff != null)
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                rectLabel = enchantedItem.HediffLabel;
                Widgets.Label(rect10, rectLabel);
                num++;
            }
            Rect rect11 = GetRowRect(rect10, num);

            if (enchantedItem.MagicAbilities != null && enchantedItem.MagicAbilities.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                string abilityLabels = "Abilities: ";
                stringBuilder.Append(abilityLabels);
                for (int i = 0; i < enchantedItem.MagicAbilities.Count; i++)
                {
                    if (i + 1 < enchantedItem.MagicAbilities.Count)
                    {
                        stringBuilder.Append(enchantedItem.MagicAbilities[i].LabelCap + ", ");
                    }
                    else
                    {
                        stringBuilder.Append(enchantedItem.MagicAbilities[i].LabelCap);
                    }
                }
                rectLabel = stringBuilder.ToString();
                Widgets.Label(rect11, rectLabel);
                num++;
            }
            Rect rect12 = GetRowRect(rect11, num);

            if (enchantedItem.SoulOrbTraits != null && enchantedItem.SoulOrbTraits.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                string abilityLabels = "Absorbed Traits: ";
                stringBuilder.Append(abilityLabels);
                for (int i = 0; i < enchantedItem.SoulOrbTraits.Count; i++)
                {
                    //abilityLabels = enchantedItem.SoulOrbTraits[i].LabelCap + "\n";
                    if (i + 1 < enchantedItem.SoulOrbTraits.Count)
                    {
                        stringBuilder.Append(enchantedItem.SoulOrbTraits[i].LabelCap + ", ");
                    }
                    else
                    {
                        stringBuilder.Append(enchantedItem.SoulOrbTraits[i].LabelCap);
                    }
                }
                rectLabel = stringBuilder.ToString();
                Widgets.Label(rect12, rectLabel);
                num++;
            }
            Rect rect13 = GetRowRect(rect12, num);

            if (enchantedItem.enchantmentAction != null && (enchantedItem.enchantmentAction.type != EnchantmentActionType.Null))
            {
                GUI.color = GenEnchantmentColor.EnchantmentColor(enchantedItem.skillTier);
                rectLabel = enchantedItem.EnchantmentActionLabel;
                Widgets.Label(rect13, rectLabel);
                num++;
            }
            //rect3.yMin += Text.CalcHeight(rectLabel, rect.width);

            //QualityCategory qualityCategory;
            //QualityUtility.TryGetQuality(ITab_Enchantment.SelectedCompEnchantment.parent, out qualityCategory);
            //StringBuilder stringBuilder = new StringBuilder();
            //stringBuilder.Append(GenText.CapitalizeFirst(QualityUtility.GetLabel(qualityCategory))).Append(" ").Append(ResourceBank.StringQuality).Append(" ");
            //if (ITab_Enchantment.SelectedCompEnchantment.parent.Stuff != null)
            //{
            //    stringBuilder.Append(ITab_Enchantment.SelectedCompEnchantment.parent.Stuff.LabelAsStuff).Append(" ");
            //}
            //stringBuilder.Append(ITab_Enchantment.SelectedCompEnchantment.parent.def.label);
            //string text = stringBuilder.ToString();
            //Widgets.Label(rect3, text);
            //GUI.color = Color.white;
            //Text.Anchor = TextAnchor.UpperLeft;
            //Rect rect4 = rect;
            //rect4.yMin += rect3.yMin + Text.CalcHeight(text, rect.width);
            //Text.Font = GameFont.Tiny;
            //Widgets.Label(rect4, ITab_Enchantment.SelectedCompEnchantment.parent.GetInfusionDesc());
        }
        public static void Draw(
            Rect rect,
            Dictionary <string, int> metrics,
            List <string> categories,
            int maxImpact,
            Dictionary <string, string> categoryHints,
            Dictionary <string, Color> categoryColors,
            Color defaultColor,
            float progressBarPadding = 4
            )
        {
            float progressBarWidth = rect.width - progressBarPadding * 2;
            float progressBarX     = 0;
            float x = rect.x + progressBarPadding;

            foreach (string cat in categories)
            {
                int impact = 0;
                metrics.TryGetValue(cat, out impact);
                if (impact == 0)
                {
                    continue;
                }

                Color color;
                if (!categoryColors.TryGetValue(cat, out color))
                {
                    color = defaultColor;
                }

                float width    = progressBarWidth * impact / maxImpact;
                Rect  textRect = new Rect(x + progressBarX, rect.y + progressBarPadding, width, rect.height - progressBarPadding * 2);


                Color stored = GUI.color;

                if (Mouse.IsOver(textRect))
                {
                    GUI.color = Color.Lerp(color * stored, Color.white, 0.25f);
                    if (textRect.width > 6)
                    {
                        GUI.DrawTexture(textRect, BaseContent.WhiteTex);
                        GUI.color = color * stored;
                        GUI.DrawTexture(GenUI.ContractedBy(textRect, 3f), BaseContent.WhiteTex);
                    }
                    else
                    {
                        GUI.DrawTexture(textRect, BaseContent.WhiteTex);
                    }
                }
                else
                {
                    GUI.color = color * stored;
                    GUI.DrawTexture(textRect, BaseContent.WhiteTex);
                }
                GUI.color = stored;

                progressBarX += width;

                TooltipHandler.TipRegion(textRect, () => {
                    string res;
                    if (!categoryHints.TryGetValue(cat, out res))
                    {
                        res = cat;
                    }
                    res += ": " + TimeText(impact);
                    return(res);
                }, 1163428609);
            }
        }
Exemple #24
0
        protected override void FillTab()
        {
            Building_Storage storage = this.SelThing as Building_Storage;

            this.container = storage.TryGetComp <CompContainer>();
            if (container == null)
            {
                Log.Error("No CompContainer included for this Building_Storage");
                return;
            }
            List <Thing> list        = container.itemsList;
            float        fieldHeight = 30.0f;

            this.size = new Vector2(300f, 55f + container.compProps.itemsCap * fieldHeight);

            ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);
            Text.Font = GameFont.Small;

            Rect  innerRect  = GenUI.ContractedBy(new Rect(0.0f, 0.0f, this.size.x, this.size.y), 10f);
            float innerRectX = innerRect.x;

            GUI.BeginGroup(innerRect);
            {
                Widgets.TextField(new Rect(0.0f, 0.0f, this.size.x - 40f, fieldHeight), GetTitle());

                Rect thingIconRect   = new Rect(10f, fieldHeight + 5f, 30f, fieldHeight);
                Rect thingLabelRect  = new Rect(thingIconRect.x + 35f, thingIconRect.y + 5.0f, innerRect.width - 35f, fieldHeight);
                Rect thingButtonRect = new Rect(thingIconRect.x, thingIconRect.y, innerRect.width, fieldHeight);

                //float startY = 0.0f;
                //Widgets.ListSeparator(ref startY, innerRect.width, GetTitle());

                foreach (var thing in list)
                {
                    Widgets.ThingIcon(thingIconRect, thing);
                    Widgets.Label(thingLabelRect, thing.Label);

                    if (Widgets.InvisibleButton(thingButtonRect))
                    {
                        List <FloatMenuOption> options = new List <FloatMenuOption>();
                        options.Add(new FloatMenuOption("Container_Info".Translate(), () =>
                        {
                            // NOTE ?
                            Find.WindowStack.Add(new Dialog_InfoCard(thing));
                        }));
                        options.Add(new FloatMenuOption("Container_Drop".Translate(), () =>
                        {
                            IntVec3 bestSpot = IntVec3.Invalid;
                            if (JobDriver_HaulToCell.TryFindPlaceSpotNear(storage.Position, thing, out bestSpot))
                            {
                                thing.Position = bestSpot;
                            }
                            else
                            {
                                Log.Error("No free spot for " + thing);
                            }
                        }));

                        Find.WindowStack.Add(new FloatMenu(options, "", false, false));
                    }

                    thingIconRect.y   += fieldHeight;
                    thingLabelRect.y  += fieldHeight;
                    thingButtonRect.y += fieldHeight;
                }
            }
            GUI.EndGroup();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;
            Rect rect = new Rect(inRect);

            rect.height = Text.CalcHeight(ChooseVoidPawnWindow.instructionString, rect.width) + 2f;
            Widgets.Label(rect, ChooseVoidPawnWindow.instructionString);
            Rect rect2 = new Rect(rect);

            rect2.y     += rect.height + 2f;
            rect2.height = inRect.height - rect2.y - 2f;
            Rect rect3 = new Rect(rect2);

            rect3.width -= 16f;
            float num  = Text.LineHeight * 2.25f + 2f;
            float num2 = this.voidPawnCache.Count > 0 ? ((float)(this.voidPawnCache.Count + 1) * num) : 0f;
            float num3 = this.voidPawnAnimalCache.Count > 0 ? ((float)(this.voidPawnAnimalCache.Count + 1) * num) : 0f;

            rect3.height = num2 + num3;
            Widgets.BeginScrollView(rect2, ref this.resultsAreaScroll, rect3, true);
            Rect rect4 = new Rect(rect3);

            rect4.height = num;
            if (this.voidPawnCache.Count > 0)
            {
                /*Text.Font = GameFont.Medium;
                 * Text.Anchor = TextAnchor.MiddleLeft;
                 * Rect rect5 = new Rect(rect4);
                 * rect5.x += 4f;
                 * rect5.width -= 4f;
                 * Widgets.Label(rect5, Translator.Translate("VoidKeyPawnsToChoose", new object[]
                 *  {
                 *      this.voidPawnCache.Count
                 *  }));
                 * Widgets.DrawLineHorizontal(rect4.x, rect4.y + rect4.height, rect4.width);
                 * Text.Font = GameFont.Small;
                 * rect4.y += num;*/
                foreach (Pawn pawn in this.voidPawnCache)
                {
                    Widgets.DrawHighlightIfMouseover(rect4);
                    Rect rect6 = new Rect(rect4);
                    rect6.width = rect6.height;
                    Rect rectTemp = new Rect(rect6);
                    rectTemp.width *= 0.8f;
                    rectTemp.height = rectTemp.width;
                    Widgets.ThingIcon(rectTemp, pawn, 1f);
                    Rect rect7 = new Rect(rect4);
                    rect7.width = rect7.width - rect6.width - num * 2f;
                    rect7.x    += rect6.width;
                    Widgets.Label(rect7, pawn.LabelCap);
                    Rect rect8 = new Rect(rect4);
                    rect8.width = rect8.height;
                    rect8.x     = rect7.x + rect7.width;
                    TooltipHandler.TipRegion(rect8, "PolarisVoidKeyPullVoidPawnData".Translate(this.thing.LabelCap));
                    if (Widgets.ButtonImage(GenUI.ContractedBy(rect8, rect8.width / 4f), VoidKeyDataBase.VoidKeyExactThisOne))
                    {
                        if (this.thing is VoidKeyThing tempThing)
                        {
                            tempThing.InnerPawn = pawn;
                            Messages.Message("PolarisVoidKeyPullDataDone".Translate(pawn.LabelShortCap), MessageTypeDefOf.PositiveEvent);
                            this.Close();
                        }
                    }
                    Rect rect9 = new Rect(rect4);
                    rect9.width = rect9.height;
                    rect9.x     = rect8.x + rect8.width;
                    Widgets.InfoCardButton(rect9.x + rect9.width / 2f - 12f, rect9.y + rect9.height / 2f - 12f, pawn);
                    TooltipHandler.TipRegion(rect4, pawn.DescriptionDetailed);
                    rect4.y += num;
                }
                foreach (Pawn pawn in this.voidPawnAnimalCache)
                {
                    Widgets.DrawHighlightIfMouseover(rect4);
                    Rect rect6 = new Rect(rect4);
                    rect6.width = rect6.height;
                    Rect rectTemp = new Rect(rect6);
                    rectTemp.width *= 0.8f;
                    rectTemp.height = rectTemp.width;
                    Widgets.ThingIcon(rectTemp, pawn, 1f);
                    Rect rect7 = new Rect(rect4);
                    rect7.width = rect7.width - rect6.width - num * 2f;
                    rect7.x    += rect6.width;
                    Widgets.Label(rect7, pawn.LabelCap);
                    Rect rect8 = new Rect(rect4);
                    rect8.width = rect8.height;
                    rect8.x     = rect7.x + rect7.width;
                    TooltipHandler.TipRegion(rect8, "PolarisVoidKeyPullVoidPawnData".Translate(this.thing.LabelCap));
                    if (Widgets.ButtonImage(GenUI.ContractedBy(rect8, rect8.width / 4f), VoidKeyDataBase.VoidKeyExactThisOne))
                    {
                        if (this.thing is VoidKeyThing tempThing)
                        {
                            tempThing.InnerPawn = pawn;
                            Messages.Message("PolarisVoidKeyPullDataDone".Translate(pawn.LabelShortCap), MessageTypeDefOf.PositiveEvent);
                            this.Close();
                        }
                    }
                    Rect rect9 = new Rect(rect4);
                    rect9.width = rect9.height;
                    rect9.x     = rect8.x + rect8.width;
                    Widgets.InfoCardButton(rect9.x + rect9.width / 2f - 12f, rect9.y + rect9.height / 2f - 12f, pawn);
                    TooltipHandler.TipRegion(rect4, pawn.DescriptionDetailed);
                    rect4.y += num;
                }
            }
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.EndScrollView();
        }