拼ui 一些业务逻辑x实现
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
#if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX)
|
||||
#define DISABLESTEAMWORKS
|
||||
#endif
|
||||
|
||||
#if !DISABLESTEAMWORKS
|
||||
using Steamworks;
|
||||
#endif
|
||||
|
||||
public static class GlobalAchievementSteamBridge
|
||||
{
|
||||
public static bool TryUnlock(GlobalAchievementSO definition)
|
||||
{
|
||||
if (definition == null || !definition.syncWithSteam || string.IsNullOrWhiteSpace(definition.steamAchievementApiName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !DISABLESTEAMWORKS
|
||||
if (!SteamManager.Initialized)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = SteamUserStats.SetAchievement(definition.steamAchievementApiName);
|
||||
if (success)
|
||||
{
|
||||
SteamUserStats.StoreStats();
|
||||
}
|
||||
|
||||
return success;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user