/// <summary> /// Checks supplied text for profanity. /// </summary> /// <remarks> /// Service Name - Profanity /// Service Operation - ProfanityCheck /// </remarks> /// <param name="text">The text to check</param> /// <param name="languages">Optional comma delimited list of two character language codes</param> /// <param name="flagEmail">Optional processing of email addresses</param> /// <param name="flagPhone">Optional processing of phone numbers</param> /// <param name="flagUrls">Optional processing of urls</param> /// <param name="success">The success callback.</param> /// <param name="failure">The failure callback.</param> /// <param name="cbObject">The user object sent to the callback.</param> public void ProfanityCheck( string text, string languages, bool flagEmail, bool flagPhone, bool flagUrls, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.ProfanityText.Value] = text; if (languages != null) { data[OperationParam.ProfanityLanguages.Value] = languages; } data[OperationParam.ProfanityFlagEmail.Value] = flagEmail; data[OperationParam.ProfanityFlagPhone.Value] = flagPhone; data[OperationParam.ProfanityFlagUrls.Value] = flagUrls; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.Profanity, ServiceOperation.ProfanityCheck, data, callback); _client.SendRequest(sc); }
/// <summary> /// Method creates a new entity on the server. /// </summary> /// <remarks> /// Service Name - GlobalEntity /// Service Operation - Create /// </remarks> /// <param name="in_entityType"> /// The entity type as defined by the user /// </param> /// <param name="in_timeToLive"> /// Sets expiry time for entity if > 0 /// </param> /// <param name="in_jsonEntityAcl"> /// The entity's access control list as json. A null acl implies default /// </param> /// <param name="in_jsonEntityData"> /// The entity's data as a json string /// </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": /// { /// gameId : "game", /// entityId : "hucfshugvgvfhug", /// ownerId : "ubfcbvfbsdvbb", /// entityType : "", /// entityIndexedId : "", /// version : 1, /// timeToLive: 0, /// expiresAt : 9947395735758975, /// data : /// { /// field : "value" /// }, /// acl : /// { /// other, 1 /// }, /// createdAt : 74889479874, /// updatedAt : 73847474897487 /// /// } /// } /// </returns> public void CreateEntity( string in_entityType, long in_timeToLive, string in_jsonEntityAcl, string in_jsonEntityData, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object> (); data[OperationParam.GlobalEntityServiceEntityType.Value] = in_entityType; data[OperationParam.GlobalEntityServiceTimeToLive.Value] = in_timeToLive; Dictionary <string, object> entityData = JsonReader.Deserialize <Dictionary <string, object> > (in_jsonEntityData); data [OperationParam.GlobalEntityServiceData.Value] = entityData; if (Util.IsOptionalParameterValid(in_jsonEntityAcl)) { Dictionary <string, object> acl = JsonReader.Deserialize <Dictionary <string, object> > (in_jsonEntityAcl); data [OperationParam.GlobalEntityServiceAcl.Value] = acl; } ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall serverCall = new ServerCall(ServiceName.GlobalEntity, ServiceOperation.Create, data, callback); m_brainCloudClientRef.SendRequest(serverCall); }
/// <summary> /// Prepares a user file upload from memory, allowing the user to bypass /// the need to read or write on disk before uploading. On success the file will begin uploading /// to the brainCloud server.To be informed of success/failure of the upload /// register an IFileUploadCallback with the BrainCloudClient class. /// </summary> /// <param name="cloudPath">The desired cloud path of the file</param> /// <param name="cloudFilename">The desired cloud fileName of the file</param> /// <param name="shareable">True if the file is shareable</param> /// <param name="replaceIfExists">Whether to replace file if it exists</param> /// <param name="fileData">The file memory data in byte[]</param> /// <param name="success">The success callback</param> /// <param name="failure">The failure callback</param> /// <param name="cbObject">The callback object</param> public bool UploadFileFromMemory( string cloudPath, string cloudFilename, bool shareable, bool replaceIfExists, byte[] fileData, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { if (fileData.Length == 0) { _client.Log("File data is empty"); return(false); } string guid = Guid.NewGuid().ToString(); _client.FileService.FileStorage.Add(guid, fileData); Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.UploadLocalPath.Value] = guid; data[OperationParam.UploadCloudFilename.Value] = cloudFilename; data[OperationParam.UploadCloudPath.Value] = cloudPath; data[OperationParam.UploadShareable.Value] = shareable; data[OperationParam.UploadReplaceIfExists.Value] = replaceIfExists; data[OperationParam.UploadFileSize.Value] = fileData.Length; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.File, ServiceOperation.PrepareUserUpload, data, callback); _client.SendRequest(sc); return(true); }
/// <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); }
/// <summary> /// Method gets the active sales inventory for the passed-in /// currency type and category. /// </summary> /// <remarks> /// Service Name - AppStore /// Service Operation - GetInventory /// </remarks> /// <param name="storeId"> /// The store storeId. Valid stores are: /// - itunes /// - facebook /// - appworld /// - steam /// - windows /// - windowsPhone /// - googlePlay /// </param> /// <param name="userCurrency"> /// The currency to retrieve the sales /// inventory for. This is only used for Steam and Facebook stores. /// </param> /// <param name="category"> /// The product category /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void GetSalesInventoryByCategory( string storeId, string userCurrency, string category, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.AppStoreServiceStoreId.Value] = storeId; Dictionary <string, object> priceInfoCriteria = new Dictionary <string, object>(); if (Util.IsOptionalParameterValid(userCurrency)) { priceInfoCriteria[OperationParam.AppStoreServiceUserCurrency.Value] = userCurrency; } data[OperationParam.AppStoreServicePriceInfoCriteria.Value] = priceInfoCriteria; if (Util.IsOptionalParameterValid(category)) { data[OperationParam.AppStoreServiceCategory.Value] = category; } ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.AppStore, ServiceOperation.GetInventory, data, callback); _client.SendRequest(sc); }
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> /// Method reads all the global properties of the game /// </summary> /// <remarks> /// Service Name - GlobalApp /// Service Operation - ReadProperties /// </remarks> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void ReadProperties( SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall serverCall = new ServerCall(ServiceName.GlobalApp, ServiceOperation.ReadProperties, null, callback); _client.SendRequest(serverCall); }
/// <summary> /// Method returns all of the global statistics. /// </summary> /// <remarks> /// Service Name - globalGameStatistics /// Service Operation - Read /// </remarks> /// <param name="success"> /// The success callback /// </param> /// <param name="failure"> /// The failure callback /// </param> /// <param name="cbObject"> /// The callback object /// </param> public void ReadAllGlobalStats( SuccessCallback success, FailureCallback failure, object cbObject = null) { ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.GlobalStatistics, ServiceOperation.Read, null, callback); _client.SendRequest(sc); }
/// <summary> /// Read all available player statistics. /// </summary> /// <remarks> /// Service Name - PlayerStatistics /// 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> The JSON returned in the callback is as follows: /// { /// "status":200, /// "data":{ /// "statistics":{ /// "minions":0, /// "wood":50, /// "pantelons":3, /// "iron":0 /// } /// } /// } /// </returns> public void ReadAllPlayerStats( 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.Read, null, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Force an RTT presence update to all listeners of the caller. /// </summary> /// <remarks> /// Service Name - Presence /// Service Operation - ForcePush /// </remarks> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void ForcePush( SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.Presence, ServiceOperation.ForcePush, data, callback); _client.SendRequest(sc); }
/// <summary> /// Reset Email password - Sends a password reset email to the specified address /// </summary> /// <remarks> /// Service Name - Authenticate /// Operation - ResetEmailPassword /// </remarks> /// <param name="in_externalId"> /// The email address to send the reset email to. /// </param> /// <param name="in_success"> /// The method to call in event of success /// </param> /// <param name="in_failure"> /// The method to call in the event of an error /// </param> public void ResetEmailPassword(string in_externalId, SuccessCallback in_success, FailureCallback in_failure) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.AuthenticateServiceAuthenticateExternalId.Value] = in_externalId; data[OperationParam.AuthenticateServiceAuthenticateGameId.Value] = m_brainCloudClientRef.GameId; ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure); ServerCall sc = new ServerCall(ServiceName.Authenticate, ServiceOperation.ResetEmailPassword, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Deregisters all device tokens currently registered to the player. /// </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 result /// { /// "status":200, /// "data":null /// } /// </returns> public void DeregisterAllPushNotificationDeviceTokens( SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.PushNotification, ServiceOperation.DeregisterAll, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Reads an existing item definition from the ///server, with language fields limited to the /// current or default language. /// </summary> /// <remarks> /// Service Name - ItemCatalog /// Service Operation - GetCatalogItemDefinition /// </remarks> /// <param name="defId"> /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void GetCatalogItemDefinition( string defId, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary<string, object> data = new Dictionary<string, object>(); data[OperationParam.ItemCatalogServiceDefId.Value] = defId; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.ItemCatalog, ServiceOperation.GetCatalogItemDefinition, data, callback); _client.SendRequest(sc); }
private void AttachIdentity(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.Attach, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Returns information on a file using fileId. /// </summary> /// <remarks> /// Service Name - GlobalFile /// Service Operation - GetFileInfo /// <param name="fileId"> /// The Id of the file /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void GetFileInfo( string fileId, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.GlobalFileServiceFileId.Value] = fileId; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall serverCall = new ServerCall(ServiceName.GlobalFile, ServiceOperation.GetFileInfo, data, callback); _client.SendRequest(serverCall); }
/// <summary> /// Gets the player's currency for the given currency type /// or all currency types if null passed in. /// </summary> /// <remarks> /// Service Name - VirtalCurrency /// Service Operation - GetPlayerVC /// </remarks> /// <param name="currencyType"> /// The currency type to retrieve or null /// if all currency types are being requested. /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void GetCurrency( string currencyType, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.VirtualCurrencyServiceCurrencyId.Value] = currencyType; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.VirtualCurrency, ServiceOperation.GetPlayerVC, data, callback); _client.SendRequest(sc); }
/// <summary> /// Reset Email password - Sends a password reset email to the specified address /// </summary> /// <remarks> /// Service Name - Authenticate /// Operation - ResetEmailPassword /// </remarks> /// <param name="externalId"> /// The email address to send the reset email to. /// </param> /// <param name="success"> /// The method to call in event of success /// </param> /// <param name="failure"> /// The method to call in the event of an error /// </param> /// <param name="cbObject"> /// The user supplied callback object /// </param> public void ResetEmailPassword( string externalId, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.AuthenticateServiceAuthenticateExternalId.Value] = externalId; data[OperationParam.AuthenticateServiceAuthenticateGameId.Value] = _client.AppId; ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure); ServerCall sc = new ServerCall(ServiceName.Authenticate, ServiceOperation.ResetEmailPassword, data, callback); _client.SendRequest(sc); }
private void SendRequest(ServiceOperation operation, SuccessCallback success, FailureCallback failure, object cbObject, IDictionary data) { ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.Group, operation, data, callback); _bcClient.SendRequest(sc); }
/// <summary> /// Submits a turn for the given match. /// </summary> /// <remarks> /// Service Name - AsyncMatch /// Service Operation - SubmitTurn /// </remarks> /// <param name="ownerId"> /// Match owner identfier /// </param> /// <param name="matchId"> /// Match identifier /// </param> /// <param name="version"> /// Game state version to ensure turns are submitted once and in order /// </param> /// <param name="jsonMatchState"> /// JSON string blob provided by the caller /// </param> /// <param name="pushNotificationMessage"> /// Optional push notification message to send to the other party. /// Refer to the Push Notification functions for the syntax required. /// </param> /// <param name="nextPlayer"> /// Optionally, force the next player player to be a specific player /// </param> /// <param name="jsonSummary"> /// Optional JSON string that other players will see as a summary of the game when listing their games /// </param> /// <param name="jsonStatistics"> /// Optional JSON string blob provided by the caller /// </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": { /// "gameId": "145677", /// "ownerId": "2bd7abc6-c2ec-4946-a1a8-02bad38540ad", /// "matchId": "1aac24b2-7976-4fd7-b7c6-44dere6d26a4", /// "version": 1, /// "players": [ /// { /// "playerId": "2bd7abc6-c2ec-4946-a1a8-02bad38540ad", /// "playerName": "UserB", /// "pictureUrl": null /// }, /// { /// "playerId": "11c9dd4d-9ed1-416d-baw2-5228c1efafac", /// "playerName": "UserA", /// "pictureUrl": null /// } /// ], /// "status": { /// "status": "PENDING", /// "currentPlayer": "11c9dd4d-9ed1-416d-baw2-5228c1efafac" /// }, /// "summary": { /// "resources": 1234 /// }, /// "createdAt": 1442507219609, /// "updatedAt": 1442507319700 /// } /// } /// </returns> public void SubmitTurn( string in_ownerId, string in_matchId, UInt64 in_version, string in_jsonMatchState, string in_pushNotificationMessage, string in_nextPlayer, string in_jsonSummary, string in_jsonStatistics, 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; data["version"] = in_version; data["matchState"] = JsonReader.Deserialize <Dictionary <string, object> >(in_jsonMatchState); if (Util.IsOptionalParameterValid(in_nextPlayer)) { Dictionary <string, object> status = new Dictionary <string, object>(); status["currentPlayer"] = in_nextPlayer; data["status"] = status; } if (Util.IsOptionalParameterValid(in_jsonSummary)) { data["summary"] = JsonReader.Deserialize <Dictionary <string, object> >(in_jsonSummary); } if (Util.IsOptionalParameterValid(in_jsonStatistics)) { data["statistics"] = JsonReader.Deserialize <Dictionary <string, object> >(in_jsonStatistics); } if (Util.IsOptionalParameterValid(in_pushNotificationMessage)) { data["pushContent"] = in_pushNotificationMessage; } ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.AsyncMatch, ServiceOperation.SubmitTurn, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <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); }
/// <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> 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); }
public void TriggerPlayerStatisticsEvent( string in_eventName, int in_eventMultiplier, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.PlayerStatisticEventServiceEventName.Value] = in_eventName; data[OperationParam.PlayerStatisticEventServiceEventMultiplier.Value] = in_eventMultiplier; ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.PlayerStatisticsEvent, ServiceOperation.Trigger, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Method returns the server time in UTC. This is in UNIX millis time format. /// For instance 1396378241893 represents 2014-04-01 2:50:41.893 in GMT-4. /// </summary> /// <remarks> /// Service Name - Time /// Service Operation - Read /// </remarks> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void ReadServerTime( SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.Time, ServiceOperation.Read, null, callback); _client.SendRequest(sc); }
// Private private void SendMessage( ServiceOperation operation, Dictionary <string, object> data, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); _clientRef.SendRequest(new ServerCall(ServiceName.Mail, operation, data, callback)); }
/// <summary> /// Method returns the social leaderboard. A player's social leaderboard is /// comprised of players who are recognized as being your friend. /// For now, this applies solely to Facebook connected players who are /// friends with the logged in player (who also must be Facebook connected). /// In the future this will expand to other identification means (such as /// Game Centre, Google circles etc). /// /// Leaderboards entries contain the player's score and optionally, some user-defined /// data associated with the score. The currently logged in player will also /// be returned in the social leaderboard. /// /// Note: If no friends have played the game, the bestScore, createdAt, updatedAt /// will contain NULL. /// </summary> /// <remarks> /// Service Name - SocialLeaderboard /// Service Operation - GetLeaderboard /// </remarks> /// <param name="in_leaderboardId"> /// The id of the leaderboard to retrieve /// </param> /// <param name="in_replaceName"> /// If true, the currently logged in player's name will be replaced /// by the string "You". /// </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> JSON string representing the entries in the leaderboard. /// Note that the friend summary data is returned for each record /// in the leaderboard. /// /// { /// "status": 200, /// "data": { /// "social_leaderboard": [ /// { /// "updatedAt": 1395840936348, /// "pictureUrl": null, /// "playerId": "26f8bb07-3e94-458b-8485-f9031c3a6ef1", /// "createdAt": 1395840936348, /// "name": "You", /// "otherData": null, /// "authenticationType": null, /// "externalId": null, /// "summaryFriendData": null, /// "score": 20000 /// }, /// { /// "updatedAt": 1395840936351, /// "pictureUrl": null, /// "playerId": "3ad8bc09-4a34-e324-1231-3b2c1c3a6bc6", /// "createdAt": 1395840936351, /// "name": "Jenny Goldsmith", /// "otherData": null, /// "authenticationType": null, /// "externalId": null, /// "summaryFriendData": null, /// "score": 10000 /// } /// ], /// "timeBeforeReset": 588182412, /// "server_time": 1395840957588 /// } /// } /// </returns> public void GetLeaderboard( string in_leaderboardId, bool in_replaceName, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.SocialLeaderboardServiceLeaderboardId.Value] = in_leaderboardId; data[OperationParam.SocialLeaderboardServiceReplaceName.Value] = in_replaceName; ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.SocialLeaderboard, ServiceOperation.GetLeaderboard, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Starts a stream /// </summary> /// <remarks> /// Service Name - PlaybackStream /// Service Operation - StartStream /// </remarks> /// <param name="in_targetPlayerId"> /// The player to start a stream with /// </param> /// <param name="in_includeSharedData"> /// Whether to include shared data in the stream /// </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> public void StartStream( string in_targetPlayerId, bool in_includeSharedData, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.PlaybackStreamServiceTargetPlayerId.Value] = in_targetPlayerId; data[OperationParam.PlaybackStreamServiceIncludeSharedData.Value] = in_includeSharedData; ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.PlaybackStream, ServiceOperation.StartStream, data, callback); m_brainCloudClientRef.SendRequest(sc); }
/// <summary> /// Sends an array of file details and returns /// the details of any of those files that have changed /// </summary> /// <remarks> /// Service Name - S3Handling /// Service Operation - GetUpdatedFiles /// </remarks> /// <param name="category"> /// Category of files on server to compare against /// </param> /// <param name="fileDetailsJson"> /// An array of file details /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void GetUpdatedFiles( string category, string fileDetailsJson, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); if (Util.IsOptionalParameterValid(category)) { data[OperationParam.S3HandlingServiceFileCategory.Value] = category; } data[OperationParam.S3HandlingServiceFileDetails.Value] = JsonReader.Deserialize <object[]>(fileDetailsJson); ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.S3Handling, ServiceOperation.GetUpdatedFiles, data, callback); _client.SendRequest(sc); }
/// <summary> /// Executes a script on the server. /// </summary> /// <remarks> /// Service Name - Script /// Service Operation - Run /// </remarks> /// <param name="scriptName"> /// The name of the script to be run /// </param> /// <param name="jsonScriptData"> /// Data to be sent to the script in json format /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void RunScript( string scriptName, string jsonScriptData, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.ScriptServiceRunScriptName.Value] = scriptName; if (Util.IsOptionalParameterValid(jsonScriptData)) { Dictionary <string, object> scriptData = JsonReader.Deserialize <Dictionary <string, object> >(jsonScriptData); data[OperationParam.ScriptServiceRunScriptData.Value] = scriptData; } ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall sc = new ServerCall(ServiceName.Script, ServiceOperation.Run, data, callback); _client.SendRequest(sc); }
/// <summary> /// Registers the given device token with the server to enable this device /// to receive push notifications. /// </param> /// <param name="in_device"> /// The device platform being registered. /// </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( string in_device, string in_token, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { bool bToReturn = false; Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.PushNotificationRegisterParamDeviceType.Value] = in_device; data[OperationParam.PushNotificationRegisterParamDeviceToken.Value] = in_token; ServerCallback callback = BrainCloudClient.CreateServerCallback(in_success, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.PushNotification, ServiceOperation.Register, data, callback); m_brainCloudClientRef.SendRequest(sc); bToReturn = true; return(bToReturn); }
/// <summary> /// Creates custom data stream page event /// </summary> /// <remarks> /// Service Name - DataStream /// Service Operation - CustomPageEvent /// </remarks> /// <param name="eventName"> /// The name of the event /// </param> /// <param name="jsonEventProperties"> /// The properties of the event /// </param> /// <param name="success"> /// The success callback. /// </param> /// <param name="failure"> /// The failure callback. /// </param> /// <param name="cbObject"> /// The user object sent to the callback. /// </param> public void CustomPageEvent( string eventName, string jsonEventProperties, SuccessCallback success = null, FailureCallback failure = null, object cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); data[OperationParam.DataStreamEventName.Value] = eventName; if (Util.IsOptionalParameterValid(jsonEventProperties)) { Dictionary <string, object> eventProperties = JsonReader.Deserialize <Dictionary <string, object> >(jsonEventProperties); data[OperationParam.DataStreamEventProperties.Value] = eventProperties; } ServerCallback callback = BrainCloudClient.CreateServerCallback(success, failure, cbObject); ServerCall serverCall = new ServerCall(ServiceName.DataStream, ServiceOperation.CustomPageEvent, data, callback); _client.SendRequest(serverCall); }