public void FetchAllSavedGames()
        {
            GameServices.SavedGames.FetchAllSavedGames((SavedGame[] games, string error) =>
            {
                if (string.IsNullOrEmpty(error))
                {
                    allSavedGames = games;

                    var items = new Dictionary <string, string>();

                    foreach (SavedGame game in allSavedGames)
                    {
#if UNITY_IOS
                        items.Add(game.Name, game.DeviceName + " " + game.ModificationDate.ToString("d"));
#else
                        items.Add(game.Name, game.ModificationDate.ToString("d"));
                            #endif
                    }

                    var scrollableList           = ScrollableList.Create(scrollableListPrefab, "ALL SAVED GAMES", items);
                    scrollableList.ItemSelected += OnSavedGameSelectedFromScrollableList;
                }
                else
                {
                    NativeUI.Alert("Alert", "Fetch all saved games failed with error: " + error);
                }
            });
        }
Exemplo n.º 2
0
        void OnFriendsLoaded(IUserProfile[] friends)
        {
            if (friends.Length > 0)
            {
                var items = new Dictionary <string, string>();

                foreach (IUserProfile user in friends)
                {
                    items.Add(user.userName, user.id);
                }

                ScrollableList.Create(scrollableListPrefab, "FRIEND LIST", items);
            }
            else
            {
                NativeUI.Alert("Load Friends Result", "Couldn't find any friend.");
            }
        }
Exemplo n.º 3
0
        public void SelectProduct()
        {
            var products = EM_Settings.InAppPurchasing.Products;

            if (products == null || products.Length == 0)
            {
                NativeUI.Alert("Alert", "You don't have any IAP product. Please go to Window > Easy Mobile > Settings and add some.");
                selectedProduct = null;
                return;
            }

            var items = new Dictionary <string, string>();

            foreach (IAPProduct pd in products)
            {
                items.Add(pd.Name, pd.Type.ToString());
            }

            var scrollableList = ScrollableList.Create(scrollableListPrefab, "PRODUCTS", items);

            scrollableList.ItemSelected += OnItemSelected;
        }
Exemplo n.º 4
0
        public void SelectLeaderboard()
        {
            var leaderboards = EM_Settings.GameServices.Leaderboards;

            if (leaderboards == null || leaderboards.Length == 0)
            {
                NativeUI.Alert("Alert", "You haven't added any leaderboard. Please go to Window > Easy Mobile > Settings and add some.");
                selectedAchievement = null;
                return;
            }

            var items = new Dictionary <string, string>();

            foreach (Leaderboard ldb in leaderboards)
            {
                items.Add(ldb.Name, ldb.Id);
            }

            var scrollableList = ScrollableList.Create(scrollableListPrefab, "LEADERBOARDS", items);

            scrollableList.ItemSelected += OnLeaderboardSelected;
        }
Exemplo n.º 5
0
        public void SelectAchievement()
        {
            var achievements = EM_Settings.GameServices.Achievements;

            if (achievements == null || achievements.Length == 0)
            {
                NativeUI.Alert("Alert", "You haven't added any achievement. Please go to Window > Easy Mobile > Settings and add some.");
                selectedAchievement = null;
                return;
            }

            var items = new Dictionary <string, string>();

            foreach (Achievement acm in achievements)
            {
                items.Add(acm.Name, acm.Id);
            }

            var scrollableList = ScrollableList.Create(scrollableListPrefab, "ACHIEVEMENTS", items);

            scrollableList.ItemSelected += OnAchievementSelected;
        }