// Token: 0x060000D9 RID: 217 RVA: 0x000057F8 File Offset: 0x000039F8
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            bool flag = Mouse.IsOver(rect) && !pawn.Name.Numerical;

            if (flag && Event.current.control && Event.current.type == null && Event.current.button == 0)
            {
                //Find.WindowStack.Add(new Dialog_RenameAnimal(pawn));
                return;
            }
            base.DoCell(rect, pawn, table);
            if (flag)
            {
                TooltipHandler.ClearTooltipsFrom(rect);
                TooltipHandler.TipRegion(rect, this.GetToolTip(pawn));
            }
        }
Example #2
0
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            var interacting = Mouse.IsOver(rect) && !pawn.Name.Numerical;

            // intercept interactions before base has a chance to do so
            if (interacting &&
                Event.current.control &&
                Event.current.type == EventType.MouseDown &&
                Event.current.button == 0)
            {
                Find.WindowStack.Add(new Dialog_RenameAnimal(pawn));
                return;
            }

            base.DoCell(rect, pawn, table);

            // replace tooltip
            if (interacting)
            {
                TooltipHandler.ClearTooltipsFrom(rect);
                TooltipHandler.TipRegion(rect, GetToolTip(pawn));
            }
        }
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            // intercept interactions before base has a chance to act on them
            if (Shift && Mouse.IsOver(rect))
            {
                if (RightClicked(rect) || ScrolledUp(rect))
                {
                    Increment(pawn);
                    return;
                }
                if (LeftClicked(rect) || ScrolledDown(rect))
                {
                    Decrement(pawn);
                    return;
                }
            }

            // call base
            base.DoCell(rect, pawn, table);

            // override tooltip
            TooltipHandler.ClearTooltipsFrom(rect);
            TooltipHandler.TipRegion(rect, GetTooltip(pawn));
        }
        private static void DoModRow(Listing_Standard listing, ModMetaDataEnhanced mod, int index, int reorderableGroup = -1)
        {
            Rect rect = listing.GetRect(26f);

            if (mod.Active && !SearchInProgress)
            {
                ReorderableWidget.Reorderable(reorderableGroup, rect);
            }
            Action clickAction = null;

            if (mod.Source == ContentSource.SteamWorkshop)
            {
                clickAction = CreateModRowActionSteam(mod);
            }
            else
            {
                clickAction = CreateModRowActionLocal(mod);
            }
            ContentSourceUtility.DrawContentSource(rect, mod.Source, clickAction);
            rect.xMin += 28f;
            bool active     = mod.Active;
            bool isSelected = mod.OriginalMetaData == selectedMod.OriginalMetaData;
            Rect rect2      = rect;

            if (mod.Enabled && RenameInProgress == false)
            {
                string text = string.Empty;
                if (mod.Active)
                {
                    text = text + "DragToReorder".Translate() + ".\n\n";
                }
                if (!text.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect2, new TipSignal(text, mod.GetHashCode() * 3311));
                }
                Color origColor = GUI.color;
                GUI.color = mod.TextColor;
                if (Widgets.CheckboxLabeledSelectable(rect2, mod.Name, ref isSelected, ref active))
                {
                    selectedMod = mod;
                }
                GUI.color = origColor;

                if (mod.Active && reorderableGroup >= 0)
                {
                    Rect texRect = new Rect(rect2.xMax - 48f + 2f, rect2.y, 24f, 24f);
                    GUI.DrawTexture(texRect, Textures.DragHash);
                }

                if (mod.HasNotifications)
                {
                    Color  notifColour   = Color.gray;
                    string tooltipString = string.Empty;

                    foreach (NotificationBase notification in mod.Notifications)
                    {
                        if (notification.MessageType == NotificationType.Error)
                        {
                            notifColour = Color.red;
                        }
                        else if (notification.MessageType == NotificationType.Warning && notifColour != Color.red)
                        {
                            notifColour = Color.yellow;
                        }

                        tooltipString += notification.MessageText + "\n\n";
                    }

                    Text.Anchor = TextAnchor.MiddleCenter;
                    Text.Font   = GameFont.Medium;
                    GUI.color   = notifColour;

                    Rect dupRect = new Rect(rect2.xMax - 72f + 2f, rect.y, 24f, 24f);
                    Widgets.Label(dupRect, "!");
                    TooltipHandler.ClearTooltipsFrom(dupRect);
                    TooltipHandler.TipRegion(dupRect, tooltipString.Trim());

                    Text.Anchor = TextAnchor.UpperLeft;
                    Text.Font   = GameFont.Small;
                    GUI.color   = Color.white;
                }
                if (mod.Active && !active && mod.Name == ModContentPack.CoreModIdentifier)
                {
                    ModMetaData coreMod = mod.OriginalMetaData;
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDisableCoreMod".Translate(), delegate {
                        coreMod.Active = false;
                        truncatedModNamesCache.Clear();
                    }, false, null));
                }
                else
                {
                    mod.Active = active;
                    truncatedModNamesCache.Clear();
                }
            }
            else if (RenameInProgress == true && isSelected)
            {
                renameBuf = Widgets.TextField(rect2, renameBuf);
            }
            else
            {
                GUI.color = Color.gray;
                Widgets.Label(rect2, mod.Name);
            }
            GUI.color = Color.white;
        }
        /// <inheritdoc/>
        protected override void DrawItemRow(Rect row, int index, IList <ThingGroupSelector> groupSelectors, int reorderableGroup, bool drawShadow = false)
        {
            ValidateArg.NotNull(row, nameof(row));
            ValidateArg.NotNull(groupSelectors, nameof(groupSelectors));

            /* Label (fill) | Weight | Gear Icon | Count Field | Delete Icon */

            WidgetRow          widgetRow     = new WidgetRow(row.width, row.y, UIDirection.LeftThenDown, row.width);
            ThingGroupSelector groupSelector = groupSelectors[index];

            // Draw delete icon.
            this.DrawDeleteIconInThingRow(widgetRow, groupSelectors, groupSelector);

            Text.Anchor = TextAnchor.MiddleLeft;

            // Draw count field.
            if (WhiteBlacklistView.IsWishlist)
            {
                this.DrawCountFieldInThingRow(
                    new Rect(widgetRow.FinalX - WidgetRow.IconSize * 2 - WidgetRow.DefaultGap, widgetRow.FinalY, WidgetRow.IconSize * 2, GenUI.ListSpacing),
                    groupSelector);
                widgetRow.GapButtonIcon();
                widgetRow.GapButtonIcon();
            }

            // Draw threshold.
            if (widgetRow.ButtonIcon(TexResource.Threshold, UIText.StockMode.TranslateSimple()))
            {
                Find.WindowStack.Add(new Dialog_RestockTrigger(groupSelector));
            }

            // Draw gear icon.
            this.DrawGearIconInThingRow(widgetRow, groupSelector);

            // Draw ammo if thing is ammo user.
            this.DrawAmmoSelection(widgetRow, groupSelector.AllowedThing);

            Text.WordWrap = false;

            // Draw weight or bulk.
            if (_drawWeight)
            {
                widgetRow.Label(groupSelector.Weight.ToStringMass());
            }
            else
            {
                widgetRow.Label(groupSelector.AllowedThing.GetStatValueAbstract(CE_StatDefOf.Bulk).ToString() + " b");
            }

            // Draw label.
            Rect labelRect = widgetRow.Label(
                drawShadow
                    ? groupSelector.LabelCapNoCount.StripTags().Colorize(Theme.MilkySlicky.ForeGround)
                    : groupSelector.LabelCapNoCount
                , widgetRow.FinalX);

            Text.WordWrap = true;
            Text.Anchor   = TextAnchor.UpperLeft;

            if (!drawShadow)
            {
                ReorderableWidget.Reorderable(reorderableGroup, labelRect);

                // Tooltips && Highlights
                Widgets.DrawHighlightIfMouseover(row);
                if (Event.current.type == EventType.MouseDown && Mouse.IsOver(row))
                {
                    TooltipHandler.ClearTooltipsFrom(labelRect);
                    if (Event.current.button == 1)
                    {
                        FloatMenu floatMenu = new FloatMenu(
                            new List <FloatMenuOption>()
                        {
                            new FloatMenuOption(
                                UIText.AddToAllLoadout.TranslateSimple()
                                , () =>
                            {
                                var loadout = _currentLoadout;
                                if (loadout is AwesomeInventoryCostume costume)
                                {
                                    loadout = costume.Base;
                                }

                                groupSelector.AddToLoadouts(Loadout.LoadoutManager.PlainLoadouts.Except(loadout));
                            }),
                        });
        private void DrawRow(Rect rect, MatteredDay matteredDay, int index)
        {
            GUI.BeginGroup(rect);

            Rect rectName = rect.AtZero();

            rectName.width -= COL_MARGIN * 4 + BTN_SEASON_WIDTH + LBL_DATE_WIDTH + BTN_DURATION_WIDTH + BTN_DELETE_WIDTH;
            rectName.xMin  += COL_MARGIN;

            Rect rectSeason = new Rect(rectName.xMax + COL_MARGIN, 2f, BTN_SEASON_WIDTH, rect.height - 4f);

            Rect rectDateMinus = new Rect(rectSeason.xMax + COL_MARGIN, (rect.height - BTN_DATE_CONTROL_WIDTH) / 2f, BTN_DATE_CONTROL_WIDTH, BTN_DATE_CONTROL_WIDTH);
            Rect rectDate      = new Rect(rectDateMinus.xMax, 0f, LBL_DATE_WIDTH - BTN_DATE_CONTROL_WIDTH * 2, rect.height);
            Rect rectDatePlus  = new Rect(rectDate.xMax, (rect.height - BTN_DATE_CONTROL_WIDTH) / 2f, BTN_DATE_CONTROL_WIDTH, BTN_DATE_CONTROL_WIDTH);

            Rect rectDuration  = new Rect(rectDatePlus.xMax + COL_MARGIN, 2f, BTN_DURATION_WIDTH, rect.height - 4f);
            Rect btnDeleteRect = new Rect(rectDuration.xMax + COL_MARGIN, Mathf.RoundToInt((ROW_HEIGHT - BTN_DELETE_HEIGHT) / 2f), BTN_DELETE_WIDTH, BTN_DELETE_HEIGHT);

            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(rectName, matteredDay.Name);
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rectDate, matteredDay.DayOfQuadrum.ToString());
            Text.Anchor = TextAnchor.UpperLeft;

            if (Widgets.ButtonText(rectSeason, matteredDay.Quadrum.Label()))
            {
                FloatMenuUtility.MakeMenu(QUADRUMS, quadrum => quadrum.Label(), quadrum => delegate
                {
                    matteredDay.Quadrum = quadrum;
                });
            }

            if (Widgets.ButtonText(rectDuration, matteredDay.Duration.Label()))
            {
                FloatMenuUtility.MakeMenu(Enum.GetValues(typeof(Duration)).Cast <Duration>(), duration => duration.Label(), duration => delegate
                {
                    matteredDay.Duration = duration;
                });
            }

            if (Widgets.ButtonImage(btnDeleteRect, Textures.ROW_DELETE))
            {
                _store.MatteredDays.RemoveAt(index);
                SoundDefOf.Click.PlayOneShotOnCamera();
            }

            if (Widgets.ButtonImage(rectDateMinus, Textures.DAY_MINUS))
            {
                int tmp = matteredDay.DayOfQuadrum - 1;
                if (tmp < 1)
                {
                    tmp = 1;
                }
                matteredDay.DayOfQuadrum = tmp;
                SoundDefOf.Click.PlayOneShotOnCamera();
            }

            if (Widgets.ButtonImage(rectDatePlus, Textures.DAY_PLUS))
            {
                int tmp = matteredDay.DayOfQuadrum + 1;
                if (tmp > 15)
                {
                    tmp = 15;
                }
                matteredDay.DayOfQuadrum = tmp;
                SoundDefOf.Click.PlayOneShotOnCamera();
            }

            var interactingName = Mouse.IsOver(rectName);

            if (interactingName)
            {
                if (Event.current.control && Event.current.type == EventType.MouseDown && Event.current.button == 0)
                {
                    Find.WindowStack.Add(new DialogRename(matteredDay));
                    return;
                }
                TooltipHandler.ClearTooltipsFrom(rectName);
                TooltipHandler.TipRegion(rectName, "DM.Tab.RenameCustomDay".Translate());
            }

            GUI.EndGroup();
        }