Пример #1
0
        public override Dictionary <string, bool> GetAchievementDictionary()
        {
            if (!SteamManager.Initialized)
            {
                Debug.LogError("Couldn't create the achievement dictionary because Steam VR is not yet initialized!");
                return(base.GetAchievementDictionary());
            }

            Dictionary <string, bool> achievements = new Dictionary <string, bool>();
            uint numAchievements = SteamUserStats.GetNumAchievements();

            for (uint i = 0; i < numAchievements; i++)
            {
                string name = SteamUserStats.GetAchievementName(i);
                bool   unlocked;
                bool   hasAchievement = SteamUserStats.GetAchievement(name, out unlocked);
                if (hasAchievement)
                {
                    achievements.Add(name, unlocked);
                }
                else
                {
                    Debug.LogError("Steamworks failed to get achievement data for " + name);
                }
            }

            return(achievements);
        }
Пример #2
0
        public AchievementCollection EndGetAchievements(IAsyncResult result)
        {
            uint numAch = SteamUserStats.GetNumAchievements();
            List <Achievement> achievements = new List <Achievement>((int)numAch);

            for (uint i = 0; i < numAch; i += 1)
            {
                string key  = SteamUserStats.GetAchievementName(i);
                string name = SteamUserStats.GetAchievementDisplayAttribute(key, "name");
                string desc = SteamUserStats.GetAchievementDisplayAttribute(key, "desc");
                string hide = SteamUserStats.GetAchievementDisplayAttribute(key, "hidden");
                bool   earned;
                uint   unlockTime;
                SteamUserStats.GetUserAchievementAndUnlockTime(
                    steamID,
                    key,
                    out earned,
                    out unlockTime
                    );
                DateTime unlockDT = new DateTime(1970, 1, 1, 0, 0, 0);
                unlockDT.AddSeconds(unlockTime);
                achievements.Add(new Achievement(
                                     key,
                                     name,
                                     desc,
                                     hide == "0",
                                     earned,
                                     unlockDT
                                     ));
            }
            statReceiveAction = null;
            return(new AchievementCollection(achievements));
        }
Пример #3
0
 public void ResetAllAchievements()
 {
     for (int i = 0; i < SteamUserStats.GetNumAchievements(); i++)
     {
         SteamUserStats.ClearAchievement(SteamUserStats.GetAchievementName((uint)i));
     }
     //SteamUserStats.ClearAchievement("MATCH_3S");
 }
Пример #4
0
        private async Task ReloadAchievementsAsync(bool reloadImages)
        {
            EnableInteraction(false);

            lv.Items.Clear();

            var achCount = SteamUserStats.GetNumAchievements();
            var achIds   = new List <string>();

            for (var i = 0u; i < achCount; i += 1)
            {
                var achId = SteamUserStats.GetAchievementName(i);
                achIds.Add(achId);
            }

            foreach (var achId in achIds)
            {
                Bitmap icon = null;

                if (reloadImages)
                {
                    icon = await GetAchievementIconAsync(achId);

                    if (icon != null)
                    {
                        iml.Images.Add(achId, icon);
                    }
                }

                var ach = AchievementInfo.Query(achId);

                var lvi = new ListViewItem();
                lvi.Text = ach.DisplayName;

                if (icon != null || !reloadImages)
                {
                    lvi.ImageKey = achId;
                }

                lvi.SubItems.Add(BoolToStr(ach.IsAchieved));

                lvi.SubItems.Add(ach.Description);
                lvi.SubItems.Add(ach.ApiName);
                lvi.SubItems.Add(BoolToStr(ach.IsHidden));

                lvi.Tag = ach;

                lv.Items.Add(lvi);
            }

            lblStats.Visible = true;
            UpdateStatsText();

            EnableInteraction(true);
        }
Пример #5
0
        public static void GetAchievementIDs()
        {
            uint iAchievements = SteamUserStats.GetNumAchievements();

            Console.WriteLine("Internal Achievement IDs: ");
            for (uint i = 0; i < iAchievements; i++)
            {
                string strName = SteamUserStats.GetAchievementName(i);
                Console.Write("  {0}{1}", strName, Environment.NewLine);
            }
        }
Пример #6
0
        public static string ClearAllAchievements()
        {
            uint iAchievements = SteamUserStats.GetNumAchievements();

            for (uint i = 0; i < iAchievements; i++)
            {
                string strAchievement = SteamUserStats.GetAchievementName(i);
                SteamUserStats.ClearAchievement(strAchievement);
            }
            if (SteamUserStats.StoreStats())
            {
                return(string.Format("Successfully cleared {0} Achievement(s)!\n", iAchievements));
            }
            return("Failed to clear achievements.\n");
        }
Пример #7
0
        private static Dictionary <string, double> GetAchievementStatsInner()
        {
            var count = SteamUserStats.GetNumAchievements();
            var tiers = new Dictionary <string, double>();

            for (var i = 0U; i < count; ++i)
            {
                var name = SteamUserStats.GetAchievementName(i);
                if (SteamUserStats.GetAchievementAchievedPercent(name, out var percent))
                {
                    tiers[name] = percent;
                }
            }
            return(tiers);
        }
Пример #8
0
        private static Dictionary <string, int> GetAchievementsInner()
        {
            var count = SteamUserStats.GetNumAchievements();
            var tiers = new Dictionary <string, int>();

            for (var i = 0U; i < count; ++i)
            {
                var name = SteamUserStats.GetAchievementName(i);
                if (SteamUserStats.GetAchievement(name, out var achieved) && achieved && name.StartsWith("SPECIAL_EVENT_") &&
                    name[name.Length - 2] == '_' && char.IsDigit(name[name.Length - 1]))
                {
                    var key   = name.Substring(0, name.Length - 2);
                    var value = name[name.Length - 1] - '0';
                    Logging.Debug("NAME: " + name);
                    Logging.Debug("BY: " + SteamUserStats.GetAchievementAchievedPercent(name, out var percent));
                    Logging.Debug("PERCENT: " + percent);
                    if (!tiers.TryGetValue(key, out var prev) || value > prev)
                    {
                        tiers[key] = Math.Max(prev, value);
                    }
                }
            }
            return(tiers);
        }
Пример #9
0
    private void Inspection()
    {
        if (currentXmlText.Item(currentTagNum).Name == "name")
        {
            nameState = true;

            currentName = currentXmlText.Item(currentTagNum).InnerText;
            srp.NamesHeroes.CurSpriteNameHero(currentName);
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "char")
        {
            inspectorXML.CharapterInspector(currentXmlText.Item(currentTagNum));
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "bg")
        {
            inspectorXML.BGInspector(currentXmlText.Item(currentTagNum));
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "fbg")
        {
            string fbg = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            srp.Backgrounds.ApplyFBG(fbg);
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "music")
        {
            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            srp.MusicController.LoadMusic(name);
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "sound")
        {
            inspectorXML.SoundInspector(currentXmlText.Item(currentTagNum));
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "choices")
        {
            ChoiceMode = true;

            int count = currentXmlText.Item(currentTagNum).ChildNodes.Count;

            XmlNode[] choices = new XmlNode[count];

            for (int i = 0; i < count; i++)
            {
                choices[i] = currentXmlText.Item(currentTagNum).ChildNodes.Item(i);
            }
            srp.SelectionController.Selection(choices);
        }
        else if (currentXmlText.Item(currentTagNum).Name == "chapter")
        {
            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            TravelMode = false;
            Singleton <GameState> .Instance.travelMode = "False";
            GoNextChapter(name, false);
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "ReadChapter")
        {
            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            IsChapterRead(name);
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "day")
        {
            string day = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            NextDay(day);
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "animation")
        {
            inspectorXML.AnimationInspector(currentXmlText.Item(currentTagNum));
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "IsItemInInventory")
        {
            string[] namesItems = currentXmlText.Item(currentTagNum).Attributes["namesItems"].Value.Split(',');
            string   chapter    = currentXmlText.Item(currentTagNum).Attributes["chapter"].Value;
            string   altChapter = currentXmlText.Item(currentTagNum).Attributes["altChapter"].Value;

            bool result = srp.Inventory.IsItemsInInventory(namesItems);

            if (currentXmlText.Item(currentTagNum).Attributes["mode"] != null)
            {
                result = currentXmlText.Item(currentTagNum).Attributes["mode"].Value == "reverse" ? !result : result;
            }

            if (result)
            {
                GoNextChapter(chapter, false);
            }
            else
            {
                if (altChapter != string.Empty)
                {
                    GoNextChapter(altChapter, false);
                }
                else
                {
                    currentTagNum++;
                }
            }

            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "AddItem")
        {
            string item          = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            bool   combinedItem  = false;
            string removeUseItem = "";
            int    taskComplete  = -1;

            if (currentXmlText.Item(currentTagNum).Attributes["combinedItem"] != null)
            {
                combinedItem  = bool.Parse(currentXmlText.Item(currentTagNum).Attributes["combinedItem"].Value);
                removeUseItem = currentXmlText.Item(currentTagNum).Attributes["removeUseItem"].Value;
                taskComplete  = int.Parse(currentXmlText.Item(currentTagNum).Attributes["taskComplete"].Value);
            }

            srp.Inventory.AddItemToInventory(item, combinedItem, removeUseItem, taskComplete);

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "RemoveItem")
        {
            string item = currentXmlText.Item(currentTagNum).Attributes["name"].Value;

            if (item == "All")
            {
                srp.Inventory.RemoveAllItemToInventory();
            }
            else
            {
                srp.Inventory.RemoveItemToInventory(item);
            }

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "TravelMode")
        {
            TravelMode = true;
            Singleton <GameState> .Instance.travelMode = "True";
            srp.SceneTransitionController.StartTransitionMode();
            InterfacePanelSetActive(false);
        }
        else if (currentXmlText.Item(currentTagNum).Name == "ModeGameItemsOnScene")
        {
            string state = currentXmlText.Item(currentTagNum).Attributes["state"].Value;
            GameItemsMode = bool.Parse(state);

            if (GameItemsMode)
            {
                srp.SceneGameItemsController.AddGameItemsOnScene();
            }
            else
            {
                srp.SceneGameItemsController.RemoveGameItemsOnScene();
            }

            Singleton <GameState> .Instance.gameItemsMode = GameItemsMode.ToString();

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "EditGameItemOnScene")
        {
            string scene       = currentXmlText.Item(currentTagNum).Attributes["scene"].Value;
            string item        = currentXmlText.Item(currentTagNum).Attributes["item"].Value;
            string interaction = currentXmlText.Item(currentTagNum).Attributes["interaction"].Value;
            string visibility  = currentXmlText.Item(currentTagNum).Attributes["visibility"].Value;

            srp.SceneGameItemsController.EditGameItemOnScene(scene, item, interaction, visibility);

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "TaskComplite")
        {
            int numTask = int.Parse(currentXmlText.Item(currentTagNum).Attributes["num"].Value);
            srp.TaskController.TaskComplete(numTask);
            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "EventEntranceOnScene")
        {
            string eventEntranceOnScene = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            string command = currentXmlText.Item(currentTagNum).Attributes["command"].Value;

            if (command == "Add")
            {
                Singleton <GameState> .Instance.eventEntranceOnScene.Add(eventEntranceOnScene);
            }
            else if (command == "Remove")
            {
                Singleton <GameState> .Instance.eventEntranceOnScene.Remove(eventEntranceOnScene);
            }

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "RememberEventsToScenes")
        {
            string[] eventsToScenes = currentXmlText.Item(currentTagNum).Attributes["eventsToScenes"].Value.Split(',');
            string   command        = currentXmlText.Item(currentTagNum).Attributes["command"].Value;

            if (command == "Add")
            {
                for (int i = 0; i < eventsToScenes.Length; i++)
                {
                    if (!Singleton <GameState> .Instance.rememberEventsToScenes.Contains(eventsToScenes[i]))
                    {
                        Singleton <GameState> .Instance.rememberEventsToScenes.Add(eventsToScenes[i]);
                    }
                }

                currentTagNum++;
            }
            else if (command == "Remove")
            {
                for (int i = 0; i < eventsToScenes.Length; i++)
                {
                    if (Singleton <GameState> .Instance.rememberEventsToScenes.Contains(eventsToScenes[i]))
                    {
                        Singleton <GameState> .Instance.rememberEventsToScenes.Remove(eventsToScenes[i]);
                    }
                }

                currentTagNum++;
            }
            else if (command == "IsEvent")
            {
                bool result = IsEventsToScenes(eventsToScenes);

                if (result)
                {
                    string chapter = currentXmlText.Item(currentTagNum).Attributes["chapter"].Value;
                    GoNextChapter(chapter, false);
                }
                else
                {
                    string altChapter = currentXmlText.Item(currentTagNum).Attributes["altChapter"].Value;

                    if (altChapter != string.Empty)
                    {
                        GoNextChapter(altChapter, false);
                    }
                    else
                    {
                        currentTagNum++;
                    }
                }
            }
            else if (command == "EditGameItemOnScene")
            {
                bool result = IsEventsToScenes(eventsToScenes);

                if (result)
                {
                    string scene       = currentXmlText.Item(currentTagNum).Attributes["scene"].Value;
                    string item        = currentXmlText.Item(currentTagNum).Attributes["item"].Value;
                    string interaction = currentXmlText.Item(currentTagNum).Attributes["interaction"].Value;
                    string visibility  = currentXmlText.Item(currentTagNum).Attributes["visibility"].Value;

                    srp.SceneGameItemsController.EditGameItemOnScene(scene, item, interaction, visibility);
                }

                currentTagNum++;
            }

            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "DeathEnd")
        {
            DeathMode      = true;
            Time.timeScale = 1f;
            StartCoroutine(srp.DeathEnd.IEDeathScene());
        }
        else if (currentXmlText.Item(currentTagNum).Name == "GameEnd")
        {
            GameEnd        = true;
            Time.timeScale = 1f;
            StartCoroutine(srp.GameEnd.IEStartGameEnd());
        }
        else if (currentXmlText.Item(currentTagNum).Name == "Note")
        {
            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;

            if (currentXmlText.Item(currentTagNum).Attributes["pressButton"] != null)
            {
                srp.NotesController.ShowNotePressButton(name);
            }
            else
            {
                srp.NotesController.ShowNote(name);
            }

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "Tutor")
        {
            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            srp.TutorController.ShowTutor(name);

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "MiniGame")
        {
            MiniGameMode = true;

            string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;

            int currentNumberGame = 0;

            if (currentXmlText.Item(currentTagNum).Attributes["game"] != null)
            {
                currentNumberGame = int.Parse(currentXmlText.Item(currentTagNum).Attributes["game"].Value);
            }

            srp.MiniGamesController.StartMiniGame(name, currentNumberGame);
            InterfacePanelSetActive(false);
        }
        else if (currentXmlText.Item(currentTagNum).Name == "DialogPanel")
        {
            string dialogPanel = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            Singleton <GameState> .Instance.dialogPanel = dialogPanel;
            DialogPanelChange(dialogPanel);

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "Log")
        {
            string log = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            Debug.Log("<color=purple>" + log + "</color>");

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "Lore")
        {
            string name        = currentXmlText.Item(currentTagNum).Attributes["name"].Value;
            string category    = currentXmlText.Item(currentTagNum).Attributes["category"].Value;
            string unlockLevel = currentXmlText.Item(currentTagNum).Attributes["unlockLevel"].Value;

            Singleton <ToolBox> .Instance.LoreOpen.UnlockLore(name, category, unlockLevel);

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "SteamAchivka")
        {
            try
            {
                string name = currentXmlText.Item(currentTagNum).Attributes["name"].Value;

                uint achivkaCount = SteamUserStats.GetNumAchievements();

                for (uint i = 0; i < achivkaCount; i++)
                {
                    string achivkaName = SteamUserStats.GetAchievementName(i);

                    if (achivkaName == name)
                    {
                        bool Unlocked;
                        SteamUserStats.GetAchievement(achivkaName, out Unlocked);
                        if (!Unlocked)
                        {
                            SteamUserStats.SetAchievement(achivkaName);
                        }
                        SteamUserStats.StoreStats();
                    }
                }
            }
            catch { Debug.Log("Нет подключения к Steam"); }

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "ArrowsSettings")
        {
            string mode = currentXmlText.Item(currentTagNum).Attributes["mode"].Value;

            if (mode == "deactivate")
            {
                string arrows = currentXmlText.Item(currentTagNum).Attributes["arrows"].Value;
                srp.SceneTransitionController.DeactivateArrows(arrows);
            }
            else if (mode == "text")
            {
                string arrow   = currentXmlText.Item(currentTagNum).Attributes["arrow"].Value;
                string bg      = currentXmlText.Item(currentTagNum).Attributes["bg"].Value;
                string chapter = currentXmlText.Item(currentTagNum).Attributes["chapter"].Value;
                srp.SceneTransitionController.ReWriteChapterArrow(arrow, bg, chapter);
            }

            currentTagNum++;
            Inspection();
        }
        else if (currentXmlText.Item(currentTagNum).Name == "Special")
        {
            string value = currentXmlText.Item(currentTagNum).Attributes["value"].Value;

            if (value == "openGallery")
            {
                PlayerPrefs.SetString("openGallery", "True");
            }
            else if (value == "openAmulet")
            {
                Singleton <GameState> .Instance.openAmulet = true;
            }

            currentTagNum++;
            Inspection();
        }
    }
    private void RenderPageOne()
    {
        if (GUILayout.Button("RequestCurrentStats()"))
        {
            bool ret = SteamUserStats.RequestCurrentStats();
            print("RequestCurrentStats() - " + ret);
        }

        {
            bool ret = SteamUserStats.GetStat("NumGames", out m_NumGamesStat);
            GUILayout.Label("GetStat(\"NumGames\", out m_NumGamesStat) - " + ret + " -- " + m_NumGamesStat);
        }

        {
            bool ret = SteamUserStats.GetStat("FeetTraveled", out m_FeetTraveledStat);
            GUILayout.Label("GetStat(\"FeetTraveled\", out m_FeetTraveledStat) - " + ret + " -- " + m_FeetTraveledStat);
        }

        if (GUILayout.Button("SetStat(\"NumGames\", m_NumGamesStat + 1)"))
        {
            bool ret = SteamUserStats.SetStat("NumGames", m_NumGamesStat + 1);
            print("SetStat(\"NumGames\", " + (m_NumGamesStat + 1) + ") - " + ret);
        }

        if (GUILayout.Button("SetStat(\"FeetTraveled\", m_FeetTraveledStat + 1)"))
        {
            bool ret = SteamUserStats.SetStat("FeetTraveled", m_FeetTraveledStat + 1);
            print("SetStat(\"FeetTraveled\", " + (m_FeetTraveledStat + 1) + ") - " + ret);
        }

        if (GUILayout.Button("UpdateAvgRateStat(\"AverageSpeed\", 100, 60.0)"))
        {
            bool ret = SteamUserStats.UpdateAvgRateStat("AverageSpeed", 100, 60.0);
            print("UpdateAvgRateStat(\"AverageSpeed\", 100, 60.0) - " + ret);
        }

        {
            bool ret = SteamUserStats.GetAchievement("ACH_WIN_ONE_GAME", out m_AchievedWinOneGame);
            GUILayout.Label("GetAchievement(\"ACH_WIN_ONE_GAME\", out m_AchievedWinOneGame) - " + ret + " -- " + m_AchievedWinOneGame);
        }

        if (GUILayout.Button("SetAchievement(\"ACH_WIN_ONE_GAME\")"))
        {
            bool ret = SteamUserStats.SetAchievement("ACH_WIN_ONE_GAME");
            print("SetAchievement(\"ACH_WIN_ONE_GAME\") - " + ret);
        }

        if (GUILayout.Button("ClearAchievement(\"ACH_WIN_ONE_GAME\")"))
        {
            bool ret = SteamUserStats.ClearAchievement("ACH_WIN_ONE_GAME");
            print("ClearAchievement(\"ACH_WIN_ONE_GAME\") - " + ret);
        }

        {
            bool Achieved;
            uint UnlockTime;
            bool ret = SteamUserStats.GetAchievementAndUnlockTime("ACH_WIN_ONE_GAME", out Achieved, out UnlockTime);
            GUILayout.Label("GetAchievementAndUnlockTime(\"ACH_WIN_ONE_GAME\", out Achieved, out UnlockTime) - " + ret + " -- " + Achieved + " -- " + UnlockTime);
        }

        if (GUILayout.Button("StoreStats()"))
        {
            bool ret = SteamUserStats.StoreStats();
            print("StoreStats() - " + ret);
        }

        if (GUILayout.Button("GetAchievementIcon(\"ACH_WIN_ONE_GAME\")"))
        {
            int icon = SteamUserStats.GetAchievementIcon("ACH_WIN_ONE_GAME");
            print("SteamUserStats.GetAchievementIcon(\"ACH_WIN_ONE_GAME\") - " + icon);

            if (icon != 0)
            {
                uint Width  = 0;
                uint Height = 0;
                bool ret    = SteamUtils.GetImageSize(icon, out Width, out Height);

                if (ret && Width > 0 && Height > 0)
                {
                    byte[] RGBA = new byte[Width * Height * 4];
                    ret = SteamUtils.GetImageRGBA(icon, RGBA, RGBA.Length);
                    if (ret)
                    {
                        m_Icon = new Texture2D((int)Width, (int)Height, TextureFormat.RGBA32, false, true);
                        m_Icon.LoadRawTextureData(RGBA);
                        m_Icon.Apply();
                    }
                }
            }
        }

        GUILayout.Label("GetAchievementDisplayAttribute(\"ACH_WIN_ONE_GAME\", \"name\") : " + SteamUserStats.GetAchievementDisplayAttribute("ACH_WIN_ONE_GAME", "name"));

        if (GUILayout.Button("IndicateAchievementProgress(\"ACH_WIN_100_GAMES\", 10, 100)"))
        {
            bool ret = SteamUserStats.IndicateAchievementProgress("ACH_WIN_100_GAMES", 10, 100);
            print("IndicateAchievementProgress(\"ACH_WIN_100_GAMES\", 10, 100) - " + ret);
        }

        GUILayout.Label("GetNumAchievements() : " + SteamUserStats.GetNumAchievements());
        GUILayout.Label("GetAchievementName(0) : " + SteamUserStats.GetAchievementName(0));

        if (GUILayout.Button("RequestUserStats(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamUserStats.RequestUserStats(new CSteamID(76561197991230424));             //rlabrecque
            UserStatsReceived.Set(handle);
            print("RequestUserStats(" + SteamUser.GetSteamID() + ") - " + handle);
        }

        {
            int  Data;
            bool ret = SteamUserStats.GetUserStat(new CSteamID(76561197991230424), "NumWins", out Data);             //rlabrecque
            GUILayout.Label("GetUserStat(SteamUser.GetSteamID(), \"NumWins\", out Data) : " + ret + " -- " + Data);
        }

        {
            float Data;
            bool  ret = SteamUserStats.GetUserStat(new CSteamID(76561197991230424), "MaxFeetTraveled", out Data);            //rlabrecque
            GUILayout.Label("GetUserStat(SteamUser.GetSteamID(), \"NumWins\", out Data) : " + ret + " -- " + Data);
        }

        {
            bool Achieved;
            bool ret = SteamUserStats.GetUserAchievement(new CSteamID(76561197991230424), "ACH_TRAVEL_FAR_ACCUM", out Achieved);             //rlabrecque
            GUILayout.Label("GetUserAchievement(SteamUser.GetSteamID(), \"ACH_TRAVEL_FAR_ACCUM\", out Achieved) : " + ret + " -- " + Achieved);
        }

        {
            bool Achieved;
            uint UnlockTime;
            bool ret = SteamUserStats.GetUserAchievementAndUnlockTime(new CSteamID(76561197991230424), "ACH_WIN_ONE_GAME", out Achieved, out UnlockTime);             //rlabrecque
            GUILayout.Label("GetUserAchievementAndUnlockTime(SteamUser.GetSteamID(), ACH_TRAVEL_FAR_SINGLE\", out Achieved, out UnlockTime) : " + ret + " -- " + Achieved + " -- " + UnlockTime);
        }

        if (GUILayout.Button("ResetAllStats(true)"))
        {
            bool ret = SteamUserStats.ResetAllStats(true);
            print("ResetAllStats(true) - " + ret);
        }
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_NumGamesStat: " + m_NumGamesStat);
        GUILayout.Label("m_FeetTraveledStat: " + m_FeetTraveledStat);
        GUILayout.Label("m_AchievedWinOneGame: " + m_AchievedWinOneGame);
        GUILayout.Label("m_SteamLeaderboard: " + m_SteamLeaderboard);
        GUILayout.Label("m_SteamLeaderboardEntries: " + m_SteamLeaderboardEntries);
        GUILayout.Label("m_Icon:");
        GUILayout.Label(m_Icon);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        if (GUILayout.Button("RequestCurrentStats()"))
        {
            bool ret = SteamUserStats.RequestCurrentStats();
            print("SteamUserStats.RequestCurrentStats() : " + ret);
        }

        {
            bool ret = SteamUserStats.GetStat("NumGames", out m_NumGamesStat);
            GUILayout.Label("GetStat(\"NumGames\", out m_NumGamesStat) : " + ret + " -- " + m_NumGamesStat);
        }

        {
            bool ret = SteamUserStats.GetStat("FeetTraveled", out m_FeetTraveledStat);
            GUILayout.Label("GetStat(\"FeetTraveled\", out m_FeetTraveledStat) : " + ret + " -- " + m_FeetTraveledStat);
        }

        if (GUILayout.Button("SetStat(\"NumGames\", m_NumGamesStat + 1)"))
        {
            bool ret = SteamUserStats.SetStat("NumGames", m_NumGamesStat + 1);
            print("SteamUserStats.SetStat(" + "\"NumGames\"" + ", " + m_NumGamesStat + 1 + ") : " + ret);
        }

        if (GUILayout.Button("SetStat(\"FeetTraveled\", m_FeetTraveledStat + 1)"))
        {
            bool ret = SteamUserStats.SetStat("FeetTraveled", m_FeetTraveledStat + 1);
            print("SteamUserStats.SetStat(" + "\"FeetTraveled\"" + ", " + m_FeetTraveledStat + 1 + ") : " + ret);
        }

        if (GUILayout.Button("UpdateAvgRateStat(\"AverageSpeed\", 100, 60.0)"))
        {
            bool ret = SteamUserStats.UpdateAvgRateStat("AverageSpeed", 100, 60.0);
            print("SteamUserStats.UpdateAvgRateStat(" + "\"AverageSpeed\"" + ", " + 100 + ", " + 60.0 + ") : " + ret);
        }

        {
            bool ret = SteamUserStats.GetAchievement("ACH_WIN_ONE_GAME", out m_AchievedWinOneGame);
            GUILayout.Label("GetAchievement(\"ACH_WIN_ONE_GAME\", out m_AchievedWinOneGame) : " + ret + " -- " + m_AchievedWinOneGame);
        }

        if (GUILayout.Button("SetAchievement(\"ACH_WIN_ONE_GAME\")"))
        {
            bool ret = SteamUserStats.SetAchievement("ACH_WIN_ONE_GAME");
            print("SteamUserStats.SetAchievement(" + "\"ACH_WIN_ONE_GAME\"" + ") : " + ret);
        }

        if (GUILayout.Button("ClearAchievement(\"ACH_WIN_ONE_GAME\")"))
        {
            bool ret = SteamUserStats.ClearAchievement("ACH_WIN_ONE_GAME");
            print("SteamUserStats.ClearAchievement(" + "\"ACH_WIN_ONE_GAME\"" + ") : " + ret);
        }

        {
            bool Achieved;
            uint UnlockTime;
            bool ret = SteamUserStats.GetAchievementAndUnlockTime("ACH_WIN_ONE_GAME", out Achieved, out UnlockTime);
            GUILayout.Label("GetAchievementAndUnlockTime(\"ACH_WIN_ONE_GAME\", out Achieved, out UnlockTime) : " + ret + " -- " + Achieved + " -- " + UnlockTime);
        }

        if (GUILayout.Button("StoreStats()"))
        {
            bool ret = SteamUserStats.StoreStats();
            print("SteamUserStats.StoreStats() : " + ret);
        }

        if (GUILayout.Button("GetAchievementIcon(\"ACH_WIN_ONE_GAME\")"))
        {
            int ret = SteamUserStats.GetAchievementIcon("ACH_WIN_ONE_GAME");
            print("SteamUserStats.GetAchievementIcon(" + "\"ACH_WIN_ONE_GAME\"" + ") : " + ret);
            if (ret != 0)
            {
                m_Icon = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
            }
        }

        GUILayout.Label("GetAchievementDisplayAttribute(\"ACH_WIN_ONE_GAME\", \"name\") : " + SteamUserStats.GetAchievementDisplayAttribute("ACH_WIN_ONE_GAME", "name"));

        if (GUILayout.Button("IndicateAchievementProgress(\"ACH_WIN_100_GAMES\", 10, 100)"))
        {
            bool ret = SteamUserStats.IndicateAchievementProgress("ACH_WIN_100_GAMES", 10, 100);
            print("SteamUserStats.IndicateAchievementProgress(" + "\"ACH_WIN_100_GAMES\"" + ", " + 10 + ", " + 100 + ") : " + ret);
        }

        GUILayout.Label("GetNumAchievements() : " + SteamUserStats.GetNumAchievements());

        GUILayout.Label("GetAchievementName(0) : " + SteamUserStats.GetAchievementName(0));

        if (GUILayout.Button("RequestUserStats(TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamAPICall_t handle = SteamUserStats.RequestUserStats(TestConstants.Instance.k_SteamId_rlabrecque);
            OnUserStatsReceivedCallResult.Set(handle);
            print("SteamUserStats.RequestUserStats(" + TestConstants.Instance.k_SteamId_rlabrecque + ") : " + handle);
        }

        {
            int  Data;
            bool ret = SteamUserStats.GetUserStat(TestConstants.Instance.k_SteamId_rlabrecque, "NumWins", out Data);
            GUILayout.Label("GetUserStat(TestConstants.Instance.k_SteamId_rlabrecque, \"NumWins\", out Data) : " + ret + " -- " + Data);
        }

        {
            float Data;
            bool  ret = SteamUserStats.GetUserStat(TestConstants.Instance.k_SteamId_rlabrecque, "MaxFeetTraveled", out Data);
            GUILayout.Label("GetUserStat(TestConstants.Instance.k_SteamId_rlabrecque, \"MaxFeetTraveled\", out Data) : " + ret + " -- " + Data);
        }

        {
            bool Achieved;
            bool ret = SteamUserStats.GetUserAchievement(TestConstants.Instance.k_SteamId_rlabrecque, "ACH_TRAVEL_FAR_ACCUM", out Achieved);
            GUILayout.Label("GetUserAchievement(TestConstants.Instance.k_SteamId_rlabrecque, \"ACH_TRAVEL_FAR_ACCUM\", out Achieved) : " + ret + " -- " + Achieved);
        }

        {
            bool Achieved;
            uint UnlockTime;
            bool ret = SteamUserStats.GetUserAchievementAndUnlockTime(TestConstants.Instance.k_SteamId_rlabrecque, "ACH_WIN_ONE_GAME", out Achieved, out UnlockTime);
            GUILayout.Label("GetUserAchievementAndUnlockTime(TestConstants.Instance.k_SteamId_rlabrecque, \"ACH_WIN_ONE_GAME\", out Achieved, out UnlockTime) : " + ret + " -- " + Achieved + " -- " + UnlockTime);
        }

        if (GUILayout.Button("ResetAllStats(true)"))
        {
            bool ret = SteamUserStats.ResetAllStats(true);
            print("SteamUserStats.ResetAllStats(" + true + ") : " + ret);
        }

        if (GUILayout.Button("FindOrCreateLeaderboard(\"Feet Traveled\", ELeaderboardSortMethod.k_ELeaderboardSortMethodAscending, ELeaderboardDisplayType.k_ELeaderboardDisplayTypeNumeric)"))
        {
            SteamAPICall_t handle = SteamUserStats.FindOrCreateLeaderboard("Feet Traveled", ELeaderboardSortMethod.k_ELeaderboardSortMethodAscending, ELeaderboardDisplayType.k_ELeaderboardDisplayTypeNumeric);
            OnLeaderboardFindResultCallResult.Set(handle);
            print("SteamUserStats.FindOrCreateLeaderboard(" + "\"Feet Traveled\"" + ", " + ELeaderboardSortMethod.k_ELeaderboardSortMethodAscending + ", " + ELeaderboardDisplayType.k_ELeaderboardDisplayTypeNumeric + ") : " + handle);
        }

        if (GUILayout.Button("FindLeaderboard(\"Feet Traveled\")"))
        {
            SteamAPICall_t handle = SteamUserStats.FindLeaderboard("Feet Traveled");
            OnLeaderboardFindResultCallResult.Set(handle);
            print("SteamUserStats.FindLeaderboard(" + "\"Feet Traveled\"" + ") : " + handle);
        }

        // Spams SteamAPI Warnings that the SteamLeaderboard does not exist.
        if (m_SteamLeaderboard != new SteamLeaderboard_t(0))
        {
            GUILayout.Label("GetLeaderboardName(m_SteamLeaderboard) : " + SteamUserStats.GetLeaderboardName(m_SteamLeaderboard));

            GUILayout.Label("GetLeaderboardEntryCount(m_SteamLeaderboard) : " + SteamUserStats.GetLeaderboardEntryCount(m_SteamLeaderboard));

            GUILayout.Label("GetLeaderboardSortMethod(m_SteamLeaderboard) : " + SteamUserStats.GetLeaderboardSortMethod(m_SteamLeaderboard));

            GUILayout.Label("GetLeaderboardDisplayType(m_SteamLeaderboard) : " + SteamUserStats.GetLeaderboardDisplayType(m_SteamLeaderboard));
        }
        else
        {
            GUILayout.Label("GetLeaderboardName(m_SteamLeaderboard) : ");
            GUILayout.Label("GetLeaderboardEntryCount(m_SteamLeaderboard) : ");
            GUILayout.Label("GetLeaderboardSortMethod(m_SteamLeaderboard) : ");
            GUILayout.Label("GetLeaderboardDisplayType(m_SteamLeaderboard) : ");
        }

        if (GUILayout.Button("DownloadLeaderboardEntries(m_SteamLeaderboard, ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal, 1, 5)"))
        {
            SteamAPICall_t handle = SteamUserStats.DownloadLeaderboardEntries(m_SteamLeaderboard, ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal, 1, 5);
            OnLeaderboardScoresDownloadedCallResult.Set(handle);
            print("SteamUserStats.DownloadLeaderboardEntries(" + m_SteamLeaderboard + ", " + ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal + ", " + 1 + ", " + 5 + ") : " + handle);
        }

        if (GUILayout.Button("DownloadLeaderboardEntriesForUsers(m_SteamLeaderboard, Users, Users.Length)"))
        {
            CSteamID[]     Users  = { SteamUser.GetSteamID() };
            SteamAPICall_t handle = SteamUserStats.DownloadLeaderboardEntriesForUsers(m_SteamLeaderboard, Users, Users.Length);
            OnLeaderboardScoresDownloadedCallResult.Set(handle);
            print("SteamUserStats.DownloadLeaderboardEntriesForUsers(" + m_SteamLeaderboard + ", " + Users + ", " + Users.Length + ") : " + handle);
        }

        if (GUILayout.Button("GetDownloadedLeaderboardEntry(m_SteamLeaderboardEntries, 0, out LeaderboardEntry, null, 0)"))
        {
            LeaderboardEntry_t LeaderboardEntry;
            bool ret = SteamUserStats.GetDownloadedLeaderboardEntry(m_SteamLeaderboardEntries, 0, out LeaderboardEntry, null, 0);
            print("SteamUserStats.GetDownloadedLeaderboardEntry(" + m_SteamLeaderboardEntries + ", " + 0 + ", " + "out LeaderboardEntry" + ", " + null + ", " + 0 + ") : " + ret + " -- " + LeaderboardEntry);
        }

        if (GUILayout.Button("UploadLeaderboardScore(m_SteamLeaderboard, ELeaderboardUploadScoreMethod.k_ELeaderboardUploadScoreMethodForceUpdate, (int)m_FeetTraveledStat, null, 0)"))
        {
            SteamAPICall_t handle = SteamUserStats.UploadLeaderboardScore(m_SteamLeaderboard, ELeaderboardUploadScoreMethod.k_ELeaderboardUploadScoreMethodForceUpdate, (int)m_FeetTraveledStat, null, 0);
            OnLeaderboardScoreUploadedCallResult.Set(handle);
            print("SteamUserStats.UploadLeaderboardScore(" + m_SteamLeaderboard + ", " + ELeaderboardUploadScoreMethod.k_ELeaderboardUploadScoreMethodForceUpdate + ", " + (int)m_FeetTraveledStat + ", " + null + ", " + 0 + ") : " + handle);
        }

        if (GUILayout.Button("AttachLeaderboardUGC(m_SteamLeaderboard, UGCHandle_t.Invalid)"))
        {
            SteamAPICall_t handle = SteamUserStats.AttachLeaderboardUGC(m_SteamLeaderboard, UGCHandle_t.Invalid);
            OnLeaderboardUGCSetCallResult.Set(handle);
            print("SteamUserStats.AttachLeaderboardUGC(" + m_SteamLeaderboard + ", " + UGCHandle_t.Invalid + ") : " + handle);
        }

        if (GUILayout.Button("GetNumberOfCurrentPlayers()"))
        {
            SteamAPICall_t handle = SteamUserStats.GetNumberOfCurrentPlayers();
            OnNumberOfCurrentPlayersCallResult.Set(handle);
            print("SteamUserStats.GetNumberOfCurrentPlayers() : " + handle);
        }

        if (GUILayout.Button("RequestGlobalAchievementPercentages()"))
        {
            SteamAPICall_t handle = SteamUserStats.RequestGlobalAchievementPercentages();
            OnGlobalAchievementPercentagesReadyCallResult.Set(handle);
            print("SteamUserStats.RequestGlobalAchievementPercentages() : " + handle);
        }

        {
            int Iterator;

            {
                string Name;
                float  Percent;
                bool   Achieved;
                Iterator = SteamUserStats.GetMostAchievedAchievementInfo(out Name, 120, out Percent, out Achieved);
                if (Iterator != -1)
                {
                    GUILayout.Label("GetMostAchievedAchievementInfo(out Name, 120, out Percent, out Achieved) : " + Iterator + " -- " + Name + " -- " + Percent + " -- " + Achieved);
                }
                else
                {
                    GUILayout.Label("GetMostAchievedAchievementInfo(out Name, 120, out Percent, out Achieved) : " + Iterator);
                }
            }

            if (Iterator != -1)
            {
                string Name;
                float  Percent;
                bool   Achieved;
                Iterator = SteamUserStats.GetNextMostAchievedAchievementInfo(Iterator, out Name, 120, out Percent, out Achieved);
                GUILayout.Label("GetNextMostAchievedAchievementInfo(out Name, 120, out Percent, out Achieved) : " + Iterator + " -- " + Name + " -- " + Percent + " -- " + Achieved);
            }
        }

        {
            float Percent;
            bool  ret = SteamUserStats.GetAchievementAchievedPercent("ACH_WIN_100_GAMES", out Percent);
            GUILayout.Label("GetAchievementAchievedPercent(\"ACH_WIN_100_GAMES\", out Percent) : " + ret + " -- " + Percent);
        }

        if (GUILayout.Button("RequestGlobalStats(3)"))
        {
            SteamAPICall_t handle = SteamUserStats.RequestGlobalStats(3);
            OnGlobalStatsReceivedCallResult.Set(handle);
            print("SteamUserStats.RequestGlobalStats(" + 3 + ") : " + handle);
        }

        /* TODO - Spams SteamAPI warnings
         * Does SpaceWar have a stat marked as "aggregated" to try out these functions?
         * {
         *      long Data;
         *      bool ret = SteamUserStats.GetGlobalStat("", out Data);
         *      GUILayout.Label("GetGlobalStat(\"\", out Data) : " + ret + " -- " + Data);
         * }
         */

        {
            double Data;
            bool   ret = SteamUserStats.GetGlobalStat("", out Data);
            GUILayout.Label("GetGlobalStat(\"\", out Data) : " + ret + " -- " + Data);
        }

        {
            long[] Data = new long[1];
            int    ret  = SteamUserStats.GetGlobalStatHistory("", Data, (uint)Data.Length);
            if (ret != 0)
            {
                GUILayout.Label("GetGlobalStatHistory(\"\", Data, " + (uint)Data.Length + ") : " + ret + " -- " + Data[0]);
            }
            else
            {
                GUILayout.Label("GetGlobalStatHistory(\"\", Data, " + (uint)Data.Length + ") : " + ret + " -- ");
            }
        }

        {
            double[] Data = new double[1];
            int      ret  = SteamUserStats.GetGlobalStatHistory("", Data, (uint)Data.Length);
            if (ret != 0)
            {
                GUILayout.Label("GetGlobalStatHistory(\"\", Data, " + (uint)Data.Length + ") : " + ret + " -- " + Data[0]);
            }
            else
            {
                GUILayout.Label("GetGlobalStatHistory(\"\", Data, " + (uint)Data.Length + ") : " + ret + " -- ");
            }
        }

        //SteamUserStats.InstallPS3Trophies() // PS3 Only.

        //SteamUserStats.GetTrophySpaceRequiredBeforeInstall() // PS3 Only.

        //SteamUserStats.SetUserStatsData() // PS3 Only.

        //SteamUserStats.GetUserStatsData() // PS3 Only.

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }