Make the buttons consistent and rework the player list
Buttons get 12 px of side padding. The top bar buttons, the quiz toolbar and Show answer/Next are laid out in rows with 12 px gaps and are all 36 px tall, and the ±1 buttons use a compact StepButton style. "Randomize new track" is now "Next song". Player rows show the name and the score apart, alternate like the other lists and highlight the character under the mouse. The name field is a LineEdit with a 10-letter limit; blank and duplicate names are refused, and a full list says "Up to 7 players". Remove buttons update when editing is switched instead of every frame, and the spacer panels are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e4352a9f34
commit
70e970b24c
39 files changed
+2054
-2177
No files matched your search
+21
-11
@@ -1,5 +1,7 @@
|
||||
class_name PlayerRow
|
||||
extends Control
|
||||
extends PanelContainer
|
||||
## One player in the player list: their name, points and character, and buttons for
|
||||
## giving and taking points. Clicking the character picks another one.
|
||||
|
||||
signal change_character_clicked
|
||||
signal player_removed
|
||||
@@ -12,6 +14,8 @@ var player_object: PlayerObject
|
||||
var list_index: int
|
||||
|
||||
@onready var player_name_field: Label = %Name
|
||||
@onready var score_label: Label = %Score
|
||||
@onready var character_frame: PanelContainer = %CharacterFrame
|
||||
@onready var add_button: Button = %AddPoint
|
||||
@onready var minus_button: Button = %RemovePoint
|
||||
@onready var character: TextureButton = %Character
|
||||
@@ -25,12 +29,20 @@ func _ready() -> void:
|
||||
minus_button.set_shortcut(create_button_shortcut(list_index, true))
|
||||
character.pressed.connect(change_character)
|
||||
remove_player.pressed.connect(func() -> void: player_removed.emit())
|
||||
character.mouse_entered.connect(_set_character_hovered.bind(true))
|
||||
character.mouse_exited.connect(_set_character_hovered.bind(false))
|
||||
# Rows take turns being lighter and darker, like the other lists
|
||||
theme_type_variation = &"ListRowOdd" if list_index % 2 == 1 else &"ListRowEven"
|
||||
player_name_field.text = player_object.player_name
|
||||
player_name_field.tooltip_text = player_object.player_name
|
||||
set_editing(Settings.edit_players)
|
||||
update_score()
|
||||
set_player_character()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
remove_player.visible = Settings.edit_players
|
||||
## Shows the button that removes the player while the player list is being edited.
|
||||
func set_editing(editing: bool) -> void:
|
||||
remove_player.visible = editing
|
||||
|
||||
|
||||
func create_button_shortcut(index: int, ctrl_pressed: bool) -> Shortcut:
|
||||
@@ -64,15 +76,13 @@ func new_character_selected(character_texture: Texture, character_name: String)
|
||||
|
||||
|
||||
func set_player_character() -> void:
|
||||
character.custom_minimum_size = Vector2(80, 40)
|
||||
character.ignore_texture_size = true
|
||||
character.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT_CENTERED
|
||||
character.texture_normal = player_object.character
|
||||
|
||||
|
||||
func update_score() -> void:
|
||||
if OS.has_feature("debug"):
|
||||
player_name_field.text = "%d %s: %d" % [list_index + 1, player_object.player_name,
|
||||
player_object.player_score]
|
||||
else:
|
||||
player_name_field.text = player_object.player_name + ": " + str(player_object.player_score)
|
||||
score_label.text = str(player_object.player_score)
|
||||
|
||||
|
||||
func _set_character_hovered(hovered: bool) -> void:
|
||||
character_frame.theme_type_variation = &"PlayerCharacterHover" if hovered \
|
||||
else &"PlayerCharacter"
|
||||
Reference in new issue
Block a user