forked from fluffy-mods/WorkTab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update FavouriteManager.cs Fluffy.WorkTab.NoStoredFavourites was not translated * Default priority (+ tip) setting now transletable Update Keyed-English.xml * Fix horizontal scroll area fixes fluffy-mods#157, fluffy-mods#159 and fluffy-mods#164 The scroll area was using cachedSize for its output rectangle capping it at the screen width. As the "Work"-tab window is not as wide as the screen, ouput rectangle was too wide when there were many work types. To fix this the PawnTable was extended with the property methods void set_OutRect(this PawnTable, Rect) and Rect get_OutRect() 'fake adding' a new property that can be used to set and get the "Work"-tab window dimension instead of relying on the screen size. MainTabWindow_WorkTab.DoWindowContents calls set_OutRect with the window dimension PawnTable_PawnTableOnGUI.PawnTableOnGUI calls get_OutRect to clamp the output rectangle properly I think ideally PawnTable.PawnTableOnGUI's parameter would be Rect window instead of Vector2 position in the future. * Respect "Disable Scrollwheel" on Checkbox WorkTypes * Replace Job Icon Column with Job Text Column * Make Mod Setting for Job Text Column (Icon vs Text) * Localize Mod Setting for Job Text Column * Add Option to Highlight Current Active Work Cell * Fix: Priorities reset after save-load. PriorityManager class was relying on Scribe methods in ExposeData() for clearing out old priorities data. But ExposeData() is not called when a new game is started or a game is loaded which was saved without the mod active. So, new data was added to the old one. If a non-modded save was loaded twice, pawn priorities lists were doubled, with the latest list being active. When the game was subsequently saved and loaded, all data was saved, but only the oldest copy of priorities was restored. Other copies yielded an error: Exception in LookDictionary(label=Priorities): System.InvalidOperationException: Tried to add different values for the same key. Attempts to load priorities data of non-existent pawns, inherited from other games, resulted in a probably harmless error: Could not resolve reference to object with loadID Thing_Human# Now, all static members of PriorityManager are initialized by constructor. * Removed unused project DynamicPawnTable. * Fix warning: DrawUtilities probably needs a StaticConstructorOnStartup attribute Fix warning in the game's log: Type DrawUtilities probably needs a StaticConstructorOnStartup attribute, because it has a field activeHighlightBox of type Texture2D. All assets must be loaded in the main thread. * Fix: Naming rule violation. * Fix: active job frame is too bright. * Fix wording in tooltips: increase/increment/decrease/decrement priorities => raise/lower * Enable HighlightCurrentJobCell by default. Also, change names and labels for being consistent: ActiveWorkCells => CurrentJobCell. Minor clean-up. * Fix: Numeric settings are reset after restarting the game. * Fix the last fix: Numeric settings are hard to edit. --------- Co-authored-by: angelolocritani <67960642+angelolocritani@users.noreply.github.com> Co-authored-by: Sineme <sineme@users.noreply.github.com> Co-authored-by: maarxx <chris.lewark@gmail.com> Co-authored-by: Doomster14 <146005125+Doomster14@users.noreply.github.com>
- Loading branch information
1 parent
80a0feb
commit 0e2955a
Showing
16 changed files
with
171 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using RimWorld; | ||
using RimWorld.BaseGen; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace WorkTab.Extensions { | ||
internal static class PawnTable_Extensions { | ||
private static ConditionalWeakTable<PawnTable, StrongBox<Rect>> outRectDictionary=new ConditionalWeakTable<PawnTable, StrongBox<Rect>>(); | ||
/// <summary> | ||
/// Sets the rectangle the <see cref="PawnTable"/> is drawn in. | ||
/// </summary> | ||
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param> | ||
/// <param name="outRect">The rectangle the <see cref="PawnTable"/> will be drawn in.</param> | ||
internal static void set_OutRect(this PawnTable pawnTable, Rect outRect) { | ||
var value = outRectDictionary.GetValue( | ||
pawnTable, | ||
a => new StrongBox<Rect>(outRect) | ||
); | ||
value.Value = outRect; | ||
} | ||
/// <summary> | ||
/// Gets the rectangle the <see cref="PawnTable"/> will be drawn in. | ||
/// </summary> | ||
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param> | ||
/// <returns>The rectangle the <see cref="PawnTable"/> will be drawn in.</returns> | ||
internal static Rect get_OutRect(this PawnTable pawnTable) { | ||
return outRectDictionary.GetOrCreateValue(pawnTable).Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright Karel Kroeze, 2020-2021. | ||
// WorkTab/WorkTab/PawnColumnWorker_WorkTabLabel.cs | ||
|
||
using RimWorld; | ||
using Verse; | ||
using static WorkTab.Constants; | ||
|
||
namespace WorkTab { | ||
public class PawnColumnWorker_JobText : PawnColumnWorker_Text { | ||
public override int GetMinWidth(PawnTable table) | ||
{ | ||
return JobTextWidth; | ||
} | ||
private string GetJobString(Pawn pawn) | ||
{ | ||
return pawn.jobs?.curDriver?.GetReport() ?? ""; | ||
} | ||
protected override string GetTextFor(Pawn pawn) { | ||
return GetJobString(pawn); | ||
} | ||
protected override string GetTip(Pawn pawn) { | ||
return GetJobString(pawn); | ||
} | ||
public string GetValueToCompare(Pawn pawn) | ||
{ | ||
return GetJobString(pawn); | ||
} | ||
public override int Compare(Pawn a, Pawn b) | ||
{ | ||
return GetValueToCompare(a).CompareTo(GetValueToCompare(b)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.