diff --git a/Assemblies/ResearchTree.dll b/Assemblies/ResearchTree.dll index a2ad167..0f30a32 100644 Binary files a/Assemblies/ResearchTree.dll and b/Assemblies/ResearchTree.dll differ diff --git a/Languages/English/Keyed/KeyedTranslations.xml b/Languages/English/Keyed/KeyedTranslations.xml index 604d468..da548fb 100644 --- a/Languages/English/Keyed/KeyedTranslations.xml +++ b/Languages/English/Keyed/KeyedTranslations.xml @@ -10,15 +10,21 @@ Unlock {0} Other prerequisites: {0} - Left-Click to replace queue - Left-Click to remove from queue - Shift-Left-Click to append to queue - Alt-Left-Click to prepend to queue - (DEBUG) Ctrl-Left-Click to instantly complete + Left-click to replace queue. + Left-click to remove from queue. + Shift + Left-click to append to queue. + Alt + Left-click to prepend to queue. + (DEBUG) Ctrl + Left-click to instantly complete. + Right-click for continuous highlight. + Right-click item icon (or dots icon) to show detail information. + Drag to interact with research queue. + Press shift to display shortcut manual. + Tech Level: Requires Leads to none + Because your faction tech level is too low ({0}), research cost is multiplied by {1} (from {2}). Already queued node Missing {0} @@ -64,6 +70,7 @@ Fix an old bug of the original ResearchPal that ignores hidden prereqisites. You should always turn this option on for a more balanced gameplay. Being able to turning off this option is for existing save game strategy compatibility. (restart the game to apply) Research settings changed, restart RimWorld to apply the change. + Disable Shortcut Manual Scrolling Speed Multiplier Control horizontal and vertical scrolling speed of the main research tree diff --git a/Source/Graph/ResearchNode.cs b/Source/Graph/ResearchNode.cs index d861f5c..2145e86 100644 --- a/Source/Graph/ResearchNode.cs +++ b/Source/Graph/ResearchNode.cs @@ -337,10 +337,16 @@ private void HandleTooltips() { return; } Text.WordWrap = true; + + + if (!Settings.disableShortcutManual) { + TooltipHandler.TipRegion(Rect, ShortcutManualTooltip, Research.GetHashCode() + 2); + } // attach description and further info to a tooltip if (!TechprintAvailable()) { TooltipHandler.TipRegion(Rect, - ResourceBank.String.MissingTechprints(Research.TechprintsApplied, Research.techprintCount)); + "InsufficientTechprintsApplied".Translate(Research.TechprintsApplied, Research.TechprintCount)); + // ResourceBank.String.MissingTechprints(Research.TechprintsApplied, Research.techprintCount)); } if ( !BuildingPresent() ) { TooltipHandler.TipRegion( Rect, @@ -355,13 +361,50 @@ private void HandleTooltips() { TooltipHandler.TipRegion(Rect, prompt); } } - TooltipHandler.TipRegion(Rect, GetResearchTooltipString, Research.GetHashCode()); + if (Research.techLevel > Faction.OfPlayer.def.techLevel) { + TooltipHandler.TipRegion( + Rect, TechLevelTooLowTooltip, Research.GetHashCode() + 3); + } + TooltipHandler.TipRegion( + Rect, GetResearchTooltipString, Research.GetHashCode()); if (Settings.progressTooltip && ProgressWorthDisplaying() && !Research.IsFinished) { TooltipHandler.TipRegion(Rect, string.Format("Progress: {0}", ProgressString())); } } + private string ShortcutManualTooltip() { + if (Event.current.shift) { + StringBuilder builder = new StringBuilder(); + if (PainterIs(Painter.Queue)) { + builder.AppendLine(ResourceBank.String.LClickRemoveFromQueue); + } else { + if (Available()) { + builder.AppendLine(ResourceBank.String.LClickReplaceQueue); + builder.AppendLine(ResourceBank.String.SLClickAddToQueue); + builder.AppendLine(ResourceBank.String.ALClickAddToQueue); + } + if (DebugSettings.godMode) { + builder.AppendLine(ResourceBank.String.CLClickDebugInstant); + } + } + if (Available()) { + builder.AppendLine(ResourceBank.String.Drag); + } + builder.AppendLine(ResourceBank.String.RClickHighlight); + builder.AppendLine(ResourceBank.String.RClickIcon); + return builder.ToString(); + } else { + return ResourceBank.String.ShiftForShortcutManual; + } + } + + private string TechLevelTooLowTooltip() { + var techlevel = Faction.OfPlayer.def.techLevel; + return ResourceBank.String.TechLevelTooLow( + techlevel, Research.CostFactor(techlevel), (int) Research.baseCost); + } + private IEnumerable OtherLockedPrerequisites( IEnumerable ps) { if (ps == null) { @@ -375,7 +418,7 @@ private string OtherPrereqTooltip(List ps) { return ""; } return ResourceBank.String.OtherPrerequisites( - String.Join(", ", ps.Distinct().Select (p => p.LabelCap))); + String.Join(", ", ps.Distinct().Select(p => p.LabelCap))); } private string UnlockItemTooltip(Def def) { @@ -799,13 +842,8 @@ private string GetResearchTooltipString() var text = new StringBuilder(); text.AppendLine(Research.description); text.AppendLine(); - - text.AppendLine(ResourceBank.String.SLClickAddToQueue); - text.AppendLine(ResourceBank.String.ALClickAddToQueue); - - if (DebugSettings.godMode) { - text.AppendLine(ResourceBank.String.CLClickDebugInstant); - } + text.Append(ResourceBank.String.TechLevelOfResearch + + Research.techLevel.ToStringHuman().CapitalizeFirst()); return text.ToString(); } diff --git a/Source/ResourceBank.cs b/Source/ResourceBank.cs index d37b50d..373128b 100644 --- a/Source/ResourceBank.cs +++ b/Source/ResourceBank.cs @@ -1,4 +1,5 @@ using Verse; +using RimWorld; namespace ResearchPal { @@ -9,7 +10,7 @@ public static class String const string PREFIX = "ResearchPal."; static string TL(string s) => (PREFIX + s).Translate(); - static string TL(string s, params object[] args) => (PREFIX + s).Translate(args); + static string TL(string s, params NamedArgument[] args) => (PREFIX + s).Translate(args); #region Settings public static readonly string ShowNotificationPopup = TL("ShowNotificationPopup"); @@ -54,6 +55,8 @@ public static class String public static readonly string ShowIndexOnQueue = TL("ShowQueueIndexOnQueue"); public static readonly string ShowIndexOnQueueTip = TL("ShowQueueIndexOnQueueTip"); + public static readonly string DisableShortcutManual = TL("DisableShortcutManual"); + public static readonly string DontIgnoreHiddenPrerequisites = TL("DontIgnoreHiddenPrerequisites"); public static readonly string DontIgnoreHiddenPrerequisitesTip = TL("DontIgnoreHiddenPrerequisitesTip"); public static readonly string DebugResearch = TL("DebugResearch"); @@ -81,9 +84,22 @@ public static class String public static readonly string ALClickAddToQueue = TL("ALClickAddToQueue"); public static readonly string CLClickDebugInstant = TL("CLClickDebugInstant"); + public static readonly string RClickHighlight = TL("RightClickNode"); + public static readonly string RClickIcon = TL("RightClickIcon"); + public static readonly string Drag = TL("Drag"); + + public static readonly string ShiftForShortcutManual = TL("ShortcutManual"); + public static string MissingFacilities(string list) => TL("MissingFacilities", list); - public static string MissingTechprints(int techprintsApplied, int techprintCount) => TL("MissingTechprints", techprintsApplied, techprintCount); + // public static string MissingTechprints(int techprintsApplied, int techprintCount) => TL("MissingTechprints", techprintsApplied, techprintCount); public static string FinishedResearch(string label) => TL("ResearchFinished", label); + + public static readonly string TechLevelOfResearch = TL("TechLevel"); + + public static string TechLevelTooLow( + TechLevel techlevel, float multiplier, int baseCost) { + return TL("TechLevelTooLow", techlevel.ToStringHuman(), multiplier, baseCost); + } #endregion #region MainTabWindow_ResearchTree diff --git a/Source/Settings.cs b/Source/Settings.cs index b9448b0..7321883 100644 --- a/Source/Settings.cs +++ b/Source/Settings.cs @@ -34,6 +34,8 @@ public class Settings : ModSettings public static bool showIndexOnQueue = false; + public static bool disableShortcutManual = false; + public static float scrollingSpeedMultiplier = 1f; public static float zoomingSpeedMultiplier = 1f; public static float draggingDisplayDelay = 0.25f; @@ -112,6 +114,7 @@ public static void DoSettingsWindowContents(Rect windowRect) listLeft.CheckboxLabeled(ProgressTooltip, ref progressTooltip, ProgressTooltipTip); listLeft.CheckboxLabeled(AlwaysDisplayProgress, ref alwaysDisplayProgress, AlwaysDisplayProgressTip); listLeft.CheckboxLabeled(ShowIndexOnQueue, ref showIndexOnQueue, ShowIndexOnQueueTip); + listLeft.CheckboxLabeled(DisableShortcutManual, ref disableShortcutManual); listLeft.Gap(); @@ -167,6 +170,7 @@ public override void ExposeData() Scribe_Values.Look(ref progressTooltip, "ProgressTooltip", false); Scribe_Values.Look(ref alwaysDisplayProgress, "AlwaysDisplayProgress", false); Scribe_Values.Look(ref showIndexOnQueue, "ShowQueuePositionOnQueue", false); + Scribe_Values.Look(ref disableShortcutManual, "DisableShortcutManual", false); Scribe_Values.Look(ref dontIgnoreHiddenPrerequisites, "dontIgnoreHiddenPrerequisites", true); Scribe_Values.Look(ref scrollingSpeedMultiplier, "ScrollingSpeedMultiplier", 1); Scribe_Values.Look(ref zoomingSpeedMultiplier, "zoomingSpeedMultiplier", 1);