Exemplo n.º 1
0
        public static GlobalTargetInfo GetWorldTarget(GlobalTargetInfo target)
        {
            GlobalTargetInfo adjustedTarget = CameraJumper.GetAdjustedTarget(target);
            GlobalTargetInfo result;

            if (adjustedTarget.IsValid)
            {
                if (adjustedTarget.IsWorldTarget)
                {
                    result = adjustedTarget;
                }
                else
                {
                    result = CameraJumper.GetWorldTargetOfMap(adjustedTarget.Map);
                }
            }
            else
            {
                result = GlobalTargetInfo.Invalid;
            }
            return(result);
        }
        private static void TryJumpInternal(Thing thing)
        {
            if (Current.ProgramState != ProgramState.Playing)
            {
                return;
            }
            Map mapHeld = thing.MapHeld;

            if (mapHeld != null && Find.Maps.Contains(mapHeld) && thing.PositionHeld.IsValid && thing.PositionHeld.InBounds(mapHeld))
            {
                bool flag = CameraJumper.TryHideWorld();
                if (Find.CurrentMap != mapHeld)
                {
                    Current.Game.CurrentMap = mapHeld;
                    if (!flag)
                    {
                        SoundDefOf.MapSelected.PlayOneShotOnCamera(null);
                    }
                }
                Find.CameraDriver.JumpToCurrentMapLoc(thing.PositionHeld);
            }
        }
Exemplo n.º 3
0
 public static void TryJump(GlobalTargetInfo target)
 {
     if (target.IsValid)
     {
         target = CameraJumper.GetAdjustedTarget(target);
         if (target.HasThing)
         {
             CameraJumper.TryJumpInternal(target.Thing);
         }
         else if (target.HasWorldObject)
         {
             CameraJumper.TryJumpInternal(target.WorldObject);
         }
         else if (target.Cell.IsValid)
         {
             CameraJumper.TryJumpInternal(target.Cell, target.Map);
         }
         else
         {
             CameraJumper.TryJumpInternal(target.Tile);
         }
     }
 }
Exemplo n.º 4
0
 private static void TrySelectInternal(Thing thing)
 {
     if (Current.ProgramState == ProgramState.Playing && thing.Spawned && thing.def.selectable)
     {
         bool flag  = CameraJumper.TryHideWorld();
         bool flag2 = false;
         if (thing.Map != Current.Game.VisibleMap)
         {
             Current.Game.VisibleMap = thing.Map;
             flag2 = true;
             if (!flag)
             {
                 SoundDefOf.MapSelected.PlayOneShotOnCamera(null);
             }
         }
         if (flag || flag2)
         {
             Find.CameraDriver.JumpToVisibleMapLoc(thing.Position);
         }
         Find.Selector.ClearSelection();
         Find.Selector.Select(thing, true, true);
     }
 }
Exemplo n.º 5
0
        public void Draw(int xOffset, int yOffset)
        {
            Rect rect = this.CalculateRect((float)xOffset, (float)yOffset);

            Find.WindowStack.ImmediateWindow(Gen.HashCombineInt(this.ID, 45574281), rect, WindowLayer.Super, delegate
            {
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect rect   = rect.AtZero();
                float alpha = this.Alpha;
                GUI.color   = new Color(1f, 1f, 1f, alpha);
                if (Message.ShouldDrawBackground)
                {
                    GUI.color = new Color(0.15f, 0.15f, 0.15f, 0.8f * alpha);
                    GUI.DrawTexture(rect, BaseContent.WhiteTex);
                    GUI.color = new Color(1f, 1f, 1f, alpha);
                }
                if (CameraJumper.CanJump(this.lookTargets.TryGetPrimaryTarget()))
                {
                    UIHighlighter.HighlightOpportunity(rect, "Messages");
                    Widgets.DrawHighlightIfMouseover(rect);
                }
                Rect rect2 = new Rect(2f, 0f, rect.width - 2f, rect.height);
                Widgets.Label(rect2, this.text);
                if (Current.ProgramState == ProgramState.Playing && CameraJumper.CanJump(this.lookTargets.TryGetPrimaryTarget()) && Widgets.ButtonInvisible(rect, false))
                {
                    CameraJumper.TryJumpAndSelect(this.lookTargets.TryGetPrimaryTarget());
                    PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.ClickingMessages, KnowledgeAmount.Total);
                }
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
                if (Mouse.IsOver(rect))
                {
                    Messages.Notify_Mouseover(this);
                }
            }, false, false, 0f);
        }
Exemplo n.º 6
0
            internal void <> m__0()
            {
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.MiddleLeft;
                Rect  rect  = this.rect.AtZero();
                float alpha = this.$this.Alpha;

                GUI.color = new Color(1f, 1f, 1f, alpha);
                if (Message.ShouldDrawBackground)
                {
                    GUI.color = new Color(0.15f, 0.15f, 0.15f, 0.8f * alpha);
                    GUI.DrawTexture(rect, BaseContent.WhiteTex);
                    GUI.color = new Color(1f, 1f, 1f, alpha);
                }
                if (CameraJumper.CanJump(this.$this.lookTargets.TryGetPrimaryTarget()))
                {
                    UIHighlighter.HighlightOpportunity(rect, "Messages");
                    Widgets.DrawHighlightIfMouseover(rect);
                }
                Rect rect2 = new Rect(2f, 0f, rect.width - 2f, rect.height);

                Widgets.Label(rect2, this.$this.text);
                if (Current.ProgramState == ProgramState.Playing && CameraJumper.CanJump(this.$this.lookTargets.TryGetPrimaryTarget()))
                {
                    if (Widgets.ButtonInvisible(rect, false))
                    {
                        CameraJumper.TryJumpAndSelect(this.$this.lookTargets.TryGetPrimaryTarget());
                        PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.ClickingMessages, KnowledgeAmount.Total);
                    }
                }
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
                if (Mouse.IsOver(rect))
                {
                    Messages.Notify_Mouseover(this.$this);
                }
            }
Exemplo n.º 7
0
 internal void <> m__0()
 {
     CameraJumper.TryJumpAndSelect(this.target);
     Find.LetterStack.RemoveLetter(this.$this);
     InspectPaneUtility.OpenTab(typeof(ITab_Pawn_Log));
 }
Exemplo n.º 8
0
 public static void TryJump(int tile)
 {
     CameraJumper.TryJump(new GlobalTargetInfo(tile));
 }
Exemplo n.º 9
0
 public static void TryJump(IntVec3 cell, Map map)
 {
     CameraJumper.TryJump(new GlobalTargetInfo(cell, map, false));
 }
Exemplo n.º 10
0
 internal void <> m__0()
 {
     CameraJumper.TryJumpAndSelect(this.target);
     Find.LetterStack.RemoveLetter(this.$this);
 }
 public override void ClickedFromPOV(Thing pov)
 {
     CameraJumper.TryJumpAndSelect(recipientPawn);
 }
 public override bool CanBeClickedFromPOV(Thing pov)
 {
     return(CameraJumper.CanJump(recipientPawn));
 }