Only show friend lobbies
This commit is contained in:
parent
2d2f87df88
commit
a996951932
@ -43,7 +43,26 @@ func _on_show_lobbies():
|
|||||||
|
|
||||||
|
|
||||||
func _on_lobbies_received(these_lobbies: Array):
|
func _on_lobbies_received(these_lobbies: Array):
|
||||||
for this_lobby in these_lobbies:
|
var friend_count = Steam.getFriendCount()
|
||||||
|
var friend_steam_ids = []
|
||||||
|
for i in range(friend_count):
|
||||||
|
friend_steam_ids.append(Steam.getFriendByIndex(i, Steam.FRIEND_FLAG_ALL))
|
||||||
|
|
||||||
|
var friend_lobbies = []
|
||||||
|
for lobby in these_lobbies:
|
||||||
|
if Steam.getLobbyOwner(lobby) in friend_steam_ids:
|
||||||
|
friend_lobbies.append(lobby)
|
||||||
|
|
||||||
|
# Clear the lobby list box before adding new lobbies
|
||||||
|
for child in lobby_list_box.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
if friend_lobbies.size() == 0:
|
||||||
|
var no_lobbies_label = Label.new()
|
||||||
|
no_lobbies_label.text = "No lobbies available"
|
||||||
|
lobby_list_box.add_child(no_lobbies_label)
|
||||||
|
else:
|
||||||
|
for this_lobby in friend_lobbies:
|
||||||
# Pull lobby data from Steam, these are specific to our example
|
# Pull lobby data from Steam, these are specific to our example
|
||||||
var lobby_name: String = Steam.getLobbyData(this_lobby, "name")
|
var lobby_name: String = Steam.getLobbyData(this_lobby, "name")
|
||||||
var lobby_mode: String = Steam.getLobbyData(this_lobby, "mode")
|
var lobby_mode: String = Steam.getLobbyData(this_lobby, "mode")
|
||||||
|
Loading…
Reference in New Issue
Block a user