public override void Notify_QuestSignalReceived(Signal signal)
        {
            base.Notify_QuestSignalReceived(signal);
            if (!(signal.tag == inSignal))
            {
                return;
            }
            LookTargets lookTargets = this.lookTargets;

            if (getLookTargetsFromSignal && !lookTargets.IsValid())
            {
                SignalArgsUtility.TryGetLookTargets(signal.args, "SUBJECT", out lookTargets);
            }
            if (lookTargets.IsValid())
            {
                if (select)
                {
                    CameraJumper.TryJumpAndSelect(lookTargets.TryGetPrimaryTarget());
                }
                else
                {
                    CameraJumper.TryJump(lookTargets.TryGetPrimaryTarget());
                }
            }
        }
 private static bool Prefix(string text, LookTargets lookTargets, MessageTypeDef def)
 {
     if (def == MessageTypeDefOf.PawnDeath && lookTargets.TryGetPrimaryTarget().Thing is Pawn pawn && (pawn.IsEmptySleeve() || pawn.HasStack()))
     {
         return(false);
     }
     return(true);
 }
        public override void Notify_QuestSignalReceived(Signal signal)
        {
            base.Notify_QuestSignalReceived(signal);
            if (!(signal.tag == inSignal))
            {
                return;
            }
            DiaNode     diaNode             = new DiaNode(signal.args.GetFormattedText(text));
            LookTargets resolvedLookTargets = lookTargets;

            if (getLookTargetsFromSignal && !resolvedLookTargets.IsValid())
            {
                SignalArgsUtility.TryGetLookTargets(signal.args, "SUBJECT", out resolvedLookTargets);
            }
            if (resolvedLookTargets.IsValid())
            {
                DiaOption diaOption = new DiaOption("JumpToLocation".Translate());
                diaOption.action = delegate
                {
                    CameraJumper.TryJumpAndSelect(resolvedLookTargets.TryGetPrimaryTarget());
                };
                diaOption.resolveTree = true;
                diaNode.options.Add(diaOption);
            }
            if (options.Any())
            {
                for (int i = 0; i < options.Count; i++)
                {
                    int       localIndex = i;
                    DiaOption diaOption2 = new DiaOption(signal.args.GetFormattedText(options[i].text));
                    diaOption2.action = delegate
                    {
                        Find.SignalManager.SendSignal(new Signal(options[localIndex].outSignal));
                    };
                    diaOption2.resolveTree = true;
                    diaNode.options.Add(diaOption2);
                }
            }
            else
            {
                DiaOption diaOption3 = new DiaOption("OK".Translate());
                diaOption3.resolveTree = true;
                diaNode.options.Add(diaOption3);
            }
            TaggedString formattedText = signal.args.GetFormattedText(title);

            Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, relatedFaction, delayInteractivity: true, radioMode, formattedText));
            if (addToArchive)
            {
                Find.Archive.Add(new ArchivedDialog(diaNode.text, formattedText, relatedFaction));
            }
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in base.GetGizmos())
            {
                yield return(c);
            }

            // Rename
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Buttons/Rename", true),
                action = () => Find.WindowStack.Add(new Dialog_RenamePocketDimensionEntranceBase(this)),
                defaultLabel = "CM_RenamePocketDimensionLabel".Translate(),
                defaultDesc = "CM_RenamePocketDimensionDescription".Translate()
            });

            Building_PocketDimensionEntranceBase otherSide = PocketDimensionUtility.GetOtherSide(this);

            if (otherSide != null && !otherSide.BeingDestroyed)
            {
                // Select other side
                yield return(new Command_Action
                {
                    action = delegate
                    {
                        if (otherSide != null)
                        {
                            LookTargets otherSideTarget = new LookTargets(otherSide.SpawnedParentOrMe);
                            CameraJumper.TrySelect(otherSideTarget.TryGetPrimaryTarget());
                        }
                    },
                    defaultLabel = this is Building_PocketDimensionBox ? "CM_ViewExitLabel".Translate() : "CM_ViewEntranceLabel".Translate(),
                    defaultDesc = this is Building_PocketDimensionBox ? "CM_ViewExitDescription".Translate() : "CM_ViewEntranceDescription".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/ViewQuest"),
                });
            }

            if (Prefs.DevMode && MapCreated)
            {
                // Fix walls not being owned by player
                yield return(new Command_Action
                {
                    action = () => PocketDimensionUtility.ClaimWalls(PocketDimensionUtility.GetMapParent(this.dimensionSeed).Map, Faction.OfPlayer),
                    defaultLabel = "DEBUG: Claim walls",
                });
            }
        }
        private void DoArchivableRow(Rect rect, IArchivable archivable, int index)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Widgets.DrawHighlightIfMouseover(rect);
            Text.Font     = GameFont.Small;
            Text.Anchor   = TextAnchor.MiddleLeft;
            Text.WordWrap = false;
            Rect rect2 = rect;
            Rect rect3 = rect2;

            rect3.width = 30f;
            rect2.xMin += 40f;
            float num;

            if (Find.Archive.IsPinned(archivable))
            {
                num = 1f;
            }
            else if (Mouse.IsOver(rect3))
            {
                num = 0.25f;
            }
            else
            {
                num = 0f;
            }
            if (num > 0f)
            {
                GUI.color = new Color(1f, 1f, 1f, num);
                GUI.DrawTexture(new Rect(rect3.x + (rect3.width - 22f) / 2f, rect3.y + (rect3.height - 22f) / 2f, 22f, 22f).Rounded(), MainTabWindow_History.PinTex);
                GUI.color = Color.white;
            }
            Rect rect4     = rect2;
            Rect outerRect = rect2;

            outerRect.width = 30f;
            rect2.xMin     += 40f;
            Texture archivedIcon = archivable.ArchivedIcon;

            if (archivedIcon != null)
            {
                GUI.color = archivable.ArchivedIconColor;
                Widgets.DrawTextureFitted(outerRect, archivedIcon, 0.8f);
                GUI.color = Color.white;
            }
            Rect rect5 = rect2;

            rect5.width = 200f;
            rect2.xMin += 210f;
            Vector2 location = (Find.CurrentMap == null) ? default(Vector2) : Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);

            GUI.color = new Color(0.75f, 0.75f, 0.75f);
            int    num2 = GenDate.TickGameToAbs(archivable.CreatedTicksGame);
            string str  = string.Concat(new object[]
            {
                GenDate.DateFullStringAt((long)num2, location),
                ", ",
                GenDate.HourInteger((long)num2, location.x),
                "LetterHour".Translate()
            });

            Widgets.Label(rect5, str.Truncate(rect5.width, null));
            GUI.color = Color.white;
            Rect rect6 = rect2;

            Widgets.Label(rect6, archivable.ArchivedLabel.Truncate(rect6.width, null));
            GenUI.ResetLabelAlign();
            Text.WordWrap = true;
            TooltipHandler.TipRegion(rect3, "PinArchivableTip".Translate(200));
            if (Mouse.IsOver(rect4))
            {
                TooltipHandler.TipRegion(rect4, archivable.ArchivedTooltip);
            }
            if (Widgets.ButtonInvisible(rect3, false))
            {
                if (Find.Archive.IsPinned(archivable))
                {
                    Find.Archive.Unpin(archivable);
                    SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
                }
                else
                {
                    Find.Archive.Pin(archivable);
                    SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
                }
            }
            if (Widgets.ButtonInvisible(rect4, false))
            {
                if (Event.current.button == 1)
                {
                    LookTargets lookTargets = archivable.LookTargets;
                    if (CameraJumper.CanJump(lookTargets.TryGetPrimaryTarget()))
                    {
                        CameraJumper.TryJumpAndSelect(lookTargets.TryGetPrimaryTarget());
                        Find.MainTabsRoot.EscapeCurrentTab(true);
                    }
                }
                else
                {
                    archivable.OpenArchived();
                }
            }
        }
        private void DoArchivableRow(Rect rect, IArchivable archivable, int index)
        {
            if (index % 2 == 1)
            {
                Widgets.DrawLightHighlight(rect);
            }
            Widgets.DrawHighlightIfMouseover(rect);
            Text.Font     = GameFont.Small;
            Text.Anchor   = TextAnchor.MiddleLeft;
            Text.WordWrap = false;
            Rect rect2 = rect;
            Rect rect3 = rect2;

            rect3.width = 30f;
            rect2.xMin += 35f;
            float num      = Find.Archive.IsPinned(archivable) ? 1f : ((!Mouse.IsOver(rect3)) ? 0f : 0.25f);
            Rect  position = new Rect(rect3.x + (rect3.width - 22f) / 2f, rect3.y + (rect3.height - 22f) / 2f, 22f, 22f).Rounded();

            if (num > 0f)
            {
                GUI.color = new Color(1f, 1f, 1f, num);
                GUI.DrawTexture(position, PinTex);
            }
            else
            {
                GUI.color = PinOutlineColor;
                GUI.DrawTexture(position, PinOutlineTex);
            }
            GUI.color = Color.white;
            Rect rect4     = rect2;
            Rect outerRect = rect2;

            outerRect.width = 30f;
            rect2.xMin     += 35f;
            Texture archivedIcon = archivable.ArchivedIcon;

            if (archivedIcon != null)
            {
                GUI.color = archivable.ArchivedIconColor;
                Widgets.DrawTextureFitted(outerRect, archivedIcon, 0.8f);
                GUI.color = Color.white;
            }
            Rect rect5 = rect2;

            rect5.width = 80f;
            rect2.xMin += 85f;
            Vector2 location = (Find.CurrentMap != null) ? Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile) : default(Vector2);

            GUI.color = new Color(0.75f, 0.75f, 0.75f);
            Widgets.Label(label: GenDate.DateShortStringAt(GenDate.TickGameToAbs(archivable.CreatedTicksGame), location).Truncate(rect5.width), rect: rect5);
            GUI.color = Color.white;
            Rect rect6 = rect2;

            Widgets.Label(rect6, archivable.ArchivedLabel.Truncate(rect6.width));
            GenUI.ResetLabelAlign();
            Text.WordWrap = true;
            TooltipHandler.TipRegionByKey(rect3, "PinArchivableTip", 200);
            if (Mouse.IsOver(rect4))
            {
                displayedMessageIndex = index;
            }
            if (Widgets.ButtonInvisible(rect3))
            {
                if (Find.Archive.IsPinned(archivable))
                {
                    Find.Archive.Unpin(archivable);
                    SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
                }
                else
                {
                    Find.Archive.Pin(archivable);
                    SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
                }
            }
            if (!Widgets.ButtonInvisible(rect4))
            {
                return;
            }
            if (Event.current.button == 1)
            {
                LookTargets lookTargets = archivable.LookTargets;
                if (CameraJumper.CanJump(lookTargets.TryGetPrimaryTarget()))
                {
                    CameraJumper.TryJumpAndSelect(lookTargets.TryGetPrimaryTarget());
                    Find.MainTabsRoot.EscapeCurrentTab();
                }
            }
            else
            {
                archivable.OpenArchived();
            }
        }