From 42c04b4e86553c8a07f9dc849f190ef793df26f9 Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 18:23:02 +0200 Subject: [PATCH 1/6] better randomizer --- .../Features/WiiManagement/MiiFactory.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/WheelWizard/Features/WiiManagement/MiiFactory.cs b/WheelWizard/Features/WiiManagement/MiiFactory.cs index 85d99026..6ed60ee0 100644 --- a/WheelWizard/Features/WiiManagement/MiiFactory.cs +++ b/WheelWizard/Features/WiiManagement/MiiFactory.cs @@ -59,9 +59,27 @@ public static Mii CreateRandomMii(IRandom random) var hairColor = (MiiHairColor)(random.Next() % 8); baseMii.IsGirl = random.Next() % 2 == 0; - baseMii.MiiHair = new(random.Next() % 71, hairColor, random.Next() % 2 == 0); + baseMii.MiiHair = new(random.Next() % 71, hairColor, random.Next() % 3 == 0); baseMii.MiiEyebrows = new(random.Next() % 23, 6, hairColor, 4, 10, 2); baseMii.MiiEyes = new(random.Next() % 47, 4, 12, (MiiEyeColor)(random.Next() % 6), 4, 2); + baseMii.MiiFavoriteColor = (MiiFavoriteColor)(random.Next() % 12); + baseMii.MiiFacialFeatures = new( + (MiiFaceShape)(random.Next() % 8), + (MiiSkinColor)(random.Next() % 6), + (MiiFacialFeature)(random.Next() % 12), + false, + false + ); + baseMii.MiiNose = new((MiiNoseType)(random.Next() % 12), 4, 9); + baseMii.MiiLips = new(random.Next() % 23, (MiiLipColor)(random.Next() % 3), 4, 13); + baseMii.MiiMole = new(random.Next() % 4 == 0, 4, 20, 2); + if (random.Next() % 4 == 0) + baseMii.MiiGlasses = new((MiiGlassesType)(random.Next() % 9), (MiiGlassesColor)(random.Next() % 6), 4, 10); + else + baseMii.MiiGlasses = new(MiiGlassesType.None, MiiGlassesColor.Grey, 4, 10); + + if (random.Next() % 4 == 0) + baseMii.MiiFacialHair = new((MiiMustacheType)(random.Next() % 4), (MiiBeardType)(random.Next() % 4), hairColor, 4, 10); return baseMii; } } From 315a66ea3b1315f774176122a445d3cbfdc3dfdb Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 18:41:30 +0200 Subject: [PATCH 2/6] randomize button in editor --- .../Features/WiiManagement/Domain/Mii/Mii.cs | 2 -- .../MiiEditor/EditorStartPage.axaml | 3 +++ .../MiiEditor/EditorStartPage.axaml.cs | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/WheelWizard/Features/WiiManagement/Domain/Mii/Mii.cs b/WheelWizard/Features/WiiManagement/Domain/Mii/Mii.cs index bd4a94fd..4762b73b 100644 --- a/WheelWizard/Features/WiiManagement/Domain/Mii/Mii.cs +++ b/WheelWizard/Features/WiiManagement/Domain/Mii/Mii.cs @@ -12,8 +12,6 @@ public class Mii public MiiScale Height { get; set; } = new(1); public MiiScale Weight { get; set; } = new(1); - public bool IsForeign => (MiiId1 >> 5) == 0b110; // checks if the top 3 bits are set to 110, if so it got blue pants - //Mii ID is also refered as Avatar ID public byte MiiId1 { get; set; } public byte MiiId2 { get; set; } diff --git a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorStartPage.axaml b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorStartPage.axaml index dff62909..353fb556 100644 --- a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorStartPage.axaml +++ b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorStartPage.axaml @@ -34,6 +34,9 @@ + Editor.Close(); private void SaveButton_OnClick(object? sender, RoutedEventArgs e) => Editor.SignalSaveMii(); From bf352fa44495cb9546f6196ec958130cb592860f Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 18:57:01 +0200 Subject: [PATCH 3/6] allow custom chars in the Mii editor --- .../Popups/Generic/TextInputWindow.axaml.cs | 8 +++++- .../MiiEditor/EditorGeneral.axaml | 10 +++++-- .../MiiEditor/EditorGeneral.axaml.cs | 27 ++++++++++++++++--- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs b/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs index 4f23aaa9..02a21c7a 100644 --- a/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs +++ b/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs @@ -41,9 +41,15 @@ public TextInputWindow SetExtraText(string extraText) return this; } - public TextInputWindow SetAllowCustomChars(bool allow) + public TextInputWindow SetAllowCustomChars(bool allow, bool initiallyOpen = false) { CustomCharsButton.IsVisible = allow; + + if (allow && initiallyOpen) + { + CustomChars.IsVisible = true; + CustomCharsButton.IsVisible = false; + } return this; } diff --git a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml index f3f2810c..2200ca0b 100644 --- a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml +++ b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml @@ -25,8 +25,14 @@ - + + + + + diff --git a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml.cs b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml.cs index d3cb21a5..35a6e964 100644 --- a/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml.cs +++ b/WheelWizard/Views/Popups/MiiManagement/MiiEditor/EditorGeneral.axaml.cs @@ -3,6 +3,7 @@ using Avalonia.Interactivity; using Avalonia.Media; using Avalonia.Threading; +using WheelWizard.Views.Popups.Generic; using WheelWizard.WiiManagement.Domain; using WheelWizard.WiiManagement.Domain.Mii; @@ -58,12 +59,16 @@ protected override void BeforeBack() } // We only have to check if it's a female, since if it's not, we already know the other option is going to be the male - private void IsGirl_OnIsCheckedChanged(object? sender, RoutedEventArgs e) => Editor.Mii.IsGirl = GirlToggle.IsChecked == true; + private void IsGirl_OnIsCheckedChanged(object? sender, RoutedEventArgs e) + { + Editor.Mii.IsGirl = GirlToggle.IsChecked == true; + Editor.RefreshImage(); + } private void Name_TextChanged(object sender, TextChangedEventArgs e) { // MiiName - var validationMiiNameResult = ValidateMiiName(MiiName.Text); + var validationMiiNameResult = ValidateMiiName(null, MiiName.Text); _hasMiiNameError = validationMiiNameResult.IsFailure; MiiName.ErrorMessage = validationMiiNameResult.Error?.Message ?? ""; @@ -73,7 +78,7 @@ private void Name_TextChanged(object sender, TextChangedEventArgs e) CreatorName.ErrorMessage = validationCreatorNameResult.Error?.Message ?? ""; } - private OperationResult ValidateMiiName(string newName) + private OperationResult ValidateMiiName(string? _, string newName) { if (newName.Length is > 10 or < 3) return Fail("Name must be between 3 and 10 characters long."); @@ -140,4 +145,20 @@ private void RefreshTimer_Tick(object? sender, EventArgs e) _refreshTimer.Stop(); Editor.RefreshImage(); } + + private async void ComplexName_OnClick(object? sender, RoutedEventArgs e) + { + var textPopup = new TextInputWindow() + .SetMainText($"Edit Mii name") + .SetExtraText($"Changing name from: {MiiName.Text}") + .SetAllowCustomChars(true, true) + .SetValidation(ValidateMiiName) + .SetInitialText(MiiName.Text) + .SetPlaceholderText("Enter Mii name"); + var newName = await textPopup.ShowDialog(); + + if (string.IsNullOrWhiteSpace(newName)) + return; + MiiName.Text = newName; + } } From 6053ffc987df38e00455dd47249c777bb36ffa95 Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 20:47:28 +0200 Subject: [PATCH 4/6] re think how favorite works --- .../Resources/Languages/Common.Designer.cs | 18 ++++++++ .../Resources/Languages/Common.nl.resx | 6 +++ WheelWizard/Resources/Languages/Common.resx | 6 +++ WheelWizard/Views/Pages/MiiListPage.axaml | 14 ++++++ WheelWizard/Views/Pages/MiiListPage.axaml.cs | 46 ++++++++++++++++++- 5 files changed, 88 insertions(+), 2 deletions(-) diff --git a/WheelWizard/Resources/Languages/Common.Designer.cs b/WheelWizard/Resources/Languages/Common.Designer.cs index 72aa9f12..9fd9b9fd 100644 --- a/WheelWizard/Resources/Languages/Common.Designer.cs +++ b/WheelWizard/Resources/Languages/Common.Designer.cs @@ -158,6 +158,15 @@ public static string Action_Export { } } + /// + /// Looks up a localized string similar to Favorite. + /// + public static string Action_Favorite { + get { + return ResourceManager.GetString("Action_Favorite", resourceCulture); + } + } + /// /// Looks up a localized string similar to Import. /// @@ -275,6 +284,15 @@ public static string Action_SaveExternalMii { } } + /// + /// Looks up a localized string similar to Unfavorite. + /// + public static string Action_Unfavorite { + get { + return ResourceManager.GetString("Action_Unfavorite", resourceCulture); + } + } + /// /// Looks up a localized string similar to Update. /// diff --git a/WheelWizard/Resources/Languages/Common.nl.resx b/WheelWizard/Resources/Languages/Common.nl.resx index 91ba4d77..8b68871a 100644 --- a/WheelWizard/Resources/Languages/Common.nl.resx +++ b/WheelWizard/Resources/Languages/Common.nl.resx @@ -195,4 +195,10 @@ Terug + + Voeg toe aan Favorieten + + + Haal uit favorieten + \ No newline at end of file diff --git a/WheelWizard/Resources/Languages/Common.resx b/WheelWizard/Resources/Languages/Common.resx index 8d5e6e8e..04ef8de0 100644 --- a/WheelWizard/Resources/Languages/Common.resx +++ b/WheelWizard/Resources/Languages/Common.resx @@ -195,4 +195,10 @@ Back + + Unfavorite + + + Favorite + \ No newline at end of file diff --git a/WheelWizard/Views/Pages/MiiListPage.axaml b/WheelWizard/Views/Pages/MiiListPage.axaml index edd70557..befc1338 100644 --- a/WheelWizard/Views/Pages/MiiListPage.axaml +++ b/WheelWizard/Views/Pages/MiiListPage.axaml @@ -33,6 +33,20 @@ + + + + + + ChangeTopButtons(); miiBlock.ContextMenu = new ContextMenu(); + var favHeader = mii.IsFavorite ? Common.Action_Unfavorite : Common.Action_Favorite; + miiBlock.ContextMenu.Items.Add( + new MenuItem { Header = favHeader, Command = new MyCommand(() => ContextAction(mii, ToggleFavorite)) } + ); miiBlock.ContextMenu.Items.Add(new MenuItem { Header = Common.Action_Edit, Command = new MyCommand(() => EditMii(mii)) }); miiBlock.ContextMenu.Items.Add( new MenuItem { Header = "Duplicate", Command = new MyCommand(() => ContextAction(mii, DuplicateMii)) } ); miiBlock.ContextMenu.Items.Add( - new MenuItem { Header = Common.Action_Delete, Command = new MyCommand(() => ContextAction(mii, DeleteMii)) } + new MenuItem { Header = Common.Action_Export, Command = new MyCommand(() => ContextAction(mii, ExportMultipleMiiFiles)) } ); miiBlock.ContextMenu.Items.Add( - new MenuItem { Header = Common.Action_Export, Command = new MyCommand(() => ContextAction(mii, ExportMultipleMiiFiles)) } + new MenuItem { Header = Common.Action_Delete, Command = new MyCommand(() => ContextAction(mii, DeleteMii)) } ); + MiiList.Children.Add(miiBlock); } @@ -178,6 +183,8 @@ private void ReloadMiiList() private async void EditMii_OnClick(object? sender, RoutedEventArgs e) => EditMii(GetSelectedMiis()[0]); + private async void FavMii_OnClick(object? sender, RoutedEventArgs e) => ToggleFavorite(GetSelectedMiis()); + private async void ExportMii_OnClick(object? sender, RoutedEventArgs e) => ExportMultipleMiiFiles(GetSelectedMiis()); private async void DuplicateMii_OnClick(object? sender, RoutedEventArgs e) => DuplicateMii(GetSelectedMiis()); @@ -220,6 +227,23 @@ private async void ImportMii_OnClick(object? sender, RoutedEventArgs e) ReloadMiiList(); } + private async void ToggleFavorite(Mii[] miis) + { + var allFavorite = miis.All(m => m.IsFavorite); + + foreach (var mii in miis) + { + mii.IsFavorite = !allFavorite; + var result = MiiDbService.Update(mii); + if (result.IsFailure) + { + ViewUtils.ShowSnackbar($"Failed to update Mii '{result.Error.Message}'", ViewUtils.SnackbarType.Danger); + return; + } + } + ReloadMiiList(); + } + private async void ExportMultipleMiiFiles(Mii[] miis) { if (miis.Length == 0) @@ -295,6 +319,18 @@ private async void DeleteMii(Mii[] miis) // TODO: add a check that you cant remove a Mii that is in use by a lisence, // I have no idea how tho + if (miis.Any(mii => mii.IsFavorite)) + { + await new MessageBoxWindow() + .SetTitleText("Cant delete favorite Miis?") + .SetInfoText( + "One or more of the selected Mii(s) is a favorite. Miis can only be deleted if they are not favorites to prevent accidental deletions." + ) + .SetMessageType(MessageBoxWindow.MessageType.Warning) + .ShowDialog(); + return; + } + var mainText = $"Are you sure you want to delete {miis.Length} Miis?"; var successMessage = $"Deleted {miis.Length} Miis"; if (miis.Length == 1) @@ -401,14 +437,20 @@ private void ChangeTopButtons() EditMiisButton.IsVisible = false; DuplicateMiisButton.IsVisible = false; ImportMiiButton.IsVisible = true; + FavoriteMiiButton.IsVisible = false; return; } + FavoriteMiiButton.IsVisible = true; EditMiisButton.IsVisible = selectedMiis.Length == 1; ImportMiiButton.IsVisible = false; DeleteMiisButton.IsVisible = true; ExportMiisButton.IsVisible = true; DuplicateMiisButton.IsVisible = true; + + FavoriteMiiButton.Classes.Remove("UnFav"); + if (selectedMiis.All(mii => mii.IsFavorite)) + FavoriteMiiButton.Classes.Add("UnFav"); } #region Command From 678c3d81bcf60636505bf87f1ec1e0cd1deda7cf Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 22:05:27 +0200 Subject: [PATCH 5/6] exporting Mii now is more readable for non-ascii characters --- .../CustomCharactersExtensions.cs | 11 + .../CustomCharactersService.cs | 215 ++++++++++++++++++ WheelWizard/SetupExtensions.cs | 2 + WheelWizard/Views/Pages/MiiListPage.axaml.cs | 6 +- .../Popups/Generic/TextInputWindow.axaml.cs | 53 +---- 5 files changed, 239 insertions(+), 48 deletions(-) create mode 100644 WheelWizard/Features/CustomCharacters/CustomCharactersExtensions.cs create mode 100644 WheelWizard/Features/CustomCharacters/CustomCharactersService.cs diff --git a/WheelWizard/Features/CustomCharacters/CustomCharactersExtensions.cs b/WheelWizard/Features/CustomCharacters/CustomCharactersExtensions.cs new file mode 100644 index 00000000..22c01050 --- /dev/null +++ b/WheelWizard/Features/CustomCharacters/CustomCharactersExtensions.cs @@ -0,0 +1,11 @@ +namespace WheelWizard.CustomCharacters; + +public static class CustomCharactersExtensions +{ + public static IServiceCollection AddCustomCharacters(this IServiceCollection services) + { + services.AddSingleton(); + + return services; + } +} diff --git a/WheelWizard/Features/CustomCharacters/CustomCharactersService.cs b/WheelWizard/Features/CustomCharacters/CustomCharactersService.cs new file mode 100644 index 00000000..1c718603 --- /dev/null +++ b/WheelWizard/Features/CustomCharacters/CustomCharactersService.cs @@ -0,0 +1,215 @@ +namespace WheelWizard.CustomCharacters; + +public interface ICustomCharactersService +{ + /// + /// Gets the custom characters. + /// + List GetCustomCharacters(); + + /// + /// To clear the given string from all the custom characters, and map them to their ascii closest representation. + /// + string NormalizeToAscii(string str); +} + +public class CustomCharactersService : ICustomCharactersService +{ + public List GetCustomCharacters() + { + var charRanges = new List<(char, char)> + { + ((char)0x2460, (char)0x246e), + ((char)0xe000, (char)0xe01c), + ((char)0xf061, (char)0xf06d), + ((char)0xf074, (char)0xf07c), + ((char)0xf107, (char)0xf10f), // it actually goes up to 0xf12f, but for some reason it repeats the same 8 icons 6 times over + }; + + var chars = new List(); + foreach (var (start, end) in charRanges) + { + for (var i = start; i <= end; i++) + { + chars.Add(i); + } + } + + // All the left-over chars that we cant make easy groups out of + chars.AddRange( + [ + (char)0xe028, + (char)0xe068, + (char)0xe067, + (char)0xe06a, + (char)0xe06b, + (char)0xf030, + (char)0xf031, + (char)0xf034, + (char)0xf035, + (char)0xf038, + (char)0xf039, + (char)0xf041, + (char)0xf043, + (char)0xf044, + (char)0xf047, + (char)0xf050, + (char)0xf058, + (char)0xf05e, + (char)0xf05f, + (char)0xf103, + ] + ); + + return chars; + } + + public string NormalizeToAscii(string str) + { + var charRanges = new List<(char, char, string[])> + { + ((char)0x2460, (char)0x246e, SArr("0123456789:,/-+")), + ( + (char)0xe000, + (char)0xe01c, + [ + "(A)", + "(B)", + "(X)", + "(Y)", + "[L]", + "[R]", + "⁜", + "◷", + ":)", + ">:(", + "<:o", + ":|", + "⁕", + "@", + "◜|◝", + "{}", + "[!]", + "[?]", + "[v]", + "[x]", + "[+]", + "\u2660", + "\u2666", + "\u2665", + "\u2663", + "▶", + "◀", + "▲", + "▼", + ] + ), + ((char)0xf061, (char)0xf06d, SArr("⁎⁑⁂⨁⨁⨁⨁⨀⩉ŲŲŲ₩")), + ((char)0xf074, (char)0xf07c, SArr("⨁⨁⨁⨁ABCDE")), + ( + (char)0xf107, + (char)0xf12f, + [ + "[⁇]", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + "▢▣▣▣", + "▣▢▣▣", + "▣▣▢▣", + "▣▣▣▢", + "○●●●", + "●○●●", + "●●○●", + "●●●○", + ] + ), + }; + + foreach (var (start, end, replacements) in charRanges) + { + for (var i = start; i <= end; i++) + { + var replacementIndex = i - start; + if (replacements.Length < replacementIndex) + continue; // If its here we did not account for 1 of the replacements + str = str.Replace($"{i}", replacements[replacementIndex]); + } + } + + (char, string)[] individualReplacements = + [ + ((char)0xe028, "✕"), + ((char)0xe068, "er"), + ((char)0xe067, "re"), + ((char)0xe06a, "e"), + ((char)0xe06b, "[?]"), + ((char)0xf030, "②"), + ((char)0xf031, "②"), + ((char)0xf034, "(A)"), + ((char)0xf035, "(A)"), + ((char)0xf038, "(a)"), + ((char)0xf039, "(a)"), + ((char)0xf041, "[B]"), + ((char)0xf043, "(1)"), + ((char)0xf044, "(+)"), + ((char)0xf047, "(+)"), + ((char)0xf050, "(b)"), + ((char)0xf058, "(B)"), + ((char)0xf05e, "(S)"), + ((char)0xf05f, "(s)"), + ((char)0xf103, "▣▣▣▣"), + // The once below are also not in teh actual app but should still be exported correctly + ((char)0xf03c, "(A)"), + ((char)0xf03d, "(A)"), + ((char)0xf102, " "), + ((char)0xf060, " "), + ]; + + foreach (var (c, replacement) in individualReplacements) + { + str = str.Replace($"{c}", replacement); + } + + return str; + } + + private static string[] SArr(string input) => input.ToCharArray().Select(c => $"{c}").ToArray(); +} diff --git a/WheelWizard/SetupExtensions.cs b/WheelWizard/SetupExtensions.cs index 77086d9c..8f27afca 100644 --- a/WheelWizard/SetupExtensions.cs +++ b/WheelWizard/SetupExtensions.cs @@ -4,6 +4,7 @@ using Testably.Abstractions; using WheelWizard.AutoUpdating; using WheelWizard.Branding; +using WheelWizard.CustomCharacters; using WheelWizard.GameBanana; using WheelWizard.GitHub; using WheelWizard.MiiImages; @@ -22,6 +23,7 @@ public static class SetupExtensions public static void AddWheelWizardServices(this IServiceCollection services) { // Features + services.AddCustomCharacters(); services.AddAutoUpdating(); services.AddBranding(); services.AddGitHub(); diff --git a/WheelWizard/Views/Pages/MiiListPage.axaml.cs b/WheelWizard/Views/Pages/MiiListPage.axaml.cs index f2d7ec5f..315d06d4 100644 --- a/WheelWizard/Views/Pages/MiiListPage.axaml.cs +++ b/WheelWizard/Views/Pages/MiiListPage.axaml.cs @@ -5,6 +5,7 @@ using Avalonia.Input; using Avalonia.Interactivity; using Testably.Abstractions; +using WheelWizard.CustomCharacters; using WheelWizard.Resources.Languages; using WheelWizard.Services; using WheelWizard.Services.Settings; @@ -19,6 +20,9 @@ namespace WheelWizard.Views.Pages; public partial class MiiListPage : UserControlBase { + [Inject] + private ICustomCharactersService CustomCharactersService { get; set; } = null!; + [Inject] private IMiiDbService MiiDbService { get; set; } = null!; @@ -265,7 +269,7 @@ public static string ReplaceInvalidFileNameChars(string filename) private async void ExportMiiAsFile(Mii mii) { - var exportName = ReplaceInvalidFileNameChars(mii.Name.ToString()); + var exportName = ReplaceInvalidFileNameChars(CustomCharactersService.NormalizeToAscii(mii.Name.ToString())); var diaglog = await FilePickerHelper.SaveFileAsync( title: "Save Mii as file", fileTypes: [CustomFilePickerFileType.Miis], diff --git a/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs b/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs index 02a21c7a..296b9a66 100644 --- a/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs +++ b/WheelWizard/Views/Popups/Generic/TextInputWindow.axaml.cs @@ -1,6 +1,8 @@ using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Layout; +using WheelWizard.CustomCharacters; +using WheelWizard.Shared.DependencyInjection; using WheelWizard.Views.Popups.Base; using Button = WheelWizard.Views.Components.Button; @@ -8,6 +10,9 @@ namespace WheelWizard.Views.Popups.Generic; public partial class TextInputWindow : PopupContent { + [Inject] + private ICustomCharactersService CustomCharactersService { get; set; } = null!; + private string? _result; private TaskCompletionSource? _tcs; private string? _initialText; @@ -87,54 +92,8 @@ public TextInputWindow SetValidation(Func vali private void SetupCustomChars() { CustomChars.Children.Clear(); - // All the custom chars that are grouped together - var charRanges = new List<(char, char)> - { - ((char)0x2460, (char)0x246e), - ((char)0xe000, (char)0xe01c), - ((char)0xf061, (char)0xf06d), - ((char)0xf074, (char)0xf07c), - ((char)0xf107, (char)0xf12f), - }; - - var chars = new List(); - foreach (var (start, end) in charRanges) - { - for (var i = start; i <= end; i++) - { - chars.Add(i); - } - } - // All the left-over chars that we cant make easy groups out of - chars.AddRange( - [ - (char)0xe028, - (char)0xe068, - (char)0xe067, - (char)0xe06a, - (char)0xe06b, - (char)0xf030, - (char)0xf031, - (char)0xf034, - (char)0xf035, - (char)0xf038, - (char)0xf039, - (char)0xf03c, - (char)0xf03d, - (char)0xf041, - (char)0xf043, - (char)0xf044, - (char)0xf047, - (char)0xf050, - (char)0xf058, - (char)0xf05e, - (char)0xf05f, - (char)0xf103, - ] - ); - - foreach (var c in chars) + foreach (var c in CustomCharactersService.GetCustomCharacters()) { var button = new Button() { From 75b38390cf68097783d93128170ad5b6626b25c9 Mon Sep 17 00:00:00 2001 From: WantToBeeMe <93130991+WantToBeeMe@users.noreply.github.com> Date: Fri, 16 May 2025 22:10:22 +0200 Subject: [PATCH 6/6] no beta flag anymore --- WheelWizard/Views/Popups/MiiManagement/MiiEditorWindow.axaml.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/WheelWizard/Views/Popups/MiiManagement/MiiEditorWindow.axaml.cs b/WheelWizard/Views/Popups/MiiManagement/MiiEditorWindow.axaml.cs index 3a6218f1..92d26a7f 100644 --- a/WheelWizard/Views/Popups/MiiManagement/MiiEditorWindow.axaml.cs +++ b/WheelWizard/Views/Popups/MiiManagement/MiiEditorWindow.axaml.cs @@ -36,8 +36,6 @@ public MiiEditorWindow() { InitializeComponent(); DataContext = this; - - Window.BetaFlag = true; } protected override void BeforeOpen()