public static void InitGameService(
     AndroidJavaObject gameService
     , GameServiceClientConfiguration configuration
     , DelegateCore.OnSuccessInit onSuccess
     , DelegateCore.OnError onError
     , DelegateCore.NotificationListener notificationListener
     )
 {
     gameService.Call("InitGameService"
                      , configuration.ClientId
                      , configuration.ClientSecret
                      , configuration.EnableLog
                      , configuration.LoginType == LoginType.Guest
                      , new IGameServiceCallback(c =>
     {
         if (c.Equals("Success"))
         {
             onSuccess.Invoke(gameService);
         }
     }, onError.Invoke)
                      , new IGSNotificationListener(l =>
     {
         if (notificationListener != null)
         {
             notificationListener.Invoke(l);
         }
     }));
 }
Exemple #2
0
        /// <summary>
        /// With this command you can get  list of all your game LeaderBoard
        /// that you have registered in the Developer panel
        /// </summary>
        /// <param name="callback">List of LeaderBoard <see cref="DelegateCore.OnGetLeaderBoards"/></param>
        /// <param name="error">Error</param>
        public void GetLeaderBoards(DelegateCore.OnGetLeaderBoards callback, DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }


            _gameServiceObj.Call("GetLeaderBoards"
                                 , new IGameServiceCallback(onCallback => {
                callback.Invoke(JsonConvert.DeserializeObject <List <LeaderBoard> >(onCallback));
            }
                                                            , error.Invoke));
        }
Exemple #3
0
 public void RemoveLastSave(DelegateCore.OnCallback saveGameData, DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("RemoveLastSave", new IGameServiceCallback(saveGameData.Invoke, error.Invoke));
     }
 }
Exemple #4
0
        /// <summary>
        /// This command is used to login again or login from guest mode to normal or vice versa
        /// </summary>
        /// <param name="logout">return true if Successful</param>
        /// <param name="error">Error</param>
        public void LogOut(DelegateCore.IsUserLogout logout, DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            _gameServiceObj.Call("Logout", new IGameServiceCallback(c =>
            {
                _gameServiceObj = null;
                _isAvailable    = false;
                logout.Invoke(true);
            }, error.Invoke));
        }
Exemple #5
0
        /// <summary>
        /// With this command you can get the current version of the game service application
        /// </summary>
        /// <param name="version">the current version of the game service application</param>
        /// <param name="error">Error</param>
        public void GetAppVersion(DelegateCore.OnCallback version, DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            if (_type == GameServiceType.Native)
            {
                if (FiroozehGameService.Configuration.EnableLog)
                {
                    LogUtil.LogError(Tag, "GetSDKVersion Only Available In AppMode");
                }
                return;
            }

            _gameServiceObj.Call("GetSDKVersion", new IGameServiceCallback(version.Invoke, error.Invoke));
        }
Exemple #6
0
        /// <summary>
        /// With this command Current game page opens in the game service app
        /// NOTE : This Command Only Available in App Mode
        /// </summary>
        /// <param name="error">Error</param>
        public void ShowGamePageUi(DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            if (_type == GameServiceType.Native)
            {
                if (FiroozehGameService.Configuration.EnableLog)
                {
                    LogUtil.LogError(Tag, "ShowGamePageUI Only Available In AppMode");
                }
                return;
            }

            _gameServiceObj.Call("ShowGamePageUI", new IGameServiceCallback(onCallback => { }

                                                                            , error.Invoke));
        }
Exemple #7
0
        /// <summary>
        /// With this command you can get information about the current player is playing
        /// </summary>
        /// <param name="saveGameData">the current player is playing<see cref="DelegateCore.OnGetUserData"/></param>
        /// <param name="error">Error</param>
        public void GetUserData(DelegateCore.OnGetUserData saveGameData, DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }


            _gameServiceObj.Call("GetUserData", new IGameServiceCallback(r =>
            {
                saveGameData.Invoke(JsonConvert.DeserializeObject <User>(r));
            }, error.Invoke));
        }
Exemple #8
0
        /// <summary>
        /// With this command you can Unlock achievement with the achievement ID
        /// you registered in the Developer panel.
        /// </summary>
        /// <param name="achievementId">The ID of Achievement you Want To Unlock it</param>
        /// <param name="callback"> Unlock Achievement Object<see cref="DelegateCore.OnUnlockAchievement"/></param>
        /// <param name="error">Error</param>
        public void UnlockAchievement(
            string achievementId,
            DelegateCore.OnUnlockAchievement callback,
            DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            _gameServiceObj.Call("UnlockAchievement"
                                 , achievementId
                                 , _haveNotification
                                 , new IGameServiceCallback(onCallback => {
                callback.Invoke(JsonConvert.DeserializeObject <Achievement>(onCallback));
            }
                                                            , error.Invoke));
        }
Exemple #9
0
        /// <summary>
        /// This command allows you to Submit Player Score with the ID of the leaderBoard
        /// you have Registered in the Developer panel
        /// </summary>
        /// <param name="leaderBoardId">leaderBoardId</param>
        /// <param name="scoreValue">scoreValue(The value must not exceed the maximum value Registered in the Developer Panel)</param>
        /// <param name="callback">Get Submit Score Response <see cref="DelegateCore.OnSubmitScoreResponse"/>></param>
        /// <param name="error">Error</param>
        public void SubmitScore(
            string leaderBoardId,
            int scoreValue,
            DelegateCore.OnSubmitScoreResponse callback,
            DelegateCore.OnError error)

        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            _gameServiceObj.Call("SubmitScore"
                                 , leaderBoardId
                                 , scoreValue
                                 , _haveNotification
                                 , new IGameServiceCallback(onCallback =>
            {
                callback.Invoke(JsonConvert.DeserializeObject <SubmitScoreResponse>(onCallback));
            }, error.Invoke));
        }
Exemple #10
0
 public void GetSDKVersion(DelegateCore.OnCallback version, DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("GetSDKVersion", new IGameServiceCallback(version.Invoke, error.Invoke));
     }
 }
Exemple #11
0
        public static void InitGameService(
            string clientId
            , string clientSecret
            , bool logEnable
            , bool isGuest
            , DelegateCore.OnSuccessInit onSuccess
            , DelegateCore.OnError onError
            , DelegateCore.NotificationListener notificationListener
            )
        {
            var gameService = GetGameServiceInstance();

            gameService.Call("InitGameService",
                             clientId,
                             clientSecret,
                             logEnable,
                             isGuest,
                             new IGameServiceCallback(callBack => {
                if (callBack.Equals("Success"))
                {
                    onSuccess.Invoke(gameService);
                }
            },
                                                      onError.Invoke)
                             , new IGSNotificationListener(l =>
            {
                if (notificationListener != null)
                {
                    notificationListener.Invoke(l);
                }
            }));
        }
Exemple #12
0
        public void ShowSurveyUi(DelegateCore.OnError error)
        {
            if (_gameServiceObj != null)
            {
                _gameServiceObj.Call("ShowSurveyUI", new IGameServiceCallback(Oncallback => { }

                                                                              , error.Invoke));
            }
        }
Exemple #13
0
 public void ShowAchievementsUI(DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("ShowAchievementUI"
                              , new IGameServiceCallback(Oncallback => { }
                                                         , error.Invoke));
     }
 }
Exemple #14
0
 public void GetUserData(DelegateCore.OnGetUserData saveGameData, DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("GetUserData", new IGameServiceCallback(r =>
         {
             saveGameData.Invoke(JsonConvert.DeserializeObject <User>(r));
         }, error.Invoke));
     }
 }
Exemple #15
0
        public void ShowLeaderBoardsUI(DelegateCore.OnError error)
        {
            if (_gameServiceObj != null)
            {
                _gameServiceObj.Call("ShowLeaderBoardUI"
                                     , new IGameServiceCallback(Oncallback => { }

                                                                , error.Invoke));
            }
        }
Exemple #16
0
 public void GetLeaderBoards(DelegateCore.OnGetLeaderBoards callback, DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("GetLeaderBoards"
                              , new IGameServiceCallback(Oncallback => {
             callback.Invoke(JsonConvert.DeserializeObject <List <LeaderBoard> >(Oncallback));
         }
                                                         , error.Invoke));
     }
 }
Exemple #17
0
 public static void Init(
     string clientId
     , string clientSecret
     , DelegateCore.OnSuccessInit onInitGameServiceSuccess
     , DelegateCore.OnError onInitGameServiceError)
 {
     GameServicePluginHandler.InitGameService(
         clientId,
         clientSecret,
         onInitGameServiceSuccess
         , onInitGameServiceError);
 }
Exemple #18
0
 public void GetAchievements(DelegateCore.OnGetAchievement callback, DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("GetAchievement"
                              , new IGameServiceCallback(Oncallback =>
         {
             callback.Invoke(JsonConvert.DeserializeObject <List <Achievement> >(Oncallback));
         }
                                                         , error.Invoke));
     }
 }
Exemple #19
0
 public void DownloadObbData(
     string obbDataTag
     , DelegateCore.OnCallback downloadCallback
     , DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("DownloadObbDataFile"
                              , obbDataTag
                              , new IGameServiceCallback(downloadCallback.Invoke
                                                         , error.Invoke));
     }
 }
 public static void ShowLoginUI(
     bool checkAppStatus
     , bool checkOptionalUpdate
     , DelegateCore.IsUserLogin isUserLogin
     , DelegateCore.OnError error)
 {
     GameServicePluginHandler.InitGameLoginService(checkAppStatus, checkOptionalUpdate
                                                   , s =>
     {
         s.Call("ShowLoginUI",
                new IGameServiceLoginCheck(
                    isUserLogin.Invoke, error.Invoke));
     }
                                                   , error.Invoke);
 }
Exemple #21
0
        public void GetLeaderBoardDetails(
            string leaderBoardId,
            DelegateCore.OnGetLeaderBoardDetails callback,
            DelegateCore.OnError error)

        {
            if (_gameServiceObj != null)
            {
                _gameServiceObj.Call("GetLeaderBoardData"
                                     , leaderBoardId
                                     , new IGameServiceCallback(oncallback => {
                    callback.Invoke(JsonConvert.DeserializeObject <LeaderBoardDetails>(oncallback));
                }, error.Invoke));
            }
        }
Exemple #22
0
        public void SubmitScore(
            string leaderBoardId,
            int scoreValue,
            DelegateCore.OnCallback callback,
            DelegateCore.OnError error)

        {
            if (_gameServiceObj != null)
            {
                _gameServiceObj.Call("SubmitScore"
                                     , leaderBoardId
                                     , scoreValue
                                     , _haveNotification
                                     , new IGameServiceCallback(callback.Invoke, error.Invoke));
            }
        }
Exemple #23
0
 public void UnlockAchievement(
     string achievementId,
     DelegateCore.OnUnlockAchievement callback,
     DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("UnlockAchievement"
                              , achievementId
                              , _haveNotification
                              , new IGameServiceCallback(Oncallback => {
             callback.Invoke(JsonConvert.DeserializeObject <Achievement>(Oncallback));
         }
                                                         , error.Invoke));
     }
 }
Exemple #24
0
 public void SaveGame(
     string saveGameName
     , string saveGameDescription
     , string saveGameCover
     , string saveGameData
     , DelegateCore.OnCallback callback
     , DelegateCore.OnError error)
 {
     if (_gameServiceObj != null)
     {
         _gameServiceObj.Call("SaveData"
                              , saveGameName
                              , saveGameDescription
                              , saveGameCover
                              , saveGameData
                              , new IGameServiceCallback(callback.Invoke, error.Invoke));
     }
 }
Exemple #25
0
        public static void InitGameService(
            string clientId
            , string clientSecret,
            DelegateCore.OnSuccessInit onSuccess,
            DelegateCore.OnError onError)
        {
            var gameService = GetGameServiceInstance();

            gameService.Call("InitGameService",
                             clientId,
                             clientSecret,
                             new IGameServiceCallback(callBack => {
                if (callBack.Equals("Success"))
                {
                    onSuccess.Invoke(gameService);
                }
            },
                                                      onError.Invoke));
        }
Exemple #26
0
        public static void InitGameLoginService(
            bool checkAppStatus
            , bool checkOptionalUpdate
            , DelegateCore.OnSuccessInit onSuccess,
            DelegateCore.OnError onError)
        {
            var loginService = GetGameLoginServiceInstance();

            loginService.Call("InitLoginService",
                              checkAppStatus,
                              checkOptionalUpdate,
                              new IGameServiceCallback(callBack => {
                if (callBack.Equals("Success"))
                {
                    onSuccess.Invoke(loginService);
                }
            },
                                                       onError.Invoke));
        }
Exemple #27
0
 public static void CheckUserLoginStatus(
     bool checkAppStatus
     , bool checkOptionalUpdate
     , bool isLogEnable
     , DelegateCore.IsUserLogin userLogin
     , DelegateCore.OnError error)
 {
     AppPluginHandler.InitGameLoginService(
         checkAppStatus
         , checkOptionalUpdate
         , isLogEnable
         , s =>
     {
         s.Call("IsUserLoggedIn",
                new IGameServiceLoginCheck(
                    userLogin.Invoke
                    , error.Invoke));
     }, error.Invoke);
 }
 public void Init(DelegateCore.OnSuccessInitService onSuccess, DelegateCore.OnError onError)
 {
     FiroozehGameServiceLoginCheck.CheckUserLoginStatus(
         _checkAppStatus
         , _checkOptionalUpdate
         , isLogin =>
     {
         if (isLogin)
         {
             GameServiceInitializer.Init(_clientId, _clientSecret, s =>
             {
                 onSuccess.Invoke(new FiroozehGameService(s, _haveNotification));
             }
                                         , onError.Invoke);
         }
         else
         {
             FiroozehGameServiceLoginCheck.ShowLoginUI(
                 _checkAppStatus
                 , _checkOptionalUpdate
                 , r =>
             {
                 if (r)
                 {
                     GameServiceInitializer.Init(
                         _clientId,
                         _clientSecret,
                         s =>
                     {
                         onSuccess.Invoke(new FiroozehGameService(s, _haveNotification));
                     }
                         , onError.Invoke);
                 }
             }, onError.Invoke);
         }
     },
         onError.Invoke)
     ;
 }
Exemple #29
0
        /// <summary>
        /// This command can remove the last current user saved
        /// </summary>
        /// <param name="removeSave">removeSave Result ("Done" if Successful)</param>
        /// <param name="error">Error</param>
        public void RemoveLastSave(DelegateCore.OnCallback removeSave, DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }

            _gameServiceObj.Call("RemoveLastSave", new IGameServiceCallback(removeSave.Invoke, error.Invoke));
        }
Exemple #30
0
        /// <summary>
        /// With this command you can save your Current Status in Game
        /// </summary>
        /// <param name="saveGameName">saveGameName</param>
        /// <param name="saveGameDescription">saveGameDescription</param>
        /// <param name="saveGameObj">the Object that you Want To Save it</param>
        /// <param name="callback">Your Save Object <see cref="DelegateCore.OnSaveGame{T}"/>></param>
        /// <param name="error">Error</param>
        public void SaveGame(
            string saveGameName
            , string saveGameDescription
            , object saveGameObj
            , DelegateCore.OnSaveGame <SaveDetails> callback
            , DelegateCore.OnError error)
        {
            if (_gameServiceObj == null)
            {
                if (_isAvailable)
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "GameService Is NotAvailable yet");
                    }
                }
                else
                {
                    if (FiroozehGameService.Configuration.EnableLog)
                    {
                        LogUtil.LogError(Tag, "You Logout Before ,You Must Config it Again...");
                    }
                }
                return;
            }


            _gameServiceObj.Call("SaveGame"
                                 , saveGameName
                                 , saveGameDescription
                                 , JsonConvert.SerializeObject(saveGameObj)
                                 , new IGameServiceCallback(onCallback =>
            {
                callback.Invoke(JsonConvert.DeserializeObject <SaveDetails>(onCallback));
            }, error.Invoke));
        }