Add flag editor warning

This commit is contained in:
pizzaboxer 2024-06-08 18:15:27 +01:00
parent 243ebbef5a
commit ae695d5cb3
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
12 changed files with 216 additions and 32 deletions

View File

@ -3,6 +3,7 @@
public class State
{
public string LastEnrolledChannel { get; set; } = "";
public bool ShowFFlagEditorWarning { get; set; } = true;
[Obsolete("Use PlayerVersionGuid instead", true)]
public string VersionGuid { set { PlayerVersionGuid = value; } }

View File

@ -468,6 +468,15 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>
public static string Common_Warning {
get {
return ResourceManager.GetString("Common.Warning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Yes.
/// </summary>
@ -1813,7 +1822,7 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// Looks up a localized string similar to Manage your own FastFlags. Double click a column to edit..
/// Looks up a localized string similar to Manage your own FastFlags. Use with caution. Double click a column to edit..
/// </summary>
public static string Menu_FastFlagEditor_Description {
get {
@ -1866,6 +1875,44 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Go back.
/// </summary>
public static string Menu_FastFlagEditor_Warning_Back {
get {
return ResourceManager.GetString("Menu.FastFlagEditor.Warning.Back", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to I know what I&apos;m doing.
/// </summary>
public static string Menu_FastFlagEditor_Warning_Continue {
get {
return ResourceManager.GetString("Menu.FastFlagEditor.Warning.Continue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Do you know what you are doing?.
/// </summary>
public static string Menu_FastFlagEditor_Warning_Header {
get {
return ResourceManager.GetString("Menu.FastFlagEditor.Warning.Header", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fast Flags are extremely powerful, being that they are intended to only be used by Roblox engineers. While they can be very useful, manually configuring them can cause serious issues with stability and functionality. Do NOT use the editor if you are unsure of what you are doing.
///
///Do NOT use this to import large &quot;flag lists&quot; made by other people that promise to improve performance or such. They are subject to the aforementioned issues, and they will cause problems for you since you will not be fully aware [rest of string was truncated]&quot;;.
/// </summary>
public static string Menu_FastFlagEditor_Warning_Text {
get {
return ResourceManager.GetString("Menu.FastFlagEditor.Warning.Text", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Control how specific Roblox engine parameters and features are configured..
/// </summary>
@ -1876,7 +1923,7 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// Looks up a localized string similar to Manage your own FastFlags..
/// Looks up a localized string similar to Manage your own Fast Flags. Use with caution..
/// </summary>
public static string Menu_FastFlags_Editor_Description {
get {
@ -1885,7 +1932,7 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// Looks up a localized string similar to Learn more about FastFlags..
/// Looks up a localized string similar to Learn more about Fast Flags, what these presets do, and how to use them..
/// </summary>
public static string Menu_FastFlags_Help_Description {
get {

View File

@ -257,6 +257,9 @@ Your ReShade configuration files will still be saved, and you can locate them by
<data name="Common.Value" xml:space="preserve">
<value>Value</value>
</data>
<data name="Common.Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Common.Yes" xml:space="preserve">
<value>Yes</value>
</data>
@ -708,7 +711,7 @@ Would you like to upgrade your currently installed version?</value>
<value>Delete selected</value>
</data>
<data name="Menu.FastFlagEditor.Description" xml:space="preserve">
<value>Manage your own FastFlags. Double click a column to edit.</value>
<value>Manage your own FastFlags. Use with caution. Double click a column to edit.</value>
</data>
<data name="Menu.FastFlagEditor.ExportJson" xml:space="preserve">
<value>Export JSON</value>
@ -725,15 +728,29 @@ Would you like to upgrade your currently installed version?</value>
<data name="Menu.FastFlagEditor.Title" xml:space="preserve">
<value>Fast Flag Editor</value>
</data>
<data name="Menu.FastFlagEditor.Warning.Back" xml:space="preserve">
<value>Go back</value>
</data>
<data name="Menu.FastFlagEditor.Warning.Continue" xml:space="preserve">
<value>I know what I'm doing</value>
</data>
<data name="Menu.FastFlagEditor.Warning.Header" xml:space="preserve">
<value>Do you know what you are doing?</value>
</data>
<data name="Menu.FastFlagEditor.Warning.Text" xml:space="preserve">
<value>Fast Flags are extremely powerful, being that they are intended to only be used by Roblox engineers. While they can be very useful, manually configuring them can cause serious issues with stability and functionality. Do NOT use the editor if you are unsure of what you are doing.
Do NOT use this to import large "flag lists" made by other people that promise to improve performance or such. They are subject to the aforementioned issues, and they will cause problems for you since you will not be fully aware of what they are changing. If you were about to do that, GO BACK.</value>
</data>
<data name="Menu.FastFlags.Description" xml:space="preserve">
<value>Control how specific Roblox engine parameters and features are configured.</value>
</data>
<data name="Menu.FastFlags.Editor.Description" xml:space="preserve">
<value>Manage your own FastFlags.</value>
<value>Manage your own Fast Flags. Use with caution.</value>
<comment>Title is Menu.FastFlagEditor.Title</comment>
</data>
<data name="Menu.FastFlags.Help.Description" xml:space="preserve">
<value>Learn more about FastFlags.</value>
<value>Learn more about Fast Flags, what these presets do, and how to use them.</value>
<comment>Title is Common.Help</comment>
</data>
<data name="Menu.FastFlags.Presets.AltGraphicsSelector.Description" xml:space="preserve">

View File

@ -59,6 +59,7 @@
<ui:NavigationItem Content="{x:Static resources:Strings.Menu_FastFlagEditor_Title}" PageType="{x:Type pages:FastFlagEditorPage}" Tag="fastflageditor" Visibility="Collapsed" />
<ui:NavigationItem Content="{x:Static resources:Strings.Menu_PreInstall_Title}" PageType="{x:Type pages:PreInstallPage}" Tag="preinstall" Visibility="Collapsed" x:Name="PreInstallNavItem" />
<ui:NavigationItem Content="" PageType="{x:Type pages:FastFlagEditorWarningPage}" Tag="fastflageditorwarning" Visibility="Collapsed" x:Name="EditorWarningNavItem" />
</ui:NavigationFluent.Items>
<ui:NavigationFluent.Footer>
<ui:NavigationItem Content="{x:Static resources:Strings.Menu_About_Title}" PageType="{x:Type pages:AboutPage}" Icon="QuestionCircle48" Tag="about" Margin="0,0,0,12" />

View File

@ -21,6 +21,7 @@ namespace Bloxstrap.UI.Elements.Menu
#if DEBUG // easier access
PreInstallNavItem.Visibility = System.Windows.Visibility.Visible;
EditorWarningNavItem.Visibility = System.Windows.Visibility.Visible;
#endif
if (showAlreadyRunningWarning)

View File

@ -1,5 +1,4 @@

<ui:UiPage x:Class="Bloxstrap.UI.Elements.Menu.Pages.FastFlagEditorPage"
<ui:UiPage x:Class="Bloxstrap.UI.Elements.Menu.Pages.FastFlagEditorPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -0,0 +1,25 @@
<ui:UiPage x:Class="Bloxstrap.UI.Elements.Menu.Pages.FastFlagEditorWarningPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.Menu"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Scrollable="True"
Loaded="Page_Loaded"
Title="FastFlagEditorWarningPage">
<StackPanel VerticalAlignment="Center">
<Image HorizontalAlignment="Center" Source="pack://application:,,,/Resources/MessageBox/Warning.png" RenderOptions.BitmapScalingMode="HighQuality" Width="96" />
<TextBlock HorizontalAlignment="Center" Text="{x:Static resources:Strings.Common_Warning}" FontSize="48" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<TextBlock HorizontalAlignment="Center" Text="{x:Static resources:Strings.Menu_FastFlagEditor_Warning_Header}" FontSize="24" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<TextBlock HorizontalAlignment="Center" Text="{x:Static resources:Strings.Menu_FastFlagEditor_Warning_Text}" TextAlignment="Center" Margin="16" TextWrapping="Wrap" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,8,0,0">
<ui:Button Content="{x:Static resources:Strings.Menu_FastFlagEditor_Warning_Back}" Margin="0,0,8,0" Appearance="Primary" Command="{Binding GoBackCommand, Mode=OneTime}" />
<ui:Button Content="{Binding ContinueButtonText, Mode=OneWay}" Appearance="Danger" IsEnabled="{Binding CanContinue, Mode=OneWay}" Command="{Binding ContinueCommand, Mode=OneTime}" />
</StackPanel>
</StackPanel>
</ui:UiPage>

View File

@ -0,0 +1,32 @@
using Bloxstrap.UI.ViewModels.Menu;
using System.Windows;
namespace Bloxstrap.UI.Elements.Menu.Pages
{
/// <summary>
/// Interaction logic for FastFlagEditorWarningPage.xaml
/// </summary>
public partial class FastFlagEditorWarningPage
{
private bool _initialLoad = false;
public FastFlagEditorWarningPage()
{
DataContext = new FastFlagEditorWarningViewModel(this);
InitializeComponent();
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
// refresh datacontext on page load to reset timer
if (!_initialLoad)
{
_initialLoad = true;
return;
}
DataContext = new FastFlagEditorWarningViewModel(this);
}
}
}

View File

@ -15,26 +15,12 @@
<StackPanel Margin="0,0,14,14">
<TextBlock Margin="0,0,0,16" Text="{x:Static resources:Strings.Menu_FastFlags_Description}" FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ui:CardAction Grid.Column="0" Margin="0,0,4,0" Icon="EditSettings24" Command="{Binding OpenFastFlagEditorCommand}">
<StackPanel>
<TextBlock FontSize="14" Text="{x:Static resources:Strings.Menu_FastFlagEditor_Title}" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="{x:Static resources:Strings.Menu_FastFlags_Editor_Description}" Padding="0,0,16,0" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardAction>
<ui:CardAction Grid.Column="1" Margin="4,0,0,0" Icon="BookQuestionMark24" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/pizzaboxer/bloxstrap/wiki/A-guide-to-FastFlags">
<ui:CardAction Grid.Column="0" Icon="BookQuestionMark24" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/pizzaboxer/bloxstrap/wiki/A-guide-to-FastFlags">
<StackPanel>
<TextBlock FontSize="14" Text="{x:Static resources:Strings.Common_Help}" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="{x:Static resources:Strings.Menu_FastFlags_Help_Description}" Padding="0,0,16,0" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardAction>
</Grid>
<StackPanel Visibility="{Binding ShowDebugFlags, Mode=OneTime}">
<TextBlock Text="{x:Static resources:Strings.Menu_FastFlags_Presets_Debug_Title}" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
@ -137,5 +123,12 @@
Description="{x:Static resources:Strings.Menu_FastFlags_Presets_AltGraphicsSelector_Description}">
<ui:ToggleSwitch IsChecked="{Binding AlternateGraphicsSelectorEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<ui:CardAction Margin="0,24,0,0" Icon="EditSettings24" Command="{Binding OpenFastFlagEditorCommand}">
<StackPanel>
<TextBlock FontSize="14" Text="{x:Static resources:Strings.Menu_FastFlagEditor_Title}" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="{x:Static resources:Strings.Menu_FastFlags_Editor_Description}" Padding="0,0,16,0" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardAction>
</StackPanel>
</ui:UiPage>

View File

@ -57,8 +57,6 @@
<ui:ToggleSwitch IsChecked="{Binding DiscordActivityJoinEnabled, Mode=TwoWay}" />
</controls:OptionControl>
<TextBlock Text="{x:Static resources:Strings.Common_Miscellaneous}" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<TextBlock Text="{x:Static resources:Strings.Menu_Integrations_Custom_Title}" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
<TextBlock Text="{x:Static resources:Strings.Menu_Integrations_Custom_Description}" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<Grid Margin="0,8,0,0">

View File

@ -0,0 +1,65 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Mvvm.Contracts;
using Bloxstrap.UI.Elements.Menu.Pages;
namespace Bloxstrap.UI.ViewModels.Menu
{
internal class FastFlagEditorWarningViewModel : NotifyPropertyChangedViewModel
{
private Page _page;
public string ContinueButtonText { get; set; } = "";
public bool CanContinue { get; set; } = false;
public ICommand GoBackCommand => new RelayCommand(GoBack);
public ICommand ContinueCommand => new RelayCommand(Continue);
public FastFlagEditorWarningViewModel(Page page)
{
_page = page;
DoCountdown();
}
private async void DoCountdown()
{
for (int i = 10; i > 0; i--)
{
ContinueButtonText = $"({i}) {Resources.Strings.Menu_FastFlagEditor_Warning_Continue}";
OnPropertyChanged(nameof(ContinueButtonText));
await Task.Delay(1000);
}
ContinueButtonText = Resources.Strings.Menu_FastFlagEditor_Warning_Continue;
OnPropertyChanged(nameof(ContinueButtonText));
CanContinue = true;
OnPropertyChanged(nameof(CanContinue));
App.State.Prop.ShowFFlagEditorWarning = false;
App.State.Save();
}
private void Continue()
{
if (!CanContinue)
return;
if (Window.GetWindow(_page) is INavigationWindow window)
window.Navigate(typeof(FastFlagEditorPage));
}
private void GoBack()
{
if (Window.GetWindow(_page) is INavigationWindow window)
window.Navigate(typeof(FastFlagsPage));
}
}
}

View File

@ -23,8 +23,13 @@ namespace Bloxstrap.UI.ViewModels.Menu
private void OpenFastFlagEditor()
{
if (Window.GetWindow(_page) is INavigationWindow window)
{
if (App.State.Prop.ShowFFlagEditorWarning)
window.Navigate(typeof(FastFlagEditorWarningPage));
else
window.Navigate(typeof(FastFlagEditorPage));
}
}
public ICommand OpenFastFlagEditorCommand => new RelayCommand(OpenFastFlagEditor);