From 3897301a0d31dc531a4763cf63eaaf271666f5c4 Mon Sep 17 00:00:00 2001 From: jhaizhou <258432107+jhaizhou-ops@users.noreply.github.com> Date: Tue, 13 Oct 2026 10:57:13 +0800 Subject: [PATCH] =?UTF-8?q?Custom=20page:=20language=20is=20now=20two=20ex?= =?UTF-8?q?plicit=20choices,=20=E4=B8=AD=E6=96=87=20/=20English=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The single "Language: English" checkbox becomes two side-by-side options, readable in both UIs, with a hint under the row in the chosen language: tap Apply, then close and reopen the app. Storage is unchanged (still one key). Suggested in #12. --- dm/host/dm_cursor.c | 3 ++- dm/host/dm_custom.c | 21 +++++++++++++++------ dm/host/dm_i18n_tab.h | 7 +++++-- dm/i18n/ui_text.tsv | 7 +++++-- dm/ios/tools/dm_i18n.py | 8 +++++--- dm/ios/tools/touch_layout.py | 28 ++++++++++++++++++++++++---- 6 files changed, 56 insertions(+), 18 deletions(-) diff --git a/dm/host/dm_cursor.c b/dm/host/dm_cursor.c index 89be352..f48eebc 100644 --- a/dm/host/dm_cursor.c +++ b/dm/host/dm_cursor.c @@ -1017,7 +1017,8 @@ static int ui_classify(module_t *m, uint64_t root, int x, int y, char *hit, size // The settings page covers the pause menu, yet the pause menu's buttons still receive clicks (the game's dispatch does not look at who is on top): on a pause menu button and not on a clickable widget of the settings page = covered, do not click (same as "on a button covered by an upper panel"). // Previously, while the settings page was open the whole pause menu layer was set invisible and written back on close - that is writing to the original game's widgets, violating the no-writes-to-original-widgets rule; changed to blocking here only on a hit { uint64_t st = ui_panel(root, "SettingsPanel"), xy = (uint64_t)(uint32_t)x | ((uint64_t)(uint32_t)y << 32); - if (st && *(uint8_t *)(st + 0x50) && !click_walk(st, xy, 1, (uint64_t)m->base)) { // 设置页自己可点的控件照常;点在它的底板 / 列表空处时,游戏会把这一下交给底下的暂停菜单按钮 | The settings page's own clickable widgets work as usual; when the tap is on its backing / empty list space, the game would hand this tap to the pause menu button underneath + uint64_t cp = ui_panel(root, "VideoOptionsPanel"); // 自定义页(借的视频页)与设置页并列、不是它的子控件:这一页上的勾选框也算「设置页自己可点的控件」(语言行的「中文」那格正落在暂停菜单按钮的位置上) | The Custom page (the borrowed video page) sits beside the settings page and is not its child: checkboxes on this page also count as "controls of the settings page itself that can be tapped" (the 「中文」 box of the language row lands exactly where the pause menu button is) + if (st && *(uint8_t *)(st + 0x50) && !click_walk(st, xy, 1, (uint64_t)m->base) && !(cp && *(uint8_t *)(cp + 0x50) && click_walk(cp, xy, 1, (uint64_t)m->base))) { // 设置页自己可点的控件照常;点在它的底板 / 列表空处时,游戏会把这一下交给底下的暂停菜单按钮 | The settings page's own clickable widgets work as usual; when the tap is on its backing / empty list space, the game would hand this tap to the pause menu button underneath static const char *const pl[] = { "PauseLayoutGarden", "PauseLayout" }; for (int i = 0; i < 2; i++) { uint64_t pw = ui_panel(root, pl[i]); if (pw && *(uint8_t *)(pw + 0x50) && click_walk(pw, xy, 1, (uint64_t)m->base)) { snprintf(hit, hn, "设置页盖着的暂停菜单按钮(不点,可滚)"); return 11; } /* 11:这一下不点下去,但从这里起手上下拖照常滚设置页的列表(自定义页各行的文字不是可点控件,玩家多半就在文字上滑) | 11: this tap is not pressed down, but a vertical drag starting here still scrolls the settings page list as usual (the text of the rows on the Custom page is not a clickable widget, and players mostly swipe right on the text) */ } } } const char *mn = ""; uint64_t mp = modal_top(m, root, &mn); diff --git a/dm/host/dm_custom.c b/dm/host/dm_custom.c index f10ef79..abd2579 100644 --- a/dm/host/dm_custom.c +++ b/dm/host/dm_custom.c @@ -132,7 +132,10 @@ void dm_custom_ui_pump(unsigned long long root) { if (pad) { uint64_t ev = dm_padmode_page_keys(DM_BTN_UP | DM_BTN_DOWN | DM_BTN_A); if (ev & DM_BTN_DOWN) sel = sel + 1 < NK ? sel + 1 : sel; else if (ev & DM_BTN_UP) sel = sel > 0 ? sel - 1 : 0; snprintf(nm, sizeof nm, "TouchCustom_%s", k_keys[sel]); cw = find_w(sp, nm, 0); snprintf(nm, sizeof nm, "TouchCustom_%s_Text", k_keys[sel]); tw = find_w(sp, nm, 0); - if ((ev & DM_BTN_A) && cw && seen[sel] == cw) set_toggle(cw, !TOGGLED(cw)); } + if ((ev & DM_BTN_A) && cw && seen[sel] == cw) { + if (sel == 0) { int p0 = atomic_load(&g_pend[0]), sh = p0 >= 0 ? p0 : atomic_load(&g_val[0]); atomic_store(&g_pend[0], !sh); set_toggle(cw, !sh); { uint64_t z = find_w(sp, "TouchCustom_lang_zh", 0); if (z) set_toggle(z, sh); } // 语言行是单选的两项:两个框当场摆好(只改待定值的话,下面读框状态会把没跟上的框当成玩家点的) | The language row is a single choice between two items: both boxes are set on the spot (if only the pending value were changed, the code below that reads the box states would take the box that has not caught up as a player tap) + LOG("自定义设置:语言 → %s(手柄 A 在两项间切换;点「应用」生效)", !sh ? "English" : "中文"); } + else set_toggle(cw, !TOGGLED(cw)); } } if (dm) { int32_t *r = (int32_t *)(dm + 0x70), want[4] = { 99999, 0, r[2], r[3] }; /* 不用时只把 x 挪出屏:它在滚动区里,y 放远了会撑大可滚范围 | when unused only x is moved off screen: it is inside the scroll area, and a far-away y would enlarge the scrollable range */ if (dm_padmode_current() && tw && cw) { int32_t *t = (int32_t *)(tw + 0x70), *c = (int32_t *)(cw + 0x70); int top = t[1] < c[1] ? t[1] : c[1], bot = t[1] + t[3] > c[1] + c[3] ? t[1] + t[3] : c[1] + c[3]; // 框住整行:文字与勾选框两者的上下沿取并,再各放 10 单位(原先只按文字框的高度算,文字框比字矮,框成了横穿文字中线的一条) | Frame the whole row: take the union of the top and bottom edges of the text and the checkbox, then pad 10 units on each side (previously computed from the text box height only; the text box is shorter than the glyphs, so the frame became a strip cutting across the middle of the text) want[0] = t[0] - 30; want[1] = top - 10; want[2] = c[0] + c[2] + 30 - want[0]; want[3] = bot - top + 20; @@ -149,13 +152,19 @@ void dm_custom_ui_pump(unsigned long long root) { for (int i = 0; i < NK; i++) { char nm[48]; snprintf(nm, sizeof nm, "TouchCustom_%s", k_keys[i]); uint64_t w = find_w(sp, nm, 0); if (!w || !*(uint8_t *)(w + 0x50)) continue; int pd0 = atomic_load(&g_pend[i]), want = pd0 >= 0 ? pd0 : atomic_load(&g_val[i]); - if (seen[i] != w) { seen[i] = w; set_toggle(w, want); continue; } // 页刚出现(布局里一律是没勾):先摆成该显示的值,这一帧不当玩家点了 | The page has just appeared (in the layout everything is unchecked): first set it to the value it should show, and do not treat this frame as a player tap + uint64_t z = i == 0 ? find_w(sp, "TouchCustom_lang_zh", 0) : 0; // 语言行:并排的「中文」「English」两个勾选框,单选——存的仍是 lang_en 一个键,「中文」那格是它的反面 | Language row: two checkboxes side by side, 「中文」 and "English", single choice -- what is stored is still the one key lang_en, and the 「中文」 box is its opposite + if (seen[i] != w) { seen[i] = w; set_toggle(w, want); if (z) set_toggle(z, !want); continue; } // 页刚出现(布局里一律是没勾):先摆成该显示的值,这一帧不当玩家点了 | The page has just appeared (in the layout everything is unchecked): first set it to the value it should show, and do not treat this frame as a player tap int on = TOGGLED(w), pd = atomic_load(&g_pend[i]), shown = pd >= 0 ? pd : atomic_load(&g_val[i]); + if (i == 0 && z) { // 点没选中的那一项 = 选它;点已选中的那一项不变(摆回勾上) | Tapping the item that is not selected = select it; tapping the one already selected changes nothing (it is put back to checked) + int zon = TOGGLED(z), to = on != shown ? (on ? 1 : shown) : zon != !shown ? (zon ? 0 : shown) : shown; + if (to != shown) { atomic_store(&g_pend[0], to); LOG("自定义设置:语言 → %s(点「应用」生效)", to ? "English" : "中文"); } + if (TOGGLED(w) != to) set_toggle(w, to); if (TOGGLED(z) != !to) set_toggle(z, !to); continue; } if (on != shown) { atomic_store(&g_pend[i], on); LOG("自定义设置:%s 勾选框 → %s(点「应用」生效)", k_keys[i], on ? "勾上" : "取消"); } } - // 语言那一格下面的「重启游戏后生效」提示(TouchCustomLangHint,布局里先放在屏外):勾选框此刻显示的值与正在跑的语言不一致时挪到标签正下方(横坐标取标签的) - // The 「重启游戏后生效」(Takes effect after restarting the game) hint under the language cell (TouchCustomLangHint, initially placed off-screen in the layout): when the value the checkbox currently shows differs from the running language it is moved directly below the label (x taken from the label) - { uint64_t hw = find_w(sp, "TouchCustomLangHint", 0), lw = find_w(sp, "TouchCustom_lang_en_Text", 0); - if (hw && lw) { int pd = atomic_load(&g_pend[0]), shown = pd >= 0 ? pd : atomic_load(&g_val[0]), x = shown != !dm_lang_zh() ? ((int32_t *)(lw + 0x70))[0] : 99999; int32_t *r = (int32_t *)(hw + 0x70); + // 语言那一行下面的「点应用后把 App 关掉重开」提示(TouchCustomLangHint,布局里先放在屏外):勾选框此刻显示的值与正在跑的语言不一致时挪到标签正下方(横坐标取标签的) + // The "tap Apply, then close and reopen the app" hint under the language row (TouchCustomLangHint, placed off screen in the layout): moved right under the label (taking the label's x) when the value the checkboxes currently show differs from the language now running + { uint64_t lw = find_w(sp, "TouchCustom_lang_en_Text", 0); int pd = atomic_load(&g_pend[0]), shown = pd >= 0 ? pd : atomic_load(&g_val[0]), diff = shown != !dm_lang_zh(); + for (int k = 0; k < 2 && lw; k++) { uint64_t hw = find_w(sp, k ? "TouchCustomLangHintEn" : "TouchCustomLangHintZh", 0); if (!hw) continue; // 提示用「选中的那种语言」写:选了中文显示中文那句,选了 English 显示英文那句 | The hint is written in "the language that was chosen": choosing 中文 shows the Chinese sentence, choosing English shows the English one + int x = diff && shown == k ? ((int32_t *)(lw + 0x70))[0] : 99999; int32_t *r = (int32_t *)(hw + 0x70); if (r[0] != x) { r[0] = x; ((void (*)(uint64_t))*(uint64_t *)(*(uint64_t *)hw + 0x10))(hw); } } } // 「应用 / 放弃」亮不亮(自定义页改了勾选,「应用」仍是灰的):原版各选项子页的每帧更新 main+0xae5f28 把自己 +0x1a0「有未应用的改动」 // 交给 main+0xaed9e4(设置页, 亮否),按钮 +0x57a 是灰的标志;原版的勾选框一改就由面板置 +0x1a0,我们的勾选框原版面板不认识,这一位一直是 0。 diff --git a/dm/host/dm_i18n_tab.h b/dm/host/dm_i18n_tab.h index da4764d..59c5e8d 100644 --- a/dm/host/dm_i18n_tab.h +++ b/dm/host/dm_i18n_tab.h @@ -79,8 +79,11 @@ static const struct { const char *k, *zh, *en; } k_dm_i18n[] = { { "dmCustomEcoFps", "省电模式(30 帧)", "Power saver (30 fps)" }, { "dmCustomLootFilter", "掉落过滤(噩梦起自动隐藏杂物)", "Loot Filter (auto, Nightmare+)" }, { "dmCustomAutoBuff", "自动补上增益技能(站着不动时)", "Auto-recast buffs when idle" }, - { "dmCustomLangEn", "语言 / Language:English", "Language: English" }, - { "dmCustomLangHint", "重启游戏后生效 / Restart to apply", "Restart to apply" }, + { "dmCustomLang", "语言 / Language", "语言 / Language" }, + { "dmCustomLangZh", "中文", "中文" }, + { "dmCustomLangEnOpt", "English", "English" }, + { "dmCustomLangHintZh", "点「应用」,然后把 App 关掉重开", "点「应用」,然后把 App 关掉重开" }, + { "dmCustomLangHintEn", "Tap Apply, then close and reopen the app", "Tap Apply, then close and reopen the app" }, { "dmTabGameSettings", "游戏设定", "Settings" }, { "dmVaultPart0", "头盔", "Helms" }, { "dmVaultPart1", "盔甲", "Armor" }, diff --git a/dm/i18n/ui_text.tsv b/dm/i18n/ui_text.tsv index 84f2dff..eead8b6 100644 --- a/dm/i18n/ui_text.tsv +++ b/dm/i18n/ui_text.tsv @@ -77,8 +77,11 @@ dmCustomStoreBtn 背包「存放」按钮 Inventory Deposit button 自定义页 dmCustomEcoFps 省电模式(30 帧) Power saver (30 fps) 自定义页开关 dmCustomLootFilter 掉落过滤(噩梦起自动隐藏杂物) Loot Filter (auto, Nightmare+) 自定义页开关;Loot Filter 是原版过滤器的英文名 dmCustomAutoBuff 自动补上增益技能(站着不动时) Auto-recast buffs when idle 自定义页开关 -dmCustomLangEn 语言 / Language:English Language: English 自定义页标题行右侧的语言开关(中文界面写中英两个词;英文界面的字体没有汉字,只写英文——English 这个词两种界面下都认得;勾上 = 英文界面 + 英文语音) -dmCustomLangHint 重启游戏后生效 / Restart to apply Restart to apply 语言开关勾选与当前语言不一致时显示在它下面 +dmCustomLang 语言 / Language 语言 / Language 自定义页语言那一行的标签。两种界面写同样的中英两个词:这一行的文字控件指定原版的全球字体 BlizzardGlobal(英文界面缺省的 Formal 字体没有汉字,全球字体有;原版标题页、队伍名、合规提示同样按控件指定它) +dmCustomLangZh 中文 中文 语言行的选项一(两种界面都写「中文」,同上用全球字体) +dmCustomLangEnOpt English English 语言行的选项二 +dmCustomLangHintZh 点「应用」,然后把 App 关掉重开 点「应用」,然后把 App 关掉重开 语言行选了「中文」而当前不是中文界面时显示在这一行下半(提示用选中的那种语言写;两种界面同文,全球字体) +dmCustomLangHintEn Tap Apply, then close and reopen the app Tap Apply, then close and reopen the app 语言行选了 English 而当前不是英文界面时显示 dmTabGameSettings 游戏设定 Settings 触屏设置页第三个子页签(原版英文 Game Settings 放不进页签;中文取原版串原文) dmVaultPart0 头盔 Helms 编年史暗金页部位页签(wide_stash.py) dmVaultPart1 盔甲 Armor 编年史暗金页部位页签(wide_stash.py) diff --git a/dm/ios/tools/dm_i18n.py b/dm/ios/tools/dm_i18n.py index dfcbd8d..761cac0 100644 --- a/dm/ios/tools/dm_i18n.py +++ b/dm/ios/tools/dm_i18n.py @@ -38,15 +38,17 @@ EN_LIMITS = ( (r'dmKbRiftUnlock', 9), (r'dmKbRift(Best|Total)', 16), ) # 键只许字母数字:布局里「@键」的解析遇到 _ 就断(@dmCustom_auto_mana 显示成「丢失字符串_auto_mana」,Mac 上的 iOS 包实测) -# Keys may contain only letters and digits: parsing of "@key" in layouts stops at _ (@dmCustom_auto_mana is displayed as "_auto_mana", -# measured on the iOS app on Mac) +# 英文界面下也要写汉字的键(自定义页语言那一行:切错语言的人得看得懂)。只许用在指定了全球字体 BlizzardGlobal 的文字控件上——英文界面缺省字体没有汉字 +# Keys may only contain letters and digits: the layout's "@key" parsing stops at _ (@dmCustom_auto_mana was shown as "missing string_auto_mana", measured in the iOS package on a Mac) +# Keys that must show Chinese characters in the English UI as well (the language row of the Custom page: someone who switched to the wrong language has to be able to read it). Only allowed on text controls that specify the global font BlizzardGlobal -- the default font of the English UI has no Chinese characters +EN_HAS_ZH = {'dmCustomLang', 'dmCustomLangZh', 'dmCustomLangHintZh'} def rows(): out = [] with open(TABLE, encoding='utf-8') as f: for r in csv.DictReader(f, delimiter='\t'): k, zh, en = r['键'], r['中文'].replace('\\n', '\n'), r['English'].replace('\\n', '\n') if not re.fullmatch(r'dm[A-Za-z0-9]+', k) or not zh or not en: raise SystemExit('dm_i18n:表里这一行不对:%r' % r) - if re.search(r'[ -鿿＀-￯]', re.sub(PROPER, '', en)): raise SystemExit('dm_i18n:%s 的英文里有中文字符:%r' % (k, en)) + if k not in EN_HAS_ZH and re.search(r'[ -鿿＀-￯]', re.sub(PROPER, '', en)): raise SystemExit('dm_i18n:%s 的英文里有中文字符:%r' % (k, en)) if FMT.findall(zh) != FMT.findall(en): raise SystemExit('dm_i18n:%s 的中英占位符不一致:%s / %s' % (k, FMT.findall(zh), FMT.findall(en))) lim = next((n for pat, n in EN_LIMITS if re.fullmatch(pat, k)), None) # 英文字数闸(见 EN_LIMITS) | English length gate (see EN_LIMITS) if lim is not None and len(FMT.sub('000', en).split('\n')[0]) > lim: raise SystemExit('dm_i18n:%s 的英文「%s」%d 个字符,超过这一栏的上限 %d(会顶框 / 被截断;压短,或给这一栏做英文专用的小字号控件后再改上限)' % (k, en, len(FMT.sub('000', en)), lim)) diff --git a/dm/ios/tools/touch_layout.py b/dm/ios/tools/touch_layout.py index 83a507a..b30751f 100644 --- a/dm/ios/tools/touch_layout.py +++ b/dm/ios/tools/touch_layout.py @@ -1190,7 +1190,7 @@ _CUSTOM_ROWS = tuple((k, '@' + _custom_key(k)) for k in _CUSTOM_KEYS) # Dimensions are taken from the values the table lays out in the same widget tree: row height 180; text 1000×180; checkbox at x 1315 within the row, 70×70, vertically centered. Header row 180 (the gold divider line below it is placed for a 180 row height). # The first row is the language switch (also first in the host's key table), followed by the rows of _CUSTOM_KEYS; adding a row = adding a key to _CUSTOM_KEYS (and to k_keys in the host's dm_custom.c in the same order) _CUSTOM_TITLE_H, _CUSTOM_LINE_H = 180, 180 -_CUSTOM_ALL = (('lang_en', '@dmCustomLangEn'),) + _CUSTOM_ROWS +_CUSTOM_ALL = (('lang_en', '@dmCustomLang'),) + _CUSTOM_ROWS _CUSTOM_TEST_ROWS = int(os.environ.get('DM_CUSTOM_TEST_ROWS', '0')) # 测试(造现场):末尾多摆这么多行假行,验更多行时的滚动;产品不设 | test (test setup): append this many dummy rows at the end, to verify scrolling with more rows; not set in the product _CUSTOM_Y = [_CUSTOM_TITLE_H + _CUSTOM_LINE_H * i for i in range(len(_CUSTOM_ALL) + _CUSTOM_TEST_ROWS)] _CUSTOM_H = _CUSTOM_TITLE_H + _CUSTOM_LINE_H * (len(_CUSTOM_ALL) + _CUSTOM_TEST_ROWS) @@ -1208,8 +1208,28 @@ def _custom_toggle_row(i, key, label): # 「重启游戏后生效」那句先放在屏外,勾选与当前语言不一致时宿主挪到这一行文字的下半(横坐标取标签的) # Language switch (first row, an ordinary row): checked = English UI + English voice, effective at the next launch (lang_en in the host's dm_custom.c, settings_lang_apply in hle_fs.c). # The line 「重启游戏后生效」(Takes effect after restarting the game) is first placed off screen; when the checkbox does not match the current language the host moves it to the lower half of this row's text (x taken from the label) -_CUSTOM_LANG_HINT = (' { "type": "TextBoxWidget", "name": "TouchCustomLangHint", "fields": { "rect": { "x": 99999, "y": %d, "width": 1000, "height": 60 }, "text": "@dmCustomLangHint", "style": "$StyleSettingsText" } },\n' - % (_CUSTOM_Y[0] + 112)) +_CUSTOM_LANG_HINT = ''.join(' { "type": "TextBoxWidget", "name": "TouchCustomLangHint%s", "fields": { "rect": { "x": 99999, "y": %d, "width": 1400, "height": 60 }, "text": "@dmCustomLangHint%s", "style": "$StyleSettingsText", "style/fontFace": "BlizzardGlobal" } },\n' + % (n, _CUSTOM_Y[0] + 112, n) for n in ('Zh', 'En')) # 两句各一个控件,宿主按选中的语言摆其中一句 | One control per sentence; the host places one of them according to the chosen language +# 语言那一行是并排的两个选项「中文 / English」(单选:宿主 dm_custom.c 让两个勾选框互斥,存的仍是 lang_en 一个键)。 +# 这一行的字两种界面都要写汉字:英文界面缺省的 Formal 字体没有汉字(缺字画不出),所以这几个文字控件指定原版的全球字体 BlizzardGlobal +# (原版标题页、队伍名等同样按控件指定它)。English 的勾选框留在各行勾选框那一列,「中文」的在它左边 +# The language row is two options side by side, 「中文 / English」 (single choice: the host dm_custom.c makes the two checkboxes mutually exclusive, and what is stored is still the one key lang_en). +# The text of this row has to show Chinese characters in both UIs: the default Formal font of the English UI has no Chinese characters (missing glyphs cannot be drawn), so these text controls specify the original global font BlizzardGlobal +# (the original title page, party names and so on specify it per control in the same way). The checkbox of English stays in the column where every row has its checkbox; the one of 「中文」 is to its left +_LANG_ZH_X, _LANG_EN_X = (770, 905), (1100, 1315) # (文字 x,勾选框 x) | (text x, checkbox x) +def _custom_lang_row(): + y, h = _CUSTOM_Y[0], 112; cy = y + (h - 70) // 2 # 标签、两个选项排在这一行的上 112,下面 68 留给提示那一句 | The label and the two options go in the top 112 of this row; the bottom 68 is left for the hint sentence + def text(name, x, w, key): return (' { "type": "TextBoxWidget", "name": "%s", "fields": { "rect": { "x": %d, "y": %d, "width": %d, "height": %d }, "text": "@%s", "style": "$StyleSettingsText", "style/fontFace": "BlizzardGlobal" } },\n' % (name, x, y, w, h, key)) + def box(name, x): return (' { "type": "ToggleButtonWidget", "name": "%s", "fields": {\n' + ' "rect": { "x": %d, "y": %d, "width": 70, "height": 70 }, "sound": "cursor_menu_select_hd",\n' + ' "focusIndicatorPadding": "$OptionsToggleFocusIndicatorPadding", "focusIndicatorFilename": "$OptionsToggleFocusIndicatorFilename", "focusIndicatorOffset": { "x": 0, "y": -4 },\n' + ' "filename": "Lobby\\\\CreateGame\\\\CreateGame_AdvancedCheckbox",\n' + ' "untoggledFrame": 0, "untoggledPressedFrame": 1, "untoggledHoveredFrame": 3, "untoggledDisabledFrame": 2,\n' + ' "toggledFrame": 4, "toggledPressedFrame": 5, "toggledHoveredFrame": 6,\n' + ' "onClickMessage": "PanelManager:ClosePanel:%s" } },\n') % (name, x, cy, name) + return (text('TouchCustom_lang_en_Text', 0, 700, 'dmCustomLang') + + text('TouchCustomLangZh_Text', _LANG_ZH_X[0], _LANG_ZH_X[1] - _LANG_ZH_X[0] - 10, 'dmCustomLangZh') + box('TouchCustom_lang_zh', _LANG_ZH_X[1]) + + text('TouchCustomLangEn_Text', _LANG_EN_X[0], _LANG_EN_X[1] - _LANG_EN_X[0] - 10, 'dmCustomLangEnOpt') + box('TouchCustom_lang_en', _LANG_EN_X[1])) def _custom_page(text): if '"name": "VideoOptionsPanel"' not in text or '"name": "OptionsTable"' not in text: raise SystemExit('touch_layout:主机版视频页不是原样(原版布局变了?),自定义页没换') title = ('{ "type": "TableRowWidget", "name": "Row TouchCustomTitle", "children": [\n' @@ -1223,7 +1243,7 @@ def _custom_page(text): ' { "type": "TableWidget", "name": "OptionsTable", "fields": { "columns": [ "$OptionsTableColumn1", "$OptionsTableColumn2" ], "rowHeight": %d }, "children": [\n' % _CUSTOM_TITLE_H + title + ' ] },\n' + ' { "type": "Widget", "name": "TouchCustomRows", "fields": { "rect": { "x": 0, "y": 0, "width": 1500, "height": %d } }, "children": [\n' % _CUSTOM_H - + ''.join(_custom_toggle_row(i, k, l) for i, (k, l) in enumerate(_CUSTOM_ALL)) + _CUSTOM_LANG_HINT + + _custom_lang_row() + ''.join(_custom_toggle_row(i, k, l) for i, (k, l) in enumerate(_CUSTOM_ALL) if i) + _CUSTOM_LANG_HINT + ''.join(' { "type": "TextBoxWidget", "name": "TouchCustomTest%d_Text", "fields": { "rect": { "x": 0, "y": %d, "width": 1000, "height": %d }, "text": "@KeyBindingTypeCustom", "style": "$StyleSettingsText" } },\n' % (n, _CUSTOM_Y[len(_CUSTOM_ALL) + n], _CUSTOM_LINE_H) for n in range(_CUSTOM_TEST_ROWS)) + # 手柄模式的选中框(同符文之语清单 TouchRwSel):框住十字键选中的那一行,宿主摆(dm_custom.c);触屏模式一直在屏外(只把 x 挪出去、y 留在内容范围内:滚动区按子控件的范围算内容高度,y 放到 99999 会把可滚范围撑到十万)。和各行在同一个容器里,跟着滚