Exemple #1
0
        private void FetchSavedGames()
        {
            //Remove Current List
            m_SavedGameMetaView.transform.parent.Clear(true);

            m_Client.FetchSavedGames(result =>
            {
                if (result.IsSucceeded)
                {
                    foreach (var snapshot in result.Snapshots)
                    {
                        var view = Instantiate(m_SavedGameMetaView.gameObject, m_SavedGameMetaView.transform.parent);
                        view.SetActive(true);
                        view.transform.localScale = Vector3.one;

                        var meta = view.GetComponent <UM_SavaedGameMetaView>();
                        meta.SetTitle(snapshot.Name + " (" + snapshot.DeviceName + ")");
                        meta.DeleteButton.onClick.AddListener(() =>
                        {
                            DeleteGameSave(snapshot);
                        });

                        meta.GetDataButton.onClick.AddListener(() =>
                        {
                            LoadData(snapshot);
                        });
                    }
                }
                else
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                }
            });
        }
        private void LoadMeta()
        {
            var client = UM_GameService.AchievementsClient;

            client.Load(result =>
            {
                if (result.IsSucceeded)
                {
                    foreach (var achievement in result.Achievements)
                    {
                        PrintAchievementInfo(achievement);
                        var view = Instantiate(m_AchievmentMetaView.gameObject, m_AchievmentMetaView.transform.parent);
                        view.SetActive(true);
                        view.transform.localScale = Vector3.one;

                        var meta = view.GetComponent <UM_AchievmentsMetaView>();
                        meta.SetTitle(achievement.Name + " / " + achievement.State);
                    }
                }
                else
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                }
            });
        }
Exemple #3
0
 private void DeleteGameSave(UM_iSavedGameMetadata game)
 {
     m_Client.Delete(game, result =>
     {
         if (result.IsSucceeded)
         {
             FetchSavedGames();
         }
         else
         {
             UM_DialogsUtility.DisplayResultMessage(result);
         }
     });
 }
Exemple #4
0
        private void Start()
        {
            m_LeaderboardMetaView.gameObject.SetActive(false);

            m_LoadButton.onClick.AddListener(LoadMeta);
            m_NativeUIButton.onClick.AddListener(() =>
            {
                var client = UM_GameService.LeaderboardsClient;
                client.ShowUI(result =>
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                });
            });
        }
Exemple #5
0
        private void CreateNewSave()
        {
            var client = UM_GameService.SavedGamesClient;
            var bytes  = Encoding.ASCII.GetBytes(m_SaveData.text);

            client.SaveGame(m_SaveName.text, bytes, result =>
            {
                if (result.IsSucceeded)
                {
                    FetchSavedGames();
                }
                else
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                }
            });
        }
Exemple #6
0
        public void LoadData(UM_iSavedGameMetadata game)
        {
            var client = UM_GameService.SavedGamesClient;

            client.LoadGameData(game, (result) =>
            {
                if (result.IsSucceeded)
                {
                    var text = Encoding.ASCII.GetString(result.Data);
                    UM_DialogsUtility.ShowMessage("Saved Game Data Loaded", text);
                    //Restore your game progress here
                }
                else
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                }
            });
        }
Exemple #7
0
        private void LoadMeta()
        {
            var client = UM_GameService.LeaderboardsClient;

            client.LoadLeaderboardsMetadata(result =>
            {
                if (result.IsSucceeded)
                {
                    foreach (var leaderboard in result.Leaderboards)
                    {
                        var view = Instantiate(m_LeaderboardMetaView.gameObject, m_LeaderboardMetaView.transform.parent);
                        view.SetActive(true);
                        view.transform.localScale = Vector3.one;

                        var meta = view.GetComponent <UM_LeaderboardMetaView>();
                        meta.SetTitle(leaderboard.Title);
                    }
                }
                else
                {
                    UM_DialogsUtility.DisplayResultMessage(result);
                }
            });
        }