public void ReportScore()
        {
            if (!GameServiceManager.IsInitialized())
            {
                MobileNativeUI.Alert("Alert", "You need to initialize the module first.");
                return;
            }

            if (selectedLeaderboard == null)
            {
                MobileNativeUI.Alert("Alert", "Please select a leaderboard to report score to.");
            }
            else
            {
                if (string.IsNullOrEmpty(scoreInput.text))
                {
                    MobileNativeUI.Alert("Alert", "Please enter a score to report.");
                }
                else
                {
                    int score = System.Convert.ToInt32(scoreInput.text);
                    GameServiceManager.ReportScore(score, selectedLeaderboard.Name);
                    MobileNativeUI.Alert("Alert", "Reported score " + score + " to leaderboard \"" + selectedLeaderboard.Name + "\".");
                }
            }
        }
        public void LoadFriends()
        {
            if (!GameServiceManager.IsInitialized())
            {
                MobileNativeUI.Alert("Alert", "You need to initialize the module first.");
                return;
            }

            GameServiceManager.LoadFriends(OnFriendsLoaded);
        }
 public void Init()
 {
     if (GameServiceManager.IsInitialized())
     {
         MobileNativeUI.Alert("Alert", "The module is already initialized.");
     }
     else
     {
         GameServiceManager.Init();
     }
 }
Ejemplo n.º 4
0
 public void ShowLeaderboardUI()
 {
     #if EASY_MOBILE
     if (GameServiceManager.IsInitialized())
     {
         GameServiceManager.ShowLeaderboardUI();
     }
     else
     {
         #if UNITY_IOS
         MobileNativeUI.Alert("Service Unavailable", "The user is not logged in to Game Center.");
         #elif UNITY_ANDROID
         GameServiceManager.Init();
         #endif
     }
     #endif
 }
 public void ShowAchievementUI()
 {
     if (GameServiceManager.IsInitialized())
     {
         GameServiceManager.ShowAchievementsUI();
     }
     else
     {
         #if UNITY_ANDROID
         GameServiceManager.Init();
         #elif UNITY_IOS
         MobileNativeUI.Alert("Service Unavailable", "The user is not logged in.");
         #else
         Debug.Log("Cannot show achievements: platform not supported.");
         #endif
     }
 }
        public void LoadLocalUserScore()
        {
            if (!GameServiceManager.IsInitialized())
            {
                MobileNativeUI.Alert("Alert", "You need to initialize the module first.");
                return;
            }

            if (selectedLeaderboard == null)
            {
                MobileNativeUI.Alert("Alert", "Please select a leaderboard to load score from.");
            }
            else
            {
                GameServiceManager.LoadLocalUserScore(selectedLeaderboard.Name, OnLocalUserScoreLoaded);
            }
        }
        public void UnlockAchievement()
        {
            if (!GameServiceManager.IsInitialized())
            {
                MobileNativeUI.Alert("Alert", "You need to initialize the module first.");
                return;
            }

            if (selectedAchievement != null)
            {
                GameServiceManager.UnlockAchievement(selectedAchievement.Name);
            }
            else
            {
                MobileNativeUI.Alert("Alert", "Please select an achievement to unlock.");
            }
        }
Ejemplo n.º 8
0
 public void ShowAchievementsUI()
 {
     #if EASY_MOBILE
     if (GameServiceManager.IsInitialized())
     {
         GameServiceManager.ShowAchievementsUI();
     }
     else
     {
     #if UNITY_IOS
         MobileNativeUI.Alert("Service Unavailable", "The user is not logged in to Game Center.");
     #elif UNITY_ANDROID
         GameServiceManager.Init();
     #endif
     }
     #else
     Debug.Log("This feature requires EasyMobile plugin.");
     #endif
 }
        void Update()
        {
            // Check if autoInit is on.
            if (EM_Settings.GameService.IsAutoInit)
            {
                demoUtils.DisplayBool(isAutoInitInfo, true, "Auto Initialization: ON");
            }
            else
            {
                demoUtils.DisplayBool(isAutoInitInfo, false, "Auto Initialization: OFF");
            }

            // Check if the module is initalized.
            if (GameServiceManager.IsInitialized())
            {
                demoUtils.DisplayBool(isInitializedInfo, true, "isInitialized: TRUE");
            }
            else
            {
                demoUtils.DisplayBool(isInitializedInfo, false, "isInitialized: FALSE");
            }
        }