Skip to content
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

Control-U during character class creation resets bonus pool #2679

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

petchema
Copy link
Collaborator

@petchema petchema commented Jul 24, 2024

Classic Daggerfall uses plain U key, but since in Daggerfall Unity the class name input field always has focus, that key would add an U character to the class name instead.

Remark: Under Linux, keyboard handling behaves a bit differently in the Unity Editor and in the Standalone Player: standalone player filters out control characters, while the editor does not, adding a "?" in the class name when Control-U is pressed. They could be filtered explicitly:

diff --git a/Assets/Scripts/Game/UserInterface/TextBox.cs b/Assets/Scripts/Game/UserInterface/TextBox.cs
index 9da458cef..6d660339f 100644
--- a/Assets/Scripts/Game/UserInterface/TextBox.cs +++ b/Assets/Scripts/Game/UserInterface/TextBox.cs @@ -453,6 +453,14 @@ namespace DaggerfallWorkshop.Game.UserInterface
                         }
                     }
                 }
+                else // !numeric
+                {
+                    // Filter control characters
+                    if ((int)character < 0x20)
+                    {
+                        return;
+                    }
+                }

                 // For upper only, force everything to caps
                 if (upperOnly)

but it seems less risky to just be aware of this small problem happening in the Editor only.
(just tested that the problem doesn't occur under Windows).

Classic Daggerfall uses plain U key, but since in Daggerfall Unity the
class name input field always has focus, that key would add an U
character to the class name instead.

Remark: keyboard handling behaves a bit differently in the Unity Editor
and in the Standalone Player: standalone player filters out control
characters, while the editor does not, adding a "?" in the class name
when Control-U is pressed. They could be filtered explicitly:

diff --git a/Assets/Scripts/Game/UserInterface/TextBox.cs
b/Assets/Scripts/Game/UserInterface/TextBox.cs
index 9da458cef..6d660339f 100644
--- a/Assets/Scripts/Game/UserInterface/TextBox.cs
+++ b/Assets/Scripts/Game/UserInterface/TextBox.cs
@@ -453,6 +453,14 @@ namespace DaggerfallWorkshop.Game.UserInterface
                         }
                     }
                 }
+                else // !numeric
+                {
+                    // Filter control characters
+                    if ((int)character < 0x20)
+                    {
+                        return;
+                    }
+                }

                 // For upper only, force everything to caps
                 if (upperOnly)

but it seems less risky to just be aware of this small problem happening
in the Editor only.
@petchema petchema added the classic variance Fixes a bug or behaviour from classic. Or could be result of lacking classic info. label Jul 24, 2024
@KABoissonneault KABoissonneault merged commit 72ba33f into Interkarma:master Oct 12, 2024
@petchema
Copy link
Collaborator Author

Rereading the PR title, now I understand how confusing it was ;)
Anyway, thanks for merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
classic variance Fixes a bug or behaviour from classic. Or could be result of lacking classic info.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants