dan select: no 自己ベスト row when there is no best #67

Merged
GanYiZhong merged 1 commits from GanYiZhong/YataiDONNijiiro:fix/dan-select-best-empty into main 2026-10-14 15:49:50 +02:00
4 changed files with 23 additions and 18 deletions

No files matched your search

Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -209,5 +209,6 @@
"x": 538,
"y": 287
},
"exam_best_pill": {}
"exam_best_pill": {},
"exam_gauge_best_pill": {}
}
+16 -15
View File
@@ -410,11 +410,12 @@ function DanSelect:draw_cursor(pos, now_ms, moved_ms)
end
-- Each exam's 自己ベスト row, as on the cabinet: a white pill under the value with the label
-- on its left and the saved best on its right (box:exam_best / exam_song_best; an engine
-- without them, or a course never played, shows the label alone). The gauge box's pill is
-- part of exam_gauge_box; the right-hand boxes get yellow_box/exam_best_pill, one per song
-- segment. The boxes are walked as the parent's draw_exam_grid walks them.
local BEST_GAUGE = { x = 10, y = 116, w = 301 } -- the pill in exam_gauge_box, from the box
-- on its left and the saved best on its right (box:exam_best / exam_song_best). With no best
-- (a course never played, or an engine without them) the row is not drawn at all, pill
-- included. The gauge box gets yellow_box/exam_gauge_best_pill, the right-hand boxes
-- yellow_box/exam_best_pill, one per song segment. The boxes are walked as the parent's
-- draw_exam_grid walks them.
local BEST_GAUGE = { x = 10, y = 116, w = 301 } -- exam_gauge_best_pill, from the box
local BEST_RIGHT = { x = 11, y = 86, w = 317 } -- exam_best_pill, from the box (+ seg dx)
local BEST_H = 31
local BEST_LABEL_X, BEST_VALUE_R = 8, 14 -- label from the pill's left, value from its right
@@ -438,17 +439,17 @@ local function call(box, name, ...)
return ok2 and v or nil
end
local function draw_best_row(box, value, etype, px, py, pw, f)
local function draw_best_row(pill, value, etype, px, py, pw, f)
if value == nil then return end
if pill then tex.draw_texture(pill, { x = px, y = py, fade = f }) end
local label = best_text("dan_exam_best_label", tex.skin_text("dan_exam_best_label"))
if label then
label:draw({ x = px + BEST_LABEL_X, y = py + (BEST_H - label.height) / 2, fade = f })
end
if value then
local str = tostring(value) .. (etype == "gauge" and " %" or "")
local t = best_text("dan_exam_best_value", str)
if t then
t:draw({ x = px + pw - BEST_VALUE_R - t.width, y = py + (BEST_H - t.height) / 2, fade = f })
end
local str = tostring(value) .. (etype == "gauge" and " %" or "")
local t = best_text("dan_exam_best_value", str)
if t then
t:draw({ x = px + pw - BEST_VALUE_R - t.width, y = py + (BEST_H - t.height) / 2, fade = f })
end
end
@@ -457,6 +458,7 @@ if parent_grid then
function DanSelect:draw_exam_grid(box, f)
parent_grid(self, box, f)
local pill = tex.get_texture("dan_select/yellow_box/exam_best_pill")
local gauge_pill = tex.get_texture("dan_select/yellow_box/exam_gauge_best_pill")
local gb = tex.get_skin_config("dan_exam_gauge_box") or { x = 436, y = 610 }
local sb = tex.get_skin_config("dan_exam_score_box") or { x = 769, y = 610, height = 132 }
local sg = tex.get_skin_config("dan_exam_seg") or { width = 327 }
@@ -468,7 +470,7 @@ if parent_grid then
local left = (etype == "gauge" and not gauge_used)
if left then gauge_used = true end
if left then
draw_best_row(box, call(box, "exam_best", i), etype,
draw_best_row(gauge_pill, call(box, "exam_best", i), etype,
gb.x + BEST_GAUGE.x, gb.y + BEST_GAUGE.y, BEST_GAUGE.w, f)
elseif right_row < 3 then
local by = sb.y + pitch * right_row
@@ -477,9 +479,8 @@ if parent_grid then
for k = 0, segs - 1 do
local px = sb.x + BEST_RIGHT.x + seg_dx * k
local py = by + BEST_RIGHT.y
if pill then tex.draw_texture(pill, { x = px, y = py, fade = f }) end
local v = gothrough and call(box, "exam_best", i) or call(box, "exam_song_best", i, k)
draw_best_row(box, v, etype, px, py, BEST_RIGHT.w, f)
draw_best_row(pill, v, etype, px, py, BEST_RIGHT.w, f)
end
right_row = right_row + 1
end