本文整理汇总了C#中FailureCallback类的典型用法代码示例。如果您正苦于以下问题:C# FailureCallback类的具体用法?C# FailureCallback怎么用?C# FailureCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FailureCallback类属于命名空间,在下文中一共展示了FailureCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEvent
/// <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);
}
示例2: AwardAchievements
/// <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);
}
示例3: RegisterPushNotificationDeviceToken
/// <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;
}
}
示例4: RegisterPushNotificationDeviceToken
/// <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;
}
}
示例5: SendEvent
/// <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);
}
示例6: MergeFacebookIdentity
/// <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);
}
示例7: RegisterCard
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);
}
示例8: TokenPreAuth
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);
}
示例9: AttachEmailIdentity
/// <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);
}
示例10: ReadAllGlobalStats
/// <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);
}
示例11: AuthorizeTwitter
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);
}
示例12: DeletePlayer
/// <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);
}
示例13: ReadProperties
/// <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);
}
示例14: GetNextExperienceLevel
/// <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);
}
示例15: HandleFailure
private void HandleFailure (FailureCallback failure,Exception ex)
{
if (failure != null) {
var judoError = new JudoError {
Exception = ex
};
failure (judoError);
}
}