void OnEnable()
        {
            if (FiroozehGameService.Core.GameService.IsAuthenticated())
            {
                return;
            }
            Debug.Log("GameService Version : " + FiroozehGameService.Core.GameService.Version() + " Initializing...");
            DontDestroyOnLoad(this);

            var systemInfo = new SystemInfo
            {
                DeviceUniqueId       = UnityEngine.SystemInfo.deviceUniqueIdentifier,
                DeviceModel          = UnityEngine.SystemInfo.deviceModel,
                DeviceName           = UnityEngine.SystemInfo.deviceName,
                DeviceType           = UnityEngine.SystemInfo.deviceType.ToString(),
                OperatingSystem      = UnityEngine.SystemInfo.operatingSystem,
                ProcessorCount       = UnityEngine.SystemInfo.processorCount,
                NetworkType          = Application.internetReachability.ToString(),
                ProcessorFrequency   = UnityEngine.SystemInfo.processorFrequency,
                ProcessorType        = UnityEngine.SystemInfo.processorType,
                GraphicsDeviceName   = UnityEngine.SystemInfo.graphicsDeviceName,
                GraphicsDeviceVendor = UnityEngine.SystemInfo.graphicsDeviceVendor,
                GraphicsMemorySize   = UnityEngine.SystemInfo.graphicsMemorySize
            };
            var config = new GameServiceClientConfiguration(ClientId, ClientSecret, systemInfo);

            FiroozehGameService.Core.GameService.ConfigurationInstance(config);
        }
 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);
         }
     }));
 }
 internal static void Init(
     GameServiceClientConfiguration configuration
     , Action <GameService> onSuccess
     , Action <string> onError)
 {
     if (configuration.LoginType == LoginType.Normal)
     {
         FiroozehGameServiceAppLoginCheck.CheckUserLoginStatus(
             configuration.CheckAppStatus
             , configuration.CheckOptionalUpdate
             , configuration.EnableLog
             , isLogin =>
         {
             if (isLogin)
             {
                 AppPluginHandler.InitGameService(
                     configuration.ClientId, configuration.ClientSecret, configuration.EnableLog, false,
                     s =>
                 {
                     onSuccess.Invoke(new GameService(s, GameServiceType.App,
                                                      configuration.HaveNotification));
                 }
                     , onError.Invoke, configuration.NotificationListener);
             }
             else
             {
                 FiroozehGameServiceAppLoginCheck.ShowLoginUI(
                     configuration.CheckAppStatus
                     , configuration.CheckOptionalUpdate
                     , configuration.EnableLog
                     , r =>
                 {
                     if (r)
                     {
                         AppPluginHandler.InitGameService(
                             configuration.ClientId, configuration.ClientSecret, configuration.EnableLog, false,
                             s =>
                         {
                             onSuccess.Invoke(new GameService(s, GameServiceType.App,
                                                              configuration.HaveNotification));
                         }
                             , onError.Invoke, configuration.NotificationListener);
                     }
                 }, onError.Invoke);
             }
         }, onError.Invoke);
     }
     else
     {
         AppPluginHandler.InitGameService(
             configuration.ClientId, configuration.ClientSecret, configuration.EnableLog, true,
             s =>
         {
             onSuccess.Invoke(new GameService(s, GameServiceType.App,
                                              configuration.HaveNotification));
         }
             , onError.Invoke, configuration.NotificationListener);
     }
 }
 internal static void DownloadAsset(string tag, GameServiceClientConfiguration configuration, Action <string> callback, Action <string> error)
 {
     LogUtil.LogDebug(Tag, "DownloadAssetStarted");
     _objDownload = NativePluginHandler.GetDownloadInstance();
     _objDownload.Call("DownloadAssetFile",
                       configuration.ClientId
                       , tag
                       , new IGameServiceCallback(callback.Invoke, error.Invoke));
 }
 public static void DownloadData(GameServiceClientConfiguration configuration, Action <string> callback, Action <string> error)
 {
     LogUtil.LogDebug(Tag, "DataDownloadStarted");
     _objDownload = NativePluginHandler.GetDownloadInstance();
     _objDownload.Call("DownloadObbDataFile",
                       configuration.ClientId
                       , configuration.DownloadTag
                       , new IGameServiceCallback(callback.Invoke, error.Invoke));
 }
        internal static void Init(GameServiceClientConfiguration configuration
                                  , Action <GameService> onSuccess
                                  , Action <string> onError)
        {
            var nativeService = NativePluginHandler.GetGameServiceInstance();

            NativePluginHandler.InitGameService(
                nativeService
                , configuration
                , gameService => { onSuccess.Invoke(new GameService(gameService, GameServiceType.Native, configuration.HaveNotification)); }
                , onError.Invoke, configuration.NotificationListener);
        }
        /// <summary>
        ///     Set configuration For Initialize Game Service.
        /// </summary>
        /// <param name="configuration">(NOTNULL)configuration For Initialize Game Service</param>
        public static void ConfigurationInstance(GameServiceClientConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new GameServiceException("Configuration Cant Be Null").LogException(typeof(GameService),
                                                                                          DebugLocation.Internal, "ConfigurationInstance");
            }

            if (SynchronizationContext.Current == null)
            {
                SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            }

            SynchronizationContext = SynchronizationContext.Current;

            if (IsAuthenticated())
            {
                throw new GameServiceException("Must Logout First To ReConfiguration").LogException(typeof(GameService),
                                                                                                    DebugLocation.Internal, "ConfigurationInstance");
            }

            Configuration   = configuration;
            HandlerType     = EventHandlerType.UnityContext;
            DownloadManager = new DownloadManager(Configuration);

            Achievement   = new AchievementProvider();
            Assets        = new AssetsProvider();
            Data          = new DataProvider();
            Table         = new TableProvider();
            CloudFunction = new CloudFunctionProvider();
            Leaderboard   = new LeaderboardProvider();
            LoginOrSignUp = new LoginOrSignUpProvider();
            Player        = new PlayerProvider();
            Save          = new SaveProvider();

            GSLive = new GsLive();
            Social = new Social.Social();
        }
        private void OnEnable()
        {
            if (FiroozehGameService.Core.GameService.IsAuthenticated())
            {
                return;
            }
            var systemInfo = new SystemInfo
            {
                DeviceUniqueId       = UnityEngine.SystemInfo.deviceUniqueIdentifier,
                DeviceModel          = UnityEngine.SystemInfo.deviceModel,
                DeviceName           = UnityEngine.SystemInfo.deviceName,
                DeviceType           = UnityEngine.SystemInfo.deviceType.ToString(),
                OperatingSystem      = UnityEngine.SystemInfo.operatingSystem,
                NetworkType          = Application.internetReachability.ToString(),
                ProcessorCount       = UnityEngine.SystemInfo.processorCount,
                ProcessorFrequency   = UnityEngine.SystemInfo.processorFrequency,
                ProcessorType        = UnityEngine.SystemInfo.processorType,
                GraphicsDeviceName   = UnityEngine.SystemInfo.graphicsDeviceName,
                GraphicsDeviceVendor = UnityEngine.SystemInfo.graphicsDeviceVendor,
                GraphicsMemorySize   = UnityEngine.SystemInfo.graphicsMemorySize
            };


            if (RealTimeUtilEnabled)
            {
                // set RealTime Helper Listener & Init GsLiveRealtime
                GsLiveRealtime.Init();
                Debug.Log("GsLiveRealtime Version : " + GsLiveRealtime.Version + " Initialized");
            }

            var config = new GameServiceClientConfiguration(ClientId, ClientSecret, systemInfo);

            FiroozehGameService.Core.GameService.ConfigurationInstance(config);

            Debug.Log("GameService Version : " + FiroozehGameService.Core.GameService.Version() + " Initialized");
        }
        private void OnEnable()
        {
            if (_isInit || FiroozehGameService.Core.GameService.IsAuthenticated())
            {
                return;
            }

            var systemInfo = new SystemInfo
            {
                DeviceUniqueId       = UnityEngine.SystemInfo.deviceUniqueIdentifier,
                DeviceModel          = UnityEngine.SystemInfo.deviceModel,
                DeviceName           = UnityEngine.SystemInfo.deviceName,
                DeviceType           = UnityEngine.SystemInfo.deviceType.ToString(),
                OperatingSystem      = UnityEngine.SystemInfo.operatingSystem,
                NetworkType          = Application.internetReachability.ToString(),
                ProcessorCount       = UnityEngine.SystemInfo.processorCount,
                ProcessorFrequency   = UnityEngine.SystemInfo.processorFrequency,
                ProcessorType        = UnityEngine.SystemInfo.processorType,
                GraphicsDeviceName   = UnityEngine.SystemInfo.graphicsDeviceName,
                GraphicsDeviceVendor = UnityEngine.SystemInfo.graphicsDeviceVendor,
                GraphicsMemorySize   = UnityEngine.SystemInfo.graphicsMemorySize
            };


            if (RealTimeUtilEnabled)
            {
                // set RealTime Helper Listener & Init GsLiveRealtime
                GsLiveRealtime.Init();
                Debug.Log("GsLiveRealtime Version : " + GsLiveRealtime.Version + " Initialized");
            }

            if (DebugSystemEnabled)
            {
                var debugConfig = new GameServiceDebugConfiguration(EnableExceptionLogger, EnableErrorLogger, EnableDebugLogger, DebugLocations);
                FiroozehGameService.Core.GameService.OnDebugReceived += OnDebugReceived;
                FiroozehGameService.Core.GameService.ConfigurationDebug(debugConfig);

                if (EnableSaveDebugLogs)
                {
                    if (!Directory.Exists(_appPath + DebugPath))
                    {
                        Directory.CreateDirectory(_appPath + DebugPath);
                        Debug.Log("GameService Debug Logs Directory Created. Path : " + _appPath + DebugPath);
                    }
                    else
                    {
                        Debug.Log("GameService Debug Logs Directory Path : " + _appPath + DebugPath);
                    }

                    File.AppendAllText(_appPath + DebugPath + _logFile, BeginLog);
                }

                Debug.Log("GameService Debug System Initialized");
            }


            var config = new GameServiceClientConfiguration(ClientId.Trim(), ClientSecret.Trim(), systemInfo);

            FiroozehGameService.Core.GameService.ConfigurationInstance(config);

            _isInit = true;
            Debug.Log("GameService Version : " + FiroozehGameService.Core.GameService.Version() + " Initialized");
        }
Beispiel #10
0
 /// <summary>
 /// Set configuration For Initialize Game Service.
 /// </summary>
 /// <param name="configuration">(Not NULL)configuration For Initialize Game Service</param>
 public static void ConfigurationInstance(GameServiceClientConfiguration configuration)
 {
     Configuration = configuration;
 }
Beispiel #11
0
 internal DownloadManager(GameServiceClientConfiguration config)
 {
     _configuration = config;
     _webClients    = new Dictionary <string, WebClient>();
 }