Class IOnlinePlatform
Interface for online platform providers for communicating with various multiplayer services such as player info, achievements, game lobby or in-game store.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Online/IOnlinePlatform.h
Syntax
public class IOnlinePlatform
Methods
GetAchievements(Array<OnlineAchievement, HeapAllocation>& achievements, User* localUser=nullptr)
Gets the list of all achievements for this game.
Declaration
public virtual bool GetAchievements(Array<OnlineAchievement, HeapAllocation>& achievements, User* localUser=nullptr) = 0
Parameters
Array<OnlineAchievement, HeapAllocation>
achievements
The result achievements list |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetFriends(Array<OnlineUser, HeapAllocation>& friends, User* localUser=nullptr)
Gets the list of friends of the user from the online platform.
Declaration
public virtual bool GetFriends(Array<OnlineUser, HeapAllocation>& friends, User* localUser=nullptr) = 0
Parameters
Array<OnlineUser, HeapAllocation>
friends
The result local player friends user infos. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetLeaderboard(const StringView& name, OnlineLeaderboard& value, User* localUser=nullptr)
Gets the online leaderboard.
Declaration
public virtual bool GetLeaderboard(const StringView& name, OnlineLeaderboard& value, User* localUser=nullptr)
Parameters
StringView
name
The leaderboard name. |
OnlineLeaderboard
value
The result value. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetLeaderboardEntries(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, int32 start = 0, int32 count=10)
Gets the online leaderboard entries. Allows to specify the range for ranks to gather.
Declaration
public virtual bool GetLeaderboardEntries(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, int32 start = 0, int32 count=10)
Parameters
OnlineLeaderboard
leaderboard
The leaderboard. |
Array<OnlineLeaderboardEntry, HeapAllocation>
entries
The list of result entries. |
int32
start
The zero-based index to start downloading entries from. For example, to display the top 10 on a leaderboard pass value of 0. |
int32
count
The amount of entries to read, starting from the first entry at start . |
Returns
bool
True if failed, otherwise false. |
GetLeaderboardEntriesAroundUser(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, int32 start=-4, int32 count=10)
Gets the online leaderboard entries around the player. Allows to specify the range for ranks to gather around the user rank. The current user's entry is always included.
Declaration
public virtual bool GetLeaderboardEntriesAroundUser(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, int32 start=-4, int32 count=10)
Parameters
OnlineLeaderboard
leaderboard
The leaderboard. |
Array<OnlineLeaderboardEntry, HeapAllocation>
entries
The list of result entries. |
int32
start
The zero-based index to start downloading entries relative to the user. For example, to display the 4 higher scores on a leaderboard pass value of -4. Value 0 will return current user as the first one. |
int32
count
The amount of entries to read, starting from the first entry at start . |
Returns
bool
True if failed, otherwise false. |
GetLeaderboardEntriesForFriends(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries)
Gets the online leaderboard entries for player friends.
Declaration
public virtual bool GetLeaderboardEntriesForFriends(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries)
Parameters
OnlineLeaderboard
leaderboard
The leaderboard. |
Array<OnlineLeaderboardEntry, HeapAllocation>
entries
The list of result entries. |
Returns
bool
True if failed, otherwise false. |
GetLeaderboardEntriesForUsers(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, const Array<OnlineUser, HeapAllocation>& users)
Gets the online leaderboard entries for an arbitrary set of users.
Declaration
public virtual bool GetLeaderboardEntriesForUsers(const OnlineLeaderboard& leaderboard, Array<OnlineLeaderboardEntry, HeapAllocation>& entries, const Array<OnlineUser, HeapAllocation>& users)
Parameters
OnlineLeaderboard
leaderboard
The leaderboard. |
Array<OnlineLeaderboardEntry, HeapAllocation>
entries
The list of result entries. |
Array<OnlineUser, HeapAllocation>
users
The list of users to read their ranks on the leaderboard. |
Returns
bool
True if failed, otherwise false. |
GetOrCreateLeaderboard(const StringView& name, OnlineLeaderboardSortModes sortMode, OnlineLeaderboardValueFormats valueFormat, OnlineLeaderboard& value, User* localUser=nullptr)
Gets or creates the online leaderboard. It will not create it if already exists.
Declaration
public virtual bool GetOrCreateLeaderboard(const StringView& name, OnlineLeaderboardSortModes sortMode, OnlineLeaderboardValueFormats valueFormat, OnlineLeaderboard& value, User* localUser=nullptr)
Parameters
StringView
name
The leaderboard name. |
OnlineLeaderboardSortModes
sortMode
The leaderboard sorting mode. |
OnlineLeaderboardValueFormats
valueFormat
The leaderboard values formatting. |
OnlineLeaderboard
value
The result value. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetSaveGame(const StringView& name, Array<byte, HeapAllocation>& data, User* localUser=nullptr)
Gets the online savegame data. Returns empty if savegame slot is unused.
Declaration
public virtual bool GetSaveGame(const StringView& name, Array<byte, HeapAllocation>& data, User* localUser=nullptr) = 0
Parameters
StringView
name
The savegame slot name. |
Array<byte, HeapAllocation>
data
The result data. Empty or null for unused slot name. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetStat(const StringView& name, float& value, User* localUser=nullptr)
Gets the online statistical value.
Declaration
public virtual bool GetStat(const StringView& name, float& value, User* localUser=nullptr) = 0
Parameters
StringView
name
The stat name. |
float
value
The result value. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetUser(OnlineUser& user, User* localUser=nullptr)
Gets the player from the online platform.
Declaration
public virtual bool GetUser(OnlineUser& user, User* localUser=nullptr) = 0
Parameters
OnlineUser
user
The local player user info. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
GetUserLoggedIn(User* localUser=nullptr)
Checks if the local user is logged in.
Declaration
public virtual bool GetUserLoggedIn(User* localUser=nullptr) = 0
Parameters
User
localUser
The local user (null if use default one). |
Returns
bool
True if user is logged, otherwise false. |
ResetAchievements(User* localUser=nullptr)
Resets the all achievements progress for this game.
Declaration
public virtual bool ResetAchievements(User* localUser=nullptr) = 0
Parameters
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
SetLeaderboardEntry(const OnlineLeaderboard& leaderboard, int32 score, bool keepBest=false)
Sets the online leaderboard entry for the user.
Declaration
public virtual bool SetLeaderboardEntry(const OnlineLeaderboard& leaderboard, int32 score, bool keepBest=false)
Parameters
OnlineLeaderboard
leaderboard
The leaderboard. |
int32
score
The score value to set. |
bool
keepBest
True if store value only if it's better than existing value (if any), otherwise will override any existing score for that user. |
Returns
bool
True if failed, otherwise false. |
SetSaveGame(const StringView& name, const Span<byte>& data, User* localUser=nullptr)
Sets the online savegame data.
Declaration
public virtual bool SetSaveGame(const StringView& name, const Span<byte>& data, User* localUser=nullptr) = 0
Parameters
StringView
name
The savegame slot name. |
Span<byte>
data
The data. Empty or null to delete slot (or mark as unused). |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
SetStat(const StringView& name, float value, User* localUser=nullptr)
Sets the online statistical value.
Declaration
public virtual bool SetStat(const StringView& name, float value, User* localUser=nullptr) = 0
Parameters
StringView
name
The stat name. |
float
value
The value. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
UnlockAchievement(const StringView& name, User* localUser=nullptr)
Unlocks the achievement.
Declaration
public virtual bool UnlockAchievement(const StringView& name, User* localUser=nullptr) = 0
Parameters
StringView
name
The achievement name. Specific for a game. |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
UnlockAchievementProgress(const StringView& name, float progress, User* localUser=nullptr)
Updates the achievement unlocking progress (in range 0-100).
Declaration
public virtual bool UnlockAchievementProgress(const StringView& name, float progress, User* localUser=nullptr) = 0
Parameters
StringView
name
The achievement name. Specific for a game. |
float
progress
The achievement unlock progress (in range 0-100). |
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
UserLogin(User* localUser=nullptr)
Logins the local user into the online platform.
Declaration
public virtual bool UserLogin(User* localUser=nullptr) = 0
Parameters
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |
UserLogout(User* localUser=nullptr)
Logout the local user from the online platform.
Declaration
public virtual bool UserLogout(User* localUser=nullptr) = 0
Parameters
User
localUser
The local user (null if use default one). |
Returns
bool
True if failed, otherwise false. |