Updated PanelContainer to use TabPanel stylebox variant. Updated structure of Scene. Added UserGames panel to the panel. Updated code to handle clearing of other panels, if the chatter is null, otherwise populate information in the other panels. Added resized signal connect, to set the UserGames panel to an even split between the lists of games, and the game info panels. Ensure that TwitchUserInfo, UserPromo and UserGames are properly updates with the correct information on becoming ready in the SceneTree.
32 lines
758 B
GDScript
32 lines
758 B
GDScript
extends PanelContainer
|
|
|
|
@onready var user_games: UserGamesPanel = %UserGames
|
|
@onready var tui := %TwitchUserInfo
|
|
@onready var up := %UserPromo
|
|
|
|
|
|
var chatter: Chatter:
|
|
set(value):
|
|
chatter = value
|
|
if not value:
|
|
tui.clear()
|
|
up.chatter = value
|
|
user_games.clear()
|
|
return
|
|
if tui:
|
|
tui.populate_from_chatter(chatter)
|
|
if up:
|
|
up.chatter = value
|
|
if user_games:
|
|
user_games.chatter = value
|
|
|
|
func _ready() -> void:
|
|
tui.extra_expanding.connect(func(x): if x: up.visible = false)
|
|
tui.extra_expanded.connect(func(x): if not x: up.visible = true)
|
|
resized.connect(func():
|
|
var width := int(size.x / 2)
|
|
user_games.splitter.split_offsets[0] = width
|
|
)
|
|
tui.populate_from_chatter(chatter)
|
|
up.chatter = chatter
|
|
user_games.chatter = chatter
|