Skip to content

Fix settings#10

Open
FangkuaiYa wants to merge 1 commit intougackMiner53:masterfrom
FangkuaiYa:master
Open

Fix settings#10
FangkuaiYa wants to merge 1 commit intougackMiner53:masterfrom
FangkuaiYa:master

Conversation

@FangkuaiYa
Copy link
Copy Markdown

Fix: Duplicate settings injection and view pane scroll truncation

Summary

This PR fixes two bugs in the Prop Hunt settings system:

  1. Duplicate settings on room re-entry — Every time a player entered a room, GameManagerCreatorPatch would unconditionally append a new Prop Hunt RulesCategory to HideAndSeekManagerPrefab.gameSettingsList.AllCategories. Because gameSettingsList is a ScriptableObject (reference type), it is shared across Instantiate calls and accumulates duplicate entries across scene reloads.

  2. Prop Hunt category cut off in the view-only settings pane — The lobby "View" settings pane (LobbyViewSettingsPane) was not scrollable far enough to reveal the Prop Hunt category. DrawNormalTab computes the scroll bound via CalculateAndSetYBounds, which treats all entries at a uniform 0.85f spacing — it does not account for the taller category headers (1.05f each). This meant the scroll range was consistently undersized by the height of the injected category.

Changes

PropHunt/Settings/PropHuntSettings.cs

  • Added a static bool settingsInjected guard flag to GameManagerCreatorPatch. The category is now injected exactly once per process lifetime, regardless of how many times the scene reloads or the player re-enters a room.

  • Added a [HarmonyPostfix] on LobbyViewSettingsPane.ChangeTab that extends the scrollbar's ContentYBounds.max by the exact pixel height of the Prop Hunt category after DrawNormalTab finishes:

    header (1.05f) + 1 item-row (0.85f) + trailing gap (0.85f) = 2.75f
    

    SetYBoundsMax is used instead of re-calling CalculateAndSetYBounds to preserve the base game's own calculation and only append the missing height.

Testing

Verified in a local lobby (Hide & Seek mode) that:

  • The Prop Hunt and Miss Penalty options appear exactly once in the edit settings menu after repeated room joins.
  • The view-only settings pane scrolls fully to reveal both the Prop Hunt checkbox and the Miss Penalty slider.

@superidol1890
Copy link
Copy Markdown
Contributor

This is actually a great fix! @ugackMiner53 , pls review this. (idk how I didn't notice this pull request till now lol)

@FangkuaiYa
Copy link
Copy Markdown
Author

@ugackMiner53

@ugackMiner53 ugackMiner53 self-assigned this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants