Skip to content

Commit

Permalink
Fixed minor UI/Window bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
skizzix3 authored and FluffierThanThou committed Jul 27, 2021
1 parent bc1dc1a commit ff78394
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
30 changes: 15 additions & 15 deletions Source/Helpers/Mining/Dialog_MiningDebugOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,91 +23,91 @@ protected override void DoListingItems()
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Mineable>() )
Messages.Message( job.IsValidMiningTarget( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false );


DebugToolMap( "IsValidDeconstructionTarget", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsValidDeconstructionTarget( thing ).ToString(),
MessageTypeDefOf.SilentInput );
} );
}, false );

DebugToolMap( "Faction", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( thing.Faction.ToStringSafe(), MessageTypeDefOf.SilentInput );
} );
}, false );

DebugToolMap( "AllowedBuilding", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.AllowedBuilding( thing.def ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);


DebugToolMap( "AllowedMineral", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Mineable>() )
Messages.Message( job.AllowedMineral( thing.def ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);


DebugToolMap( "IsRelevantDeconstructionTarget", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsRelevantDeconstructionTarget( thing ).ToString(),
MessageTypeDefOf.SilentInput );
} );
}, false);

DebugToolMap( "IsRelevantMiningTarget", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Mineable>() )
Messages.Message( job.IsRelevantMiningTarget( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);

DebugToolMap( "IsInAllowedArea", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsInAllowedArea( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);

DebugToolMap( "IsReachable", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsReachable( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);

DebugToolMap( "IsRoomDivider", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsARoomDivider( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);

DebugToolMap( "IsRoofSupport: basic", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsARoofSupport_Basic( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false); ;

DebugToolMap( "IsRoofSupport: advanced", delegate
{
foreach ( var thing in Find.CurrentMap.thingGrid.ThingsAt( UI.MouseCell() ).OfType<Building>() )
Messages.Message( job.IsARoofSupport_Advanced( thing ).ToString(), MessageTypeDefOf.SilentInput );
} );
}, false);

DebugAction( "DrawSupportGrid", delegate
{
foreach ( var cell in job.manager.map.AllCells )
if ( job.IsARoofSupport_Basic( cell ) )
job.manager.map.debugDrawer.FlashCell( cell, DebugSolidColorMats.MaterialOf( Color.green ) );
} );
}, false);

DebugAction( "GetBaseCenter", delegate
{
var cell = Utilities.GetBaseCenter( job.manager );
job.manager.map.debugDrawer.FlashCell( cell, DebugSolidColorMats.MaterialOf( Color.blue ) );
} );
}, false);

DebugToolMap( "DrawPath", delegate
{
Expand All @@ -118,7 +118,7 @@ protected override void DoListingItems()
TraverseMode.PassDoors, Danger.Some ) );
path.DrawPath( null );
path.ReleaseToPool();
}
}, false
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Helpers/UI/UIThingFilterSearchable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void DoThingFilterConfigWindow( Rect canvas, ref Vector2 scrollPosition,

// main listing
var listingRect = new Rect( 0f, curY, viewRect.width, 9999f );
var listingTreeThingFilter = new Listing_TreeThingFilter( filter, parentFilter, null, null, null );
var listingTreeThingFilter = new Listing_TreeThingFilter( filter, parentFilter, null, null, null, new RimWorld.QuickSearchFilter() );
listingTreeThingFilter.Begin( listingRect );
var node = ThingCategoryNodeDatabase.RootNode;
if ( parentFilter != null )
Expand All @@ -91,7 +91,7 @@ public void DoThingFilterConfigWindow( Rect canvas, ref Vector2 scrollPosition,
}

// draw the actual thing
listingTreeThingFilter.DoCategoryChildren( node, 0, openMask, Find.CurrentMap, true );
listingTreeThingFilter.ListCategoryChildren(node, openMask, Find.CurrentMap, new Rect(0f, curY+2f, viewRect.width-2f, 9999f));//DoCategoryChildren( node, 0, openMask, Find.CurrentMap, true );
listingTreeThingFilter.End();

// update height.
Expand Down
2 changes: 1 addition & 1 deletion Source/ManagerJobs/ManagerJob_Mining.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public bool IsARoomDivider( Thing target )
.ToArray();

// check if there are more than two rooms in the surrounding cells.
var rooms = adjacent.Select( c => c.GetRoom( manager.map, RegionType.Normal ) )
var rooms = adjacent.Select( c => c.GetRoom( manager.map) )
.Where( r => r != null )
.Distinct()
.ToList();
Expand Down
6 changes: 3 additions & 3 deletions Source/Triggers/Trigger_Threshold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ public override void DrawTriggerConfig( ref Vector2 cur, float width, float entr
{
var option = string.Empty;
Action onClick = () => Find.WindowStack.TryRemove( typeof( MainTabWindow_Manager ), false );
Action onHover = null;
Action<UnityEngine.Rect> onHover = null;
if ( designation.target.HasThing )
{
var thing = designation.target.Thing;
option = designationLabelGetter?.Invoke( designation ) ?? thing.LabelCap;
onClick += () => CameraJumper.TryJumpAndSelect( thing );
onHover += () => CameraJumper.TryJump( thing );
onHover += (c) => CameraJumper.TryJump( thing );
}
else
{
Expand All @@ -271,7 +271,7 @@ public override void DrawTriggerConfig( ref Vector2 cur, float width, float entr
// so I suppose it doesn't matter -- Fluffy.
option = designationLabelGetter?.Invoke( designation ) ?? cell.GetTerrain( map ).LabelCap;
onClick += () => CameraJumper.TryJump( cell, map );
onHover += () => CameraJumper.TryJump( cell, map );
onHover += (c) => CameraJumper.TryJump( cell, map );
}

options.Add( new FloatMenuOption( option, onClick, MenuOptionPriority.Default, onHover ) );
Expand Down
1 change: 1 addition & 0 deletions Source/Windows/Window_TriggerThresholdDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using UnityEngine;
using Verse;
using RimWorld;

namespace FluffyManager
{
Expand Down

0 comments on commit ff78394

Please sign in to comment.