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
+4
-4
@@ -7,12 +7,12 @@ extends ColorRect
|
||||
## Popups close themselves when clicked outside, and the backdrop keeps that click from
|
||||
## reaching the buttons behind them.
|
||||
|
||||
var _popups: Array[PopupWindow] = []
|
||||
var _popups: Array[BasePopup] = []
|
||||
|
||||
|
||||
## Adds a backdrop to [param parent] and moves [param popups] above it. The backdrop
|
||||
## shows while any of them is open.
|
||||
static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop:
|
||||
static func add_to(parent: Control, popups: Array[BasePopup]) -> PopupBackdrop:
|
||||
var backdrop: PopupBackdrop = PopupBackdrop.new()
|
||||
backdrop.name = "PopupBackdrop"
|
||||
backdrop.color = Color(0, 0, 0, 0.55)
|
||||
@@ -20,7 +20,7 @@ static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop
|
||||
backdrop._popups = popups
|
||||
parent.add_child(backdrop)
|
||||
backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
for popup: PopupWindow in popups:
|
||||
for popup: BasePopup in popups:
|
||||
parent.move_child(popup, -1)
|
||||
popup.visibility_changed.connect(backdrop._update)
|
||||
backdrop._update()
|
||||
@@ -28,4 +28,4 @@ static func add_to(parent: Control, popups: Array[PopupWindow]) -> PopupBackdrop
|
||||
|
||||
|
||||
func _update() -> void:
|
||||
visible = _popups.any(func(popup: PopupWindow) -> bool: return popup.visible)
|
||||
visible = _popups.any(func(popup: BasePopup) -> bool: return popup.visible)
|
||||
Reference in new issue
Block a user