diff options
| author | 2021-12-25 20:27:52 +0100 | |
|---|---|---|
| committer | 2022-07-25 21:59:28 +0200 | |
| commit | 705f7db84dd85555a6aef1e136cf251725cef293 (patch) | |
| tree | e110c6482a11d711d18515afce4fc50adcee76e7 /src/web_service/announce_room_json.h | |
| parent | network: Add initial files and enet dependency (diff) | |
| download | yuzu-705f7db84dd85555a6aef1e136cf251725cef293.tar.gz yuzu-705f7db84dd85555a6aef1e136cf251725cef293.tar.xz yuzu-705f7db84dd85555a6aef1e136cf251725cef293.zip | |
yuzu: Add ui files for multiplayer rooms
Diffstat (limited to '')
| -rw-r--r-- | src/web_service/announce_room_json.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/web_service/announce_room_json.h b/src/web_service/announce_room_json.h new file mode 100644 index 000000000..ac02af5b1 --- /dev/null +++ b/src/web_service/announce_room_json.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | #include <string> | ||
| 9 | #include "common/announce_multiplayer_room.h" | ||
| 10 | #include "web_service/web_backend.h" | ||
| 11 | |||
| 12 | namespace WebService { | ||
| 13 | |||
| 14 | /** | ||
| 15 | * Implementation of AnnounceMultiplayerRoom::Backend that (de)serializes room information into/from | ||
| 16 | * JSON, and submits/gets it to/from the yuzu web service | ||
| 17 | */ | ||
| 18 | class RoomJson : public AnnounceMultiplayerRoom::Backend { | ||
| 19 | public: | ||
| 20 | RoomJson(const std::string& host, const std::string& username, const std::string& token) | ||
| 21 | : client(host, username, token), host(host), username(username), token(token) {} | ||
| 22 | ~RoomJson() = default; | ||
| 23 | void SetRoomInformation(const std::string& name, const std::string& description, const u16 port, | ||
| 24 | const u32 max_player, const u32 net_version, const bool has_password, | ||
| 25 | const std::string& preferred_game, | ||
| 26 | const u64 preferred_game_id) override; | ||
| 27 | void AddPlayer(const std::string& username_, const std::string& nickname_, | ||
| 28 | const std::string& avatar_url, | ||
| 29 | const AnnounceMultiplayerRoom::MacAddress& mac_address, const u64 game_id, | ||
| 30 | const std::string& game_name) override; | ||
| 31 | WebResult Update() override; | ||
| 32 | WebResult Register() override; | ||
| 33 | void ClearPlayers() override; | ||
| 34 | AnnounceMultiplayerRoom::RoomList GetRoomList() override; | ||
| 35 | void Delete() override; | ||
| 36 | |||
| 37 | private: | ||
| 38 | AnnounceMultiplayerRoom::Room room; | ||
| 39 | Client client; | ||
| 40 | std::string host; | ||
| 41 | std::string username; | ||
| 42 | std::string token; | ||
| 43 | std::string room_id; | ||
| 44 | }; | ||
| 45 | |||
| 46 | } // namespace WebService | ||