public void MapInterfaceUpdate()
 {
     if (Find.CurrentMap != null)
     {
         if (!WorldRendererUtility.WorldRenderedNow)
         {
             Profiler.BeginSample("TargeterUpdate()");
             this.targeter.TargeterUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("DrawSelectionOverlays()");
             SelectionDrawer.DrawSelectionOverlays();
             Profiler.EndSample();
             Profiler.BeginSample("EnvironmentStatsDrawer.DrawRoomOverlays()");
             EnvironmentStatsDrawer.DrawRoomOverlays();
             Profiler.EndSample();
             Profiler.BeginSample("DesignatorManagerUpdate()");
             this.designatorManager.DesignatorManagerUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("RoofGridUpdate()");
             Find.CurrentMap.roofGrid.RoofGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("ExitMapGridUpdate()");
             Find.CurrentMap.exitMapGrid.ExitMapGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("DeepResourceGridUpdate()");
             Find.CurrentMap.deepResourceGrid.DeepResourceGridUpdate();
             Profiler.EndSample();
             Profiler.BeginSample("Debug drawing");
             if (DebugViewSettings.drawPawnDebug)
             {
                 Find.CurrentMap.pawnDestinationReservationManager.DebugDrawDestinations();
                 Find.CurrentMap.reservationManager.DebugDrawReservations();
             }
             if (DebugViewSettings.drawFoodSearchFromMouse)
             {
                 FoodUtility.DebugFoodSearchFromMouse_Update();
             }
             if (DebugViewSettings.drawPreyInfo)
             {
                 FoodUtility.DebugDrawPredatorFoodSource();
             }
             if (DebugViewSettings.drawAttackTargetScores)
             {
                 AttackTargetFinder.DebugDrawAttackTargetScores_Update();
             }
             MiscDebugDrawer.DebugDrawInteractionCells();
             Find.CurrentMap.debugDrawer.DebugDrawerUpdate();
             Find.CurrentMap.regionGrid.DebugDraw();
             InfestationCellFinder.DebugDraw();
             StealAIDebugDrawer.DebugDraw();
             if (DebugViewSettings.drawRiverDebug)
             {
                 Find.CurrentMap.waterInfo.DebugDrawRiver();
             }
             Profiler.EndSample();
         }
     }
 }
Exemple #2
0
 public static void DrawSelectionOverlays()
 {
     foreach (object obj in Find.Selector.SelectedObjects)
     {
         SelectionDrawer.DrawSelectionBracketFor(obj);
         Thing thing = obj as Thing;
         if (thing != null)
         {
             thing.DrawExtraSelectionOverlays();
         }
     }
 }
 public void MapInterfaceUpdate()
 {
     if (Find.CurrentMap != null && !WorldRendererUtility.WorldRenderedNow)
     {
         targeter.TargeterUpdate();
         SelectionDrawer.DrawSelectionOverlays();
         EnvironmentStatsDrawer.DrawRoomOverlays();
         designatorManager.DesignatorManagerUpdate();
         Find.CurrentMap.roofGrid.RoofGridUpdate();
         Find.CurrentMap.fertilityGrid.FertilityGridUpdate();
         Find.CurrentMap.terrainGrid.TerrainGridUpdate();
         Find.CurrentMap.exitMapGrid.ExitMapGridUpdate();
         Find.CurrentMap.deepResourceGrid.DeepResourceGridUpdate();
         if (DebugViewSettings.drawPawnDebug)
         {
             Find.CurrentMap.pawnDestinationReservationManager.DebugDrawDestinations();
             Find.CurrentMap.reservationManager.DebugDrawReservations();
         }
         if (DebugViewSettings.drawDestReservations)
         {
             Find.CurrentMap.pawnDestinationReservationManager.DebugDrawReservations();
         }
         if (DebugViewSettings.drawFoodSearchFromMouse)
         {
             FoodUtility.DebugFoodSearchFromMouse_Update();
         }
         if (DebugViewSettings.drawPreyInfo)
         {
             FoodUtility.DebugDrawPredatorFoodSource();
         }
         if (DebugViewSettings.drawAttackTargetScores)
         {
             AttackTargetFinder.DebugDrawAttackTargetScores_Update();
         }
         MiscDebugDrawer.DebugDrawInteractionCells();
         Find.CurrentMap.debugDrawer.DebugDrawerUpdate();
         Find.CurrentMap.regionGrid.DebugDraw();
         InfestationCellFinder.DebugDraw();
         StealAIDebugDrawer.DebugDraw();
         if (DebugViewSettings.drawRiverDebug)
         {
             Find.CurrentMap.waterInfo.DebugDrawRiver();
         }
         BuildingsDamageSectionLayerUtility.DebugDraw();
     }
 }
Exemple #4
0
        public void Select(object obj, bool playSound = true, bool forceDesignatorDeselect = true)
        {
            if (obj == null)
            {
                Log.Error("Cannot select null.", false);
                return;
            }
            Thing thing = obj as Thing;

            if (thing == null && !(obj is Zone))
            {
                Log.Error("Tried to select " + obj + " which is neither a Thing nor a Zone.", false);
                return;
            }
            if (thing != null && thing.Destroyed)
            {
                Log.Error("Cannot select destroyed thing.", false);
                return;
            }
            Pawn pawn = obj as Pawn;

            if (pawn != null && pawn.IsWorldPawn())
            {
                Log.Error("Cannot select world pawns.", false);
                return;
            }
            if (forceDesignatorDeselect)
            {
                Find.DesignatorManager.Deselect();
            }
            if (this.SelectedZone != null && !(obj is Zone))
            {
                this.ClearSelection();
            }
            if (obj is Zone && this.SelectedZone == null)
            {
                this.ClearSelection();
            }
            Map map = (thing == null) ? ((Zone)obj).Map : thing.Map;

            for (int i = this.selected.Count - 1; i >= 0; i--)
            {
                Thing thing2 = this.selected[i] as Thing;
                Map   map2   = (thing2 == null) ? ((Zone)this.selected[i]).Map : thing2.Map;
                if (map2 != map)
                {
                    this.Deselect(this.selected[i]);
                }
            }
            if (this.selected.Count >= 80)
            {
                return;
            }
            if (!this.IsSelected(obj))
            {
                if (map != Find.CurrentMap)
                {
                    Current.Game.CurrentMap = map;
                    SoundDefOf.MapSelected.PlayOneShotOnCamera(null);
                    IntVec3 cell = (thing == null) ? ((Zone)obj).Cells[0] : thing.Position;
                    Find.CameraDriver.JumpToCurrentMapLoc(cell);
                }
                if (playSound)
                {
                    this.PlaySelectionSoundFor(obj);
                }
                this.selected.Add(obj);
                SelectionDrawer.Notify_Selected(obj);
            }
        }
Exemple #5
0
 public void ClearSelection()
 {
     SelectionDrawer.Clear();
     this.selected.Clear();
 }
Exemple #6
0
        public void Select(object obj, bool playSound = true, bool forceDesignatorDeselect = true)
        {
            if (obj == null)
            {
                Log.Error("Cannot select null.");
                return;
            }
            Thing thing = obj as Thing;

            if (thing == null && !(obj is Zone))
            {
                Log.Error("Tried to select " + obj + " which is neither a Thing nor a Zone.");
                return;
            }
            if (thing != null && thing.Destroyed)
            {
                Log.Error("Cannot select destroyed thing.");
                return;
            }
            Pawn pawn = obj as Pawn;

            if (pawn != null && pawn.IsWorldPawn())
            {
                Log.Error("Cannot select world pawns.");
                return;
            }
            if (forceDesignatorDeselect)
            {
                Find.DesignatorManager.Deselect();
            }
            if (SelectedZone != null && !(obj is Zone))
            {
                ClearSelection();
            }
            if (obj is Zone && SelectedZone == null)
            {
                ClearSelection();
            }
            Map map = (thing != null) ? thing.Map : ((Zone)obj).Map;

            for (int num = selected.Count - 1; num >= 0; num--)
            {
                Thing thing2 = selected[num] as Thing;
                if (((thing2 != null) ? thing2.Map : ((Zone)selected[num]).Map) != map)
                {
                    Deselect(selected[num]);
                }
            }
            if (selected.Count < 200 && !IsSelected(obj))
            {
                if (map != Find.CurrentMap)
                {
                    Current.Game.CurrentMap = map;
                    SoundDefOf.MapSelected.PlayOneShotOnCamera();
                    IntVec3 cell = thing?.Position ?? ((Zone)obj).Cells[0];
                    Find.CameraDriver.JumpToCurrentMapLoc(cell);
                }
                if (playSound)
                {
                    PlaySelectionSoundFor(obj);
                }
                selected.Add(obj);
                SelectionDrawer.Notify_Selected(obj);
            }
        }
Exemple #7
0
 public void ClearSelection()
 {
     SelectionDrawer.Clear();
     selected.Clear();
     shelved.Clear();
 }