Ejemplo n.º 1
0
        private void OnEnable()
        {
            if (FiroozehGameService.Core.GameService.IsAuthenticated())
            {
                return;
            }
            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,
                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");
        }