Class AchievementsService
- Namespace
- PlayEveryWare.EpicOnlineServices.Samples
Class AchievementsService
is a simplified wrapper for
EOS Achievements Interface.
public class AchievementsService : EOSService, IDisposable
- Inheritance
-
AchievementsService
- Implements
- Inherited Members
Properties
Instance
Accessor for the instance.
public static AchievementsService Instance { get; }
Property Value
Methods
CachedAchievements()
Returns an IEnumerable of the achievement definitions that have been cached by the EOS SDK. Should be called after QueryAchievements() TODO: Provide a guarantee that the QueryAchievements function has been called at least once before this is called - failing that provide a descriptive warning to users.
public IEnumerable<DefinitionV2> CachedAchievements()
Returns
- IEnumerable<DefinitionV2>
The achievements for the game.
CachedPlayerAchievements(ProductUserId)
Enumerates the collection of cached achievements for the player associated with the provided ProductUserId.
public IEnumerable<PlayerAchievement> CachedPlayerAchievements(ProductUserId productUserId)
Parameters
productUserId
ProductUserIdThe ProductUserId that corresponds to the player for whom the achievements are to be enumerated.
Returns
- IEnumerable<PlayerAchievement>
The cached achievements for the given player.
GetAchievementDefinitionAtIndex(int)
Returns the achievement definition at the given index. The index is the index of the achievement as it exists in the collection of achievements on the server side - so it is not a particularly meaningful means to get the achievement definition, unless you are enumerating all of them.
public DefinitionV2 GetAchievementDefinitionAtIndex(int idx)
Parameters
idx
intThe achievement definition at the index - where the index is the index of the achievement on the server side.
Returns
- DefinitionV2
The definition of an achievement from the dev portal.
GetAchievementLockedIconTexture(string)
Retrieves the texture for the achievement to be used when a player has not unlocked the achievement.
public Task<Texture2D> GetAchievementLockedIconTexture(string achievementId)
Parameters
achievementId
stringThe id of the achievement to get the locked icon texture of.
Returns
- Task<Texture2D>
The texture to be used when a player has not unlocked the achievement.
GetAchievementUnlockedIconTexture(string)
Retrieves the texture for the achievement to be used when a player has unlocked the achievement.
public Task<Texture2D> GetAchievementUnlockedIconTexture(string achievementId)
Parameters
achievementId
stringThe id of the achievement to get the unlocked icon texture of.
Returns
- Task<Texture2D>
The texture to be used when a player has unlocked the achievement.
GetAchievementsCount()
Gets the number of achievement definitions that have been cached locally.
public static uint GetAchievementsCount()
Returns
- uint
Number of cached achievement definitions.
InternalRefreshAsync()
Refreshes all the data related to the achievements and statistics. This encompasses updating the achievement definitions in addition to updating the details of the achievements and statistics that relate to any player for whom that information has been requested previously.
protected override Task InternalRefreshAsync()
Returns
OnLoggedIn()
Implement this method to perform tasks when a user authenticates. By default, there is no action taken.
protected override void OnLoggedIn()
Reset()
This method clears all state for the service. If overridden in an implementing class, this base implementation should be called at the end of that implementation. Implementing classes probably should override this function.
protected override void Reset()
UnlockAchievementAsync(string)
Unlocks the achievement for the current player. TODO: Create a callback version of this method
public Task UnlockAchievementAsync(string achievementId)
Parameters
achievementId
stringThe id of the achievement to unlock for the current player.