Fix shield icon rendering, move slot machine to a movable panel

The shield icon's dark/mushy rendering was caused by disabled mipmaps
on all 6 slot-machine icon textures (inherited from the flat lucide
icon convention, wrong for these gradient-heavy assets) - at small
display sizes this caused aliasing that hit the shield's fine detail
(RZ lettering, metallic bevels) hardest since the other icons are
bolder/simpler shapes. Enabling mipmaps/generate on all 6 fixes it;
confirmed by rendering the actual in-game presentation size before
and after, not just eyeballing the source file.

Also converts the slot machine from a full standalone screen (sidebar
nav entry, main.gd-managed) into a movable/draggable floating panel
opened from the question-player toolbar, mirroring the existing
calculator panel exactly: same top_level+custom title-bar-drag+
viewport-clamp mechanics, same open/close/toggle API, instantiated
once alongside the calculator and closed on session hide. Shrunk the
cabinet and restacked the rewards list below it (was beside it) to
fit a toolbox-sized floating panel instead of a full page, wrapped in
a ScrollContainer for any overflow.

Removed the sidebar entry and screens[] registration from main.gd and
the now-dead routing case from navigation_routes.gd.
This commit is contained in:
hz
2026-07-30 05:18:51 -05:00
parent 98518e8d39
commit 94de696af1
12 changed files with 247 additions and 115 deletions
+34 -4
View File
@@ -4,6 +4,7 @@ const Style := preload("res://scripts/ui/ui_style.gd")
const Brand := preload("res://scripts/ui/medmind_style.gd")
const FlashcardPrefillDialog := preload("res://scripts/ui/flashcard_prefill_dialog.gd")
const CalculatorPanel := preload("res://scripts/ui/calculator_panel.gd")
const SlotMachinePanel := preload("res://scripts/ui/rz_slot_machine_screen.gd")
const CreditsBadge := preload("res://scripts/ui/credits_badge.gd")
const CLEAR_HIGHLIGHT_DARK_ICON := preload("res://assets/icons/medmind/clear-highlight-dark.svg")
const CLEAR_HIGHLIGHT_LIGHT_ICON := preload("res://assets/icons/medmind/clear-highlight-light.svg")
@@ -94,6 +95,7 @@ var text_smaller_button: Button
var text_larger_button: Button
var labs_button: Button
var calculator_button: Button
var slot_machine_button: Button
var exit_button: Button
var clear_highlight_button: Button
var flag_button: Button
@@ -127,6 +129,7 @@ var labs_overlay: Control
var labs_panel: PanelContainer
var labs_content: VBoxContainer
var calculator_panel
var slot_machine_panel
var report_overlay: Control
var report_panel: PanelContainer
var report_form_content: VBoxContainer
@@ -347,6 +350,18 @@ func _ready() -> void:
UISoundService.set_button_sound(calculator_button, "open")
calculator_button.pressed.connect(_toggle_calculator)
slot_machine_button = Button.new()
slot_machine_button.name = "SlotMachineButton"
slot_machine_button.tooltip_text = "Open RZ Slot Machine"
slot_machine_button.icon = preload("res://assets/icons/lucide/gem.svg")
slot_machine_button.custom_minimum_size = Vector2(44, 44)
slot_machine_button.add_theme_constant_override("icon_max_width", 22)
slot_machine_button.alignment = HORIZONTAL_ALIGNMENT_CENTER
slot_machine_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
slot_machine_button.focus_mode = Control.FOCUS_NONE
UISoundService.set_button_sound(slot_machine_button, "open")
slot_machine_button.pressed.connect(_toggle_slot_machine)
labs_button = Button.new()
labs_button.tooltip_text = "Review lab results"
labs_button.custom_minimum_size = Vector2(44, 44)
@@ -432,6 +447,7 @@ func _ready() -> void:
question_toolbar.add_child(text_smaller_button)
question_toolbar.add_child(text_larger_button)
question_toolbar.add_child(calculator_button)
question_toolbar.add_child(slot_machine_button)
question_toolbar.add_child(labs_button)
question_toolbar.add_child(clear_highlight_button)
question_toolbar.add_child(flag_button)
@@ -725,6 +741,9 @@ func _ready() -> void:
_build_labs_modal()
calculator_panel = CalculatorPanel.new()
add_child(calculator_panel)
slot_machine_panel = SlotMachinePanel.new()
slot_machine_panel.main = main
add_child(slot_machine_panel)
_build_report_modal()
_build_media_viewer()
resized.connect(_fit_modal_panels)
@@ -810,10 +829,10 @@ func _refresh_responsive_layout() -> void:
header_toolbar_host.reparent(target_parent)
header_toolbar_host.size_flags_horizontal = Control.SIZE_EXPAND_FILL if compact else Control.SIZE_SHRINK_END
question_toolbar.size_flags_horizontal = Control.SIZE_EXPAND_FILL
# 12 bare 44px icon buttons + the wider 92px Feedback button + the ~194px
# rank/ELO + points badge, with 8px gaps between all 14 - anything less
# 13 bare 44px icon buttons + the wider 92px Feedback button + the ~194px
# rank/ELO + points badge, with 8px gaps between all 15 - anything less
# than this wraps onto a second row.
header_toolbar_host.custom_minimum_size.x = 0.0 if compact else 960.0
header_toolbar_host.custom_minimum_size.x = 0.0 if compact else 1020.0
if size.x < 560.0:
nav_palette.columns = 5
else:
@@ -1069,7 +1088,7 @@ func _apply_question_theme() -> void:
var navigator_heading := navigator_popup.find_child("NavigatorHeading", true, false) as Label
if navigator_heading != null:
navigator_heading.add_theme_color_override("font_color", Brand.text_color(dark))
for control in [exit_button, text_smaller_button, text_larger_button, calculator_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]:
for control in [exit_button, text_smaller_button, text_larger_button, calculator_button, slot_machine_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]:
if control == null:
continue
var active: bool = control == bookmark_button and BookmarkService.is_bookmarked(str(BlockSessionService.get_current_question().get("id", "")))
@@ -1085,6 +1104,8 @@ func _apply_question_theme() -> void:
_style_theme_toggle_button(dark)
if calculator_panel != null:
calculator_panel.refresh_theme_controls()
if slot_machine_panel != null:
slot_machine_panel.refresh_theme_controls()
if credits_badge != null:
credits_badge.refresh_theme_controls()
if skip_button != null:
@@ -1135,6 +1156,8 @@ func on_hide() -> void:
if calculator_panel != null:
calculator_panel.close_panel()
calculator_panel.reset_calculation()
if slot_machine_panel != null:
slot_machine_panel.close_panel()
func _save_simulation_current_response() -> void:
@@ -2365,6 +2388,8 @@ func _refresh_toolbar_state() -> void:
bookmark_button.tooltip_text = ("Saved; waiting to sync" if bookmark_pending else "Remove bookmark") if bookmark_value else ("Removal waiting to sync" if bookmark_pending else "Save question")
if calculator_button != null:
calculator_button.visible = true
if slot_machine_button != null:
slot_machine_button.visible = true
_apply_question_theme()
@@ -2373,6 +2398,11 @@ func _toggle_calculator() -> void:
calculator_panel.toggle_panel()
func _toggle_slot_machine() -> void:
if slot_machine_panel != null:
slot_machine_panel.toggle_panel()
func _toggle_bookmark_current_question() -> void:
var question := BlockSessionService.get_current_question()
if not question.is_empty():