예제 #1
0
        public static void SetStat(Stats stat, int value)
        {
            if (!GameplayManager.m_i_am_a_cheater && !GameManager.m_cheating_detected)
            {
#if UNITY_XBOXONE && !UNITY_EDITOR
                XboxOneStats.SetStat(stat, value);
#elif UNITY_PS4 && !UNITY_EDITOR
                PlayerPrefs.SetInt("stat_" + stat.ToString(), value);
#else
                if (CloudProvider == CloudProviders.Steam)
                {
                    Steamworks.SteamUserStats.SetStat(stat.ToString(), value);
#if !UNITY_STANDALONE_LINUX
                }
                else if (CloudProvider == CloudProviders.Galaxy)
                {
                    try {
                        Galaxy.Api.GalaxyInstance.Stats().SetStatInt(stat.ToString(), value);
                    }
                    catch (Exception ex) {
                        Debug.Log("Error setting Galaxy stat: " + ex.Message);
                    }
#endif
                }
#endif
            }
        }
예제 #2
0
        public static int GetStatInt(Stats stat)
        {
            if (!StatsAvailable)
            {
                return(0);
            }

#if UNITY_XBOXONE && !UNITY_EDITOR
            return(XboxOneStats.GetStatInt(stat));;
#elif UNITY_PS4 && !UNITY_EDITOR
            return(PlayerPrefs.GetInt("stat_" + stat.ToString()));
#else
            if (CloudProvider == CloudProviders.Steam)
            {
                int value = 0;
                Steamworks.SteamUserStats.GetStat(stat.ToString(), out value);
                return(value);

#if !UNITY_STANDALONE_LINUX
            }
            else if (CloudProvider == CloudProviders.Galaxy)
            {
                try {
                    return(Galaxy.Api.GalaxyInstance.Stats().GetStatInt(stat.ToString()));
                }
                catch (Exception ex) {
                    Debug.Log("Error getting Galaxy stat: " + ex.Message);
                    return(0);
                }
#endif
            }
            else
            {
                return(0);
            }
#endif
        }
예제 #3
0
        public static void SetStat(Stats stat, float value)
        {
#if UNITY_XBOXONE && !UNITY_EDITOR
            XboxOneStats.SetStat(stat, value);
#elif UNITY_PS4 && !UNITY_EDITOR
            PlayerPrefs.SetFloat("stat_" + stat.ToString(), value);
#else
            if (CloudProvider == CloudProviders.Steam)
            {
                Steamworks.SteamUserStats.SetStat(stat.ToString(), value);
#if !UNITY_STANDALONE_LINUX
            }
            else if (CloudProvider == CloudProviders.Galaxy)
            {
                try {
                    Galaxy.Api.GalaxyInstance.Stats().SetStatFloat(stat.ToString(), value);
                }
                catch (Exception ex) {
                    Debug.LogWarning("Error settings Galaxy stat: " + ex.Message);
                }
#endif
            }
#endif
        }