internal override void AddSettings(ModSettingsBase modSettings) { base.AddSettings(modSettings); tabSettings.Add(modSettings); menuGroup.NotifyChildAdded(modSettings.IsVisible()); modSettings.AddVisibilityListener((visible) => { menuGroup.NotifyChildVisible(visible); }); }
private void SetVisibilityListener(ModSettingsBase modSettings, FieldInfo field, GameObject guiObject, Header header) { bool startVisible = modSettings.IsFieldVisible(field); if (guiObject.activeSelf != startVisible) { guiObject.SetActive(startVisible); } header?.NotifyChildAdded(startVisible); modSettings.AddVisibilityListener(field, (visible) => { guiObject.SetActive(visible); header?.NotifyChildVisible(visible); uiGrid.repositionNow = true; }); }