private static void OnConsoleColorClicked <EnumType>(MenuUtils menuUtils, IMenuPropertyAccessor <EnumType> colorAccessor, string header, int spacing) where EnumType : struct, Enum { colorAccessor.SetValue( Enum.Parse <EnumType>( menuUtils.OpenEnumConfigEditor( header + "." + colorAccessor.GetFieldName(), colorAccessor.GetValue().ToString(), Enum.GetNames(typeof(EnumType)), spacing ) ) ); }
void IMenuPropertyOnClickBehavior <bool> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <bool> property, string header, int spacing) { property.SetValue(!property.GetValue()); }
void IMenuPropertyOnClickBehavior <T> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <T> property, string header, int spacing) { onClick(menuUtils, property, header, spacing); }
void IMenuProperty.OnClick(MenuUtils menuUtils, string header, int spacing) { onClickBehavior.OnClick(menuUtils, this, header, spacing); }
private static void OnNormalTextColorClicked(MenuUtils menuUtils, IMenuPropertyAccessor <ConsoleColor> colorAccessor, string header, int spacing) { OnConsoleColorClicked(menuUtils, colorAccessor, header, spacing); Console.ForegroundColor = colorAccessor.GetValue(); }
void IMenuPropertyOnClickBehavior <string> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <string> property, string header, int spacing) { property.SetValue(MenuUtils.OpenSimpleConfigEditor(header, property.GetFieldName(), property.GetValue())); }
void IMenuPropertyOnClickBehavior <T> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <T> property, string header, int spacing) { property.SetValue(Enum.Parse <T>(menuUtils.OpenEnumConfigEditor(header + "." + property.GetFieldName(), property.GetValue().ToString(), Enum.GetNames(typeof(T)), spacing))); }
void IMenuPropertyOnClickBehavior <T> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <T> property, string header, int spacing) { menuUtils.OpenObjectMenu(header, property.GetFieldName(), property.GetValue(), 0, spacing); }