internal static void InstallEvents() { UserStatsReceived_t.Install((UserStatsReceived_t x) => { if (x.SteamIDUser == SteamClient.SteamId) { SteamUserStats.StatsRecieved = true; } Action <SteamId, Result> onUserStatsReceived = SteamUserStats.OnUserStatsReceived; if (onUserStatsReceived != null) { onUserStatsReceived(x.SteamIDUser, x.Result); } else { } }, false); UserStatsStored_t.Install((UserStatsStored_t x) => { Action <Result> onUserStatsStored = SteamUserStats.OnUserStatsStored; if (onUserStatsStored != null) { onUserStatsStored(x.Result); } else { } }, false); UserAchievementStored_t.Install((UserAchievementStored_t x) => { Action <Achievement, int, int> onAchievementProgress = SteamUserStats.OnAchievementProgress; if (onAchievementProgress != null) { onAchievementProgress(new Achievement(x.AchievementName), x.CurProgress, x.MaxProgress); } else { } }, false); UserStatsUnloaded_t.Install((UserStatsUnloaded_t x) => { Action <SteamId> onUserStatsUnloaded = SteamUserStats.OnUserStatsUnloaded; if (onUserStatsUnloaded != null) { onUserStatsUnloaded(x.SteamIDUser); } else { } }, false); UserAchievementIconFetched_t.Install((UserAchievementIconFetched_t x) => { Action <string, int> onAchievementIconFetched = SteamUserStats.OnAchievementIconFetched; if (onAchievementIconFetched != null) { onAchievementIconFetched(x.AchievementName, x.IconHandle); } else { } }, false); }
internal static void InstallEvents() { UserStatsReceived_t.Install(x => { if (x.SteamIDUser == SteamClient.SteamId) { StatsRecieved = true; } OnUserStatsReceived?.Invoke(x.SteamIDUser, x.Result); }); UserStatsStored_t.Install(x => OnUserStatsStored?.Invoke(x.Result)); UserAchievementStored_t.Install(x => OnAchievementProgress?.Invoke(x.AchievementName, (int)x.CurProgress, (int)x.MaxProgress)); UserStatsUnloaded_t.Install(x => OnUserStatsUnloaded?.Invoke(x.SteamIDUser)); }
private void OnUserStatsStored(UserStatsStored_t pCallback) { // We may get callbacks for other games' stats arriving, ignore them if ((ulong)m_GameID != pCallback.m_nGameID) return; if (EResult.k_EResultOK != pCallback.m_eResult) { if (EResult.k_EResultInvalidParam == pCallback.m_eResult) { // One or more stats we set broke a constraint. They've been reverted, // and we should re-iterate the values now to keep in sync. Debug.LogWarning("StoreStats - some failed to validate"); // Fake up a callback here so that we re-load the values. UserStatsReceived_t callback = new UserStatsReceived_t(); callback.m_eResult = EResult.k_EResultOK; callback.m_nGameID = (ulong)m_GameID; OnUserStatsReceived(callback); } else { Debug.LogWarning("StoreStats - failed, " + pCallback.m_eResult); } } //Debug.Log("UserStats Stored"); }
private void OnUserStatsStored(UserStatsStored_t pCallback) { Debug.Log("[" + UserStatsStored_t.k_iCallback + " - UserStatsStored] - " + pCallback.m_nGameID + " -- " + pCallback.m_eResult); }