Name popups *Popup and give scripts, scenes and classes matching names
Every popup is now called *Popup instead of *Window in its file, root node, node name, class and variable, and PopupWindow becomes BasePopup. Player is PlayerRow, SongListObject is SongRow and Character is CharacterCard. Script files are snake_case and scene files PascalCase, each matching its class or root node, and LightGrayTheme.tres is light_gray_theme.tres.
This commit is contained in:
1 parent
b7d67b573e
commit
390da577d7
78 files changed
+281
-258
No files matched your search
@@ -10,33 +10,53 @@ extends GdUnitTestSuite
|
||||
|
||||
const BASELINE_PATH: String = "res://tests/data/layout_baseline.json"
|
||||
|
||||
## Nodes that moved from the main window into the Quiz scene, by their old name.
|
||||
const QUIZ_NODES: Array[String] = [
|
||||
"Open", "FileDialog", "MusicListPanel", "DebugLabel", "SettingsWindow",
|
||||
"NewCharacterSelect", "WinnerWindow",
|
||||
]
|
||||
|
||||
## Nodes that moved into the Quiz scene under another path: old name to new path in
|
||||
## the quiz.
|
||||
const RENAMED_QUIZ_NODES: Dictionary = {
|
||||
"Players": "PlayersPanel",
|
||||
"ScrollContainer": "InspirationList",
|
||||
"VBoxContainer": "NowPlaying",
|
||||
"MusicPlayer": "MusicPlayer/PlayerBar",
|
||||
"RepeatSongCheckButton": "MusicPlayer/RepeatSongCheckButton",
|
||||
"ResetPlaylistButton": "QuizToolbar/ResetPlaylistButton",
|
||||
"ResetPointsButton": "QuizToolbar/ResetPointsButton",
|
||||
"SettingsButton": "QuizToolbar/SettingsButton",
|
||||
"SoundTestButton": "QuizToolbar/SoundTestButton",
|
||||
"ShowAnswerButton": "SongControls/ShowAnswerButton",
|
||||
"NextButton": "SongControls/NextButton",
|
||||
## Where each node of the old main window lives now: its old name, and the path that
|
||||
## replaces it. Nodes that are not listed are still where they were.
|
||||
const MOVED: Dictionary = {
|
||||
# The top bar
|
||||
"TopPanelContainer": "TopBar/TopPanelContainer",
|
||||
"Title": "TopBar/Title",
|
||||
"SearchButton": "TopBar/SearchButton",
|
||||
"SyncButton": "TopBar/SyncButton",
|
||||
"StatisticsButton": "TopBar/StatisticsButton",
|
||||
"ShortcutsButton": "TopBar/ShortcutsButton",
|
||||
"AboutButton": "TopBar/AboutButton",
|
||||
"QRButton": "TopBar/QRButton",
|
||||
# The popups of the main window, renamed from *Window to *Popup
|
||||
"Search": "SearchPopup",
|
||||
"SyncWindow": "SyncPopup",
|
||||
"QRWindow": "QRPopup",
|
||||
"ShortcutsWindow": "ShortcutsPopup",
|
||||
"AboutWindow": "AboutPopup",
|
||||
"Log": "LogPopup",
|
||||
# The quiz and its parts
|
||||
"Open": "Quiz/Open",
|
||||
"FileDialog": "Quiz/FileDialog",
|
||||
"DebugLabel": "Quiz/DebugLabel",
|
||||
"MusicListPanel": "Quiz/MusicListPanel",
|
||||
"Players": "Quiz/PlayersPanel",
|
||||
"ScrollContainer": "Quiz/InspirationList",
|
||||
"VBoxContainer": "Quiz/NowPlaying",
|
||||
"MusicPlayer": "Quiz/MusicPlayer/PlayerBar",
|
||||
"RepeatSongCheckButton": "Quiz/MusicPlayer/RepeatSongCheckButton",
|
||||
"ResetPlaylistButton": "Quiz/QuizToolbar/ResetPlaylistButton",
|
||||
"ResetPointsButton": "Quiz/QuizToolbar/ResetPointsButton",
|
||||
"SettingsButton": "Quiz/QuizToolbar/SettingsButton",
|
||||
"SoundTestButton": "Quiz/QuizToolbar/SoundTestButton",
|
||||
"ShowAnswerButton": "Quiz/SongControls/ShowAnswerButton",
|
||||
"NextButton": "Quiz/SongControls/NextButton",
|
||||
"SettingsWindow": "Quiz/SettingsPopup",
|
||||
"NewCharacterSelect": "Quiz/CharacterSelectPopup",
|
||||
"WinnerWindow": "Quiz/WinnerPopup",
|
||||
}
|
||||
|
||||
## Nodes that moved from the main window into the TopBar scene, by their old name.
|
||||
const TOP_BAR_NODES: Array[String] = [
|
||||
"TopPanelContainer", "Title", "SearchButton", "SyncButton", "StatisticsButton",
|
||||
"ShortcutsButton", "AboutButton", "QRButton",
|
||||
]
|
||||
## Scenes that were renamed, by their old and new root name. A row added to a list is
|
||||
## named after its scene's root when the name is still free, so these show up deeper in a
|
||||
## path.
|
||||
const RENAMED_SCENES: Dictionary = {
|
||||
"SongListObject": "SongRow",
|
||||
"Player": "PlayerRow",
|
||||
}
|
||||
|
||||
## How far a node may be from its old place, in pixels.
|
||||
const TOLERANCE: float = 0.5
|
||||
@@ -71,14 +91,12 @@ func after() -> void:
|
||||
|
||||
## Where the node that used to be at [param old_path] in the main window is now.
|
||||
static func new_path(old_path: String) -> String:
|
||||
var first: String = old_path.get_slice("/", 0)
|
||||
if first in QUIZ_NODES:
|
||||
return "Quiz/" + old_path
|
||||
if first in RENAMED_QUIZ_NODES:
|
||||
return "Quiz/" + RENAMED_QUIZ_NODES[first] + old_path.trim_prefix(first)
|
||||
if first in TOP_BAR_NODES:
|
||||
return "TopBar/" + old_path
|
||||
return old_path
|
||||
var parts: PackedStringArray = old_path.split("/")
|
||||
for i: int in parts.size():
|
||||
parts[i] = RENAMED_SCENES.get(parts[i], parts[i])
|
||||
var first: String = parts[0]
|
||||
parts[0] = MOVED.get(first, first)
|
||||
return "/".join(parts)
|
||||
|
||||
|
||||
func _baseline() -> Dictionary:
|
||||
|
||||
Reference in new issue
Block a user