diff --git a/UI/Controls/user_games.gd b/UI/Controls/user_games.gd new file mode 100644 index 00000000..b45a1b89 --- /dev/null +++ b/UI/Controls/user_games.gd @@ -0,0 +1,85 @@ +extends PanelContainer +class_name UserGamesPanel +const GAME_ENTRY = preload("res://UI/Controls/game_entry.tscn") + +@onready var splitter: HSplitContainer = %Splitter +var chatter: Chatter: + set(value): + chatter = value + if not chatter: return + clear() + populate_games() + +func _ready() -> void: + %SteamSearch.pressed.connect(_handle_search) + %AddSteamGame.pressed.connect(_handle_add) + +func _handle_search() -> void: + var info: String = %SteamGameInput.text + var app_id: int = -1 + if info.begins_with("https:"): + var parts := Array(info.split("/")) + parts.reverse() + for part in parts: + if part.is_valid_int(): + app_id = part.to_int() + break + elif info.is_valid_int(): + app_id = info.to_int() + if app_id == -1: return + var data: SteamAppData = await %SteamService.get_steam_app_data(app_id) + if data: + %SteamAppPanel.display_app_info(data) + %SteamAppPanel.show() + +func _handle_add() -> void: + var info: String = %SteamGameInput.text + var app_id: int = -1 + if info.begins_with("https:"): + var parts = Array(info.split("/")) + parts.reverse() + for part in parts: + if part.is_valid_int(): + app_id = part.to_int() + break + elif info.is_valid_int(): + app_id = info.to_int() + + if app_id == -1: return + + var data: SteamAppData = await %SteamService.get_steam_app_data(app_id) + if data: + chatter.steam_games.append(app_id) + chatter.save() + clear() + populate_games() + +func populate_games() -> void: + for game in chatter.steam_games: + var inst: GameEntry = GAME_ENTRY.instantiate() + inst.steam_app_id = game + inst.type = GameEntry.Type.STEAM + inst.game_info_steam_pressed.connect(func(x: SteamAppData): + %SteamAppPanel.show() + %SteamAppPanel.display_app_info(x) + ) + %SteamList.add_child(inst) + + for game in chatter.itch_games: + var inst: GameEntry = GAME_ENTRY.instantiate() + inst.itchio_app_url = chatter.itch_games[game] + inst.type = GameEntry.Type.ITCHIO + inst.game_info_itchio_pressesd.connect(func(x: ItchIOAppData): + %ItchAppPanel.show() + %ItchAppPanel.display_app_info(x) + ) + %ItchList.add_child(inst) + +func clear() -> void: + for node in %SteamList.get_children(): + node.queue_free() + for node in %ItchList.get_children(): + node.queue_free() + + %SteamAppPanel.clear() + %ItchAppPanel.clear() diff --git a/UI/Controls/user_games.gd.uid b/UI/Controls/user_games.gd.uid new file mode 100644 index 00000000..43f4b37b --- /dev/null +++ b/UI/Controls/user_games.gd.uid @@ -0,0 +1 @@ +uid://bj06jd8vt70im diff --git a/UI/Controls/user_games.tscn b/UI/Controls/user_games.tscn new file mode 100644 index 00000000..54089c29 --- /dev/null +++ b/UI/Controls/user_games.tscn @@ -0,0 +1,249 @@ +[gd_scene format=3 uid="uid://cojuxefo7cryj"] + +[ext_resource type="Texture2D" uid="uid://bexdhdpprh6aa" path="res://UI/assets/font_awesome/magnifying-glass-location.svg" id="1_7mil5"] +[ext_resource type="Script" uid="uid://bj06jd8vt70im" path="res://UI/Controls/user_games.gd" id="1_myc1y"] +[ext_resource type="Texture2D" uid="uid://4nae34ce8pjn" path="res://UI/assets/bootstrap/plus-circle.svg" id="2_0hl8v"] +[ext_resource type="Script" uid="uid://chgufd1youdel" path="res://lib/games_info/steam_service.gd" id="2_u0xo6"] +[ext_resource type="Script" uid="uid://cyef5m8x5f7k6" path="res://lib/games_info/itch_io_service.gd" id="3_hk3mv"] +[ext_resource type="PackedScene" uid="uid://685pgmw1cdw3" path="res://UI/Controls/steam_app_panel.tscn" id="3_j36q5"] +[ext_resource type="Script" uid="uid://bllsv2cy6komw" path="res://lib/models/steam_app_data.gd" id="4_myc1y"] +[ext_resource type="PackedScene" uid="uid://c0ahhupmdstxq" path="res://UI/Controls/itch_app_panel.tscn" id="8_hk3mv"] + +[sub_resource type="Resource" id="Resource_hk3mv"] +script = ExtResource("4_myc1y") +steam_app_id = 3712430 +type = "game" +name = "Carbrix" +short_description = "Carbrix is a sci-fi inspired multiplayer vehicle-building sandbox game where creativity meets action. Design and construct anything you can imagine—from sleek cars and powerful trucks to futuristic planes, bikes, and rockets." +detailed_description = "

Carbrix is a sci-fi inspired multiplayer vehicle-building sandbox game where creativity meets action. Design and construct anything you can imagine, from sleek cars and powerful trucks to futuristic planes, bikes, and rockets.

Play solo or team up with friends in multiplayer to share your creations, race, battle, or simply explore endless possibilities. With intuitive building tools and a physics-driven world, Carbrix offers a playground of imagination, competition, and fun.

With Carbrix, you can build cars, trucks, planes, bikes—and so much more!

Thanks to the intuitive building system, you can build, test, and drive with ease.

Looking for something to sink your teeth into?

With the built-in destruction system, worry no more

Create combat-oriented vehicles and battle your friends!

With multiplayer, the fun never ends!
Team up with your friends to build together—or challenge them in head-to-head battles.

Take part in thrilling races, compete in creative build contests,
or just mess around and see who can come up with the wildest inventions.

With so many ways to play, there’s always something new to try!

" +header_image = "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/a18c9a286445c8553a4eac10ba42df6b96ce63ed/header.jpg?t=1771564874" +capsule_image = "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/0e3354ecdcc92437b51dcc8a7ce5aec3c956d6b8/capsule_231x87.jpg?t=1771564874" +capsule_imagev5 = "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/0e3354ecdcc92437b51dcc8a7ce5aec3c956d6b8/capsule_184x69.jpg?t=1771564874" +developers = Array[String](["Redston4D"]) +publishers = Array[String](["Redston4D"]) +platforms = { +"linux": true, +"mac": false, +"windows": true +} +genres = Array[Dictionary]([{ +"description": "Action", +"id": "1" +}, { +"description": "Adventure", +"id": "25" +}, { +"description": "Casual", +"id": "4" +}, { +"description": "Indie", +"id": "23" +}, { +"description": "Racing", +"id": "9" +}, { +"description": "Simulation", +"id": "28" +}]) +release_date = { +"coming_soon": true, +"date": "Coming soon" +} +screenshots_full = Array[String](["https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/4a0c3b9405921fd84ee530e87c4bb49e5bac47d5/ss_4a0c3b9405921fd84ee530e87c4bb49e5bac47d5.1920x1080.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/c3bfb9c95fafd7e2e42bf22b2e1a6324202ff3b3/ss_c3bfb9c95fafd7e2e42bf22b2e1a6324202ff3b3.1920x1080.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/41a0157dabd641a59f561befa2d36687405f906c/ss_41a0157dabd641a59f561befa2d36687405f906c.1920x1080.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/d6440c8c03850fa478c8c845561c6729bf69b981/ss_d6440c8c03850fa478c8c845561c6729bf69b981.1920x1080.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/8c8af6ab67b663d1860e5ebdfe3943eebe85e222/ss_8c8af6ab67b663d1860e5ebdfe3943eebe85e222.1920x1080.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/7ebb66440d8eef2e94a818d95f0805f89ca881d3/ss_7ebb66440d8eef2e94a818d95f0805f89ca881d3.1920x1080.jpg?t=1771564874"]) +screenshots_thumbs = Array[String](["https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/4a0c3b9405921fd84ee530e87c4bb49e5bac47d5/ss_4a0c3b9405921fd84ee530e87c4bb49e5bac47d5.600x338.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/c3bfb9c95fafd7e2e42bf22b2e1a6324202ff3b3/ss_c3bfb9c95fafd7e2e42bf22b2e1a6324202ff3b3.600x338.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/41a0157dabd641a59f561befa2d36687405f906c/ss_41a0157dabd641a59f561befa2d36687405f906c.600x338.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/d6440c8c03850fa478c8c845561c6729bf69b981/ss_d6440c8c03850fa478c8c845561c6729bf69b981.600x338.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/8c8af6ab67b663d1860e5ebdfe3943eebe85e222/ss_8c8af6ab67b663d1860e5ebdfe3943eebe85e222.600x338.jpg?t=1771564874", "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/3712430/7ebb66440d8eef2e94a818d95f0805f89ca881d3/ss_7ebb66440d8eef2e94a818d95f0805f89ca881d3.600x338.jpg?t=1771564874"]) +categories = Array[Dictionary]([{ +"description": "Single-player", +"id": 2.0 +}, { +"description": "Multi-player", +"id": 1.0 +}, { +"description": "PvP", +"id": 49.0 +}, { +"description": "Online PvP", +"id": 36.0 +}, { +"description": "Co-op", +"id": 9.0 +}, { +"description": "Online Co-op", +"id": 38.0 +}, { +"description": "Steam Achievements", +"id": 22.0 +}, { +"description": "Steam Workshop", +"id": 30.0 +}, { +"description": "Custom Volume Controls", +"id": 68.0 +}, { +"description": "Adjustable Difficulty", +"id": 78.0 +}, { +"description": "Playable without Timed Input", +"id": 74.0 +}, { +"description": "Save Anytime", +"id": 79.0 +}, { +"description": "Stereo Sound", +"id": 69.0 +}, { +"description": "Surround Sound", +"id": 70.0 +}, { +"description": "Partial Controller Support", +"id": 18.0 +}, { +"description": "Family Sharing", +"id": 62.0 +}]) +pc_requirements = "Minimum:
" +mac_requirements = "{ \"minimum\": \"Minimum:
\", \"recommended\": \"Recommended:
\" }" +linux_requirements = "{ \"minimum\": \"Minimum:
\", \"recommended\": \"Recommended:
\" }" +support_email = "CarbrixGame@gmail.com" +background_image = "https://store.akamai.steamstatic.com/images/storepagebackground/app/3712430?t=1771564874" +background_image_raw = "https://store.akamai.steamstatic.com/images/storepagebackground/app/3712430?t=1771564874" + +[node name="UserGames" type="PanelContainer" unique_id=2022365407] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_myc1y") + +[node name="SteamService" type="Node" parent="." unique_id=1181960445] +unique_name_in_owner = true +script = ExtResource("2_u0xo6") +metadata/_custom_type_script = "uid://chgufd1youdel" + +[node name="ItchIOService" type="Node" parent="." unique_id=400309790] +unique_name_in_owner = true +script = ExtResource("3_hk3mv") +metadata/_custom_type_script = "uid://cyef5m8x5f7k6" + +[node name="Splitter" type="HSplitContainer" parent="." unique_id=182228020] +unique_name_in_owner = true +layout_mode = 2 +split_offsets = PackedInt32Array(530) +split_offset = 530 + +[node name="VBoxContainer" type="VBoxContainer" parent="Splitter" unique_id=869345086] +layout_mode = 2 + +[node name="Label" type="Label" parent="Splitter/VBoxContainer" unique_id=385647229] +layout_mode = 2 +text = "Games" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="Splitter/VBoxContainer" unique_id=1347394535] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="Splitter/VBoxContainer" unique_id=123570347] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="SteamColumn" type="VBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer" unique_id=1965017268] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="SteamSearch" type="HBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn" unique_id=476996992] +layout_mode = 2 + +[node name="SteamGameInput" type="LineEdit" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn/SteamSearch" unique_id=135652688] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +placeholder_text = "steam app id or url" + +[node name="SteamSearch" type="Button" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn/SteamSearch" unique_id=1427348414] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +icon = ExtResource("1_7mil5") +icon_alignment = 1 +expand_icon = true + +[node name="AddSteamGame" type="Button" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn/SteamSearch" unique_id=1199771317] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +icon = ExtResource("2_0hl8v") +icon_alignment = 1 +expand_icon = true + +[node name="PanelContainer" type="PanelContainer" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn" unique_id=1782797010] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn/PanelContainer" unique_id=1538765940] +layout_mode = 2 + +[node name="SteamList" type="VBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer/SteamColumn/PanelContainer/ScrollContainer" unique_id=788126228] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="VSeparator" type="VSeparator" parent="Splitter/VBoxContainer/HBoxContainer" unique_id=220505221] +layout_mode = 2 + +[node name="ItchColumn" type="VBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer" unique_id=1035792899] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ItchSearch" type="HBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn" unique_id=58917565] +layout_mode = 2 + +[node name="ItchInput" type="LineEdit" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn/ItchSearch" unique_id=81918204] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +placeholder_text = "itch.io link" + +[node name="ItchFetch" type="Button" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn/ItchSearch" unique_id=1917953068] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +icon = ExtResource("1_7mil5") +icon_alignment = 1 +expand_icon = true + +[node name="ItchAdd" type="Button" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn/ItchSearch" unique_id=1726319206] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +icon = ExtResource("2_0hl8v") +icon_alignment = 1 +expand_icon = true + +[node name="PanelContainer" type="PanelContainer" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn" unique_id=1055230274] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn/PanelContainer" unique_id=1143536360] +layout_mode = 2 + +[node name="ItchList" type="VBoxContainer" parent="Splitter/VBoxContainer/HBoxContainer/ItchColumn/PanelContainer/ScrollContainer" unique_id=1691269823] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="TabContainer" type="TabContainer" parent="Splitter" unique_id=298665581] +layout_mode = 2 +current_tab = 1 +tabs_visible = false + +[node name="SteamAppPanel" parent="Splitter/TabContainer" unique_id=597550935 instance=ExtResource("3_j36q5")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +test_data = SubResource("Resource_hk3mv") +metadata/_tab_index = 0 + +[node name="ItchAppPanel" parent="Splitter/TabContainer" unique_id=691251029 instance=ExtResource("8_hk3mv")] +unique_name_in_owner = true +layout_mode = 2 +metadata/_tab_index = 1