Ejemplo n.º 1
0
        private void DoIgnoreNewsProviderToggle(Vector2 togglePos, FeatureEntry entry)
        {
            var ownerId = entry.def.OwningModId;
            var wasOn   = !ignoredNewsProviders.Contains(ownerId);
            var isOn    = wasOn;

            Widgets.Checkbox(togglePos, ref isOn);
            if (wasOn != isOn)
            {
                void ToggleIgnoredState()
                {
                    ignoredNewsProviders.SetIgnored(ownerId, !isOn);
                }

                if (isOn || HugsLibUtility.ShiftIsHeld)
                {
                    ToggleIgnoredState();
                }
                else
                {
                    Find.WindowStack.Add(new Dialog_Confirm("HugsLib_features_confirmIgnore".Translate(entry.def.modNameReadable),
                                                            ToggleIgnoredState, false, "HugsLib_features_confirmIgnoreTitle".Translate()));
                }
            }
            var tooltipRect = new Rect(togglePos.x, togglePos.y, Widgets.CheckboxSize, Widgets.CheckboxSize);

            TooltipHandler.TipRegion(tooltipRect, ignoreToggleTip);
        }
Ejemplo n.º 2
0
        private static void DrawHeadingCheckBox(IEntityFilter filter, string label, string description, ref Rect baseRect)
        {
            Text.Font = GameFont.Medium;
            Rect rect = new Rect(baseRect.x, baseRect.y, baseRect.width, Text.LineHeight);

            Widgets.DrawHighlightIfMouseover(rect);
            if (!description.NullOrEmpty())
            {
                if (Mouse.IsOver(rect))
                {
                    GUI.DrawTexture(rect, TexUI.HighlightTex);
                }
                TooltipHandler.TipRegion(rect, description);
            }
            Text.Anchor = TextAnchor.MiddleCenter;

            Widgets.Label(rect, label);
            bool flag  = filter.IsVaild();
            bool flag2 = flag;

            Widgets.Checkbox(new Vector2(baseRect.x + rect.width - 26f, baseRect.y + 4f), ref flag);
            if (flag != flag2)
            {
                filter.SetVaild(flag);
            }
            baseRect.y += rect.height;
            Text.Anchor = TextAnchor.UpperLeft;
        }
 private void DrawRoyaltyChanger(float y)
 {
     Widgets.Label(new Rect(10, y, 200, 35), "Structure need royalty dlc:");
     Text.Anchor = TextAnchor.MiddleCenter;
     Widgets.Checkbox(220, y, ref this.needRoyalty);
     Text.Anchor = TextAnchor.UpperLeft;
 }
        private void DoThingDef(ThingDef tDef, int nestLevel)
        {
            bool   flag = (this.suppressSmallVolumeTags == null || !this.suppressSmallVolumeTags.Contains(tDef)) && tDef.IsStuff && tDef.smallVolume;
            string text = tDef.description;

            if (flag)
            {
                text = text + "\n\n" + "ThisIsSmallVolume".Translate(new object[]
                {
                    10.ToStringCached()
                });
            }
            base.LabelLeft(tDef.LabelCap, text, nestLevel);
            if (flag)
            {
                Rect rect = new Rect(this.LabelWidth - 30f, this.curY, 30f, 30f);
                Text.Font = GameFont.Tiny;
                GUI.color = Color.gray;
                Widgets.Label(rect, "x" + 10.ToStringCached());
                Text.Font = GameFont.Small;
                GUI.color = Color.white;
            }
            bool flag2 = this.filter.Allows(tDef);
            bool flag3 = flag2;

            Widgets.Checkbox(new Vector2(this.LabelWidth, this.curY), ref flag2, this.lineHeight, false);
            if (flag2 != flag3)
            {
                this.filter.SetAllow(tDef, flag2);
            }
            base.EndLine();
        }
Ejemplo n.º 5
0
 public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 {
     if (this.HasCheckbox(pawn))
     {
         int      num       = (int)((rect.width - 24f) / 2f);
         int      num2      = Mathf.Max(3, 0);
         Vector2  vector    = new Vector2(rect.x + (float)num, rect.y + (float)num2);
         Rect     rect2     = new Rect(vector.x, vector.y, 24f, 24f);
         bool     value     = this.GetValue(pawn);
         bool     flag      = value;
         Vector2  topLeft   = vector;
         ref bool checkOn   = ref value;
         bool     paintable = this.def.paintable;
         Widgets.Checkbox(topLeft, ref checkOn, 24f, false, paintable, null, null);
         if (Mouse.IsOver(rect2))
         {
             string tip = this.GetTip(pawn);
             if (!tip.NullOrEmpty())
             {
                 TooltipHandler.TipRegion(rect2, tip);
             }
         }
         if (value != flag)
         {
             this.SetValue(pawn, value);
         }
     }
Ejemplo n.º 6
0
        private void DrawVehicleSelect(Rect rect)
        {
            Text.Anchor = TextAnchor.MiddleLeft;

            Rect viewRect = new Rect(0f, rect.yMin, rect.width - ButtonPadding * 2, rect.yMax);

            Widgets.BeginScrollView(rect, ref scrollPosition, viewRect, true);
            float num  = scrollPosition.y - 30f;
            float num2 = scrollPosition.y + rect.height;
            float num3 = 30f;

            for (int i = 0; i < availableVehicles.Count; i++)
            {
                VehiclePawn vehicle = availableVehicles[i];

                Rect iconRect = new Rect(5f, num3 + 5f, 30f, 30f);
                Rect rowRect  = new Rect(iconRect.x, iconRect.y, rect.width, 30f);

                if (i % 2 == 1)
                {
                    Widgets.DrawLightHighlight(rowRect);
                }
                rowRect.x = iconRect.width + 10f;

                if (vehicle.VehicleDef.properties.generateThingIcon)
                {
                    Rect    texCoords      = new Rect(0, 0, 1, 1);
                    Vector2 texProportions = vehicle.VehicleDef.graphicData.drawSize;
                    float   x = texProportions.x;
                    texProportions.x = texProportions.y;
                    texProportions.y = x;
                    Widgets.DrawTextureFitted(iconRect, VehicleTex.VehicleTexture(vehicle.VehicleDef, Rot8.East), GenUI.IconDrawScale(vehicle.VehicleDef), texProportions,
                                              texCoords, 0, vehicle.VehicleGraphic.MatAt(Rot8.East, vehicle.pattern));
                }
                else
                {
                    Widgets.ButtonImageFitted(iconRect, VehicleTex.CachedTextureIcons[vehicle.VehicleDef]);
                }

                Widgets.Label(rowRect, vehicle.LabelShortCap);

                bool flag = storedVehicles.Contains(vehicle);

                Vector2 checkposition = new Vector2(rect.width - iconRect.width * 1.5f, rowRect.y + 5f);
                Widgets.Checkbox(checkposition, ref flag);
                if (flag && !storedVehicles.Contains(vehicle))
                {
                    storedVehicles.Add(vehicle);
                }
                else if (!flag && storedVehicles.Contains(vehicle))
                {
                    storedVehicles.Remove(vehicle);
                }

                num3 += rowRect.height;
            }

            Widgets.EndScrollView();
            Text.Anchor = TextAnchor.UpperLeft;
        }
Ejemplo n.º 7
0
        public void OnGUI(float positionX, ref float positionY, float width)
        {
            bool   disabled = this.Disabled;
            float  num      = (!this.Indent) ? 0f : Dialog_InterfaceOptions.IndentSize;
            string label    = this.Label;
            float  num2     = Text.CalcHeight(label, width - BooleanPreference.LabelMargin - num);
            Rect   rect     = new Rect(positionX - 4f + num, positionY - 3f, width + 6f - num, num2 + 5f);

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            Rect rect2 = new Rect(positionX + num, positionY, width - BooleanPreference.LabelMargin - num, num2);

            if (disabled)
            {
                GUI.color = Dialog_InterfaceOptions.DisabledControlColor;
            }
            GUI.Label(rect2, label);
            GUI.color = Color.white;
            if (this.Tooltip != null)
            {
                TipSignal tip = new TipSignal(() => this.Tooltip.Translate(), this.TooltipId);
                TooltipHandler.TipRegion(rect2, tip);
            }
            bool valueForDisplay = this.ValueForDisplay;

            Widgets.Checkbox(new Vector2(positionX + width - BooleanPreference.CheckboxWidth, positionY - 2f), ref valueForDisplay, 24f, disabled);
            this.Value = valueForDisplay;
            positionY += num2;
        }
        private void                    DoCheckbox(Rect rect, ref bool value, string labelKey)
        {
            var originalFont   = Text.Font;
            var originalAnchor = Text.Anchor;

            Text.Font   = fontCheckbox;
            Text.Anchor = TextAnchor.MiddleLeft;

            var label = labelKey.Translate();

            Vector2 radioVec = new Vector2(
                rect.x,
                rect.y + ((rect.height - entrySize) / 2));
            float labelWidth = Text.CalcSize(label).x;
            Rect  labelRect  = new Rect(
                rect.x + entrySize + innerPadding,
                rect.y,
                labelWidth,
                rect.height);

            Widgets.Checkbox(
                radioVec,
                ref value);

            Widgets.Label(
                labelRect,
                label
                );

            Text.Anchor = originalAnchor;
            Text.Font   = originalFont;
        }
        // Helper function that does what it says on the box
        private static bool CheckboxChangedToTrue(ref float y, float width, string textKey, ref bool key, string tooltipKey, int indent = 0)
        {
            // this could have been done in 5 linse with a Listing_Standard....if Listing_Standard did
            //   "painting" - which allows the player to drag X (or Check) to mark a bunch of thing X at once.
            //   But.  That is a super useful feature, so:
            bool tmp      = key;
            Rect textRect = new Rect(indent * 20f, y + 1, width - (indent * 20f) - 24f, 22f);
            //Rect checkRect=new Rect(width-24f,y,24f,24f);
            Rect highlightRect = new Rect(indent * 20f, y, width - (indent * 20f), 24f);

            Widgets.Label(textRect, textKey); //todo: translate()
            Widgets.Checkbox(width - 24f, y, ref key, 24f, false, true /*paintable*/, null, null);
            if (Mouse.IsOver(highlightRect))
            {
                if (!tooltipKey.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(highlightRect, tooltipKey.Translate());
                }
                Widgets.DrawHighlight(highlightRect);
                if (Widgets.ButtonInvisible(textRect))
                {
                    key = !key;
                }
            }
            y += 24f;
            if (tmp == false &&
                key == true)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 10
0
        private void DrawTable <T>(float x, float y, float width, ref Vector2 scroll, string header, ICollection <T> labels, Dictionary <T, bool> items) where T : Def
        {
            const float ROW_HEIGHT = 28;

            GUI.BeginGroup(new Rect(x, y, width, 400));
            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(0, 0, width, 40), header.Translate());
            Widgets.BeginScrollView(new Rect(0, 50, width, 300), ref scroll, new Rect(0, 0, width - 16, items.Count * ROW_HEIGHT + 40));
            Text.Font = GameFont.Small;

            int  index = 0;
            bool b, orig;

            foreach (T t in labels)
            {
                y = index * ROW_HEIGHT;
                ++index;
                Widgets.Label(new Rect(0, y, 200, 22), t.label + ":");

                b = orig = items[t];
                Widgets.Checkbox(new Vector2(220, y - 1), ref b);
                if (b != orig)
                {
                    items[t] = b;
                }
            }
            Widgets.EndScrollView();
            GUI.EndGroup();
        }
Ejemplo n.º 11
0
            public void CheckboxNonLabeled(ref bool checkOn, string tooltip = null, bool leftAligned = false)
            {
                var rect = GetRect(Text.LineHeight);

                if (!tooltip.NullOrEmpty())
                {
                    if (Mouse.IsOver(rect))
                    {
                        Widgets.DrawHighlight(rect);
                    }
                    TooltipHandler.TipRegion(rect, (TipSignal)tooltip);
                }

                float x;

                if (leftAligned)
                {
                    x = rect.x;
                }
                else
                {
                    x = rect.x + rect.width - 24f;
                }

                Widgets.Checkbox(x, rect.y, ref checkOn);

                Gap(verticalSpacing);
            }
 private void DrawStorageChanger(float y)
 {
     Widgets.Label(new Rect(10, y, 200, 35), "Structure is stockpile:");
     Text.Anchor = TextAnchor.MiddleCenter;
     Widgets.Checkbox(220, y, ref this.isStorage);
     Text.Anchor = TextAnchor.UpperLeft;
 }
Ejemplo n.º 13
0
        private int DrawUseInBattle(int x, int y)
        {
#if TRACE && CUSTOM_OUTFIT_UI
            Log.Warning("Begin CustomOutfitUI.DrawUseInBattle " + x + " " + y);
#endif
            if (this.pawn != null && this.outfitTracker != null && this.customOutfit != null)
            {
                Widgets.Label(new Rect(x, y, 100, 30), "ChangeDresser.UseForBattle".Translate());
                bool useInBattle = this.customOutfit.OutfitType == OutfitType.Battle;
                bool temp        = useInBattle;
                Widgets.Checkbox(x + 110, y, ref useInBattle);
                if (useInBattle != temp)
                {
#if CUSTOM_OUTFIT_UI
                    Log.Warning("CustomOutfitUI.DrawUseInBattle <Changed> from " + temp + " to " + useInBattle);
#endif
                    this.customOutfit.OutfitType = (useInBattle) ? OutfitType.Battle : OutfitType.Civilian;
                }
                return(x + 150);
            }
#if TRACE && CUSTOM_OUTFIT_UI
            Log.Warning("End CustomOutfitUI.DrawUseInBattle " + x + " " + y);
#endif
            return(x);
        }
Ejemplo n.º 14
0
        protected override void                 FillTab()
        {
            Rect rect1 = new Rect(0.0f, 0.0f, ITab_AutomatedFactory.WinSize.x, ITab_AutomatedFactory.WinSize.y).ContractedBy(10f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect1, SelectedFactory.def.LabelCap);
            Rect rect2 = rect1;

            rect2.yMin += 35f;
            Vector2 vector = rect2.position;

            rect2.xMin += 20f;
            Text.Font   = GameFont.Small;
            for (int index = 0; index < products.Count; ++index)
            {
                var product = products[index];
                if (SelectedFactory.FindRecipeForProduct(product) != null)
                {
                    Widgets.Label(rect2, product.LabelCap);
                    Widgets.Checkbox(vector, ref allowed[index], 16f);
                    TooltipHandler.TipRegion(rect2, tips[index]);
                    rect2.yMin += 20f;
                    vector.y   += 20f;
                }
            }
        }
Ejemplo n.º 15
0
        public static void DrawRandomizableFloatInput(float x, ref float y, RandomizableFieldValue <float> fv)
        {
            if (fv.GetRandomizableValue())
            {
                DrawLabel(x, y, 150, fv.Label);
            }
            else
            {
                fv.Buffer = DrawLabeledInput(x, y, fv.Label, fv.Buffer, out float nextX);
                if (float.TryParse(fv.Buffer, out float f))
                {
                    fv.OnChange(f);
                }
                if (fv.Default != 0 && Widgets.ButtonText(new Rect(nextX, y, 100, 28), "CM.Default".Translate()))
                {
                    fv.OnChange(fv.Default);
                    fv.UpdateBuffer();
                }
            }
            y += 30;
            Widgets.Label(new Rect(x, y, 100, 28), "Randomize".Translate());
            var r = fv.GetRandomizableValue();

            Widgets.Checkbox(new Vector2(x + 110, y - 2), ref r);
            fv.OnRandomizableChange(r);
            y += 30;
        }
Ejemplo n.º 16
0
 public static void DoTrainableCheckbox(Rect rect, Pawn pawn, TrainableDef td, AcceptanceReport canTrain, bool drawLabel, bool doTooltip)
 {
     if (pawn.training.IsCompleted(td))
     {
         if (!drawLabel)
         {
             GUI.DrawTexture(rect, TrainingCardUtility.TrainedTrainableTex);
         }
     }
     else
     {
         bool wanted = pawn.training.GetWanted(td);
         bool flag   = wanted;
         if (drawLabel)
         {
             Widgets.CheckboxLabeled(rect, td.LabelCap, ref wanted, !canTrain.Accepted);
         }
         else
         {
             Widgets.Checkbox(rect.position, ref wanted, rect.width, !canTrain.Accepted);
         }
         if (wanted != flag)
         {
             PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTraining, KnowledgeAmount.Total);
             pawn.training.SetWantedRecursive(td, wanted);
         }
     }
     if (doTooltip)
     {
         TrainingCardUtility.DoTrainableTooltip(rect, pawn, td, canTrain);
     }
 }
Ejemplo n.º 17
0
        public static void DoTrainableCheckbox(Rect rect, Pawn pawn, TrainableDef td, AcceptanceReport canTrain, bool drawLabel, bool doTooltip)
        {
            bool      flag         = pawn.training.HasLearned(td);
            bool      checkOn      = pawn.training.GetWanted(td);
            bool      flag2        = checkOn;
            Texture2D texChecked   = (!flag) ? null : LearnedTrainingTex;
            Texture2D texUnchecked = (!flag) ? null : LearnedNotTrainingTex;

            if (drawLabel)
            {
                Widgets.CheckboxLabeled(rect, td.LabelCap, ref checkOn, !canTrain.Accepted, texChecked, texUnchecked);
            }
            else
            {
                Widgets.Checkbox(rect.position, ref checkOn, rect.width, !canTrain.Accepted, paintable: true, texChecked, texUnchecked);
            }
            if (checkOn != flag2)
            {
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTraining, KnowledgeAmount.Total);
                pawn.training.SetWantedRecursive(td, checkOn);
            }
            if (doTooltip)
            {
                DoTrainableTooltip(rect, pawn, td, canTrain);
            }
        }
Ejemplo n.º 18
0
        private void DrawSettingsPanel(Listing listing)
        {
            (Rect nameLabel, Rect nameField) = listing.GetRect(Text.LineHeight).ToForm();
            Widgets.Label(nameLabel, "Points Base Name:");
            pointsBaseName = Widgets.TextField(nameField, pointsBaseName);

            if (!pointsBaseName.NullOrEmpty() && SettingsHelper.DrawClearButton(nameField))
            {
                pointsBaseName = "";
            }

            listing.Gap(Text.LineHeight);
            (Rect awardLabel, Rect awardField) = listing.GetRect(Text.LineHeight).ToForm();
            Widgets.Label(awardLabel, $"Reward viewers with {pointsBaseName}?");
            Widgets.Checkbox(awardField.x + awardField.width - 24f, awardField.y, ref rewardPoints);

            if (!rewardPoints)
            {
                return;
            }

            string minutesBuffer = minutesBetweenRewards.ToString();

            (Rect minutesLabel, Rect minutesField) = listing.GetRect(Text.LineHeight).ToForm();
            Widgets.Label(minutesLabel, $"Minutes Between {pointsBaseName} Rewards");
            Widgets.TextFieldNumeric(minutesField, ref minutesBetweenRewards, ref minutesBuffer);

            string pointsBuffer = pointsPerReward.ToString();

            (Rect pointsLabel, Rect pointsField) = listing.GetRect(Text.LineHeight).ToForm();
            Widgets.Label(pointsLabel, $"{pointsBaseName} Per Reward");
            Widgets.TextFieldNumeric(pointsField, ref pointsPerReward, ref pointsBuffer);
        }
Ejemplo n.º 19
0
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            if (!HasCheckbox(pawn))
            {
                return;
            }
            int     num     = (int)((rect.width - 24f) / 2f);
            int     num2    = Mathf.Max(3, 0);
            Vector2 topLeft = new Vector2(rect.x + (float)num, rect.y + (float)num2);
            Rect    rect2   = new Rect(topLeft.x, topLeft.y, 24f, 24f);
            bool    checkOn = GetValue(pawn);
            bool    flag    = checkOn;

            Widgets.Checkbox(topLeft, ref checkOn, 24f, disabled: false, def.paintable);
            if (Mouse.IsOver(rect2))
            {
                string tip = GetTip(pawn);
                if (!tip.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect2, tip);
                }
            }
            if (checkOn != flag)
            {
                SetValue(pawn, checkOn);
            }
        }
Ejemplo n.º 20
0
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref specificHealthTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect3, p);
            Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f);

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            float num = bgRect.xMax;

            if (!compactMode)
            {
                if (p.RaceProps.IsFlesh)
                {
                    Rect rect4 = new Rect(num, 0f, 100f, 50f);
                    DoPain(rect4, p);
                }
                num += 100f;
                List <PawnCapacityDef> list = CapacitiesToDisplay;
                for (int i = 0; i < list.Count; i++)
                {
                    Rect rect5 = new Rect(num, 0f, 100f, 50f);
                    if ((p.RaceProps.Humanlike && !list[i].showOnHumanlikes) || (p.RaceProps.Animal && !list[i].showOnAnimals) || (p.RaceProps.IsMechanoid && !list[i].showOnMechanoids) || !PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i]))
                    {
                        num += 100f;
                        continue;
                    }
                    DoCapacity(rect5, p, list[i]);
                    num += 100f;
                }
            }
            if (!compactMode)
            {
                Vector2 vector = new Vector2(num + 8f, 13f);
                Widgets.Checkbox(vector, ref p.health.beCarriedByCaravanIfSick, 24f, disabled: false, paintable: true);
                TooltipHandler.TipRegionByKey(new Rect(vector, new Vector2(24f, 24f)), "BeCarriedIfSickTip");
                num += 40f;
            }
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
        private void DrawThingRow(ref float y, float width, Thing thing)
        {
            Rect rect = new Rect(0f, y, width, 28f);

            Widgets.InfoCardButton(rect.width - 24f, y, thing);
            rect.width -= 24f;

            Rect rect2 = new Rect(rect.width - 24f, y, 24f, 24f);

            TooltipHandler.TipRegion(rect2, "Allow/Forbid"); // Replace "Allow/Forbid" with a translated entry in a Keyed Language XML file

            bool forbidFlag = !thing.IsForbidden(Faction.OfPlayer);

            Widgets.Checkbox(rect2.x, rect2.y, ref forbidFlag, 24f, false, true, null, null);

            ForbidUtility.SetForbidden(thing, !forbidFlag, false);

            rect.width -= 24f;

            Rect rect3 = rect;

            rect3.xMin = rect3.xMax - 60f;
            RimWorld.Planet.CaravanThingsTabUtility.DrawMass(thing, rect3);
            rect.width -= 60f;
            if (Mouse.IsOver(rect))
            {
                GUI.color = ITab_Pawn_Gear.HighlightColor;
                GUI.DrawTexture(rect, TexUI.HighlightTex);
            }
            if (thing.def.DrawMatSingle != null && thing.def.DrawMatSingle.mainTexture != null)
            {
                Widgets.ThingIcon(new Rect(4f, y, 28f, 28f), thing, 1f);
            }
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = ITab_Pawn_Gear.ThingLabelColor;
            Rect    rect4   = new Rect(36f, y, rect.width - 36f, rect.height);
            string  text    = thing.LabelCap;
            Apparel apparel = thing as Apparel;

            Text.WordWrap = false;
            Widgets.Label(rect4, text.Truncate(rect4.width, null));
            Text.WordWrap = true;
            string text2 = thing.DescriptionDetailed;

            if (thing.def.useHitPoints)
            {
                string text3 = text2;
                text2 = string.Concat(new object[]
                {
                    text3,
                    "\n",
                    thing.HitPoints,
                    " / ",
                    thing.MaxHitPoints
                });
            }
            TooltipHandler.TipRegion(rect, text2);
            y += 28f;
        }
Ejemplo n.º 22
0
        protected void DrawInvertOption(ref float xAnchor, float yAnchor)
        {
            Widgets.Label(new Rect(xAnchor, yAnchor, InvertWidth, OptionHeight), InvertKey.Translate());
            xAnchor += InvertWidth + XSeparation;
            Widgets.Checkbox(xAnchor, yAnchor + (OptionHeight - InvertCheckSize) / 2, ref Inverted, InvertCheckSize);

            xAnchor += InvertCheckSize + XSeparation;
        }
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);
            Vector2 topLeft = new Vector2(inRect.x + 10f, inRect.height - 35f - 24f - 10f);

            Widgets.Checkbox(topLeft, ref mod.translationMod);
            Widgets.Label(new Rect(topLeft.x + 24f + 10f, topLeft.y + (24f - Text.LineHeight) / 2f, inRect.width / 2f, 24f), "TagAsTranslation".Translate());
        }
Ejemplo n.º 24
0
        public static void CheckboxLabeled(this WidgetRow row, string label, ref bool val, float gap = WidgetRow.DefaultGap)
        {
            row.Label(label);
            Rect butRect = row.GetRect(WidgetRow.IconSize);

            Widgets.Checkbox(butRect.x, butRect.y, ref val);
            row.Gap(gap);
        }
Ejemplo n.º 25
0
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            SurgeryUnlimitedGameComponent comp = SurgeryUnlimitedGameComponent.Get();
            bool enabled = comp.surgeryUnlimited.Contains(pawn);

            Widgets.Checkbox(rect.position, ref enabled, rect.width);
            comp.Set(pawn, enabled);
        }
Ejemplo n.º 26
0
        public override void Draw(Listing_Standard list)
        {
            var rect = list.GetRect(Text.LineHeight);
            var left = rect.LeftHalf();

            Widgets.Label(left.LeftHalf(), new GUIContent(this.label.Translate(), this.description.Translate()));
            Widgets.Checkbox(left.RightHalf().position, ref this.currentCheckOn);
            this.currentValue = Widgets.TextField(rect.RightHalf(), this.currentValue);
            list.Gap(list.verticalSpacing);
        }
        private void DrawCheckBoxWithLabel(Rect elemRect, string taggedLabelID, ref bool setting)
        {
            var leftRect  = elemRect.LeftPart(0.20f);
            var rightRect = elemRect.RightPart(0.80f);
            var x         = (float)elemRect.x;
            var y         = (float)(elemRect.y + 0.5 * (elemRect.height - 24));

            Widgets.Checkbox(x, y, ref setting);
            Widgets.Label(rightRect, Translator.Translate(taggedLabelID));
        }
        private void DoThingDef(ThingDef tDef, int nestLevel, Map map)
        {
            if (InViewArea)
            {
                var obj = (suppressSmallVolumeTags == null || !suppressSmallVolumeTags.Contains(tDef)) &&
                          tDef.IsStuff &&
                          tDef.smallVolume;
                var text = tDef.DescriptionDetailed;
                if (obj)
                {
                    text += "\n\n" + "ThisIsSmallVolume".Translate(10.ToStringCached());
                }
                var num = -4f;
                if (obj)
                {
                    var rect = new Rect(LabelWidth - 19f, curY, 19f, 20f);
                    Text.Font   = GameFont.Tiny;
                    Text.Anchor = TextAnchor.UpperRight;
                    GUI.color   = Color.gray;
                    Widgets.Label(rect, "/" + 10.ToStringCached());
                    Text.Font = GameFont.Small;
                    GenUI.ResetLabelAlign();
                    GUI.color = Color.white;
                }

                num -= 19f;
                if (map != null)
                {
                    var count = map.resourceCounter.GetCount(tDef);
                    if (count > 0)
                    {
                        var text2 = count.ToStringCached();
                        var rect2 = new Rect(0f, curY, LabelWidth + num, 40f);
                        Text.Font   = GameFont.Tiny;
                        Text.Anchor = TextAnchor.UpperRight;
                        GUI.color   = new Color(0.5f, 0.5f, 0.1f);
                        Widgets.Label(rect2, text2);
                        num -= Text.CalcSize(text2).x;
                        GenUI.ResetLabelAlign();
                        Text.Font = GameFont.Small;
                        GUI.color = Color.white;
                    }
                }

                LabelLeft(tDef.LabelCap, text, nestLevel, num);
                var flag  = filter.Allows(tDef);
                var flag2 = flag;
                Widgets.Checkbox(new Vector2(LabelWidth, curY), ref flag, lineHeight, false, true);
                if (flag != flag2)
                {
                    filter.SetAllow(tDef, flag);
                }
            }
            EndLine();
        }
Ejemplo n.º 29
0
        private void DoThingDef(ThingDef tDef, int nestLevel, Map map)
        {
            bool   flag = (this.suppressSmallVolumeTags == null || !this.suppressSmallVolumeTags.Contains(tDef)) && tDef.IsStuff && tDef.smallVolume;
            string text = tDef.DescriptionDetailed;

            if (flag)
            {
                text = text + "\n\n" + "ThisIsSmallVolume".Translate(new object[]
                {
                    10.ToStringCached()
                });
            }
            float num = -4f;

            if (flag)
            {
                Rect rect = new Rect(this.LabelWidth - 19f, this.curY, 19f, 20f);
                Text.Font   = GameFont.Tiny;
                Text.Anchor = TextAnchor.UpperRight;
                GUI.color   = Color.gray;
                Widgets.Label(rect, "/" + 10.ToStringCached());
                Text.Font = GameFont.Small;
                GenUI.ResetLabelAlign();
                GUI.color = Color.white;
            }
            num -= 19f;
            if (map != null)
            {
                int count = map.resourceCounter.GetCount(tDef);
                if (count > 0)
                {
                    string text2 = count.ToStringCached();
                    Rect   rect2 = new Rect(0f, this.curY, this.LabelWidth + num, 40f);
                    Text.Font   = GameFont.Tiny;
                    Text.Anchor = TextAnchor.UpperRight;
                    GUI.color   = new Color(0.5f, 0.5f, 0.1f);
                    Widgets.Label(rect2, text2);
                    num -= Text.CalcSize(text2).x;
                    GenUI.ResetLabelAlign();
                    Text.Font = GameFont.Small;
                    GUI.color = Color.white;
                }
            }
            base.LabelLeft(tDef.LabelCap, text, nestLevel, num);
            bool flag2 = this.filter.Allows(tDef);
            bool flag3 = flag2;

            Widgets.Checkbox(new Vector2(this.LabelWidth, this.curY), ref flag2, this.lineHeight, false, true, null, null);
            if (flag2 != flag3)
            {
                this.filter.SetAllow(tDef, flag2);
            }
            base.EndLine();
        }
Ejemplo n.º 30
0
        public static bool DrawCheckbox(Rect rect, ref bool flag, TipSignal?tooltip = null, float iconSize = 24f)
        {
            var oldFlag = flag;

            Widgets.Checkbox(rect.position, ref flag, iconSize);
            if (tooltip.HasValue && Mouse.IsOver(rect))
            {
                TooltipHandler.TipRegion(rect, tooltip.Value);
            }
            return(flag != oldFlag);
        }