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
        public static ScrollableList Create(GameObject listPrefab, string title, Dictionary <string, string> items)
        {
            GameObject     listObj        = Instantiate(listPrefab, listPrefab.transform.position, listPrefab.transform.rotation) as GameObject;
            ScrollableList scrollableList = listObj.GetComponent <ScrollableList>();

            scrollableList.title.text = title;
            scrollableList.items      = items;
            scrollableList.Init();

            return(scrollableList);
        }
        void OnSavedGameSelectedFromScrollableList(ScrollableList list, string title, string subtitle)
        {
            list.ItemSelected -= OnSavedGameSelectedFromScrollableList;

            foreach (SavedGame game in allSavedGames)
            {
                if (game.Name.Equals(title))
                {
                    selectedSavedGame = game;
                    NativeUI.Alert("Saved Game Selected", "You selected saved game: " + selectedSavedGame.Name);
                    return;
                }
            }
        }
Exemplo n.º 4
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.º 5
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.º 6
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.º 7
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;
        }
Exemplo n.º 8
0
 void OnItemSelected(ScrollableList list, string title, string subtitle)
 {
     list.ItemSelected       -= OnItemSelected;
     selectedProduct          = InAppPurchasing.GetIAPProductByName(title);
     selectedProductInfo.text = "Selected product: " + selectedProduct.Name + " (" + selectedProduct.Type.ToString() + ")";
 }
Exemplo n.º 9
0
 void OnLeaderboardSelected(ScrollableList list, string title, string subtitle)
 {
     list.ItemSelected           -= OnLeaderboardSelected;
     selectedLeaderboard          = GameServices.GetLeaderboardByName(title);
     selectedLeaderboardInfo.text = "Selected leaderboard: " + title;
 }
Exemplo n.º 10
0
 void OnAchievementSelected(ScrollableList list, string title, string subtitle)
 {
     list.ItemSelected           -= OnAchievementSelected;
     selectedAchievement          = GameServices.GetAchievementByName(title);
     selectedAchievementInfo.text = "Selected achievement: " + title;
 }
 private void OnSavedGameSelectedFromScrollableList(ScrollableList list, string title, string subtitle)
 {
 }
Exemplo n.º 12
0
 private static void <ItemSelected> m__0(ScrollableList A_0, string A_1, string A_2)
 {
 }
Exemplo n.º 13
0
 private static void <UIClosed> m__1(ScrollableList A_0)
 {
 }
Exemplo n.º 14
0
 private void OnLeaderboardSelected(ScrollableList list, string title, string subtitle)
 {
 }
Exemplo n.º 15
0
 private void OnAchievementSelected(ScrollableList list, string title, string subtitle)
 {
 }
Exemplo n.º 16
0
 private void OnItemSelected(ScrollableList list, string title, string subtitle)
 {
 }