/// <summary>
        /// Registers the given device token with the server to enable this device
        /// to receive push notifications.
        /// </param>
        /// <param name="in_token">
        /// The platform-dependant device token needed for push notifications.
        /// </param>
        /// <param name="in_success">
        /// The success callback
        /// </param>
        /// <param name="in_failure">
        /// The failure callback
        /// </param>
        /// <param name="in_cbObject">
        /// The callback object
        /// </param>
        /// <returns> JSON describing the new value of the statistics and any rewards that were triggered:
        /// {
        ///   "status":200,
        ///   "data":null
        /// }
        /// </returns>
        public bool RegisterPushNotificationDeviceToken(
            byte[] in_token,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            if (in_token != null || in_token.Length < 1)
            {
                byte[] token = in_token;

                // send token to a provider
                // default to iOS
                // TODO: implement other device types
                string deviceType = OperationParam.DeviceRegistrationTypeIos.Value;
                if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.Android)
                {
                    deviceType = OperationParam.DeviceRegistrationTypeAndroid.Value;
                }

                string hexToken = System.BitConverter.ToString(token).Replace("-","").ToLower();
                return RegisterPushNotificationDeviceToken(deviceType,
                        hexToken,
                        in_success,
                        in_failure,
                        in_cbObject);
            }
            // there was an error
            else
            {
                return false;
            }
        }
        /// <summary>
        /// Adds a stream event
        /// </summary>
        /// <remarks>
        /// Service Name - PlaybackStream
        /// Service Operation - AddEvent
        /// </remarks>
        /// <param name="in_playbackStreamId">
        /// Identifies the stream to read
        /// </param>
        /// <param name="in_eventData">
        /// Describes the event
        /// </param>
        /// <param name="in_summary">
        /// Current summary data as of this event
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///    "status": 200,
        ///    "data": null
        /// }
        /// </returns>
        public void AddEvent(
            string in_playbackStreamId,
            string in_eventData,
            string in_summary,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.PlaybackStreamServicePlaybackStreamId.Value] = in_playbackStreamId;

            if (Util.IsOptionalParameterValid(in_eventData))
            {
                Dictionary<string, object> jsonEventData = JsonReader.Deserialize<Dictionary<string, object>> (in_eventData);
                data[OperationParam.PlaybackStreamServiceEventData.Value] = jsonEventData;
            }

            if (Util.IsOptionalParameterValid(in_summary))
            {
                Dictionary<string, object> jsonSummary = JsonReader.Deserialize<Dictionary<string, object>> (in_summary);
                data[OperationParam.PlaybackStreamServiceSummary.Value] = jsonSummary;
            }

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.PlaybackStream, ServiceOperation.AddEvent, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Method will award the achievements specified. On success, this will
        /// call AwardThirdPartyAchievement to hook into the client-side Achievement
        /// service (ie GameCentre, Facebook etc).
        /// </summary>
        /// <remarks>
        /// Service Name - Gamification
        /// Service Operation - AwardAchievements
        /// </remarks>
        /// <param name="in_achievementIds">
        /// A comma separated list of achievement ids to award
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data":null
        /// }
        /// </returns>
        public void AwardAchievements(
            string in_achievementIds,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            string[] ids = in_achievementIds.Split(new char[] { ',' });
            string achievementsStr = "[";
            for (int i = 0, isize = ids.Length; i < isize; ++i)
            {
                achievementsStr += (i == 0 ? "\"" : ",\"");
                achievementsStr += ids[i];
                achievementsStr += "\"";
            }
            achievementsStr += "]";

            string[] achievementData = JsonReader.Deserialize<string[]>(achievementsStr);

            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.GamificationServiceAchievementsName.Value] = achievementData;

            SuccessCallback successCallbacks = (SuccessCallback)AchievementAwardedSuccessCallback;
            if (in_success != null)
            {
                successCallbacks += in_success;
            }
            ServerCallback callback = BrainCloudClient.CreateServerCallback(successCallbacks, in_failure);
            ServerCall sc = new ServerCall(ServiceName.Gamification, ServiceOperation.AwardAchievements, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Registers the given device token with the server to enable this device
        /// to receive push notifications.
        /// </param>
        /// <param name="in_token">
        /// The platform-dependant device token needed for push notifications.
        /// </param>
        /// <param name="in_success">
        /// The success callback
        /// </param>
        /// <param name="in_failure">
        /// The failure callback
        /// </param>
        /// <param name="in_cbObject">
        /// The callback object
        /// </param>
        /// <returns> JSON describing the new value of the statistics and any rewards that were triggered:
        /// {
        ///   "status":200,
        ///   "data":null
        /// }
        /// </returns>
        public bool RegisterPushNotificationDeviceToken(
            byte[] in_token,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            if (in_token != null || in_token.Length < 1)
            {
                byte[] token = in_token;

                Platform platform = Platform.FromUnityRuntime();
                string hexToken = System.BitConverter.ToString(token).Replace("-","").ToLower();
                RegisterPushNotificationDeviceToken(platform,
                        hexToken,
                        in_success,
                        in_failure,
                        in_cbObject);
                return true;
            }
            // there was an error
            else
            {
                return false;
            }
        }
        /// <summary>
        /// Sends an event to the designated player id with the attached json data.
        /// Any events that have been sent to a player will show up in their
        /// incoming event mailbox. If the in_recordLocally flag is set to true,
        /// a copy of this event (with the exact same event id) will be stored
        /// in the sending player's "sent" event mailbox.
        ///
        /// Note that the list of sent and incoming events for a player is returned
        /// in the "ReadPlayerState" call (in the BrainCloudPlayer module).
        /// </summary>
        /// <remarks>
        /// Service Name - Event
        /// Service Operation - Send
        /// </remarks>
        /// <param name="in_toPlayerId">
        /// The id of the player who is being sent the event
        /// </param>
        /// <param name="in_eventType">
        /// The user-defined type of the event.
        /// </param>
        /// <param name="in_jsonEventData">
        /// The user-defined data for this event encoded in JSON.
        /// </param>
        /// <param name="in_recordLocally">
        /// If true, a copy of this event will be saved in the
        /// user's sent events mailbox.
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback includes the server generated
        /// event id and is as follows:
        /// {
        ///   "status":200,
        ///   "data":{
        ///     "eventId":3824
        ///   }
        /// }
        /// </returns>
        public void SendEvent(
            string in_toPlayerId,
            string in_eventType,
            string in_jsonEventData,
            bool in_recordLocally,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();

            data[OperationParam.EventServiceSendToId.Value] = in_toPlayerId;
            data[OperationParam.EventServiceSendEventType.Value] = in_eventType;

            if (Util.IsOptionalParameterValid(in_jsonEventData))
            {
                Dictionary<string, object> eventData = JsonReader.Deserialize<Dictionary<string, object>> (in_jsonEventData);
                data[OperationParam.EventServiceSendEventData.Value] = eventData;
            }

            data[OperationParam.EventServiceSendRecordLocally.Value] = in_recordLocally;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Event, ServiceOperation.Send, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #6
0
        public void TokenPreAuth(TokenPaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController)
        {
            var view = _viewLocator.GetTokenPreAuthView();
            view.successCallback = success;
            view.failureCallback = failure;
            view.tokenPayment = payment;
			PresentView (navigationController, view);
        }
Example #7
0
        public void RegisterCard(PaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController)
        {
            var view = _viewLocator.GetRegisterCardView();
            view.successCallback = success;
            view.failureCallback = failure;
            view.registerCardModel = payment;
			PresentView (navigationController, view);
        }
 /// <summary>
 /// Merge the profile associated with the provided Facebook credentials with the
 /// current profile.
 /// </summary>
 /// <remarks>
 /// Service Name - Identity
 /// Service Operation - Merge
 /// </remarks>
 /// <param name="externalId">
 /// The facebook id of the user
 /// </param>
 /// <param name="authenticationToken">
 /// The validated token from the Facebook SDK
 /// (that will be further validated when sent to the bC service)
 /// </param>
 /// <param name="in_success">
 /// The method to call in event of successful login
 /// </param>
 /// <param name="in_failure">
 /// The method to call in the event of an error during authentication
 /// </param>
 public void MergeFacebookIdentity(
     string in_externalId,
     string in_authenticationToken,
     SuccessCallback in_success,
     FailureCallback in_failure)
 {
     this.MergeIdentity(in_externalId, in_authenticationToken, OperationParam.AuthenticateServiceAuthenticateAuthFacebook.Value, in_success, in_failure);
 }
 /// <summary>
 /// Attach a Email and Password identity to the current profile.
 /// </summary>
 /// <remarks>
 /// Service Name - Identity
 /// Service Operation - Attach
 /// </remarks>
 /// <param name="in_email">
 /// The player's e-mail address
 /// </param>
 /// <param name="in_password">
 /// The player's password
 /// </param>
 /// <param name="in_success">
 /// The method to call in event of successful login
 /// </param>
 /// <param name="in_failure">
 /// The method to call in the event of an error during authentication
 /// </param>
 /// <returns>
 /// Errors to watch for:  SWITCHING_PROFILES - this means that the email address you provided
 /// already points to a different profile.  You will likely want to offer the player the
 /// choice to *SWITCH* to that profile, or *MERGE* the profiles.
 ///
 /// To switch profiles, call ClearSavedProfileID() and then call AuthenticateEmailPassword().
 /// </returns>
 public void AttachEmailIdentity(
     string in_email,
     string in_password,
     SuccessCallback in_success,
     FailureCallback in_failure)
 {
     this.AttachIdentity(in_email, in_password, OperationParam.AuthenticateServiceAuthenticateAuthEmail.Value, in_success, in_failure);
 }
 /// <summary>
 /// Method reads all the global properties of the game
 /// </summary>
 /// <remarks>
 /// Service Name - GlobalApp
 /// Service Operation - ReadProperties
 /// </remarks>
 /// <param name="in_success">
 /// The success callback.
 /// </param>
 /// <param name="in_failure">
 /// The failure callback.
 /// </param>
 /// <param name="in_cbObject">
 /// The user object sent to the callback.
 /// </param>
 /// <returns> JSON describing the global properties:
 /// {
 ///   "status":200,
 ///   "data": {
 ///     "pName": {
 ///       "name": "pName",
 ///	      "description": "pValue",
 ///	      "value": "pDescription"
 ///	    }
 ///   }
 /// }
 /// </returns>
 public void ReadProperties(
     SuccessCallback in_success = null,
     FailureCallback in_failure = null,
     object in_cbObject = null)
 {
     ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
     ServerCall serverCall = new ServerCall(ServiceName.GlobalApp, ServiceOperation.ReadProperties, null, callback);
     m_brainCloudClientRef.SendRequest(serverCall);
 }
		private void HandleFailure (FailureCallback failure,Exception ex)
		{
			if (failure != null) {
				var judoError = new JudoError {
					Exception = ex
				};
				failure (judoError);
			}
		}
 /// <summary>
 /// Returns JSON representing the next experience level for the player.
 /// </summary>
 /// <remarks>
 /// Service Name - PlayerStatistics
 /// Service Operation - ReadNextXpLevel
 /// </remarks>
 /// <param name="in_success">
 /// The success callback
 /// </param>
 /// <param name="in_failure">
 /// The failure callback
 /// </param>
 /// <param name="in_cbObject">
 /// The callback object
 /// </param>
 /// <returns> JSON describing the next experience level for the player.
 /// {
 ///   "status":200,
 ///   "data":{
 ///     "xp_level":{
 ///       "gameId":"com.bitheads.unityexample",
 ///       "numericLevel":2,
 ///       "experience":20,
 ///       "reward":{
 ///         "globalGameStatistics":null,
 ///         "experiencePoints":null,
 ///         "playerStatistics":null,
 ///         "achievement":null,
 ///         "currencies":{
 ///           "gems":10,
 ///           "gold":2000
 ///         }
 ///       },
 ///       "facebookAction":"",
 ///       "statusTitle":"Jester",
 ///       "key":{
 ///         "gameId":"com.bitheads.unityexample",
 ///         "numericLevel":2,
 ///         "primaryKey":true
 ///       }
 ///     }
 ///   }
 /// }
 /// </returns>
 public void GetNextExperienceLevel(
     SuccessCallback in_success = null,
     FailureCallback in_failure = null,
     object in_cbObject = null)
 {
     ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
     ServerCall sc = new ServerCall(ServiceName.PlayerStatistics, ServiceOperation.ReadNextXpLevel, null, callback);
     m_brainCloudClientRef.SendRequest(sc);
 }
 /// <summary>
 /// Method returns all of the global statistics.
 /// </summary>
 /// <remarks>
 /// Service Name - GlobalStatistics
 /// Service Operation - Read
 /// </remarks>
 /// <param name="in_success">
 /// The success callback
 /// </param>
 /// <param name="in_failure">
 /// The failure callback
 /// </param>
 /// <param name="in_cbObject">
 /// The callback object
 /// </param>
 /// <returns> JSON describing the global statistics:
 /// {
 ///   "status":200,
 ///   "data":{
 ///     "statisticsExceptions":{
 ///     },
 ///     "statistics":{
 ///       "Level02_TimesBeaten":11,
 ///       "Level01_TimesBeaten":1,
 ///       "GameLogins":376,
 ///       "PlayersWhoLikePirateClothing":12
 ///     }
 ///   }
 /// }
 /// </returns>
 public void ReadAllGlobalStats(
     SuccessCallback in_success,
     FailureCallback in_failure,
     object in_cbObject = null)
 {
     ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
     ServerCall sc = new ServerCall(ServiceName.GlobalStatistics, ServiceOperation.Read, null, callback);
     m_brainCloudClientRef.SendRequest(sc);
 }
Example #14
0
 public void AuthorizeTwitter(
     SuccessCallback in_success = null,
     FailureCallback in_failure = null,
     object in_cbObject = null)
 {
     ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
     ServerCall sc = new ServerCall(ServiceName.Event, ServiceOperation.Send, null, callback);
     m_brainCloudClientRef.SendRequest(sc);
 }
 /// <summary>
 /// Completely deletes the player record and all data fully owned
 /// by the player. After calling this method, the player will need
 /// to re-authenticate and create a new profile.
 /// This is mostly used for debugging/qa.
 /// </summary>
 /// <remarks>
 /// Service Name - PlayerState
 /// Service Operation - FullReset
 /// </remarks>
 /// <param name="in_success">
 /// The success callback.
 /// </param>
 /// <param name="in_failure">
 /// The failure callback.
 /// </param>
 /// <param name="in_cbObject">
 /// The user object sent to the callback.
 /// </param>
 /// <returns> The JSON returned in the callback is as follows:
 /// {
 ///   "status":200,
 ///   "data":null
 /// }
 /// </returns>
 public void DeletePlayer(
     SuccessCallback in_success = null,
     FailureCallback in_failure = null,
     object in_cbObject = null)
 {
     ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
     ServerCall sc = new ServerCall(ServiceName.PlayerState, ServiceOperation.FullReset, null, callback);
     m_brainCloudClientRef.SendRequest(sc);
 }
Example #16
0
        public void PreAuth(PaymentViewModel preAuthorisation, SuccessCallback success, FailureCallback failure, UINavigationController navigationController)
        {
            var view = _viewLocator.GetPreAuthView();

            // register card and pre Auth sharing same view so we need to set this property to false
            view.successCallback = success;
            view.failureCallback = failure;
            view.authorisationModel = preAuthorisation;
			PresentView (navigationController, view);
        }
        public void TokenPreAuth(TokenPaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController)
        {
            try
            {
                _paymentService.MakeTokenPreAuthorisation(payment).ContinueWith(reponse => HandResponse(success, failure, reponse));
            }
            catch (Exception ex)
            {
                // Failure
				HandleFailure (failure,ex);
            }
        }
        /// <summary>
        /// Gets the player's currency for the given currency type
        /// or all currency types if null passed in.
        /// </summary>
        /// <remarks>
        /// Service Name - Product
        /// Service Operation - GetPlayerVC
        /// </remarks>
        /// <param name="in_currencyType">
        /// The currency type to retrieve or null
        /// if all currency types are being requested.
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data": {
        ///     "updatedAt": 1395693676208,
        ///     "currencyMap": {
        ///       "gold": {
        ///         "purchased": 0,
        ///         "balance": 0,
        ///         "consumed": 0,
        ///         "awarded": 0
        ///       }
        ///     },
        ///     "playerId": "6ea79853-4025-4159-8014-60a6f17ac4e6",
        ///     "createdAt": 1395693676208
        ///   }
        /// }
        /// </returns>
        public void GetCurrency(
            string in_currencyType,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.ProductServiceGetPlayerVCId.Value] = in_currencyType;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Product, ServiceOperation.GetPlayerVC, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Cancels a match
        /// </summary>
        /// <remarks>
        /// Service Name - OneWayMatch
        /// Service Operation - CancelMatch
        /// </remarks>
        /// <param name="in_playbackStreamId">
        /// The playback stream id returned in the start match
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status": 200,
        ///   "data": null
        /// }
        /// </returns>
        public void CancelMatch(
            string in_playbackStreamId,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.OfflineMatchServicePlaybackStreamId.Value] = in_playbackStreamId;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.OneWayMatch, ServiceOperation.CancelMatch, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Decrements player rating
        /// </summary>
        /// <remarks>
        /// Service Name - MatchMaking
        /// Service Operation - DecrementPlayerRating
        /// </remarks>
        /// <param name="in_decrement">
        /// The decrement amount
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status": 200,
        ///   "data": null
        /// }
        /// </returns>
        public void DecrementPlayerRating(
            long in_decrement,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.MatchMakingServicePlayerRating.Value] = in_decrement;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.MatchMaking, ServiceOperation.DecrementPlayerRating, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Atomically increment (or decrement) global statistics.
        /// Global statistics are defined through the brainCloud portal.
        /// </summary>
        /// <remarks>
        /// Service Name - GlobalStatistics
        /// Service Operation - UpdateIncrement
        /// </remarks>
        /// <param name="in_jsonData">
        /// The JSON encoded data to be sent to the server as follows:
        /// {
        ///   stat1: 10,
        ///   stat2: -5.5,
        /// }
        /// would increment stat1 by 10 and decrement stat2 by 5.5.
        /// For the full statistics grammer see the api.braincloudservers.com site.
        /// There are many more complex operations supported such as:
        /// {
        ///   stat1:INC_TO_LIMIT#9#30
        /// }
        /// which increments stat1 by 9 up to a limit of 30.
        /// </param>
        /// <param name="in_success">
        /// The success callback
        /// </param>
        /// <param name="in_failure">
        /// The failure callback
        /// </param>
        /// <param name="in_cbObject">
        /// The callback object
        /// </param>
        /// <returns> JSON describing the new value of the statistics incremented (similar to ReadAll):
        /// {
        ///   "status":200,
        ///   "data":{
        ///     "statisticsExceptions":{
        ///     },
        ///     "statistics":{
        ///       "Level02_TimesBeaten":11,
        ///     }
        ///   }
        /// }
        /// </returns>
        public void IncrementGlobalStats(
            string in_jsonData,
            SuccessCallback in_success,
            FailureCallback in_failure,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            Dictionary<string, object> stats = JsonReader.Deserialize<Dictionary<string, object>> (in_jsonData);
            data[OperationParam.PlayerStatisticsServiceStats.Value] = stats;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.GlobalStatistics, ServiceOperation.UpdateIncrement, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #22
0
        /// <summary>
        /// Returns a particular entity of a particular friend.
        /// </summary>
        /// <remarks>
        /// Service Name - Friend
        /// Service Operation - ReadFriendEntity
        /// </remarks>
        /// <param name="in_entityId">
        /// Id of entity to retrieve.
        /// </param>
        /// <param name="in_friendId">
        /// Profile Id of friend who owns entity.
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback
        /// </returns>
        public void ReadFriendEntity(
            string in_entityId,
            string in_friendId,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.FriendServiceEntityId.Value] = in_entityId;
            data[OperationParam.FriendServiceFriendId.Value] = in_friendId;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Friend, ServiceOperation.ReadFriendEntity, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #23
0
        /// <summary>
        /// Delete an event out of the player's incoming mailbox.
        /// </summary>
        /// <remarks>
        /// Service Name - Event
        /// Service Operation - DeleteIncoming
        /// </remarks>
        /// <param name="in_fromPlayerId">
        /// The id of the player who sent the event
        /// </param>
        /// <param name="in_eventId">
        /// The event id
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data":null
        /// }
        /// </returns>
        public void DeleteIncomingEvent(
            string in_fromPlayerId,
            ulong in_eventId,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.EventServiceDeleteIncomingFromId.Value] = in_fromPlayerId;
            data[OperationParam.EventServiceDeleteIncomingEventId.Value] = in_eventId;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Event, ServiceOperation.DeleteIncoming, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Retrieves profile information for the specified user.
        /// </summary>
        /// <remarks>
        /// Service Name - Friend
        /// Service Operation - GetFriendProfileInfo
        /// </remarks>
        /// <param name="in_friendId">
        /// Profile Id of friend who owns entity.
        /// </param>
        /// <param name="in_authenticationType">
        /// The authentication type used for this friend id e.g. Facebook
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback
        /// {
        ///   "status":200,
        ///   "data": {
        ///     "playerId" : "17c7ee96-1b73-43d0-8817-cba1953bbf57",
        ///     "playerName" : "Donald Trump",
        ///     "email" : "*****@*****.**",
        ///     "playerSummaryData" : {},
        ///   }
        /// }
        /// </returns>
        public void GetFriendProfileInfo(
            string in_friendId,
            string in_authenticationType,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.FriendServiceFriendId.Value] = in_friendId;
            data[OperationParam.FriendServiceAuthenticationType.Value] = in_authenticationType;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Friend, ServiceOperation.GetFriendProfileInfo, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #25
0
        public void VerifyTwitter(
            string in_token,
            string in_verifier,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.TwitterServiceVerifyToken.Value] = in_token;
            data[OperationParam.TwitterServiceVerifyVerifier.Value] = in_verifier;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Event, ServiceOperation.Send, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Starts a match
        /// </summary>
        /// <remarks>
        /// Service Name - OneWayMatch
        /// Service Operation - StartMatch
        /// </remarks>
        /// <param name="in_otherPlayerId"> The player to start a match with </param>
        /// <param name="in_rangeDelta"> The range delta used for the initial match search </param>
        /// <param name="in_success"> The success callback. </param>
        /// <param name="in_failure"> The failure callback. </param>
        /// <param name="in_cbObject"> The user object sent to the callback. </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///    "status": 200,
        ///    "data": {
        ///        "playbackStreamId": "d18719db-9d02-2341-b62f-8e2f013369be",
        ///        "initiatingPlayerId": "d175f6ac-9221-4adc-aea4-f25f2426ff62",
        ///        "targetPlayerId": "07a0d23e-996b-4488-90ae-cb438342423a54",
        ///        "status": "STARTED",
        ///        "summary": {},
        ///        "initialSharedData": {
        ///            "entities": [],
        ///            "statistics": {}
        ///        },
        ///        "events": [],
        ///        "createdAt": 1437419496282,
        ///        "updatedAt": 1437419496282
        ///    }
        /// }
        /// </returns>
        public void StartMatch(
            string in_otherPlayerId,
            long in_rangeDelta,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();
            data[OperationParam.OfflineMatchServicePlayerId.Value] = in_otherPlayerId;
            data[OperationParam.OfflineMatchServiceRangeDelta.Value] = in_rangeDelta;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.OneWayMatch, ServiceOperation.StartMatch, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #27
0
        public static void GetUserNamesAndIds_Async(Uri requestUri, GetUserNamesAndIDsSuccessCallback SuccessCallback, FailureCallback FailureCallback, string Filter = "")
        {
            Task<Dictionary<int, string>> T = Task.Factory.StartNew(() =>
            {
                return GetUserNamesAndIds(requestUri, Filter);
            });

            T.ContinueWith((antecedent) =>
            {
                if (antecedent.IsFaulted)
                    FailureCallback(antecedent.Exception);
                else if (!antecedent.IsCanceled)
                    SuccessCallback(antecedent.Result);
            });
        }
        /// <summary>
        /// Marks the given match as abandoned.
        /// </summary>
        /// <remarks>
        /// Service Name - AsyncMatch
        /// Service Operation - Abandon
        /// </remarks>
        /// <param name="ownerId">
        /// Match owner identifier
        /// </param>
        /// <param name="matchId">
        /// Match identifier
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns>
        /// {
        ///     "status": 200,
        ///     "data": {}
        /// }
        /// </returns>
        public void AbandonMatch(
            string in_ownerId,
            string in_matchId,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();

            data["ownerId"] = in_ownerId;
            data["matchId"] = in_matchId;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.AsyncMatch, ServiceOperation.Abandon, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Finds a list of players matching the search text by performing a substring
        /// search of all player names.
        /// If the number of results exceeds maxResults the message
        /// "Too many results to return." is received and no players are returned
        /// </summary>
        /// 
        /// <remarks>
        /// Service Name - Friend
        /// Service Operation - FindPlayerByName
        /// </remarks>
        /// 
        /// <param name="in_searchText"> 
        /// The substring to search for. Minimum length of 3 characters.
        /// </param>
        /// <param name="in_maxResults"> 
        /// Maximum number of results to return. If there are more the message 
        /// "Too many results to return." is sent back instead of the players.
        /// </param>
        /// <param name="in_success"> The success callback. </param>
        /// <param name="in_failure"> The failure callback. </param>
        /// <param name="in_cbObject"> The user object sent to the callback. </param>
        /// 
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///     "status": 200,
        ///     "data": {
        ///         "matches": [
        ///             {
        ///                 "profileId": "63d1fdbd-2971-4791-a248-f8cda1a79bba",
        ///                 "playerSummaryData": null,
        ///                 "profileName": "ABC"
        ///             }
        ///         ],
        ///         "matchedCount": 1
        ///     }
        /// }
        /// </returns>
        public void FindPlayerByName(
            string in_searchText,
            int in_maxResults,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            Dictionary<string, object> data = new Dictionary<string, object>();

            data[OperationParam.FriendServiceSearchText.Value] = in_searchText;
            data[OperationParam.FriendServiceMaxResults.Value] = in_maxResults;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject);
            ServerCall sc = new ServerCall(ServiceName.Friend, ServiceOperation.FindPlayerByName, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
        /// <summary>
        /// Method will award the achievements specified. On success, this will
        /// call AwardThirdPartyAchievement to hook into the client-side Achievement
        /// service (ie GameCentre, Facebook etc).
        /// </summary>
        /// <remarks>
        /// Service Name - Gamification
        /// Service Operation - AwardAchievements
        /// </remarks>
        /// <param name="in_achievementIds">
        /// A comma separated list of achievement ids to award
        /// </param>
        /// <param name="in_success">
        /// The success callback.
        /// </param>
        /// <param name="in_failure">
        /// The failure callback.
        /// </param>
        /// <param name="in_cbObject">
        /// The user object sent to the callback.
        /// </param>
        /// <returns> The JSON returned in the callback is as follows:
        /// {
        ///   "status":200,
        ///   "data":null
        /// }
        /// </returns>
        public void AwardAchievements(
            string in_achievementIds,
            SuccessCallback in_success = null,
            FailureCallback in_failure = null,
            object in_cbObject = null)
        {
            string[] ids = in_achievementIds.Split(new char[] {','});
            string achievementsStr = "[";
            for (int i = 0, isize = ids.Length; i < isize; ++i)
            {
                achievementsStr += (i == 0 ? "" : ",");
                achievementsStr += ids[i];
                //achievementsStr += ((i == isize - 1 || ids[i] == "}" || ids[i] == ",") ? "" : "\"");

                UnityEngine.Debug.Log(achievementsStr);
            }

            achievementsStr += "]";

            object[] array = JsonReader.Deserialize<object[]>(achievementsStr);

            UnityEngine.Debug.Log(array.Length);

            Dictionary<string, object> data = new Dictionary<string, object>();

            List<string> achievs = new List<string>();

            foreach (object abc in array)
            {
                foreach (KeyValuePair<string, object> kvp in (Dictionary<string, object>)abc)
                {
                    UnityEngine.Debug.Log(kvp.Key + " : " + kvp.Value);
                    achievs.Add((string)kvp.Value);
                }
            }

            data[OperationParam.GamificationServiceAchievementsName.Value] = achievs;

            SuccessCallback successCallbacks = (SuccessCallback) AchievementAwardedSuccessCallback;
            if (in_success != null)
            {
                successCallbacks += in_success;
            }
            ServerCallback callback = BrainCloudClient.CreateServerCallback(successCallbacks, in_failure);
            ServerCall sc = new ServerCall(ServiceName.Gamification, ServiceOperation.AwardAchievements, data, callback);
            m_brainCloudClientRef.SendRequest(sc);
        }
Example #31
0
        /// <summary>
        /// Retrieves list of specified messages.
        /// </summary>
        public void GetMessages(string in_msgBox, string[] in_msgsIds, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.MessagingMessageBox.Value] = in_msgBox;
            data[OperationParam.MessagingMessageIds.Value] = in_msgsIds;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Messaging, ServiceOperation.GetMessages, data, callback);

            m_clientRef.SendRequest(sc);
        }
Example #32
0
        /// <summary>
        /// Retrieves a page of messages.
        /// </summary>
        public void GetMessagesPage(string in_context, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            var data    = new Dictionary <string, object>();
            var context = JsonReader.Deserialize <Dictionary <string, object> >(in_context);

            data[OperationParam.MessagingContext.Value] = context;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Messaging, ServiceOperation.GetMessagesPage, data, callback);

            m_clientRef.SendRequest(sc);
        }
Example #33
0
 protected override void DeleteEntity(SuccessCallback success, FailureCallback failure)
 {
     m_braincloud.DeleteEntity(m_entityId, m_version, CbDeleteSuccess + success, CbDeleteFailure + failure, this);
 }
Example #34
0
        private void MergeIdentity(string externalId, string authenticationToken, AuthenticationType authenticationType, SuccessCallback success, FailureCallback failure,
                                   object cbObject)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.IdentityServiceExternalId.Value]         = externalId;
            data[OperationParam.IdentityServiceAuthenticationType.Value] = authenticationType.ToString();
            data[OperationParam.AuthenticateServiceAuthenticateAuthenticationToken.Value] = authenticationToken;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Identity, ServiceOperation.Merge, data, callback);

            _client.SendRequest(sc);
        }
        /// <summary>
        /// sends LOBBY_SIGNAL_DATA message to all lobby members
        /// </summary>
        public void SendSignal(string in_lobbyID, Dictionary <string, object> in_signalData, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.LobbyIdentifier.Value] = in_lobbyID;
            data[OperationParam.LobbySignalData.Value] = in_signalData;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Lobby, ServiceOperation.SendSignal, data, callback);

            m_clientRef.SendRequest(sc);
        }
 /// <summary>
 /// Enables Real Time event for this session.
 /// Real Time events are disabled by default. Usually events
 /// need to be polled using GET_EVENTS. By enabling this, events will
 /// be received instantly when they happen through a TCP connection to an Event Server.
 ///
 ///This function will first call requestClientConnection, then connect to the address
 /// </summary>
 /// <param name="in_connectionType"></param>
 /// <param name="in_success"></param>
 /// <param name="in_failure"></param>
 /// <param name="cb_object"></param>
 public void EnableRTT(RTTConnectionType in_connectionType = RTTConnectionType.WEBSOCKET, SuccessCallback in_success = null, FailureCallback in_failure = null, object cb_object = null)
 {
     m_commsLayer.EnableRTT(in_connectionType, in_success, in_failure, cb_object);
 }
Example #37
0
        private void SwitchToChildProfile(string childProfileId, string childAppd, bool forceCreate, bool forceSingleton, SuccessCallback success, FailureCallback failure,
                                          object cbObject)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            if (Util.IsOptionalParameterValid(childProfileId))
            {
                data[OperationParam.ProfileId.Value] = childProfileId;
            }

            data[OperationParam.AuthenticateServiceAuthenticateGameId.Value]      = childAppd;
            data[OperationParam.AuthenticateServiceAuthenticateForceCreate.Value] = forceCreate;
            data[OperationParam.IdentityServiceForceSingleton.Value] = forceSingleton;

            data[OperationParam.AuthenticateServiceAuthenticateReleasePlatform.Value] = _client.ReleasePlatform.ToString();
            data[OperationParam.AuthenticateServiceAuthenticateCountryCode.Value]     = Util.GetCurrentCountryCode();
            data[OperationParam.AuthenticateServiceAuthenticateLanguageCode.Value]    = Util.GetIsoCodeForCurrentLanguage();
            data[OperationParam.AuthenticateServiceAuthenticateTimeZoneOffset.Value]  = Util.GetUTCOffsetForCurrentTimeZone();

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Identity, ServiceOperation.SwitchToChildProfile, data, callback);

            _client.SendRequest(sc);
        }
Example #38
0
        /// <summary>
        /// Gets the page of messages from the server based on the encoded context and specified page offset.
        /// </summary>
        public void GetMessagesPageOffset(string in_context, int pageOffset, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            var data = new Dictionary <string, object>();

            data[OperationParam.MessagingContext.Value]    = in_context;
            data[OperationParam.MessagingPageOffset.Value] = pageOffset;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Messaging, ServiceOperation.GetMessagesPageOffset, data, callback);

            m_clientRef.SendRequest(sc);
        }
 /// <summary>
 /// Failure callback invoked for all errors generated
 /// </summary>
 public void RegisterGlobalErrorCallback(FailureCallback callback)
 {
     _comms.RegisterGlobalErrorCallback(callback);
 }
        public static ServerCallback CreateServerCallback(SuccessCallback in_success, FailureCallback in_failure, object in_cbObject = null)
        {
            ServerCallback newCallback = null;

            if (in_success != null || in_failure != null)
            {
                newCallback = new ServerCallback(in_success, in_failure, in_cbObject);
            }

            return(newCallback);
        }
Example #41
0
        /// <summary>
        /// Enables Real Time event for this session.
        /// Real Time events are disabled by default. Usually events
        /// need to be polled using GET_EVENTS. By enabling this, events will
        /// be received instantly when they happen through a TCP connection to an Event Server.
        ///
        ///This function will first call requestClientConnection, then connect to the address
        /// </summary>
        /// <param name="in_connectionType"></param>
        /// <param name="in_success"></param>
        /// <param name="in_failure"></param>
        /// <param name="cb_object"></param>
        public void EnableRTT(RTTConnectionType in_connectionType = RTTConnectionType.WEBSOCKET, SuccessCallback in_success = null, FailureCallback in_failure = null, object cb_object = null)
        {
            m_disconnectedWithReason = false;

            if (IsRTTEnabled() || m_rttConnectionStatus == RTTConnectionStatus.CONNECTING)
            {
                return;
            }
            else
            {
                m_connectedSuccessCallback  = in_success;
                m_connectionFailureCallback = in_failure;
                m_connectedObj = cb_object;

                m_currentConnectionType = in_connectionType;
                m_clientRef.RTTService.RequestClientConnection(rttConnectionServerSuccess, rttConnectionServerError, cb_object);
            }
        }
        /// <summary>
        /// Retrieves the region settings for each of the given lobby types. Upon SuccessCallback or afterwards, call PingRegions to start retrieving appropriate data.
        /// Once that completes, the associated region Ping Data is retrievable via PingData and all associated <>WithPingData APIs are useable
        /// </summary>
        ///
        public void GetRegionsForLobbies(string[] in_roomTypes, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.LobbyTypes.Value] = in_roomTypes;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(onRegionForLobbiesSuccess + success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Lobby, ServiceOperation.GetRegionsForLobbies, data, callback);

            m_clientRef.SendRequest(sc);
        }
        /// <summary>
        /// Cancel this members Find, Join and Searching of Lobbies
        /// </summary>
        ///
        public void CancelFindRequest(string in_roomType, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.LobbyRoomType.Value]     = in_roomType;
            data[OperationParam.LobbyConnectionId.Value] = m_clientRef.RTTConnectionID;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Lobby, ServiceOperation.CancelFindRequest, data, callback);

            m_clientRef.SendRequest(sc);
        }
        /// <summary>
        /// Only valid from the owner of the lobby -- removes the specified member from the lobby
        /// </summary>
        ///
        public void RemoveMember(string in_lobbyID, string in_connectionId, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.LobbyIdentifier.Value]   = in_lobbyID;
            data[OperationParam.LobbyConnectionId.Value] = in_connectionId;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Lobby, ServiceOperation.RemoveMember, data, callback);

            m_clientRef.SendRequest(sc);
        }
Example #45
0
        protected override void UpdateSharedEntity(string targetProfileId, SuccessCallback success, FailureCallback failure)
        {
            string jsonData = ToJsonString();

            m_braincloud.UpdateSharedEntity(m_entityId, targetProfileId, m_entityType, jsonData, m_version, CbUpdateSuccess + success, CbUpdateFailure + failure, this);
        }
Example #46
0
 /// <summary>
 /// Merge the profile associated with the provided Facebook credentials with the
 /// current profile.
 /// </summary>
 /// <remarks>
 /// Service Name - Identity
 /// Service Operation - Merge
 /// </remarks>
 /// <param name="externalId">
 /// The facebook id of the user
 /// </param>
 /// <param name="authenticationToken">
 /// The validated token from the Facebook SDK
 /// (that will be further validated when sent to the bC service)
 /// </param>
 /// <param name="in_success">
 /// The method to call in event of successful login
 /// </param>
 /// <param name="in_failure">
 /// The method to call in the event of an error during authentication
 /// </param>
 public void MergeFacebookIdentity(string in_externalId, string in_authenticationToken, SuccessCallback in_success, FailureCallback in_failure)
 {
     this.MergeIdentity(in_externalId, in_authenticationToken, OperationParam.AuthenticateServiceAuthenticateAuthFacebook.Value, in_success, in_failure);
 }
Example #47
0
        /// <summary>
        /// Store the Entity object to the braincloud server. This will result in one of the following operations:
        ///
        /// 1) CreateEntity
        /// 2) UpdateSharedEntity
        /// 3) DeleteEntity
        ///
        /// Certain caveats must be observed:
        /// a) Store operation will be ignored if an entity has been deleted or is in the process of being deleted.
        /// b) TODO: remove this caveat!: Store operation will queue an update if an entity is in the process of being created on the server.
        /// If the entity fails to be created, the update failure callback will not be run.
        ///
        /// </param>
        /// <param name="success">
        /// A callback to run when store operation is completed successfully.
        /// </param>
        /// <param name="failure">
        /// A callback to run when store operation fails.
        /// </param>
        public void StoreAsyncShared(string targetProfileId, SuccessCallback success = null, FailureCallback failure = null)
        {
            if (m_state == EntityState.Deleting || m_state == EntityState.Deleted)
            {
                return;
            }

            if (m_state == EntityState.Creating)
            {
                // a store async call came in while we are waiting for the server to create the object... queue an update
                m_updateWhenCreated          = true;
                m_updateWhenCreatedSuccessCb = success;
                m_updateWhenCreatedFailureCb = failure;
                return;
            }

            if (m_state == EntityState.New)
            {
                CreateEntity(success, failure);

                m_state = EntityState.Creating;
            }
            else
            {
                UpdateSharedEntity(targetProfileId, success, failure);
                // we don't currently need a state to say an update is in progress... and if we add this state we
                // need to keep track of how many updates are queued in order to set the state back to ready when *all*
                // updates have completed. So just removing the state for now... an update queued should not have any impact
                // on whether the user can transition to the delete state.
                //m_state = EntityState.Updating;
            }
        }
Example #48
0
        private void MergeIdentity(String in_externalId, string in_authenticationToken, String in_authenticationType, SuccessCallback in_success, FailureCallback in_failure)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.IdentityServiceExternalId.Value]         = in_externalId;
            data[OperationParam.IdentityServiceAuthenticationType.Value] = in_authenticationType;
            data[OperationParam.AuthenticateServiceAuthenticateAuthenticationToken.Value] = in_authenticationToken;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure);
            ServerCall     sc       = new ServerCall(ServiceName.Identity, ServiceOperation.Merge, data, callback);

            m_brainCloudClientRef.SendRequest(sc);
        }
Example #49
0
        /// <summary>
        /// Send a potentially rich chat message. <content> must contain at least a "plain" field for plain-text messaging.
        /// </summary>
        ///
        public void SendMessageSimple(string[] in_toProfileIds, string in_messageText, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.MessagingToProfileIds.Value] = in_toProfileIds;
            data[OperationParam.MessagingText.Value]         = in_messageText;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Messaging, ServiceOperation.SendMessageSimple, data, callback);

            m_clientRef.SendRequest(sc);
        }
Example #50
0
 /// <summary>
 /// Merge the profile associated with the provided steam userid with the current profile.
 /// </summary>
 /// <remarks>
 /// Service Name - Identity
 /// Service Operation - Merge
 /// </remarks>
 /// <param name="in_userid">
 /// String representation of 64 bit steam id
 /// </param>
 /// <param name="in_sessionticket">
 /// The player's session ticket (hex encoded)
 /// </param>
 /// <param name="in_success">
 /// The method to call in event of successful login
 /// </param>
 /// <param name="in_failure">
 /// The method to call in the event of an error during authentication
 /// </param>
 public void MergeSteamIdentity(string in_userid, string in_sessionticket, SuccessCallback in_success, FailureCallback in_failure)
 {
     this.MergeIdentity(in_userid, in_sessionticket, OperationParam.AuthenticateServiceAuthenticateAuthSteam.Value, in_success, in_failure);
 }
Example #51
0
        private void DetachIdentity(string externalId, AuthenticationType authenticationType, bool continueAnon, SuccessCallback success, FailureCallback failure,
                                    object cbObject)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.IdentityServiceExternalId.Value]         = externalId;
            data[OperationParam.IdentityServiceAuthenticationType.Value] = authenticationType.ToString();
            data[OperationParam.IdentityServiceConfirmAnonymous.Value]   = continueAnon;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Identity, ServiceOperation.Detach, data, callback);

            _client.SendRequest(sc);
        }
Example #52
0
        /// <summary>
        /// Sends a message with specified 'subject' and 'text' to list of users.
        /// </summary>
        public void SendMessage(string[] in_toProfileIds, string in_contentJson, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.MessagingToProfileIds.Value] = in_toProfileIds;

            var content = JsonReader.Deserialize <Dictionary <string, object> >(in_contentJson);

            data[OperationParam.MessagingContent.Value] = content;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject);
            ServerCall     sc       = new ServerCall(ServiceName.Messaging, ServiceOperation.SendMessage, data, callback);

            m_clientRef.SendRequest(sc);
        }
 protected abstract void UpdateSharedEntity(string targetProfileId, SuccessCallback success, FailureCallback failure);
Example #54
0
 public void GetPresenceOfFriends(SuccessCallback in_success = null, FailureCallback in_failure = null)
 {
     GCore.Wrapper.Client.PresenceService.GetPresenceOfFriends(m_platform, m_includeOffline, OnGetPresenceOfFriendsSuccess + in_success, OnGetPresenceOfFriendsFailed + in_failure);
 }
Example #55
0
        private void DetachIdentity(string in_externalId, string in_authenticationType, bool in_continueAnon, SuccessCallback in_success, FailureCallback in_failure)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.IdentityServiceExternalId.Value]         = in_externalId;
            data[OperationParam.IdentityServiceAuthenticationType.Value] = in_authenticationType;
            data[OperationParam.IdentityServiceConfirmAnonymous.Value]   = in_continueAnon;

            ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure);
            ServerCall     sc       = new ServerCall(ServiceName.Identity, ServiceOperation.Detach, data, callback);

            m_brainCloudClientRef.SendRequest(sc);
        }
 protected abstract void DeleteEntity(SuccessCallback success, FailureCallback failure);
Example #57
0
 /// <summary>Detach the steam identity from the current profile
 /// </summary>
 /// <remarks>
 /// Service Name - Identity
 /// Service Operation - Detach
 /// </remarks>
 /// <param name="in_userid">
 /// String representation of 64 bit steam id
 /// </param>
 /// <param name="in_continueAnon">
 /// Proceed even if the profile will revert to anonymous?
 /// </param>
 /// <param name="in_success">
 /// The method to call in event of successful login
 /// </param>
 /// <param name="in_failure">
 /// The method to call in the event of an error during authentication
 /// </param>
 /// <returns>
 /// Watch for DOWNGRADING_TO_ANONYMOUS_ERROR - occurs if you set in_continueAnon to false, and
 /// disconnecting this identity would result in the profile being anonymous (which means that
 /// the profile wouldn't be retrievable if the user loses their device)
 /// </returns>
 public void DetachSteamIdentity(string in_userid, bool in_continueAnon, SuccessCallback in_success, FailureCallback in_failure)
 {
     this.DetachIdentity(in_userid, OperationParam.AuthenticateServiceAuthenticateAuthSteam.Value, in_continueAnon, in_success, in_failure);
 }
Example #58
0
 public void GetRecentlyViewedEntity(SuccessCallback in_success = null, FailureCallback in_failure = null, object cbObj = null)
 {
     GCore.Wrapper.EntityService.GetSingleton("recentlyViewed", OnReadRecentlyViewedEntitySuccess + in_success, in_failure, cbObj);
 }
Example #59
0
        public void AttachSteamAccount(bool in_bAttach = false, SuccessCallback in_success = null, FailureCallback in_fail = null, object in_obj = null)
        {
#if STEAMWORKS_ENABLED
            if (IsSteamInitialized)
            {
                m_bAttachSteam     = in_bAttach;
                m_steamAuthSuccess = in_success;
                m_steamFailure     = in_fail;
                m_steamObj         = in_obj;

                m_ticket = new byte[1024];
                SteamUser.GetAuthSessionTicket(m_ticket, 1024, out m_ticketSize);
            }
            else if (in_fail != null)
#endif
            {
                in_fail(505, 999999, "STEAM NOT INITIALIZED", in_obj);
            }
        }
Example #60
0
        public void FindUserByUniversalId(string in_searchText, int in_maxResults, SuccessCallback in_success = null, FailureCallback in_failure = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[BrainCloudConsts.JSON_SEARCH_TEXT] = in_searchText;
            data[BrainCloudConsts.JSON_MAX_RESULTS] = in_maxResults;
            // reliance on FIND FRIENDS script
            GCore.Wrapper.ScriptService.RunScript("FindFriends", JsonWriter.Serialize(data), OnFindUserByUniversalIdSuccess + in_success, OnFindUserByUniversalIdFailure + in_failure, data);
        }