Repository navigation
modoptions: string 设置项直接给文本框 + 游戏内文本输入层(并修复键位配置界面被盖住) - #5
Open
std-external wants to merge 5 commits into
Open
std-external wants to merge 5 commits into
std-external wants to merge 5 commits into
Conversation
Render string settings as inline text fields in the material mod options page and edit them through a reusable full-screen entry prompt (character grid, cancel/space/backspace/accept) that works with gamepad, touch, mouse and physical keyboards. Also stop the acrylic composition and input handling from covering the Everest key/button config screens opened from this page: disable acrylic while they are open, place the page behind them and ignore input.
Reorder the prompt keyboard to qwertyuiop / asdfghjkl / zxcvbnm with shift and a 123/symbol page cycle, matching a phone keyboard. Tapping a key with mouse or touch now types immediately, the highlight follows the pointer, and holding the space bar repeats spaces. Gamepad navigation and Enter/Esc behaviour are unchanged.
Keyboard and mouse now edit string settings inline through SDL text input (the same path as vanilla's rename box) instead of opening the self-drawn keyboard; touch keeps using CeleMod's "text" touch target, which raises the Android system soft keyboard. The QWERTY prompt is reserved for the gamepad (MInput.ControllerHasFocus) or when Everest's UseKeyboardForTextInput is off. Replace the cycling page key with explicit 123 / #+= / ABC keys so the number and symbol pages are discoverable; the corner hints on the letter keys stay visual only, like a phone keyboard.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
动机
群友反馈两件事,都落在模组设置页(
MaterialModOptions):改动
1. 可复用的游戏内文本输入层(新文件
Source/TextEntryOverlay.cs)一个轻量版
OuiFileNaming/OuiModOptionString,键盘按手机输入法的 QWERTY 排版:长度/上限、错误红框)、键盘、底部取消 / 空格 / 退格 / 接受qwertyuiop / asdfghjkl / zxcvbnm(默认小写,左侧 shift 切大写),键帽右上角带数字/符号提示,和手机键盘一致123/#+=明确切到数字页 / 符号页;数字页有ABC、#+=,符号页有ABC、123(不再用单键循环)IMaterialAcrylicPage新增AllowsAcrylic:弹层打开时关闭 acrylic 合成,改走普通渲染,弹层才能画在最上面。2. 按最近输入源分流(
Source/MaterialModOptions.cs)引擎里可直接用的信号(已核对 Monocle / Everest / CeleMod 源码):
MInput.ControllerHasFocus:MInput 每帧维护的「最近输入源」判据 —— 任意手柄GamePads[i].HasAnyInput()时为 true,键盘Keyboard.HasAnyInput()且没有手柄输入时清掉;只是想判断「有没有接手柄」不能只看GamePads[i].Attached(接了没用也会是 true)。CoreModuleSettings.UseKeyboardForTextInput(默认 true):vanilla 的OuiFileNaming/OuiModOptionString就是用它决定「物理键盘直输」还是「字符网格」;这里沿用同一个开关,关掉它会强制显示 QWERTY。TextInput.OnInput+TextInputEXT.TextEditing(IME 组字),和 vanilla 改名框同一条路径,直接编辑行内文本框。TouchKind: "text"的触控目标后,DirectTouch.kt会把它映射成键盘意图,GameActivity.kt调SDLActivity.showTextInput(0, 0, 1, 1)拉起系统软键盘(返回键也能收起)。所以触屏不画自绘键盘。因此实际行为:
TextEntryOverlayMInput.ControllerHasFocus为 true 时进入 QWERTY 界面,方向键导航 + 确认UseKeyboardForTextInput == false时,不管输入源都显示 QWERTY鼠标/键盘触发时显式传入
allowGameKeyboard: false,避免「刚才用过手柄」把鼠标点击误判成手柄(鼠标移动本身不会清ControllerHasFocus)。3. 模组设置页支持 string 设置项(
Source/MaterialModOptions.cs)QolSettingsOverlay的文本框一致)TextMenu.Button的Func<string>getter /Action<string>setter 闭包识别Overworld.Goto<OuiModOptionString>(),第一次按到的字符串按钮直接换成本输入层,之后也会显示为行内文本框SettingMaxLength/SettingMinLength4. 键位配置界面被盖住(
MaterialModOptions+MaterialAcrylicRenderer+QolSettingsOverlay)KeyboardConfigUI/ButtonConfigUI:有就关闭 acrylic、把设置页放到它们后面(Depth),并停止设置页自己的输入处理,让配置界面正常聚焦 / 改键QolSettingsOverlay在打开键位配置时同样清空触屏目标(该页原本就会隐藏自己)改了哪些文件
Source/TextEntryOverlay.csSource/IMaterialAcrylicPage.csAllowsAcrylicSource/MaterialAcrylicRenderer.csSource/MaterialModOptions.csSource/MaterialChapterSelect.cs/Source/QolSettingsOverlay.csAllowsAcrylic,后者清空弹层期间的触屏目标验证
dotnet build Source/MicroblocksQolUtils.csproj:0 error / 0 warning(Everest stable lib-stripped)dotnet run --project Tests/Capture/Capture.csproj:PASS(未涉及的部分回归)手工验证步骤
123/#+=/ABC切页,shift 切大写,长按空格连打,退格删字,接受保存。回到列表确认值已更新,退出再进设置页确认已持久化;把内容删空后接受应提示无效(下限 1);超过上限后不再追加。
备注
Func<string>+Action<string>),如果某个 mod 写法特殊,会退回 Everest 原生字符串输入页,不会出错。