Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5 Fix for reordering #16

Open
wants to merge 6 commits into
base: 1.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Assemblies/AreaUnlocker.dll
Binary file not shown.
5 changes: 4 additions & 1 deletion Source/AreaUnlocker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4034-beta" />
<PackageReference Include="Lib.Harmony" Version="2.3.1.1" ExcludeAssets="runtime" />
<ProjectReference Include="..\..\..\TOOLS\ColourPicker\ColourPicker.csproj" />
<Reference Include="ColourPicker">
<HintPath>..\Assemblies\0ColourPicker.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>
31 changes: 0 additions & 31 deletions Source/AreaUnlocker.sln

This file was deleted.

7 changes: 7 additions & 0 deletions Source/HarmonyPatch_AreaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@ private static bool Prefix(ref bool __result) {
return false;
}
}

[HarmonyPatch(typeof(AreaManager), "SortAreas")]
public static class AreaManager_Disable_SortAreas {
private static bool Prefix() {
return false;
}
}
}
20 changes: 11 additions & 9 deletions Source/HarmonyPatch_Dialog_ManageAreas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class HarmonyPatch_Dialog_ManageAreas {
private static float height = 100f;
private static Vector2 scrollposition = Vector2.zero;

private static int reorderableGroup = -1;

[System.Obsolete]
public static bool Prefix(Rect inRect, Map ___map) {
Rect outRect = new Rect( inRect.xMin, inRect.yMin, inRect.width, inRect.height - 100 );
Expand All @@ -26,15 +28,15 @@ public static bool Prefix(Rect inRect, Map ___map) {

Listing_Standard areaList = new Listing_Standard {ColumnWidth = viewRect.width};

// TODO: the interface for NewGroup changed, and simply using the viewRect for the new rect
// argument doesn't seem to work. No errors though, so for now it's just not draggable.
int reorderableGroup = ReorderableWidget.NewGroup( ( from, to ) =>
{
from = Index( from, ___map );
to = Index( to, ___map );
___map.areaManager.AllAreas.Insert( to, ___map.areaManager.AllAreas[from] );
___map.areaManager.AllAreas.RemoveAt( from >= to ? from + 1 : from );
}, ReorderableDirection.Vertical, viewRect );
if (Event.current.type == EventType.Repaint) {
reorderableGroup = ReorderableWidget.NewGroup( ( from, to ) =>
{
from = Index( from, ___map );
to = Index( to, ___map );
___map.areaManager.AllAreas.Insert( to, ___map.areaManager.AllAreas[from] );
___map.areaManager.AllAreas.RemoveAt( from >= to ? from + 1 : from );
}, ReorderableDirection.Vertical, viewRect );
}

Widgets.BeginScrollView(outRect, ref scrollposition, viewRect);
areaList.Begin(viewRect);
Expand Down