Added String Filter for Lobbies directly, so no manual filtering is required
This commit is contained in:
7
main.gd
7
main.gd
@@ -83,7 +83,7 @@ func remove_player(id: int):
|
|||||||
|
|
||||||
|
|
||||||
func on_lobby_match_list(lobby_ids: Array):
|
func on_lobby_match_list(lobby_ids: Array):
|
||||||
print(lobby_ids)
|
#print(lobby_ids)
|
||||||
var _lobbys = lobby_ids.map(func(id):
|
var _lobbys = lobby_ids.map(func(id):
|
||||||
var result = Dictionary()
|
var result = Dictionary()
|
||||||
var lobbyType = Steam.getLobbyData(id,"LobbyType");
|
var lobbyType = Steam.getLobbyData(id,"LobbyType");
|
||||||
@@ -92,9 +92,9 @@ func on_lobby_match_list(lobby_ids: Array):
|
|||||||
result.set("LobbyType", lobbyType)
|
result.set("LobbyType", lobbyType)
|
||||||
result.set("LobbyName", lobbyName)
|
result.set("LobbyName", lobbyName)
|
||||||
return result;
|
return result;
|
||||||
).filter(func filterOwnLobbyType(lobby_data: Dictionary):
|
|
||||||
return lobby_data.get("LobbyType") == "GodotSteamDemo"
|
|
||||||
);
|
);
|
||||||
|
for child in lobby_list.get_children():
|
||||||
|
child.queue_free()
|
||||||
for lobby in _lobbys:
|
for lobby in _lobbys:
|
||||||
var list_item : LobbyListItem = lobby_list_item.instantiate();
|
var list_item : LobbyListItem = lobby_list_item.instantiate();
|
||||||
list_item.lobby = lobby
|
list_item.lobby = lobby
|
||||||
@@ -115,6 +115,7 @@ func _on_lobby_id_text_changed(new_text: String) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_list_lobbies_button_pressed() -> void:
|
func _on_list_lobbies_button_pressed() -> void:
|
||||||
|
Steam.addRequestLobbyListStringFilter("LobbyType","GodotSteamDemo",Steam.LobbyComparison.LOBBY_COMPARISON_EQUAL)
|
||||||
Steam.requestLobbyList()
|
Steam.requestLobbyList()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user