Repository navigation
modoptions: 按设置类型区分开关 / 下拉 / 滑条(修范围项显示下拉、两项 enum 显示开关) - #7
Merged
Dilant merged 7 commits intoOct 24, 2026
Merged
Conversation
Everest models booleans as Option<bool>, integer ranges as Slider and enums as Slider too, so the old option-count heuristic rendered integer ranges as dropdowns and two-value enums as switches. Classify every option into Switch / Dropdown / Range once: bool options are switches, enum-backed or non-numeric Slider/Option<int> values are dropdowns, and consecutive numeric ranges become sliders. Range rows now always use the slider control, dropdown rows open the list, and touch slider targets are only published for real ranges.
- start a slider drag on press and keep updating from the pointer while the button is held (mouse and touch); save settings once on release instead of every step - give range sliders and dropdowns the same 400px control box on the right edge, with the track inset inside it - adapt keyboard steps to the range (about 50 presses end to end) and accelerate x2/x4/x8 after holding a direction for 0.4s/0.8s/1.2s
std-external
force-pushed
the
feat/modoptions-option-controls
branch
from
October 23, 2026 13:43
444c3f9 to
2ca4c46
Compare
…bounce A single direction tap now always moves one minimum step. Holding starts a smooth ramp after 0.45s up to range/12 steps per second (8..160), with A/D as well as the arrow keys/gamepad. Slider changes mark settings dirty and save 0.5s after the last change (paused while dragging or holding), so the save icon appears once instead of once per release; leaving waits for any pending save to finish.
std-external
force-pushed
the
feat/modoptions-option-controls
branch
from
October 24, 2026 02:29
fbf5997 to
19633b5
Compare
Dilant
force-pushed
the
feat/modoptions-option-controls
branch
from
October 24, 2026 05:43
19633b5 to
7ab759a
Compare
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.
问题
模组设置页的控件是按 选项数量 猜的:
option.Options.Count == 2→ 开关option.Options.Count >= 3→ 下拉但 Everest 的类型映射不是这样:
bool→TextMenu.OnOff(Option<bool>,2 项)int+[SettingRange]→TextMenu.Slider(每格一项,可能是 3+ 项)enum→TextMenu.Slider(包括只有 2 个值的 enum)TextMenuExt.IntSlider→ 大范围整数滑条结果:范围数值(≥3 项)被画成下拉;只有两个值的 enum 被画成开关。
类型 → 控件对照
TextMenu.OnOff/Option<bool>TextMenu.Slider且闭包指向 int/float 属性TextMenu.Slider且闭包指向 enum 属性 / enum 数组TextMenu.Slider,看不到闭包属性时Option<int>(手写、非 Slider)Option<string>/ 其它Option<T>TextMenuExt.IntSliderTextMenu.Button/TextMenu.SettingTextMenuExt.SubMenu/OptionSubMenustring设置float/[SettingNumberInput]OuiNumberEntryint无[SettingRange]enum无论 2 项还是多项都走下拉;只有真正 bool 才是开关。滑条手感(键盘步长与保存节流)
Everest.SaveSettings()一次,不会每帧写盘。TextMenu.Slider和TextMenuExt.IntSlider都是 1)。按住超过 0.45s 才开始加速,速率在 1s 内平滑升到range/12(8~160 步/秒);A/D 和方向键、手柄共用同一套计时,轻推就是细调,长按才快。松开立即复位。OptionControlRect(400px、右边界rect.Right - 424),滑条轨道在这个容器内缩进;控件宽度、右边界与下拉完全一致。保存节流(保存图标问题)
Everest.SaveSettings()。Leave/ 暂停菜单收尾会先等正在进行的保存结束(SaveSettingsAfterPending),避免页面被移除后托管协程中断、保存图标停在右下角。实现
OptionSnapshot增加OptionKind(Switch / Dropdown / Range),在TryGetOption里分类一次,渲染、确认、鼠标/触屏、下拉都只看这个 kind。OnValueChange闭包里的PropertyInfo(enum / int);闭包被编译器合并、同时抓到多个属性时退回“值连续 + 标签数字”的判断。手写菜单没有属性时走同一个回退。draggedSlider状态和HandleRangeKeyboard,鼠标拖动与键盘/手柄步进互不影响。触屏 slider 手势只给真正的 Range 发布。改了哪些文件
Source/MaterialModOptions.csOptionKind分类;开关/下拉/滑条渲染与输入按 kind 选中;滑条拖动、宽度统一、键盘自适应步长与加速测试包
19633b5构建的 managed DLL 已替换进 nightly 通用包:https://gofile.io/d/wPf1FEx4MicroblocksQolUtils-7-test.zip,sha25639471c9e4657760f6c89ae12b1a9111c0a5b137c94693f13cf5a728a1c21b387,md5474b60be84140b81d3c3271d5983c11a。everest.yaml+Code/+Dialog/,三平台 native/FFmpeg runtime 沿用 nightly;只替换了Code/MicroblocksQolUtils.dll(modoptions: 按设置类型区分开关 / 下拉 / 滑条(修范围项显示下拉、两项 enum 显示开关) #7 仅 managed UI 改动)。验证
自动化已过
dotnet build Source/MicroblocksQolUtils.csproj:0 error / 0 warningdotnet run --project Tests/Capture/Capture.csproj:PASSOptionControlRect同宽同右边界;slider 轨道完整落在控件内SettingsSaveDebounce:0.4s 不触发、0.5s 触发一次;拖动/按住阻塞;保存中阻塞;保存结束后可再次触发;新的修改会重置计时实机手测清单
Mods/,打开 Mod Options → 找一个 200~2000 的范围项:单按方向键只变 1;按住 0.45s 后平滑加速;A/D 也能轻推;当前值文本准确。TextMenuExt.IntSlider正常。Option<int>→ Range、文字Option<int>→ Dropdown、Option<string>→ Dropdown、OnOff→ Switch。TextMenuExt.IntSlider正常。