MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_achievement.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_ACHIEVEMENT_H_1631538489
12#define INCGUARD_MGL_ACHIEVEMENT_H_1631538489
13
15
16namespace MGL::Achievement
17{
18/* ------------------------------------------------------------------------- */
24/* ------------------------------------------------------------------------- */
25template <class DelegateClass, class... Args>
26inline bool CreateServer(Args... args) noexcept
27{
29 {
30 return false;
31 }
32
33 STL::unique_ptr<ServerDelegate> delegate = STL::make_unique<DelegateClass>(args...);
34 auto &server = Server::CreateInstance();
35
36 return server.Initialize(delegate);
37}
38
39/* ------------------------------------------------------------------------- */
45/* ------------------------------------------------------------------------- */
46[[nodiscard]] inline bool IsAvailableServer() noexcept
47{
48 return Server::HasInstance();
49}
50
51/* ------------------------------------------------------------------------- */
59/* ------------------------------------------------------------------------- */
60inline bool SetValue(Identifier identifier, uint32_t value) noexcept
61{
62 return IsAvailableServer() ? Server::GetInstance().SetValue(identifier, value) : false;
63}
64
65/* ------------------------------------------------------------------------- */
73/* ------------------------------------------------------------------------- */
74inline bool SetProgressRate(Identifier identifier, float progressRate) noexcept
75{
76 return IsAvailableServer() ? Server::GetInstance().SetProgressRate(identifier, progressRate) : false;
77}
78
79/* ------------------------------------------------------------------------- */
87/* ------------------------------------------------------------------------- */
88inline bool SetAchieved(Identifier identifier, bool isAchieved) noexcept
89{
90 return IsAvailableServer() ? Server::GetInstance().SetAchieved(identifier, isAchieved) : false;
91}
92
93/* ------------------------------------------------------------------------- */
99/* ------------------------------------------------------------------------- */
100[[nodiscard]] inline uint32_t GetValue(Identifier identifier) noexcept
101{
102 return IsAvailableServer() ? Server::GetInstance().GetValue(identifier) : 0;
103}
104
105/* ------------------------------------------------------------------------- */
111/* ------------------------------------------------------------------------- */
112[[nodiscard]] inline float GetProgressRate(Identifier identifier) noexcept
113{
114 return IsAvailableServer() ? Server::GetInstance().GetProgressRate(identifier) : 0.0f;
115}
116
117/* ------------------------------------------------------------------------- */
124/* ------------------------------------------------------------------------- */
125[[nodiscard]] inline bool IsAchieved(Identifier identifier) noexcept
126{
127 return IsAvailableServer() ? Server::GetInstance().IsAchieved(identifier) : false;
128}
129
130/* ------------------------------------------------------------------------- */
136/* ------------------------------------------------------------------------- */
137inline bool Clear() noexcept
138{
139 return IsAvailableServer() ? Server::GetInstance().Clear() : false;
140}
141
142/* ------------------------------------------------------------------------- */
148/* ------------------------------------------------------------------------- */
149[[nodiscard]] inline bool IsProcessing() noexcept
150{
152}
153
154/* ------------------------------------------------------------------------- */
160/* ------------------------------------------------------------------------- */
161[[nodiscard]] inline bool IsReady() noexcept
162{
163 return !IsProcessing();
164}
165} // namespace MGL::Achievement
166
167#endif // INCGUARD_MGL_ACHIEVEMENT_H_1631538489
168
169// vim: et ts=4 sw=4 sts=4
bool SetValue(Identifier identifier, uint32_t value) noexcept
値を設定
Definition mgl_achievement_server.cc:76
bool SetAchieved(Identifier identifier, bool isAchieved) noexcept
達成状態を設定
Definition mgl_achievement_server.cc:120
float GetProgressRate(Identifier identifier) const noexcept
実績の進捗率を取得
Definition mgl_achievement_server.cc:140
uint32_t GetValue(Identifier identifier) const noexcept
実績の達成状況を整数値で取得
Definition mgl_achievement_server.cc:179
bool SetProgressRate(Identifier identifier, float progressRate) noexcept
進捗率を設定
Definition mgl_achievement_server.cc:98
bool IsAchieved(Identifier identifier) const noexcept
実績の達成状況を取得
Definition mgl_achievement_server.cc:160
bool Clear() noexcept
実績のクリア
Definition mgl_achievement_server.cc:198
constexpr bool IsProcessing() const noexcept
処理中かどうかを取得
Definition mgl_achievement_server.h:58
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
uint32_t GetValue(Identifier identifier) noexcept
実績の達成状況を整数値で取得
Definition mgl_achievement.h:100
bool Clear() noexcept
実績のクリア
Definition mgl_achievement.h:137
bool SetAchieved(Identifier identifier, bool isAchieved) noexcept
達成状態を設定
Definition mgl_achievement.h:88
bool IsAvailableServer() noexcept
サーバの有効状態を取得
Definition mgl_achievement.h:46
bool CreateServer(Args... args) noexcept
実績サーバの生成
Definition mgl_achievement.h:26
bool IsProcessing() noexcept
処理中かどうかを取得
Definition mgl_achievement.h:149
bool IsAchieved(Identifier identifier) noexcept
実績の達成状況を取得
Definition mgl_achievement.h:125
float GetProgressRate(Identifier identifier) noexcept
実績の進捗率を取得
Definition mgl_achievement.h:112
bool SetValue(Identifier identifier, uint32_t value) noexcept
値を設定
Definition mgl_achievement.h:60
bool SetProgressRate(Identifier identifier, float progressRate) noexcept
進捗率を設定
Definition mgl_achievement.h:74
bool IsReady() noexcept
サーバが処理可能な状態かを取得
Definition mgl_achievement.h:161
uint32_t Identifier
実績用の識別子の型
Definition mgl_achievement_defs.h:26
MGL 実績サーバ
std::unique_ptr< T, Deleter > unique_ptr
MGLのアロケータを利用するユニークポインタ
Definition mgl_stl_memory.h:247