public DynamicOption(OptionCategory category, string name, OptionType expectedType, bool isRequired, IEnumerable<object> permittedValues) { Name = name; ExpectedType = expectedType; IsRequired = isRequired; PermittedValues = permittedValues; }
public ActionResult Delete(int[] ids) { if (ids == null || !ids.Any()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = new OptionCategoriesDeleteViewModel(); model.OptionsCategories = new List <OptionCategoryDeleteViewModel>(); foreach (int id in ids) { OptionCategory optionCategory = optionCategoryService.Find(id); if (optionCategory == null) { continue; } model.OptionsCategories.Add(new OptionCategoryDeleteViewModel { Id = optionCategory.Id, Name = optionCategory.Name, }); } return(View(model)); }
public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection) { return(IdProviderCreator.Create(() => { var contourView = Mission.Current.GetMissionBehaviour <CommandSystemLogic>().FormationColorSubLogic; var optionClass = new OptionClass(CommandSystemSubModule.ModuleId, GameTexts.FindText("str_rts_camera_command_system_option_class"), menuClassCollection); var commandOptionCategory = new OptionCategory("Command", GameTexts.FindText("str_rts_camera_command_system_command_system_options")); commandOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_command_system_click_to_select_formation"), GameTexts.FindText("str_rts_camera_command_system_click_to_select_formation_hint"), () => CommandSystemConfig.Get().ClickToSelectFormation, b => { CommandSystemConfig.Get().ClickToSelectFormation = b; contourView?.SetEnableContourForSelectedFormation(b); })); commandOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_command_system_attack_specific_formation"), GameTexts.FindText("str_rts_camera_command_system_attack_specific_formation_hint"), () => CommandSystemConfig.Get().AttackSpecificFormation, b => { CommandSystemConfig.Get().AttackSpecificFormation = b; if (b) { PatchChargeToFormation.Patch(); } })); optionClass.AddOptionCategory(0, commandOptionCategory); return optionClass; }, CommandSystemSubModule.ModuleId)); }
public DynamicOption(OptionCategory category, string name, OptionType expectedType, bool isRequired, IEnumerable <object> permittedValues) { Name = name; ExpectedType = expectedType; IsRequired = isRequired; PermittedValues = permittedValues; }
public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection) { return(IdProviderCreator.Create(() => { var optionClass = new OptionClass(ImprovedCombatAISubModule.ModuleId, GameTexts.FindText("str_improved_combat_ai_option_class"), menuClassCollection); var optionCategory = new OptionCategory("CombatAI", GameTexts.FindText("str_improved_combat_ai_ai_options")); optionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_improved_combat_ai_use_realistic_blocking"), null, () => ImprovedCombatAIConfig.Get().UseRealisticBlocking, b => ImprovedCombatAIConfig.Get().UseRealisticBlocking = b)); optionCategory.AddOption(new NumericOptionViewModel( GameTexts.FindText("str_improved_combat_ai_melee_ai_difficulty"), null, () => ImprovedCombatAIConfig.Get().MeleeAIDifficulty, f => ImprovedCombatAIConfig.Get().MeleeAIDifficulty = (int)f, 0, 100, true, true)); optionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_improved_combat_ai_directly_set_melee_ai"), GameTexts.FindText("str_improved_combat_ai_directly_set_melee_ai_description"), () => ImprovedCombatAIConfig.Get().DirectlySetMeleeAI, b => ImprovedCombatAIConfig.Get().DirectlySetMeleeAI = b)); optionCategory.AddOption(new NumericOptionViewModel( GameTexts.FindText("str_improved_combat_ai_ranged_ai_difficulty"), null, () => ImprovedCombatAIConfig.Get().RangedAIDifficulty, f => ImprovedCombatAIConfig.Get().RangedAIDifficulty = (int)f, 0, 100, true, true)); optionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_improved_combat_ai_directly_set_ranged_ai"), GameTexts.FindText("str_improved_combat_ai_directly_set_ranged_ai_description"), () => ImprovedCombatAIConfig.Get().DirectlySetRangedAI, b => ImprovedCombatAIConfig.Get().DirectlySetRangedAI = b)); optionClass.AddOptionCategory(0, optionCategory); return optionClass; }, ImprovedCombatAISubModule.ModuleId)); }
public bool YieldDynamicOption(OptionCategory category, string name, OptionType expectedType, bool isRequired, IEnumerable <string> permittedValues) { if (CoreVersion() > 0) { return(YieldDynamicOption(category.ToString(), name, expectedType.ToString(), isRequired) && (permittedValues ?? Enumerable.Empty <string>()).All(each => YieldKeyValuePair(name, each))); } return(YieldDynamicOption((int)category, name, (int)expectedType, isRequired) && (permittedValues ?? Enumerable.Empty <string>()).All(each => YieldKeyValuePair(name, each))); }
public ActionOption(string prototype, OptionCategory category, string description, int count, Action <OptionValueCollection> action) : base(prototype, category, description, count) { if (action == null) { throw new ArgumentNullException("action"); } this.action = action; }
public OptionDescription(OptionCategory optionCatagory, int index, string shortName, string longName, string args, string desc) { m_optionCategory = optionCatagory; m_optionIndex = index; m_shortName = shortName; m_longName = longName; m_arguments = args; m_descriptionText = desc; }
internal IEnumerable <string> GetOptionValues(OptionCategory category, string name) { // get the value from the request if (CoreVersion() > 0) { return(GetOptionValues(category.ToString(), name) ?? Enumerable.Empty <string>()); } return(GetOptionValues((int)category, name) ?? Enumerable.Empty <string>()); }
public OptionDescription(OptionCategory optionCatagory, int index, string shortName, string longName, string args, string desc) { m_optionCategory = optionCatagory; m_optionIndex = index; m_shortName = shortName; m_longName = longName; m_arguments = args; m_descriptionText = desc; }
public OptionHandler(string[] aliases, Action <string> setter, OptionValueType type, OptionCategory category = OptionCategory.Generic, string description = null) { ValueType = type; Category = category; Description = description; this.aliases = aliases; this.setter = setter; WorkingAliases = aliases.Select(a => a.ToLower()); }
public bool YieldDynamicOption(OptionCategory category, string name, OptionType expectedType, bool isRequired) { if (CoreVersion() > 0) { return(YieldDynamicOption(category.ToString(), name, expectedType.ToString(), isRequired)); } // Deprecated--August Preview build uses ints. return(YieldDynamicOption((int)category, name, (int)expectedType, isRequired)); }
public OptionSet Add(string prototype, OptionCategory category, string description, OptionAction <string, string> action) { if (action == null) { throw new ArgumentNullException("action"); } Option p = new ActionOption(prototype, category, description, 2, v => action(v[0], v[1])); base.Add(p); return(this); }
/// <summary> /// Creates a new instance of <see cref="OptionDialog"/> /// </summary> public OptionDialog() { var nodePickerOptionCategory = new OptionCategory("Node Picker"); nodePickerOptionCategory.AddOption(_organizeNodesOption); OptionCategories.Add(nodePickerOptionCategory); var debuggingOptionCategory = new OptionCategory("Debugging"); debuggingOptionCategory.AddOption(_visualizeDataPropagationOption); OptionCategories.Add(debuggingOptionCategory); }
// ************* // * Functions * // ************* // Load Data public static void LoadOptionCategories(string categoryFile) { // Initialize OptionCategories if (IData.OptionCategories == null) { IData.OptionCategories = new List <OptionCategory>(); } // The raw data from the CSV file List <Dictionary <string, string> > theList = ProcessData(categoryFile); OptionCategory optionCategoryItem; // Process the list foreach (var item in theList) { int id = -1; // error check, all id's must be positive string value; // Option Category ID [int] id if (item.TryGetValue("id", out value)) { int n; if (int.TryParse(value, out n)) { id = n; } } if (id != -1) { optionCategoryItem = new OptionCategory(id); // Option Category Description [string] optioncategoriesdesc if (item.TryGetValue("optioncategoriesdesc", out value)) { optionCategoryItem.Description = value; } // each item must be unique var index = IData.OptionCategories.FindIndex(x => x.ID == optionCategoryItem.ID); if (index == -1) { IData.OptionCategories.Add(optionCategoryItem); } else { IData.OptionCategories[index] = optionCategoryItem; } } } }
public ICancellableEnumerable <DynamicOption> GetDynamicOptions(OptionCategory operation, Object requestImpl) { requestImpl = requestImpl ?? new { IsCancelled = new IsCancelled(() => false) }; var isCancelled = requestImpl.As <IsCancelled>(); DynamicOption lastItem = null; var list = new List <string>(); return(CallAndCollect <DynamicOption>( result => Provider.GetDynamicOptions(operation.ToString(), ExtendRequest(requestImpl, new { YieldDynamicOption = new YieldDynamicOption((name, type, isRequired) => { if (lastItem != null) { lastItem.PossibleValues = list.ToArray(); list = new List <string>(); result.Add(lastItem); } OptionType typ; if (Enum.TryParse(type, true, out typ)) { lastItem = new DynamicOption { Category = operation, Name = name, Type = typ, IsRequired = isRequired, ProviderName = ProviderName, }; } return !(isCancelled() || result.IsCancelled); }), YieldKeyValuePair = new YieldKeyValuePair((key, value) => { if (lastItem != null && lastItem.Name == key) { list.Add(value); } return !(isCancelled() || result.IsCancelled); }) })), collection => { if (lastItem != null) { lastItem.PossibleValues = list.ToArray(); collection.Add(lastItem); } })); }
private void CheckCategory(Option p, string f, string n) { if (currentCategory == OptionCategory.None) { currentCategory = p.Category; } else if (p.Category.HasFlag(currentCategory) || currentCategory.HasFlag(p.Category) || p.Category == OptionCategory.None) { currentCategory |= p.Category; } else { var category = currentCategory; category &= ~OptionCategory.None; throw new InvalidOperationException(string.Format("Cannot use options from different category. Current category: '{0}'. Invalid option: '{1}' from category '{2}'.", category, f + n, p.Category)); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OptionCategory optionCategory = optionCategoryService.Find(id.Value); if (optionCategory == null) { return(HttpNotFound()); } var model = Mapper.Map <OptionCategoryEditViewModel>(optionCategory); model.Options = Mapper.Map <List <OptionEditViewModel> >(optionCategory.Options); return(View(model)); }
private void CheckCategory(Option p, string f, string n) { if (currentCategory == OptionCategory.None) { currentCategory = p.Category; } else if (p.Category.HasFlag(currentCategory) || currentCategory.HasFlag(p.Category) || p.Category == OptionCategory.None) { currentCategory |= p.Category; } else { var category = currentCategory; category &= ~OptionCategory.None; OnWarning(string.Format("Cannot use options from different category. Current category: '{0}'. Invalid option: '{1}' from category '{2}'. Using option from different category might cause unpredictable actions.", category, f + n, p.Category)); } }
protected Option(string prototype, OptionCategory category, string description, int maxValueCount) { if (prototype == null) { throw new ArgumentNullException("prototype"); } if (prototype.Length == 0) { throw new ArgumentException("Cannot be the empty string.", "prototype"); } if (maxValueCount < 0) { throw new ArgumentOutOfRangeException("maxValueCount"); } this.prototype = prototype; this.category = category; this.names = prototype.Split('|'); this.description = description; this.count = maxValueCount; this.type = ParsePrototype(); if (this.count == 0 && type != OptionValueType.None) { throw new ArgumentException( "Cannot provide maxValueCount of 0 for OptionValueType.Required or " + "OptionValueType.Optional.", "maxValueCount"); } if (this.type == OptionValueType.None && maxValueCount > 1) { throw new ArgumentException( string.Format("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), "maxValueCount"); } if (Array.IndexOf(names, "<>") >= 0 && ((names.Length == 1 && this.type != OptionValueType.None) || (names.Length > 1 && this.MaxValueCount > 1))) { throw new ArgumentException( "The default option handler '<>' cannot require values.", "prototype"); } }
public void ConfigureUserOptions(IUserOptionsService userOptionsService, UserRoles userRoles) { OptionCategory defaultCategory = new OptionCategory(OptionCategoryIds.General, () => "General"); /* Add options to the following collection and they will be * automatically displayed on the options page. * Each UserOption object must have a unique key. * Lambda expression are used for most of the properties * to allow your app to switch languages without requiring a restart. * You can specify a template for the option by setting its TemplateFunc property. * See the UserOptionBase implementations. */ var generalOptions = new List <IUserOption> { new StringUserOption(() => "String 1", String1Key, () => string1DefaultValue), new BooleanUserOption(() => "Boolean 1", Boolean1Key, () => boolean1DefaultValue) }; userOptionsService.Register(generalOptions, defaultCategory); }
private static void EnsureAllOptions() { if (_allFormattingOptions.Count == 0) { foreach (CodeFormattingCategory curCat in Enum.GetValues(typeof(CodeFormattingCategory))) { if (curCat == CodeFormattingCategory.None) { continue; } var cat = OptionCategory.GetOptions(curCat); foreach (var optionInfo in cat) { _allFormattingOptions[optionInfo.Key] = optionInfo; } } } }
public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection) { return(IdProviderCreator.Create(() => { var optionClass = new OptionClass(CinematicCameraSubModule.ModuleId, GameTexts.FindText("str_cinematic_camera_cinematic_camera"), menuClassCollection); var cameraOptionCategory = new OptionCategory("Camera", GameTexts.FindText("str_cinematic_camera_cinematic_camera")); cameraOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_cinematic_camera_open_menu"), null, () => { Mission.Current.GetMissionBehaviour <CinematicCameraMenuView>()?.ActivateMenu(); })); optionClass.AddOptionCategory(0, cameraOptionCategory); return optionClass; }, CinematicCameraSubModule.ModuleId)); }
/// <summary> /// Gets a new CodeFormattinOptions object configured to the users current settings. /// </summary> public CodeFormattingOptions GetCodeFormattingOptions() { if (_optionsFactory == null) { // create a factory which can create CodeFormattingOptions without tons of reflection var initializers = new Dictionary <OptionInfo, Action <CodeFormattingOptions, object> >(); foreach (CodeFormattingCategory curCat in Enum.GetValues(typeof(CodeFormattingCategory))) { if (curCat == CodeFormattingCategory.None) { continue; } var cat = OptionCategory.GetOptions(curCat); foreach (var option in cat) { var propInfo = typeof(CodeFormattingOptions).GetProperty(option.Key); if (propInfo.PropertyType == typeof(bool)) { initializers[option] = MakeFastSetter <bool>(propInfo); } else if (propInfo.PropertyType == typeof(bool?)) { initializers[option] = MakeFastSetter <bool?>(propInfo); } else if (propInfo.PropertyType == typeof(int)) { initializers[option] = MakeFastSetter <int>(propInfo); } else { throw new InvalidOperationException(String.Format("Unsupported formatting option type: {0}", propInfo.PropertyType.FullName)); } } } _optionsFactory = CreateOptionsFactory(initializers); } return(_optionsFactory()); }
public static IPropertyState <T> RegisterOption <T>(OptionCategory category, string name, T defaultValue) { if (!Enum.IsDefined(typeof(OptionCategory), category)) { throw new ArgumentException("Invalid category."); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("Option registration is empty.", "name"); } if (name.IndexOfAny(new[] { '.', '\\', ' ', ':' }) > 0) { throw new ArgumentException("Option registration contains invalid characters.", "name"); } string categoryName = Enum.GetName(typeof(OptionCategory), category); string optionName = String.Format("{0}.{1}", categoryName, name); IPropertyState <T> state = null; var propertyName = PropertyManager.CreatePropertyName(optionName); if (c_registeredProperties.ContainsKey(propertyName)) { state = c_registeredProperties[propertyName] as IPropertyState <T>; if (state == null) { throw new Exception("Duplicate option registration with a different type for {0}."); } WriteLine("Duplicate option registration: ", propertyName); } else { state = PropertyManager.Create(propertyName, defaultValue); c_registeredProperties.Add(propertyName, state); c_registeredPropertiesList.Add(state); } return(state); }
private IEnumerable <string> GetValues(OptionCategory category, string name) { // get the value from the request return(GetOptionValues((int)category, name) ?? Enumerable.Empty <string>()); }
public DynamicOption(OptionCategory category,string name, OptionType expectedType, bool isRequired) : this(category, name , expectedType, isRequired, null) { }
private static bool HasCategory(PropertyInfo propertyInfo) => OptionCategory.GetOption(propertyInfo.Name) != null;
protected CmdletWithSource(OptionCategory[] categories) : base(categories) { }
public static IIdProvider <AOptionClass> CreateOptionClassProvider(IMenuClassCollection menuClassCollection) { return(IdProviderCreator.Create(() => { var optionClass = new OptionClass(RTSCameraSubModule.ModuleId, GameTexts.FindText("str_rts_camera_option_class"), menuClassCollection); var rtsCameraLogic = Mission.Current.GetMissionBehaviour <RTSCameraLogic>(); var selectCharacterView = Mission.Current.GetMissionBehaviour <RTSCameraSelectCharacterView>(); var hideHudView = Mission.Current.GetMissionBehaviour <HideHUDView>(); var missionScreen = selectCharacterView.MissionScreen; var menuManager = AMenuManager.Get(); var cameraOptionCategory = new OptionCategory("Camera", GameTexts.FindText("str_rts_camera_camera_options")); cameraOptionCategory.AddOption(new ActionOptionViewModel( GameTexts.FindText("str_rts_camera_switch_free_camera"), GameTexts.FindText("str_rts_camera_switch_free_camera_hint"), () => { rtsCameraLogic.SwitchFreeCameraLogic.SwitchCamera(); menuManager.RequestToCloseMenu(); })); cameraOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_use_free_camera_by_default"), GameTexts.FindText("str_rts_camera_use_free_camera_by_default_hint"), () => RTSCameraConfig.Get().UseFreeCameraByDefault, b => RTSCameraConfig.Get().UseFreeCameraByDefault = b)); cameraOptionCategory.AddOption(new NumericOptionViewModel( GameTexts.FindText("str_rts_camera_raised_height_after_switching_to_free_camera"), GameTexts.FindText("str_rts_camera_raised_height_hint"), () => { return RTSCameraConfig.Get().RaisedHeight; }, f => { RTSCameraConfig.Get().RaisedHeight = f; }, 0, 50, true, true)); cameraOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_constant_speed"), GameTexts.FindText("str_rts_camera_constant_speed_hint"), () => RTSCameraConfig.Get().ConstantSpeed, b => { RTSCameraConfig.Get().ConstantSpeed = b; var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>(); if (view != null) { view.ConstantSpeed = b; } })); cameraOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_ignore_terrain"), GameTexts.FindText("str_rts_camera_ignore_terrain_hint"), () => RTSCameraConfig.Get().IgnoreTerrain, b => { RTSCameraConfig.Get().IgnoreTerrain = b; var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>(); if (view != null) { view.IgnoreTerrain = b; } })); cameraOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_ignore_boundaries"), GameTexts.FindText("str_rts_camera_ignore_boundaries_hint"), () => RTSCameraConfig.Get().IgnoreBoundaries, b => { RTSCameraConfig.Get().IgnoreBoundaries = b; var view = Mission.Current.GetMissionBehaviour <FlyCameraMissionView>(); if (view != null) { view.IgnoreBoundaries = b; } })); optionClass.AddOptionCategory(0, cameraOptionCategory); var controlOptionCategory = new OptionCategory("Control", GameTexts.FindText("str_rts_camera_control_options")); controlOptionCategory.AddOption(new SelectionOptionViewModel( GameTexts.FindText("str_rts_camera_player_formation"), GameTexts.FindText("str_rts_camera_player_formation_hint"), new SelectionOptionData( i => { var config = RTSCameraConfig.Get(); if ((i != config.PlayerFormation || config.AlwaysSetPlayerFormation) && i >= 0 && i < (int)FormationClass.NumberOfAllFormations) { config.PlayerFormation = i; rtsCameraLogic.SwitchFreeCameraLogic.CurrentPlayerFormation = (FormationClass)i; if (WatchBattleBehavior.WatchMode) { return; } Utility.SetPlayerFormation((FormationClass)i); } }, () => RTSCameraConfig.Get().PlayerFormation, (int)FormationClass.NumberOfRegularFormations, new[] { new SelectionItem(true, "str_troop_group_name", "0"), new SelectionItem(true, "str_troop_group_name", "1"), new SelectionItem(true, "str_troop_group_name", "2"), new SelectionItem(true, "str_troop_group_name", "3"), new SelectionItem(true, "str_troop_group_name", "4"), new SelectionItem(true, "str_troop_group_name", "5"), new SelectionItem(true, "str_troop_group_name", "6"), new SelectionItem(true, "str_troop_group_name", "7") }), true)); controlOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_always_set_player_formation"), GameTexts.FindText("str_rts_camera_always_set_player_formation_hint"), () => RTSCameraConfig.Get().AlwaysSetPlayerFormation, b => { var config = RTSCameraConfig.Get(); config.AlwaysSetPlayerFormation = b; if (config.AlwaysSetPlayerFormation) { var formationClass = (FormationClass)config.PlayerFormation; rtsCameraLogic.SwitchFreeCameraLogic.CurrentPlayerFormation = formationClass; if (WatchBattleBehavior.WatchMode) { return; } Utility.SetPlayerFormation(formationClass); } })); controlOptionCategory.AddOption(new SelectionOptionViewModel( GameTexts.FindText("str_rts_camera_watch_another_hero"), GameTexts.FindText("str_rts_camera_watch_another_hero_hint"), new WatchAgentSelectionData(missionScreen).SelectionOptionData, true)); controlOptionCategory.AddOption(new ActionOptionViewModel( GameTexts.FindText("str_rts_camera_select_character"), GameTexts.FindText("str_rts_camera_select_character_hint"), () => { selectCharacterView.IsSelectingCharacter = true; menuManager.RequestToCloseMenu(); })); controlOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_control_ally_after_death"), GameTexts.FindText("str_rts_camera_control_ally_after_death_hint"), () => RTSCameraConfig.Get().ControlAllyAfterDeath, b => RTSCameraConfig.Get().ControlAllyAfterDeath = b)); controlOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_prefer_to_control_companions"), GameTexts.FindText("str_rts_camera_prefer_to_control_companions_hint"), () => RTSCameraConfig.Get().PreferToControlCompanions, b => RTSCameraConfig.Get().PreferToControlCompanions = b)); controlOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_control_troops_in_player_party_only"), GameTexts.FindText("str_rts_camera_control_troops_in_player_party_only_hint"), () => RTSCameraConfig.Get().ControlTroopsInPlayerPartyOnly, b => RTSCameraConfig.Get().ControlTroopsInPlayerPartyOnly = b)); optionClass.AddOptionCategory(0, controlOptionCategory); var miscellaneousOptionCategory = new OptionCategory("Miscellaneous", GameTexts.FindText("str_rts_camera_miscellaneous_options")); miscellaneousOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_toggle_pause"), GameTexts.FindText("str_rts_camera_toggle_pause_hint"), () => { rtsCameraLogic.MissionSpeedLogic?.TogglePause(); menuManager.RequestToCloseMenu(); })); miscellaneousOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_slow_motion_mode"), GameTexts.FindText("str_rts_camera_slow_motion_hint"), () => Mission.Current.Scene.SlowMotionMode, b => rtsCameraLogic.MissionSpeedLogic.SetSlowMotionMode(b))); miscellaneousOptionCategory.AddOption(new NumericOptionViewModel( GameTexts.FindText("str_rts_camera_slow_motion_factor"), GameTexts.FindText("str_rts_camera_slow_motion_factor_hint"), () => Mission.Current.Scene.SlowMotionFactor, f => rtsCameraLogic.MissionSpeedLogic.SetSlowMotionFactor(f), 0, 3, false, true)); miscellaneousOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_display_mod_message"), GameTexts.FindText("str_rts_camera_display_message_hint"), () => RTSCameraConfig.Get().DisplayMessage, b => { RTSCameraConfig.Get().DisplayMessage = b; Utility.ShouldDisplayMessage = b; })); miscellaneousOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_toggle_ui"), GameTexts.FindText("str_rts_camera_toggle_ui_hint"), () => { hideHudView?.ToggleUI(); menuManager.RequestToCloseMenu(); })); optionClass.AddOptionCategory(1, miscellaneousOptionCategory); if (NativeConfig.CheatMode) { var cheatOptionCategory = new OptionCategory("Cheat", GameTexts.FindText("str_rts_camera_unbalanced_options_description")); cheatOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_all_invulnerable"), GameTexts.FindText("str_rts_camera_all_invulnerable_hint"), () => RTSCameraConfig.Get().DisableDeath, b => { RTSCameraConfig.Get().DisableDeath = b; rtsCameraLogic.DisableDeathLogic.SetDisableDeath(b); })); cheatOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_enable_all_invulnerable_hotkey"), null, () => RTSCameraConfig.Get().DisableDeathHotkeyEnabled, b => RTSCameraConfig.Get().DisableDeathHotkeyEnabled = b)); cheatOptionCategory.AddOption(new ActionOptionViewModel(GameTexts.FindText("str_rts_camera_switch_team"), GameTexts.FindText("str_rts_camera_switch_team_hint"), () => { rtsCameraLogic.SwitchTeamLogic.SwapTeam(); menuManager.RequestToCloseMenu(); })); cheatOptionCategory.AddOption(new BoolOptionViewModel( GameTexts.FindText("str_rts_camera_enable_switch_team_hotkey"), null, () => RTSCameraConfig.Get().SwitchTeamHotkeyEnabled, b => RTSCameraConfig.Get().SwitchTeamHotkeyEnabled = b)); optionClass.AddOptionCategory(1, cheatOptionCategory); } return optionClass; }, RTSCameraSubModule.ModuleId)); }
protected CmdletWithSearch(OptionCategory[] categories) : base(categories) { }
public OptionSet Add <TKey, TValue>(string prototype, OptionCategory category, string description, OptionAction <TKey, TValue> action) { return(Add(new ActionOption <TKey, TValue>(prototype, category, description, action))); }
public DynamicOptionRequestObject(ProviderBase provider, IHostApi request, Action <RequestObject> action, OptionCategory category) : base(provider, request, action) { _category = category; InvokeImpl(); }
private string GetValue(OptionCategory category, string name) { // get the value from the request return((GetOptionValues((int)category, name) ?? Enumerable.Empty <string>()).LastOrDefault()); }
protected CmdletWithProvider(OptionCategory[] categories) { _optionCategories = categories; }
public DynamicOption(OptionCategory category, string name, OptionType expectedType, bool isRequired) : this(category, name, expectedType, isRequired, null) { }