Sort the scripts and scenes into folders
main/ holds the main window and top bar, quiz/ the quiz and its parts, player/ the music player, popups/ every popup and what they share, data/ the songs, players, playlist and settings, server/ the MusicServer client, common/ the list row and GameLog, and themes/ the themes and style boxes.
This commit is contained in:
1 parent
a0428e3475
commit
d77b72159d
115 files changed
+94
-84
No files matched your search
@@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
## Writes messages about what the game is doing, for finding problems.
|
||||
##
|
||||
## Registered as the [code]GameLog[/code] autoload. Use [method debug] instead of
|
||||
## [code]print()[/code]: the messages show in debug builds and the editor, and are left
|
||||
## out of released games. Problems the player may notice go through [method warning].
|
||||
|
||||
|
||||
## Prints [param parts] joined together, like [code]print()[/code], in debug builds only.
|
||||
func debug(...parts: Array) -> void:
|
||||
if OS.is_debug_build():
|
||||
print(_join(parts))
|
||||
|
||||
|
||||
## Reports a problem in the editor's debugger and the console, in every build.
|
||||
func warning(...parts: Array) -> void:
|
||||
push_warning(_join(parts))
|
||||
|
||||
|
||||
func _join(parts: Array) -> String:
|
||||
return "".join(parts.map(func(part: Variant) -> String: return str(part)))
|
||||
@@ -0,0 +1 @@
|
||||
uid://c37mlo6svk03q
|
||||
@@ -0,0 +1,59 @@
|
||||
class_name ListRow
|
||||
extends PanelContainer
|
||||
## One item in a list of names, such as the inspiration list or a sync result column.
|
||||
##
|
||||
## Every row has its own background, alternating between two shades, so it is clear
|
||||
## where an item starts even when its text wraps over several lines.
|
||||
|
||||
const EVEN_BACKGROUND: Color = Color(1, 1, 1, 0.05)
|
||||
const ODD_BACKGROUND: Color = Color(1, 1, 1, 0.11)
|
||||
|
||||
static var _even_style: StyleBoxFlat
|
||||
static var _odd_style: StyleBoxFlat
|
||||
|
||||
## The label showing the item's text.
|
||||
var label: Label
|
||||
|
||||
## The item's text.
|
||||
var text: String:
|
||||
|
||||
|
||||
get:
|
||||
return label.text
|
||||
|
||||
|
||||
## Creates the row for item number [param row] (counting from 0) in a list.
|
||||
static func create(
|
||||
item_text: String,
|
||||
row: int,
|
||||
font_size: int,
|
||||
alignment: HorizontalAlignment = HORIZONTAL_ALIGNMENT_LEFT,
|
||||
) -> ListRow:
|
||||
var list_row: ListRow = ListRow.new()
|
||||
list_row.add_theme_stylebox_override("panel", _style(row % 2 != 0))
|
||||
list_row.label = Label.new()
|
||||
list_row.label.add_theme_font_size_override("font_size", font_size)
|
||||
list_row.label.text = item_text
|
||||
list_row.label.horizontal_alignment = alignment
|
||||
list_row.label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
list_row.add_child(list_row.label)
|
||||
return list_row
|
||||
|
||||
|
||||
# Rows share two styles instead of each creating its own
|
||||
static func _style(odd: bool) -> StyleBoxFlat:
|
||||
if _even_style == null:
|
||||
_even_style = _make_style(EVEN_BACKGROUND)
|
||||
_odd_style = _make_style(ODD_BACKGROUND)
|
||||
return _odd_style if odd else _even_style
|
||||
|
||||
|
||||
static func _make_style(background: Color) -> StyleBoxFlat:
|
||||
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||
style.bg_color = background
|
||||
style.set_corner_radius_all(4)
|
||||
style.content_margin_left = 8
|
||||
style.content_margin_right = 8
|
||||
style.content_margin_top = 2
|
||||
style.content_margin_bottom = 2
|
||||
return style
|
||||
@@ -0,0 +1 @@
|
||||
uid://c2o2qunso5n8l
|
||||
Reference in new issue
Block a user