Esempio n. 1
0
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     _bc             = gameObject.AddComponent <BrainCloudWrapper>();
     _bc.WrapperName = gameObject.name;
     _bc.InitWithApps();
 }
        public void Setup()
        {
            LoadIds();

            _bc = new BrainCloudWrapper();
            Dictionary <string, string> secretMap = new Dictionary <string, string>();

            secretMap.Add(AppId, Secret);
            secretMap.Add(ChildAppId, ChildSecret);
            _bc.InitWithApps(ServerUrl, AppId, secretMap, Version);
            _bc.Client.EnableLogging(true);
            _bc.Client.RegisterLogDelegate(HandleLog);

            //set to enable compression
            if (SupportsCompression != "")
            {
                _bc.Client.EnableCompression(Boolean.Parse(SupportsCompression));
            }

            if (ShouldAuthenticate())
            {
                TestResult tr = new TestResult(_bc);
                _bc.Client.AuthenticationService.AuthenticateUniversal(
                    GetUser(Users.UserA).Id,
                    GetUser(Users.UserA).Password,
                    true,
                    tr.ApiSuccess, tr.ApiError);
                tr.Run();
            }
        }