Пример #1
0
        static AccelBytePlugin()
        {
            var configFile = Resources.Load("AccelByteSDKConfig");

            if (configFile == null)
            {
                throw new Exception("'AccelByteSDKConfig.json' isn't found in the Project/Assets/Resources directory");
            }

            string wholeJsonText = ((TextAsset)configFile).text;

            AccelBytePlugin.config = SimpleJson.SimpleJson.DeserializeObject <Config>(wholeJsonText);
            AccelBytePlugin.config.Expand();
            AccelBytePlugin.taskDispatcher  = new AsyncTaskDispatcher();
            AccelBytePlugin.coroutineRunner = new CoroutineRunner();
            var authApi = new AuthenticationApi(AccelBytePlugin.config.IamServerUrl);

            AccelBytePlugin.user = new User(
                authApi,
                new UserApi(AccelBytePlugin.config.IamServerUrl),
                AccelBytePlugin.config.Namespace,
                AccelBytePlugin.config.ClientId,
                AccelBytePlugin.config.ClientSecret,
                AccelBytePlugin.config.RedirectUri,
                AccelBytePlugin.taskDispatcher,
                AccelBytePlugin.coroutineRunner);

            ServicePointManager.ServerCertificateValidationCallback = AccelBytePlugin.OnCertificateValidated;
        }
 internal User(AuthenticationApi authApi, UserApi userApi, string @namespace,
               string clientId, string clientSecret, string redirectUri, AsyncTaskDispatcher taskDispatcher,
               CoroutineRunner coroutineRunner)
 {
     this.authApi         = authApi;
     this.userApi         = userApi;
     this.@namespace      = @namespace;
     this.clientId        = clientId;
     this.clientSecret    = clientSecret;
     this.redirectUri     = redirectUri;
     this.taskDispatcher  = taskDispatcher;
     this.coroutineRunner = coroutineRunner;
     this.taskDispatcher.Start(this.Refresh());
 }