static void Postfix(ref GameOptionsMenu __instance) { var countOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <NumberOption>()[1], __instance.transform); countOption.transform.localPosition = new Vector3(countOption.transform.localPosition.x, -8.35f, countOption.transform.localPosition.z); countOption.Title = sheriffCountTitle; countOption.Value = sheriffCount; var str = ""; TranslationController_GetString.Prefix(countOption.Title, ref str); countOption.TitleText.Text = str; countOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged); countOption.gameObject.AddComponent <OptionBehaviour>(); var toggleOption = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <ToggleOption>()[1], __instance.transform); toggleOption.transform.localPosition = new Vector3(toggleOption.transform.localPosition.x, -8.85f, toggleOption.transform.localPosition.z); toggleOption.Title = killTargetTitle; toggleOption.CheckMark.enabled = doKillSheriffsTarget; var str2 = ""; TranslationController_GetString.Prefix(toggleOption.Title, ref str2); toggleOption.TitleText.Text = str2; toggleOption.OnValueChanged = new Action <OptionBehaviour>(OnValueChanged); toggleOption.gameObject.AddComponent <OptionBehaviour>(); __instance.GetComponentInParent <Scroller>().YBounds.max += 0.3f; }
public static void Postfix(GameOptionsMenu __instance) { foreach (var customNoOption in AllCustomNumberOptions) { try { Scroller componentInParent = __instance.GetComponentInParent <Scroller>(); componentInParent.YBounds = new FloatRange(componentInParent.YBounds.min, 20f); float num = -8.5f; float num2 = -0.5f; NumberOption option = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <NumberOption>().First(), __instance.transform); // Instantiate new option option.transform.localPosition = new Vector3(option.transform.localPosition.x, num + num2 * customNoOption.IndexId, option.transform.localPosition.z); // Update position option.Title = (StringNames)customNoOption.StringNameId; // Set custom string name id option.TitleText.Text = customNoOption.TitleText; // Set the title text option.Value = customNoOption.Value; // Set the current value option.gameObject.AddComponent <NumberOption>(); option.ValidRange = customNoOption.FloatRange; customNoOption.GameNumberOption = option; } catch { } } foreach (var customToggleOption in AllCustomToggleOptions) { try { Scroller componentInParent = __instance.GetComponentInParent <Scroller>(); componentInParent.YBounds = new FloatRange(componentInParent.YBounds.min, 20f); float num = -8.5f; float num2 = -0.5f; ToggleOption option = UnityEngine.Object.Instantiate(__instance.GetComponentsInChildren <ToggleOption>().First(), __instance.transform); // Instantiate new option option.transform.localPosition = new Vector3(option.transform.localPosition.x, num + num2 * customToggleOption.IndexId, option.transform.localPosition.z); // Update position option.Title = (StringNames)customToggleOption.StringNameId; // Set custom string name id option.TitleText.Text = customToggleOption.TitleText; // Set the title text option.CheckMark.enabled = customToggleOption.Value; // Set the current value option.gameObject.AddComponent <NumberOption>(); customToggleOption.GameToggleOption = option; } catch { } } }
static void Postfix(ref GameOptionsMenu __instance) { __instance.GetComponentsInChildren <NumberOption>() .First(o => o.Title == StringNames.GameNumImpostors) .ValidRange = new FloatRange(1, (int)(CreateGameOptionsPatches.CreateOptionsPicker_Start.maxPlayers - 0.5f) / 2); }