MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_leaderboard.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_LEADERBOARD_H_1631037391
12#define INCGUARD_MGL_LEADERBOARD_H_1631037391
13
15
16namespace MGL::Leaderboard
17{
18/* ------------------------------------------------------------------------- */
24/* ------------------------------------------------------------------------- */
25template <class DelegateClass, class... Args>
26inline bool CreateServer(Args... args) noexcept
27{
29 {
30 return false;
31 }
32
33 auto &server = Server::CreateInstance();
34
35 STL::unique_ptr<ServerDelegate> delegate = STL::make_unique<DelegateClass>(args...);
36
37 return server.Initialize(delegate);
38}
39
40/* ------------------------------------------------------------------------- */
46/* ------------------------------------------------------------------------- */
47[[nodiscard]] inline bool IsAvailableServer() noexcept
48{
49 return Server::HasInstance();
50}
51
52/* ------------------------------------------------------------------------- */
61/* ------------------------------------------------------------------------- */
62inline bool ReportScore(Identifier identifier, uint64_t score, const OptionDataArray &options = OptionDataArray()) noexcept
63{
64 return IsAvailableServer() ? Server::GetInstance().ReportScore(identifier, score, options) : false;
65}
66
67/* ------------------------------------------------------------------------- */
77/* ------------------------------------------------------------------------- */
78inline bool FetchEntryData(Identifier identifier, uint32_t startRank, uint32_t requestSize, PlayerScope playerScope) noexcept
79{
80 return IsAvailableServer() ? Server::GetInstance().FetchEntryData(identifier, startRank, requestSize, playerScope) : false;
81}
82
83/* ------------------------------------------------------------------------- */
92/* ------------------------------------------------------------------------- */
93inline bool FetchEntryDataAroundUser(Identifier identifier, uint32_t requestSize, PlayerScope playerScope) noexcept
94{
95 return IsAvailableServer() ? Server::GetInstance().FetchEntryDataAroundUser(identifier, requestSize, playerScope) : false;
96}
97
98/* ------------------------------------------------------------------------- */
106/* ------------------------------------------------------------------------- */
107inline bool UploadClipData(Identifier identifier, const ClipData &clipData) noexcept
108{
109 return IsAvailableServer() ? Server::GetInstance().UploadClipData(identifier, clipData) : false;
110}
111
112/* ------------------------------------------------------------------------- */
119/* ------------------------------------------------------------------------- */
120inline bool DownloadClipData(uint64_t clipID) noexcept
121{
122 return IsAvailableServer() ? Server::GetInstance().DownloadClipData(clipID) : false;
123}
124
125/* ------------------------------------------------------------------------- */
130/* ------------------------------------------------------------------------- */
131[[nodiscard]] inline const FetchResults &GetFetchedData() noexcept
132{
134}
135
136/* ------------------------------------------------------------------------- */
141/* ------------------------------------------------------------------------- */
142[[nodiscard]] inline const ReportResults &GetReportResults() noexcept
143{
145}
146
147/* ------------------------------------------------------------------------- */
152/* ------------------------------------------------------------------------- */
153[[nodiscard]] inline const ClipData &GetClipData() noexcept
154{
156}
157
158/* ------------------------------------------------------------------------- */
163/* ------------------------------------------------------------------------- */
164[[nodiscard]] inline ClipData::ErrorType GetClipDataUploadResults() noexcept
165{
167}
168
169/* ------------------------------------------------------------------------- */
175/* ------------------------------------------------------------------------- */
176[[nodiscard]] inline bool IsProcessing() noexcept
177{
178 return IsAvailableServer() ? Server::GetInstance().IsProcessing() : false;
179}
180
181/* ------------------------------------------------------------------------- */
187/* ------------------------------------------------------------------------- */
188[[nodiscard]] inline bool IsReady() noexcept
189{
190 return IsAvailableServer() ? !Server::GetInstance().IsProcessing() : false;
191}
192
193/* ------------------------------------------------------------------------- */
198/* ------------------------------------------------------------------------- */
199[[nodiscard]] inline Server::State GetServerState() noexcept
200{
201 return IsAvailableServer() ? Server::GetInstance().GetState() : Server::State::NotReady;
202}
203} // namespace MGL::Leaderboard
204
205#endif // INCGUARD_MGL_LEADERBOARD_H_1631037391
206
207// vim: et ts=4 sw=4 sts=4
クリップデータ
Definition mgl_leaderboard_clipdata.h:21
ErrorType
エラータイプ
Definition mgl_leaderboard_clipdata.h:34
const ReportResults & GetReportResults() const noexcept
送信結果を取得
Definition mgl_leaderboard_server.h:65
const FetchResults & GetFetchedData() const noexcept
エントリ取得結果を取得
Definition mgl_leaderboard_server.h:54
ClipData::ErrorType GetClipDataUploadResults() const noexcept
クリップデータのアップロード結果を取得
Definition mgl_leaderboard_server.h:87
constexpr bool IsProcessing() const noexcept
処理中かどうかを取得
Definition mgl_leaderboard_server.h:99
bool ReportScore(Identifier identifier, uint64_t score, const OptionDataArray &options) noexcept
スコアの送信
Definition mgl_leaderboard_server.cc:70
bool DownloadClipData(uint64_t clipID) noexcept
クリップデータのダウンロード
Definition mgl_leaderboard_server.cc:180
bool FetchEntryData(Identifier identifier, uint32_t startRank, uint32_t requestSize, PlayerScope playerScope) noexcept
エントリデータを取得
Definition mgl_leaderboard_server.cc:99
bool FetchEntryDataAroundUser(Identifier identifier, uint32_t requestSize, PlayerScope playerScope) noexcept
プレイヤーの順位を中心にエントリデータを取得
Definition mgl_leaderboard_server.cc:127
bool UploadClipData(Identifier identifier, const ClipData &clipData) noexcept
クリップデータの送信
Definition mgl_leaderboard_server.cc:154
const ClipData & GetClipData() const noexcept
ダウンロードしたクリップデータを取得
Definition mgl_leaderboard_server.h:76
State
ステート
Definition mgl_leaderboard_server.h:27
@ NotReady
準備できていない
constexpr State GetState() const noexcept
現在のステートを取得
Definition mgl_leaderboard_server.h:110
static Server & CreateInstance(Args... args) noexcept
Definition mgl_singleton.h:52
static Server & GetInstance() noexcept
Definition mgl_singleton.h:74
static bool HasInstance() noexcept
Definition mgl_singleton.h:102
Server::State GetServerState() noexcept
現在のサーバのステートを取得
Definition mgl_leaderboard.h:199
bool FetchEntryDataAroundUser(Identifier identifier, uint32_t requestSize, PlayerScope playerScope) noexcept
プレイヤーの順位を中心にエントリデータを取得
Definition mgl_leaderboard.h:93
bool DownloadClipData(uint64_t clipID) noexcept
クリップデータのダウンロード
Definition mgl_leaderboard.h:120
const ReportResults & GetReportResults() noexcept
送信結果を取得
Definition mgl_leaderboard.h:142
bool ReportScore(Identifier identifier, uint64_t score, const OptionDataArray &options=OptionDataArray()) noexcept
スコアの送信
Definition mgl_leaderboard.h:62
const ClipData & GetClipData() noexcept
ダウンロードしたクリップデータを取得
Definition mgl_leaderboard.h:153
const FetchResults & GetFetchedData() noexcept
エントリ取得結果を取得
Definition mgl_leaderboard.h:131
bool UploadClipData(Identifier identifier, const ClipData &clipData) noexcept
クリップデータの送信
Definition mgl_leaderboard.h:107
ClipData::ErrorType GetClipDataUploadResults() noexcept
クリップデータのアップロード結果を取得
Definition mgl_leaderboard.h:164
bool FetchEntryData(Identifier identifier, uint32_t startRank, uint32_t requestSize, PlayerScope playerScope) noexcept
エントリデータを取得
Definition mgl_leaderboard.h:78
PlayerScope
プレイヤーのスコープ
Definition mgl_leaderboard_defs.h:40
STL::vector< uint32_t > OptionDataArray
オプションデータ配列の型
Definition mgl_leaderboard_defs.h:29
MGL リーダーボードサーバ
std::unique_ptr< T, Deleter > unique_ptr
MGLのアロケータを利用するユニークポインタ
Definition mgl_stl_memory.h:247
エントリ取得結果
Definition mgl_leaderboard_defs.h:59
エントリ送信結果
Definition mgl_leaderboard_defs.h:68