-
Notifications
You must be signed in to change notification settings - Fork 23
feat: better characters #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
42c04b4
better randomizer
DirkDoes 315a66e
randomize button in editor
DirkDoes bf352fa
allow custom chars in the Mii editor
DirkDoes 6053ffc
re think how favorite works
DirkDoes 678c3d8
exporting Mii now is more readable for non-ascii characters
DirkDoes 75b3839
no beta flag anymore
DirkDoes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
WheelWizard/Features/CustomCharacters/CustomCharactersExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| namespace WheelWizard.CustomCharacters; | ||
|
|
||
| public static class CustomCharactersExtensions | ||
| { | ||
| public static IServiceCollection AddCustomCharacters(this IServiceCollection services) | ||
| { | ||
| services.AddSingleton<ICustomCharactersService, CustomCharactersService>(); | ||
|
|
||
| return services; | ||
| } | ||
| } |
215 changes: 215 additions & 0 deletions
215
WheelWizard/Features/CustomCharacters/CustomCharactersService.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| namespace WheelWizard.CustomCharacters; | ||
|
|
||
| public interface ICustomCharactersService | ||
| { | ||
| /// <summary> | ||
| /// Gets the custom characters. | ||
| /// </summary> | ||
| List<char> GetCustomCharacters(); | ||
|
|
||
| /// <summary> | ||
| /// To clear the given string from all the custom characters, and map them to their ascii closest representation. | ||
| /// </summary> | ||
| string NormalizeToAscii(string str); | ||
| } | ||
|
|
||
| public class CustomCharactersService : ICustomCharactersService | ||
| { | ||
| public List<char> 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<char>(); | ||
| 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(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.