コード例 #1
0
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     _bc             = gameObject.AddComponent <BrainCloudWrapper>();
     _bc.WrapperName = gameObject.name;
     _bc.InitWithApps();
 }
コード例 #2
0
        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();
            }
        }