public static void InitializeMenu() { if (!initialized) { initialized = true; RGBLightsEnabled = ModPrefs.GetBool("ChromaLite", "RGBLights", true); SpecialEventsEnabled = ModPrefs.GetBool("ChromaLite", "SpecialEvents", false); } GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.PlayerSettingsRight, "ChromaLite", "MainMenu", "CLite", "ChromaLite events options"); ToggleOption rgbLightsToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "RGB Lights", "CLite", "Enable/Disable RGB lighting events."); rgbLightsToggle.GetValue = RGBLightsEnabled; rgbLightsToggle.OnToggle += delegate(bool value) { RGBLightsEnabled = value; ModPrefs.SetBool("ChromaLite", "RGBLights", value); }; rgbLightsToggle.AddConflict("Darth Maul"); ToggleOption specialEventsToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Special Events", "CLite", "Enable/Disable Special Events, such as note size changing, player heal/harm events, and rotation events."); specialEventsToggle.GetValue = SpecialEventsEnabled; specialEventsToggle.OnToggle += delegate(bool value) { SpecialEventsEnabled = value; ModPrefs.SetBool("ChromaLite", "SpecialEvents", value); }; specialEventsToggle.AddConflict("Darth Maul"); }
public ContinentSelectorOptions(IAppSettings settings, ICountryCollection collection, ContinentSelectorFlags flags) { IgnoreBorderExlusion = (flags & ContinentSelectorFlags.IgnoreBorderExlusion) != 0; _counts = new IDictionary<Continent, int>[] { GetCountryCount(collection, IgnoreBorderExlusion, (flags & ContinentSelectorFlags.LimitByNeighbors) != 0, (flags & ContinentSelectorFlags.LimitByContinent) != 0, false), GetCountryCount(collection, IgnoreBorderExlusion, (flags & ContinentSelectorFlags.LimitByNeighbors) != 0, (flags & ContinentSelectorFlags.LimitByContinent) != 0, true) }; var continent = new ChoiceOption<Continent>("continent", "Continent", Enum .GetValues(typeof(Continent)) .Cast<Continent>(); var maritime = new ToggleOption("maritime", "Use Maritime Borders", false, (flags & ContinentSelectorFlags.MaritimeBorders) != 0, p => RefreshValues()); _optionsList.AddOption(continent); _optionsList.AddOption(maritime); if ((flags & ContinentSelectorFlags.RangeLimits) != 0) { var limit = _counts[0][Continent.Unspecified]; var min = new RangedOption<int>("min", "Countries (min)", 1, 1, limit, p => RefreshValues()); var max = new RangedOption<int>("max", "Countries (max)", limit, 1, limit, p => RefreshValues()); min.Depandancies = new List<IOption> { continent, maritime, max }; max.Depandancies = new List<IOption> { continent, maritime, min }; _optionsList.AddOption(min); _optionsList.AddOption(max); _hasRange = true; } }
/// <summary> /// Adds a toggle option to the in-game "Gameplay Setup" window. It can be found in the left panel of the Player Settings /// </summary> public static void CreateGameplaySetupMenu() { hmdToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsLeft, Plugin.PluginName, disclaimer, optionIcon, 0); hmdToggle.GetValue = Plugin.IsHMDOn; hmdToggle.OnToggle += ((bool value) => { Plugin.IsHMDOn = value; Logger.log.Debug($"Toggle is very '{(value ? "toggled" : "untoggled")}! Value is now '{value}'"); }); }
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { if (scene.name == "MenuCore") { Gamemode.Init(); ToggleOption enableToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersRight, "No Fail+", "Activates No Fail in party mode with no effect on score", null, 0); enableToggle.GetValue = config.Value.Enable; enableToggle.OnToggle += (bool enabled) => { config.Value.Enable = enabled; }; } }
public static bool Prefix(ToggleOption __instance) { if (__instance.TitleText.text == "Both Lovers Die") { CustomGameOptions.BothLoversDie = !CustomGameOptions.BothLoversDie; PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions); __instance.LCDAKOCANPH = CustomGameOptions.BothLoversDie; __instance.CheckMark.enabled = CustomGameOptions.BothLoversDie; return(false); } return(true); }
public static void Postfix(ref ToggleOption __instance) { foreach (CustomBoolOption custom in boolOpts) { if (__instance.Title == custom.boolOptionTitle) { if (AmongUsClient.Instance.AmHost) { Rpc <SendOpt> .Instance.Send((false, 0f, custom.value, custom.optTitleInt)); } } } }
static bool Prefix(ref ToggleOption __instance) { foreach (var opt in options) { if (__instance.Title == opt.optionTitleName) { opt.OnEnable(ref __instance, GameOptionsMenu_Start.OnValueChanged); return(false); } } return(true); }
public static bool Prefix(ToggleOption __instance) { if (__instance.TitleText.Text == "Show Sheriff") { CustomGameOptions.showSheriff = !CustomGameOptions.showSheriff; PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions); __instance.IOFLMCGMJBA = CustomGameOptions.showSheriff; __instance.CheckMark.enabled = CustomGameOptions.showSheriff; return(false); } return(true); }
public CheckboxBooleanQuestionInputView(BooleanQuestion question, SurveyPageAppearance appearance) : base(appearance) { var option = new ToggleOption (); option.HorizontalOptions = LayoutOptions.FillAndExpand; option.VerticalOptions = LayoutOptions.CenterAndExpand; option.UnselectedSource = appearance.UnselectedCheckboxImageSource; option.SelectedSource = appearance.SelectedCheckboxImageSource; option.BindingContext = question; option.SetBinding (Option.TextProperty, new Binding ("Text", BindingMode.OneWay)); option.SetBinding (Option.IsSelectedProperty, new Binding ("Response", BindingMode.TwoWay)); Content = option; }
public static bool Prefix(ToggleOption __instance) { if (__instance.TitleText.Text == "Jester Role") { Jester.jesterEnabled = !Jester.jesterEnabled; PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions); __instance.oldValue = Jester.jesterEnabled; __instance.CheckMark.enabled = Jester.jesterEnabled; return(false); } return(true); }
public static bool Prefix(ToggleOption __instance) { CustomOption option = Options.FirstOrDefault(option => option.GameSetting == __instance); // Works but may need to change to gameObject.name check if (option is CustomToggleOption toggle) { toggle.Toggle(); //EssentialsPlugin.Logger.LogInfo($"Option \"{toggle.Name}\" was {toggle.GetOldValue()} now {toggle.GetValue()}"); return(false); } return(true); }
public static bool Prefix(ToggleOption __instance) { var option = Options.FirstOrDefault(option => option.GameSetting == __instance); // Works but may need to change to gameObject.name check if (option is CustomToggleOption toggle) { toggle.Toggle(); return(false); } return(true); }
static bool Prefix(ref ToggleOption __instance) { foreach (CustomBoolOption custom in boolOpts) { if (__instance.Title == custom.boolOptionTitle) { string str = ""; customTranslationController.Prefix(__instance.Title, ref str); __instance.TitleText.text = str; __instance.CheckMark.enabled = custom.defValue; __instance.OnValueChanged = new Action <OptionBehaviour>(optionsMenuStartPatch.OnValueChanged); __instance.enabled = true; return(false); } } return(true); }
void OnMenuLoaded() { if (_gamemodeToggle != null) { _gamemodeToggle.OnToggle -= OnGamemodeToggled; } _gamemodeToggle = GameplaySettingsUI.CreateToggleOption( GameplaySettingsPanels.ModifiersLeft, "Claws Mode", hintText: "Shortens saber hitboxes to 0.3m, and adjusts grip.", optionIcon: Plugin.IconSprite ); _gamemodeToggle.GetValue = Plugin.IsEnabled; _gamemodeToggle.OnToggle += OnGamemodeToggled; UpdateCapability(); }
public static void AddOptions() { if (GameOptionsMenuPatch.showJesterOption == null) { ToggleOption showAnonymousVotes = GameObject.FindObjectsOfType <ToggleOption>().ToList().Where(x => x.TitleText.Text == "Anonymous Votes").First(); GameOptionsMenuPatch.showJesterOption = GameObject.Instantiate(showAnonymousVotes); OptionBehaviour[] options = new OptionBehaviour[GameOptionsMenuPatch.instance.Children.Count + 1]; GameOptionsMenuPatch.instance.Children.ToArray().CopyTo(options, 0); options[options.Length - 1] = GameOptionsMenuPatch.showJesterOption; GameOptionsMenuPatch.instance.Children = new Il2CppReferenceArray <OptionBehaviour>(options); } else { GameOptionsMenuPatch.showJesterOption.gameObject.SetActive(true); } GameOptionsMenuPatch.showJesterOption.TitleText.Text = "Jester Role"; GameOptionsMenuPatch.showJesterOption.oldValue = Jester.jesterEnabled; GameOptionsMenuPatch.showJesterOption.CheckMark.enabled = Jester.jesterEnabled; }
public static void Postfix(ref GameOptionsMenu __instance) { float lowestY = __instance.GetComponentsInChildren <OptionBehaviour>().Min(o => o.transform.position.y) - 0.2f; ToggleOption togglePrefab = __instance.Children.Where(o => o.TryCast <ToggleOption>() != null).First(o => o.Title != StringNames.GameRecommendedSettings).Cast <ToggleOption>(); // GameRecommendedSettings has a specific design NumberOption numberPrefab = __instance.GetComponentInChildren <NumberOption>(); StringOption stringPrefab = __instance.GetComponentInChildren <StringOption>(); byte optionsAdded = 0; foreach (var baseOption in OptionsManager.LimitOptions.Values .Concat(OptionsManager.CustomOptions.SelectMany(p => p.Value)) ) { var option = Object.Instantiate <OptionBehaviour>( baseOption switch { CustomToggleOption => togglePrefab, CustomNumberOption => numberPrefab, CustomStringOption => stringPrefab, _ => throw new InvalidCastException($"{nameof(baseOption)} was unknown type") },
public void toggle(ToggleOption option) { if (!minigame_started) { return; } switch (option) { case ToggleOption.AMPLITUDE: current_amp = (current_amp + 1) % amp_presets.Length; break; case ToggleOption.FREQUENCY: current_freq = (current_freq + 1) % freq_presets.Length; break; case ToggleOption.X_SPEED: current_x_speed = (current_x_speed + 1) % x_speed_presets.Length; break; case ToggleOption.Y_SPEED: current_y_speed = (current_y_speed + 1) % y_speed_presets.Length; break; default: break; } if (current_amp == amp_target && current_freq == freq_target && current_x_speed == x_speed_target && current_y_speed == y_speed_target) { FinishMinigame(); } }
public async Task Setup() { thisWindow = this.gameObject; // Populate our dictionary of option names -> gameobjects for (int i = 0; i < dropdownArray.Length; ++i) { Dropdown dropdown = dropdownArray[i]; ListOption script = dropdown.GetComponent <ListOption>(); if (!script) { throw new System.Exception("Option dropdown does not have a ListOption script attached!"); } objectDictionary.Add(script.GetName(), dropdown.gameObject); } for (int i = 0; i < toggleArray.Length; ++i) { Toggle toggle = toggleArray[i]; ToggleOption script = toggle.GetComponent <ToggleOption>(); if (!script) { throw new System.Exception("Option toggle does not have a ToggleOption script attached!"); } objectDictionary.Add(script.GetName(), toggle.gameObject); } // See note below await DisplaySelectedOptionsEvent(); toggleArray = null; dropdownArray = null; }
private static List <OptionBehaviour> GetGameOptions(float lowestY) { List <OptionBehaviour> options = new List <OptionBehaviour>(); /*EssentialsPlugin.Logger.LogInfo($"toggles {Object.FindObjectsOfType<ToggleOption>().Count}"); * EssentialsPlugin.Logger.LogInfo($"numbers {Object.FindObjectsOfType<NumberOption>().Count}"); * EssentialsPlugin.Logger.LogInfo($"strings {Object.FindObjectsOfType<StringOption>().Count}"); * EssentialsPlugin.Logger.LogInfo($"keyvalues {Object.FindObjectsOfType<KeyValueOption>().Count}");*/ ToggleOption toggleOption = Object.FindObjectsOfType <ToggleOption>().FirstOrDefault(); NumberOption numberOption = Object.FindObjectsOfType <NumberOption>().FirstOrDefault(); StringOption stringOption = Object.FindObjectsOfType <StringOption>().FirstOrDefault(); //KeyValueOption kvOption = Object.FindObjectsOfType<KeyValueOption>().FirstOrDefault(); int i = 0; foreach (CustomOption option in Options) { if (option.GameSetting != null) { option.GameSetting.gameObject.SetActive(option.MenuVisible); options.Add(option.GameSetting); continue; } if (option.Type == CustomOptionType.Toggle && AmongUsClient.Instance?.AmHost == true) { if (toggleOption == null) { continue; } ToggleOption toggle = Object.Instantiate(toggleOption, toggleOption.transform.parent);//.DontDestroy(); if (!option.OnGameOptionCreated(toggle)) { toggle.Destroy(); continue; } options.Add(toggle); if (Debug) { EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created"); } } else if (option.Type == CustomOptionType.Number) { if (numberOption == null) { continue; } NumberOption number = Object.Instantiate(numberOption, numberOption.transform.parent);//.DontDestroy(); if (!option.OnGameOptionCreated(number)) { number.Destroy(); continue; } options.Add(number); if (Debug) { EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created"); } } else if (option.Type == CustomOptionType.String || option.Type == CustomOptionType.Toggle && AmongUsClient.Instance?.AmHost != true) { //if (option is IKeyValueOption) //{ // //if (kvOption == null) continue; // Transform parent = kvOption?.transform?.parent ?? toggleOption?.transform?.parent ?? numberOption?.transform?.parent ?? stringOption?.transform?.parent; // if (parent == null) continue; // KeyValueOption kv = kvOption == null ? new KeyValueOption().DontDestroy() : Object.Instantiate(kvOption); // if (kv == null) continue; // kv.transform.SetParent(/*kvOption.transform.*/parent); // option.OnGameOptionCreated(kv); // options.Add(kv); // if (Debug)EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created"); //} if (stringOption == null) { continue; } StringOption str = Object.Instantiate(stringOption, stringOption.transform.parent);//.DontDestroy(); if (!option.OnGameOptionCreated(str)) { str.Destroy(); continue; } options.Add(str); if (Debug) { EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created"); } } if (!option.GameSetting) { continue; } if (option.MenuVisible) { option.GameSetting.transform.localPosition = new Vector3(option.GameSetting.transform.localPosition.x, lowestY - ++i * 0.5F, option.GameSetting.transform.localPosition.z); } option.GameSetting.gameObject.SetActive(option.MenuVisible); } return(options); }
public virtual void OnEnable(ref ToggleOption __instance, Action <OptionBehaviour> callback) { }
public override void OnEnable(ref ToggleOption __instance, Action <OptionBehaviour> callback) { __instance.TitleText.Text = optionTitle; __instance.OnValueChanged = new Action <OptionBehaviour>(callback); __instance.enabled = value; }
private static void GameplaySettingsUISetup() { /* * MODIFIERS */ Sprite sprite = Base64Sprites.Base64ToSprite("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA3WAAAN1gGQb3mcAAAAB3RJTUUH4wINFyAWrJdsNwAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAAKSSURBVEhL3dbLq05RHMbxEzEhuQ0OBi4DDDAxcSlDE1ISCgMGDAgTt8iACRMlyW0kKSZMKIRcBsQAfwGRiUK5RLm9vs9u/XbrXefZ+30z9KvP6V3Puuxz9nv2Wnug0+n8q4d4UGR9s2GffuBnkfXNhn36fy68Cd+xIcuc9/hQZCWtobU2Zlmlq5GswR/8QtvF5ySuTzRXa2it1SmrdTUyOxAX1y9S9o9FXFify/61iItqrbK/9TuOi99I7WFYj8f4jSh9foR10BiNvYXGi4oNMwswCRNwD1Gf8CTR56i70FjN0Vy3ZsWGhdF4AdUr6PsagegfCX0d6lM9xyjkawxhw8JZqLTgRLgxor74BU/BjanZMDMDela/YVrK2mi8Hh/NmZ4yy4aZPVCdget3zkG1C66/oh/jsRN7k92I5/MyVCvRNbHFKqguQe250Jqxvq41Th0HUFacOneqVqezCLFwLxqr0ly1dYqVtV8d+tc/jKPJEcSjcBWq5YiFe1kB1RWovRBaM9Y/hMFyUukgVMfh+p0TUOlOuv6KDTOzoR1Im8SUlLXRmM/QbjYzZZYNCxehuo984yipL3a3C3BjajYsaAt8CdVJuDESt1hjNceNqdkwo1sdJ9EXqNxppdNI9RXzoDmzUI6r2TCJ8/RaautkUr3GcMQ43eK3UMX5fR2t57kNkR/im1Mmz6BagsiWKqCeIrIt0NzGiw8JoGe26RCP7VC7UuxEel5V5SOXv0wsS1mtq5Fsgx4Hd4gfQ1NpEyrHaw2ttTXLKl2NzBiTyVTorz5fOI1BuDl2rSFBD/vQVNvh5lg2bLEYep+6XbiJ+XBzLBv2oBeCN/iYaMPQQePGNrJhD3rL0It81DtMhhvboDPwF6eIOFNA61CjAAAAAElFTkSuQmCC"); ToggleOption lightshowModifier = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersLeft, "Lightshow Only", hintText: "Disables all notes and sabers, allowing you to view the lightshow!", optionIcon: sprite); lightshowModifier.GetValue = ChromaConfig.LightshowModifier; lightshowModifier.OnToggle += LightshowToggled; /* * COLOURS */ GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.PlayerSettingsRight, "Chroma Colours", "MainMenu", "CTC", "Choose your Colour Scheme and more!"); ToggleOption technicolourToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Technicolour", "CTC", "Enable/Disable Technicolour. See Technicolour options below."); technicolourToggle.GetValue = ChromaConfig.TechnicolourEnabled; technicolourToggle.OnToggle += TechnicolourToggled; technicolourToggle.AddConflict("RNG PLights"); /* * EVENTS */ GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.PlayerSettingsRight, "Chroma Events", "MainMenu", "CTE", "Toggle RGB lighting and special events"); ToggleOption rgbLightsToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "RGB Lights", "CTE", "Enable/Disable RGB lighting events."); rgbLightsToggle.GetValue = ChromaConfig.CustomColourEventsEnabled; rgbLightsToggle.OnToggle += RGBEventsToggled; rgbLightsToggle.AddConflict("Darth Maul"); ToggleOption specialEventsToggle = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Special Events", "CTE", "Enable/Disable Special Events, such as note size changing, player heal/harm events, and rotation events."); specialEventsToggle.GetValue = ChromaConfig.CustomSpecialEventsEnabled; specialEventsToggle.OnToggle += SpecialEventsToggled; specialEventsToggle.AddConflict("Darth Maul"); GameplaySettingsUI.CreateSubmenuOption(GameplaySettingsPanels.PlayerSettingsRight, "Techni. Options", "CTC", "CTT", "Adjust Technicolour Settings."); List <Tuple <float, string> > technicolourOptions = new List <Tuple <float, string> > { { 0f, "OFF" }, { 1f, "WARM/COLD" }, { 2f, "EITHER" }, { 3f, "TRUE RANDOM" } }; //float[] techniOptions = new float[technicolourOptions.Count]; //for (int i = 0; i < technicolourOptions.Count; i++) techniOptions[i] = i; MultiSelectOption techniLights = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Tech. Lights", "CTT", "Technicolour style of the lights."); for (int i = 0; i < technicolourOptions.Count; i++) { techniLights.AddOption(i, technicolourOptions[i].Item2); } techniLights.GetValue += delegate { return((int)ChromaConfig.TechnicolourLightsStyle); }; techniLights.OnChange += delegate(float value) { ColourManager.TechnicolourStyle style = ColourManager.GetTechnicolourStyleFromFloat(value); ChromaConfig.TechnicolourLightsStyle = style; }; MultiSelectOption techniLightsGrouping = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Lights Grouping", "CTT", ChromaConfig.WaiverRead ? "The more isolated, the more intense. Isolated Event has the best performance.\n <color=red>Mayhem prevents fades and flashes from working properly</color>." : "Isolated Event for better performance, but more chaotic lighting"); techniLightsGrouping.AddOption(0f, "Standard"); techniLightsGrouping.AddOption(1f, "Isolated Event"); if (ChromaConfig.WaiverRead) { techniLightsGrouping.AddOption(2f, "Isolated (Mayhem)"); } techniLightsGrouping.GetValue += delegate { return((int)ChromaConfig.TechnicolourLightsGrouping); }; techniLightsGrouping.OnChange += delegate(float value) { ChromaConfig.TechnicolourLightsGrouping = ColourManager.GetTechnicolourLightsGroupingFromFloat(value); }; MultiSelectOption techniFrequency = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Lights Freq", "CTT", "The higher the frequency, the more colour changes. 10% is default."); for (int i = 1; i <= 20; i++) { techniFrequency.AddOption(0.05f * i, i == 2 ? "10% (Def)" : (5f * i) + "%"); } techniFrequency.GetValue += delegate { return(ChromaConfig.TechnicolourLightsFrequency); }; techniFrequency.OnChange += delegate(float value) { ChromaConfig.TechnicolourLightsFrequency = value; }; /*ToggleOption techniIndividualLights = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Isolated Lights", "CTT", "If enabled, Technicolour will only affect one light source at a time. This results in much, much more colour variety being possible, but also can look excessively chaotic."); * techniIndividualLights.GetValue = ChromaConfig.TechnicolourLightsIndividual; * techniIndividualLights.OnToggle += delegate (bool value) { * ChromaConfig.TechnicolourLightsIndividual = value; * };*/ /*MultiSelectOption techniBarriers = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Tech. Walls", "CTT", "Technicolour style of the walls/barriers."); * for (int i = 0; i < technicolourOptions.Count; i++) techniBarriers.AddOption(i, technicolourOptions[i].Item2); * techniBarriers.GetValue += delegate { * return (int)ChromaConfig.TechnicolourWallsStyle; * }; * techniBarriers.OnChange += delegate (float value) { * ColourManager.TechnicolourStyle style = ColourManager.GetTechnicolourStyleFromFloat(value); * ChromaConfig.TechnicolourWallsStyle = style; * };*/ //Walls don't need to have other options since they only work nicely with Either ToggleOption techniWalls = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Tech. Barriers", "CTT", "If enabled, Barriers will rainbowify!"); techniWalls.GetValue = ChromaConfig.TechnicolourWallsStyle == ColourManager.TechnicolourStyle.ANY_PALETTE; techniWalls.OnToggle += delegate(bool value) { ChromaConfig.TechnicolourWallsStyle = value ? ColourManager.TechnicolourStyle.ANY_PALETTE : ColourManager.TechnicolourStyle.OFF; }; MultiSelectOption techniBlocks = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Tech. Blocks", "CTT", "Technicolour style of the blocks."); for (int i = 0; i < technicolourOptions.Count; i++) { techniBlocks.AddOption(i, technicolourOptions[i].Item2); } techniBlocks.GetValue += delegate { return((int)ChromaConfig.TechnicolourBlocksStyle); }; techniBlocks.OnChange += delegate(float value) { ColourManager.TechnicolourStyle style = ColourManager.GetTechnicolourStyleFromFloat(value); ChromaConfig.TechnicolourBlocksStyle = style; }; MultiSelectOption techniSsabers = GameplaySettingsUI.CreateListOption(GameplaySettingsPanels.PlayerSettingsRight, "Tech. Sabers", "CTT", "Technicolour style of the sabers."); for (int i = 0; i < technicolourOptions.Count; i++) { techniSsabers.AddOption(i, technicolourOptions[i].Item2); } techniSsabers.GetValue += delegate { return((int)ChromaConfig.TechnicolourSabersStyle); }; techniSsabers.OnChange += delegate(float value) { ColourManager.TechnicolourStyle style = ColourManager.GetTechnicolourStyleFromFloat(value); ChromaConfig.TechnicolourSabersStyle = style; }; ToggleOption techniSabersMismatch = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.PlayerSettingsRight, "Desync Sabers", "CTT", "If true, technicolour sabers will have their \"time\" start and progress differently, resulting in their colours not matching so often."); techniSabersMismatch.GetValue = !ChromaConfig.MatchTechnicolourSabers; techniSabersMismatch.OnToggle += TechnicolourSaberMismatchToggled; GameplaySubMenuCreatedEvent?.Invoke("CTC"); GameplaySubMenuCreatedEvent?.Invoke("CTE"); GameplaySubMenuCreatedEvent?.Invoke("CTT"); ExtensionGameplayMenusEvent?.Invoke(); }
public EmProperty <bool> GetBoolProperty(ToggleOption option) { return((EmProperty <bool>) this[option.Id]); }
private void ToggleWorkBrowseButton(ToggleOption pOptionToImplement) { if (pOptionToImplement == ToggleOption.Browse) { btnWorkBrowse.Text = "Browse"; btnWorkBrowse.Image = global::SalesConsultant.Properties.Resources.browse; } else if (pOptionToImplement == ToggleOption.Work) { btnWorkBrowse.Text = "Work"; btnWorkBrowse.Image = global::SalesConsultant.Properties.Resources.work; } }
internal void AddToSubmenu() { option = GameplaySettingsUI.CreateToggleOption(GameplaySettingsPanels.ModifiersLeft, Name, Submenu, "", Sprite, 0); option.GetValue = Enabled; option.OnToggle += (value) => { Enabled = value; }; }
private static bool Prefix(ToggleOption __instance) { return(OnEnable(__instance)); }
public static bool Prefix(ToggleOption __instance) { var option = CustomOption.AllOptions.FirstOrDefault(option => option.Setting == __instance); // Works but may need to change to gameObject.name check if (option is CustomToggleOption toggle) { toggle.Toggle(); return(false); } if (__instance == ExportButton.Setting) { if (!AmongUsClient.Instance.AmHost) { return(false); } ExportButton.Do(); return(false); } if (__instance == ImportButton.Setting) { if (!AmongUsClient.Instance.AmHost) { return(false); } ImportButton.Do(); return(false); } if (option is CustomHeaderOption) { return(false); } CustomOption option2 = ExportButton.SlotButtons.FirstOrDefault(option => option.Setting == __instance); if (option2 is CustomButtonOption button) { if (!AmongUsClient.Instance.AmHost) { return(false); } button.Do(); return(false); } CustomOption option3 = ImportButton.SlotButtons.FirstOrDefault(option => option.Setting == __instance); if (option3 is CustomButtonOption button2) { if (!AmongUsClient.Instance.AmHost) { return(false); } button2.Do(); return(false); } return(true); }