Skip to content

Commit 7c6d553

Browse files
Fixed inconsistency in finding necessary components and GOs
1 parent edbc166 commit 7c6d553

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

InscryptionAPI/Rulebook/RuleBookRedirectManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public void ClearActiveInteractables()
5050
createdInteractableObjects.RemoveAll(x => x == null);
5151
createdInteractableObjects.ForEach(x => x.SetActive(false));
5252
}
53-
public void UpdateActiveInteractables(TextMeshPro description, Dictionary<string, RuleBookManager.RedirectInfo> redirects)
53+
public void UpdateActiveInteractables(TextMeshPro description, GameObject currentPageObj, Dictionary<string, RuleBookManager.RedirectInfo> redirects)
5454
{
55-
InscryptionAPIPlugin.Logger.LogDebug("[UpdateActiveInteractables]");
55+
InscryptionAPIPlugin.Logger.LogDebug($"[UpdateActiveInteractables]");
5656
Bounds pageBounds;
57-
Bounds borderBounds = description.transform.parent.parent.Find("Border").GetComponent<SpriteRenderer>().bounds; // in world space
57+
Bounds borderBounds = currentPageObj.transform.Find("Border").GetComponent<SpriteRenderer>().bounds; // in world space
5858
Vector3 pageBottomLeft;
5959
float zLength;
60-
60+
6161
if (SaveManager.SaveFile.IsPart3)
6262
{
6363
pageBounds = currentTopPage.GetComponent<MeshRenderer>().bounds; // in world space

InscryptionAPI/Rulebook/RulebookRedirectPatches.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,8 @@ private static IEnumerator ResetTrueTopIndex(IEnumerator enumerator, int pageInd
5353
yield return enumerator;
5454
rulebookShowFlipIndex = -1;
5555
}
56-
public static int rulebookShowFlipIndex = -1;
5756

58-
/*[HarmonyPostfix, HarmonyPatch(typeof(RulebookPageFlipper), nameof(RulebookPageFlipper.RandomRotationAdjustment))]
59-
private static void RetrieveRandomRotation(Transform page)
60-
{
61-
if (page == RuleBookRedirectManager.Instance.currentTopPage.parent)
62-
{
63-
RuleBookRedirectManager.Instance.currentPageRotation = page.localEulerAngles.y;
64-
}
65-
}*/
57+
public static int rulebookShowFlipIndex = -1;
6658

6759
[HarmonyPrefix, HarmonyPatch(typeof(RulebookPageFlipper), nameof(RulebookPageFlipper.RenderPages))]
6860
private static bool RetrieveRuleBookTopPage(Transform topPage)
@@ -105,12 +97,12 @@ private static void AddInteractablesToTopPage(PageFlipper __instance, PageConten
10597
else if (component is ItemPage item)
10698
descriptionMesh = item.descriptionTextMesh;
10799
else
108-
descriptionMesh = loader.currentPageObj.GetComponentInChildren<TextMeshPro>();
100+
descriptionMesh = loader.currentPageObj.transform.Find("Description").GetComponent<TextMeshPro>();
109101

110102
if (descriptionMesh != null)
111103
{
112104
descriptionMesh.ForceMeshUpdate();
113-
RuleBookRedirectManager.Instance.UpdateActiveInteractables(descriptionMesh, fullInfo.RulebookDescriptionRedirects);
105+
RuleBookRedirectManager.Instance.UpdateActiveInteractables(descriptionMesh, loader.currentPageObj, fullInfo.RulebookDescriptionRedirects);
114106
}
115107
RuleBookRedirectManager.Instance.currentActivePageIndex = __instance.currentPageIndex;
116108
}

0 commit comments

Comments
 (0)