-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support hiding a part tooltip's Extended Info tab if the part tooltip…
… is of a PartUpgrade not a part.
- Loading branch information
1 parent
b7e0a6b
commit cbf3858
Showing
3 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using HarmonyLib; | ||
using KSP.UI.Screens.Editor; | ||
using System; | ||
using System.Collections.Generic; | ||
using TMPro; | ||
using UnityEngine; | ||
|
||
namespace KSPCommunityFixes | ||
{ | ||
public class HidePartUpgradeExtendedInfo : BasePatch | ||
{ | ||
protected override Version VersionMin => new Version(1, 8, 0); | ||
|
||
protected override void ApplyPatches(ref List<PatchInfo> patches) | ||
{ | ||
patches.Add(new PatchInfo( | ||
PatchMethodType.Prefix, | ||
AccessTools.Method(typeof(PartListTooltip), "DisplayExtendedInfo"), | ||
this)); | ||
} | ||
|
||
static bool PartListTooltip_DisplayExtendedInfo_Prefix(PartListTooltip __instance) | ||
{ | ||
if (__instance.upgrade != null && __instance.HasExtendedInfo) | ||
{ | ||
__instance.panelExtended.SetActive(false); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |