当前位置: 首页>>代码示例>>C#>>正文


C# Reward.Give方法代码示例

本文整理汇总了C#中Reward.Give方法的典型用法代码示例。如果您正苦于以下问题:C# Reward.Give方法的具体用法?C# Reward.Give怎么用?C# Reward.Give使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reward的用法示例。


在下文中一共展示了Reward.Give方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Like

		// TODO: this is irrelevant for now. Will be updated soon.
//		public static void AddAppRequest(Provider provider, string message, string[] to, string extraData, string dialogTitle) {
//			providers[provider].AppRequest(message, to, extraData, dialogTitle,
//			    /* success */	(string requestId, List<string> recipients) => {
//									string requestsStr = KeyValueStorage.GetValue("soomla.profile.apprequests");
//									List<string> requests = new List<string>();
//									if (!string.IsNullOrEmpty(requestsStr)) {
//										requests = requestsStr.Split(',').ToList();
//									}
//									requests.Add(requestId);
//									KeyValueStorage.SetValue("soomla.profile.apprequests", string.Join(",", requests.ToArray()));
//									KeyValueStorage.SetValue(requestId, string.Join(",", recipients.ToArray()));
//									ProfileEvents.OnAddAppRequestFinished(provider, requestId);
//								},
//				/* fail */		(string errMsg) => {
//									ProfileEvents.OnAddAppRequestFailed(provider, errMsg);
//								});
//		}


		/// <summary>
		///  Will fetch posts from user feed
		///
		/// </summary>
		/// <param name="provider">Provider.</param>
		/// <param name="reward">Reward.</param>
//		public static void GetFeed(Provider provider, Reward reward) {
//
//			// TODO: implement with FB SDK
//
//		}

		/// <summary>
		/// Likes the page (with the given name) of the given provider.
		/// Supported platforms: Facebook, Twitter, Google+.
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The provider that the page belongs to.</param>
		/// <param name="pageName">The name of the page to like.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after he/she likes the page.</param>
		public static void Like(Provider provider, string pageId, Reward reward=null) {
			SocialProvider targetProvider = GetSocialProvider(provider);
			if (targetProvider != null) {
				targetProvider.Like(pageId);

				if (reward != null) {
					reward.Give();
				}
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:51,代码来源:SoomlaProfile.cs

示例2: GetFeed

		/// <summary>
		/// Retrieves a list of the user's feed entries from the supplied provider.
		/// Upon a successful retrieval of feed entries the user will be granted the supplied reward.
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> on which to retrieve a list of feed entries.</param>
		/// <param name="fromStart">Should we reset pagination or request the next page.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">The reward which will be granted to the user upon a successful retrieval of feed.</param>
		public static void GetFeed(Provider provider, bool fromStart = false, string payload = "", Reward reward = null) {
			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;

			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				string rewardId = reward != null ? reward.ID: "";
				//fallback to native
				instance._getFeed(provider, fromStart, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}
			else
			{
				ProfileEvents.OnGetFeedStarted(provider);
				targetProvider.GetFeed(fromStart,
				/* success */
				(SocialPageData<String> feeds) => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnGetFeedFinished(provider, feeds);
				},
				/* fail */
				(string message) => {
					ProfileEvents.OnGetFeedFailed(provider, message);
				});
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:40,代码来源:SoomlaProfile.cs

示例3: Invite

		public static void Invite(Provider provider, string inviteMessage, string dialogTitle = null, string payload="", Reward reward = null) {

			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				//TODO: add invite implementation when implemented in native
				instance._invite(provider, inviteMessage, dialogTitle, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}

			else
			{
				ProfileEvents.OnInviteStarted(provider, userPayload);
				targetProvider.Invite(inviteMessage, dialogTitle,
				                      /* success */ (string requestId, List<string> invitedIds) => {

					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnInviteFinished(provider, requestId, invitedIds, userPayload);
				},
									     /* fail */ (string message) => {
					ProfileEvents.OnInviteFailed(provider, message, userPayload);
				},
										/* cancel */ () => {
					ProfileEvents.OnInviteCancelled(provider, userPayload);
				});
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:34,代码来源:SoomlaProfile.cs

示例4: UploadImage

		/// <summary>
		/// Uploads an image to the user's social page on the given Provider.
		/// Supported platforms: Facebook, Twitter, Google+
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given image should be uploaded to.</param>
		/// <param name="message">Message to post with the image.</param>
		/// <param name="fileName">Name of image file with extension (jpeg/pgn).</param>
		/// <param name="imageBytes">Image bytes.</param>
		/// <param name="jpegQuality">Image quality, number from 0 to 100. 0 meaning compress for small size, 100 meaning compress for max quality.
		/// Some formats, like PNG which is lossless, will ignore the quality setting
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful upload.</param>
		public static void UploadImage(Provider provider, string message, string fileName, byte[] imageBytes,
		                               int jpegQuality, string payload="", Reward reward = null) {
			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				string rewardId = reward != null ? reward.ID: "";
				instance._uploadImage(provider, message, fileName, imageBytes, jpegQuality,
				                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), false, null);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPLOAD_IMAGE, userPayload);
				targetProvider.UploadImage(imageBytes, fileName, message,
				                           /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPLOAD_IMAGE, userPayload);
				},
				/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPLOAD_IMAGE, error, userPayload); },
				/* cancel */	() => {  ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPLOAD_IMAGE, userPayload); }
				);
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:43,代码来源:SoomlaProfile.cs

示例5: UploadImageWithConfirmation

		/// <summary>
		/// Uploads an image to the user's social page on the given Provider with confirmation dialog.
		/// Supported platforms: Facebook, Twitter, Google+
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given image should be uploaded to.</param>
		/// <param name="message">Message to post with the image.</param>
		/// <param name="fileName">Name of image file with extension (jpeg/pgn).</param>
		/// <param name="imageBytes">Image bytes.</param>
		/// <param name="jpegQuality">Image quality, number from 0 to 100. 0 meaning compress for small size, 100 meaning compress for max quality.
		/// Some formats, like PNG which is lossless, will ignore the quality setting
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful upload.</param>
		/// <param name="customMessage">The message to show in the dialog</param>
		public static void UploadImageWithConfirmation(Provider provider, string message, string fileName, byte[] imageBytes,
		                                               int jpegQuality, string payload="", Reward reward = null, string customMessage = null) {
			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				string rewardId = reward != null ? reward.ID: "";
				instance._uploadImage(provider, message, fileName, imageBytes, jpegQuality,
				                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), true, customMessage);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPLOAD_IMAGE, userPayload);
				ModalDialog.CreateModalWindow("Click 'Post' to proceed with image upload.",
				() => targetProvider.UploadImage(imageBytes, fileName, message,
				                           /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPLOAD_IMAGE, userPayload);
				},
				/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPLOAD_IMAGE, error, userPayload); },
				/* cancel */	() => {  ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPLOAD_IMAGE, userPayload); }
				) );
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:45,代码来源:SoomlaProfile.cs

示例6: UpdateStoryWithConfirmation

		/// <summary>
		/// Posts a full story to the user's social page on the given Provider with confirmation dialog.
		/// A story contains a title, description, image and more.
		/// Supported platforms: Facebook (full support),
		/// Twitter and Google+ (partial support - message and link only)
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given story should be posted to.</param>
		/// <param name="message">A message that will be shown along with the story.</param>
		/// <param name="name">The name (title) of the story.</param>
		/// <param name="caption">A caption.</param>
		/// <param name="description">A description.</param>
		/// <param name="link">A link to a web page.</param>
		/// <param name="pictureUrl">A link to an image on the web.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
		/// <param name="customMessage">The message to show in the dialog</param>
		public static void UpdateStoryWithConfirmation(Provider provider, string message, string name,
		                               string caption, string description, string link, string pictureUrl,
		                                               string payload="", Reward reward = null,
		                                               string customMessage = null) {

			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				instance._updateStory(provider, message, name, caption, description, link, pictureUrl,
				                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), true, customMessage);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STORY, userPayload);
				ModalDialog.CreateModalWindow("Click 'Post' to proceed with story update.",
				() => targetProvider.UpdateStory(message, name, caption, description, link, pictureUrl,
				                           /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STORY, userPayload);
				},
				/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STORY, error, userPayload); },
				/* cancel */	() => {  ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPDATE_STORY, userPayload); }
				) );
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:52,代码来源:SoomlaProfile.cs

示例7: UpdateStoryDialog

		/// <summary>
		/// Shares a story to the user's feed and grants the user a reward.
        /// Using the provider's native dialog (when available).
		/// </summary>
		/// <param name="provider">The provider to use.</param>
		/// <param name="name">he headline for the link which will be integrated in the story.</param>
		/// <param name="caption">The sub-headline for the link which will be integrated in the story.</param>
		/// <param name="description">The description for the link which will be integrated in the story.</param>
		/// <param name="link">The link which will be integrated into the user's story.</param>
		/// <param name="picture">a Link to a picture which will be featured in the link.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">The reward which will be granted to the user upon a successful update.</param>
		public static void UpdateStoryDialog(Provider provider, string name, string caption, string description, string link, string picture, string payload, Reward reward = null) {
			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null) {
				return;
			}

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				instance._updateStoryDialog(provider, name, caption, description, link, picture,
				                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STORY, userPayload);
				targetProvider.UpdateStoryDialog(name, caption, description, link, picture,
				() => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STORY, userPayload);
				},
				(string error) => {
					ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STORY, error, userPayload);
				},
				() => {
					ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPDATE_STORY, userPayload);
				});
			}

		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:46,代码来源:SoomlaProfile.cs

示例8: login

		private static void login(Provider provider, bool autoLogin, string payload="", Reward reward = null) {
			SoomlaUtils.LogDebug (TAG, "Trying to login with provider " + provider.ToString ());
			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
			{
				SoomlaUtils.LogError(TAG, "Provider not supported or not set as active: " + provider.ToString());
				return;
			}

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID : "";
				instance._login(provider, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}

			else
			{
				setLoggedInForProvider(provider, false);
				ProfileEvents.OnLoginStarted(provider, autoLogin, userPayload);
				targetProvider.Login(
					/* success */	() => {
					targetProvider.GetUserProfile((UserProfile userProfile) => {
						StoreUserProfile(userProfile);
						setLoggedInForProvider(provider, true);
						ProfileEvents.OnLoginFinished(userProfile, autoLogin, userPayload);
						if (reward != null) {
							reward.Give();
						}
					}, (string message) => {
						ProfileEvents.OnLoginFailed (provider, message, autoLogin, userPayload);
					});
				},
				/* fail */		(string message) => {  ProfileEvents.OnLoginFailed (provider, message, autoLogin, userPayload); },
				/* cancel */	() => {  ProfileEvents.OnLoginCancelled(provider, autoLogin, userPayload); }
				);
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:39,代码来源:SoomlaProfile.cs

示例9: UpdateStatus

		/// <summary>
		/// Updates the user's status on the given provider.
		/// Supported platforms: Facebook, Twitter, Google+
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given status should be posted to.</param>
		/// <param name="status">The actual status text.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
		/// <param name="showConfirmation">If true, shows confirmation dialog before the action</param>
		public static void UpdateStatus(Provider provider, string status, string payload="", Reward reward = null, bool showConfirmation = false) {

			SocialProvider targetProvider = GetSocialProvider(provider);
			string userPayload = (payload == null) ? "" : payload;

			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID : "";
				instance._updateStatus(provider, status, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), false, null);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STATUS, userPayload);
				targetProvider.UpdateStatus(status,
				                            /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STATUS, userPayload);
				},
				/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STATUS, error, userPayload); }
				);
			}
		}
开发者ID:IgorPushkar,项目名称:FlappyBirdClone,代码行数:40,代码来源:SoomlaProfile.cs

示例10: Like

		// TODO: this is irrelevant for now. Will be updated soon.
//		public static void AddAppRequest(Provider provider, string message, string[] to, string extraData, string dialogTitle) {
//			providers[provider].AppRequest(message, to, extraData, dialogTitle,
//			    /* success */	(string requestId, List<string> recipients) => {
//									string requestsStr = KeyValueStorage.GetValue("soomla.profile.apprequests");
//									List<string> requests = new List<string>();
//									if (!string.IsNullOrEmpty(requestsStr)) {
//										requests = requestsStr.Split(',').ToList();
//									}
//									requests.Add(requestId);
//									KeyValueStorage.SetValue("soomla.profile.apprequests", string.Join(",", requests.ToArray()));
//									KeyValueStorage.SetValue(requestId, string.Join(",", recipients.ToArray()));
//									ProfileEvents.OnAddAppRequestFinished(provider, requestId);
//								},
//				/* fail */		(string errMsg) => {
//									ProfileEvents.OnAddAppRequestFailed(provider, errMsg);
//								});
//		}


		/// <summary>
		///  Will fetch posts from user feed
		///
		/// </summary>
		/// <param name="provider">Provider.</param>
		/// <param name="reward">Reward.</param>
//		public static void GetFeed(Provider provider, Reward reward) {
//
//			// TODO: implement with FB SDK
//
//		}

		/// <summary>
		/// Likes the page (with the given name) of the given provider.
		/// Supported platforms: Facebook, Twitter, Google+.
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The provider that the page belongs to.</param>
		/// <param name="pageName">The name of the page to like.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after he/she likes the page.</param>
		public static void Like(Provider provider, string pageId, Reward reward=null) {
			ISocialProvider targetProvider = (ISocialProvider)GetProviderImplementation(provider);
			if (targetProvider != null) {
				targetProvider.Like(pageId);

				if (reward != null) {
					reward.Give();
				}
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:51,代码来源:SoomlaProfile.cs

示例11: GetScores

		/// <summary>
		/// Fetches Scores for selected leaderboard.
		/// Supported platforms: GameCenter.
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> to fetch contacts from.</param>
		/// <param name="from">The <c>Leaderboard</c> scores related to.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		public static void GetScores(Provider provider, Leaderboard from, bool fromStart = false, string payload = "", Reward reward = null) {
			IGameServicesProvider targetProvider = (IGameServicesProvider)GetProviderImplementation(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				instance._getScores(provider, from, fromStart, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}
			else
			{
				ProfileEvents.OnGetScoresStarted(new GetScoresStartedEvent(provider, from, fromStart, payload));
				targetProvider.GetScores(from, fromStart, (SocialPageData<Score> scores) => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnGetScoresFinished(new GetScoresFinishedEvent(provider, from, scores, payload));
				}, (string message) => {
					ProfileEvents.OnGetScoresFailed(new GetScoresFailedEvent(provider, from, fromStart, message, payload));
				});
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:34,代码来源:SoomlaProfile.cs

示例12: UpdateStory

		/// <summary>
		/// Posts a full story to the user's social page on the given Provider.
		/// A story contains a title, description, image and more.
		/// Supported platforms: Facebook (full support),
		/// Twitter and Google+ (partial support - message and link only)
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given story should be posted to.</param>
		/// <param name="message">A message that will be shown along with the story.</param>
		/// <param name="name">The name (title) of the story.</param>
		/// <param name="caption">A caption.</param>
		/// <param name="description">A description.</param>
		/// <param name="link">A link to a web page.</param>
		/// <param name="pictureUrl">A link to an image on the web.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
		public static void UpdateStory(Provider provider, string message, string name,
		                               string caption, string description, string link, string pictureUrl,
		                               string payload="", Reward reward = null) {

			ISocialProvider targetProvider = (ISocialProvider)GetProviderImplementation(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				instance._updateStory(provider, message, name, caption, description, link, pictureUrl,
				                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), false, null);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STORY, userPayload);
				//ProfileEvents.OnSocialActionStarted(new SocialActionStartedEvent(provider, SocialActionType.UPDATE_STORY, userPayload) );
				targetProvider.UpdateStory(message, name, caption, description, link, pictureUrl,
				    /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
						ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STORY, userPayload);
						//ProfileEvents.OnSocialActionFinished( new SocialActionFinishedEvent(provider, SocialActionType.UPDATE_STORY, userPayload) );
				},
					/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STORY, error, userPayload); },
					/* cancel */	() => {  ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPDATE_STORY, userPayload); }

					///* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed( new SocialActionFailedEvent (provider, SocialActionType.UPDATE_STORY, error, userPayload) ); },
					///* cancel */	() => {  ProfileEvents.OnSocialActionCancelled( new SocialActionCancelledEvent(provider, SocialActionType.UPDATE_STORY, userPayload) ); }
				);
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:54,代码来源:SoomlaProfile.cs

示例13: UpdateStatusDialog

		/// <summary>
		/// Shares the given status to the user's feed and grants the user a reward.
        /// Using the provider's native dialog (when available).
		/// </summary>
		/// <param name="provider">The provider to us.</param>
		/// <param name="link">The link to share (could be null).</param>
		/// <param name="payload">a String to receive when the function returns..</param>
		/// <param name="reward">The reward to give the user.</param>
		public static void UpdateStatusDialog(Provider provider, string link, string payload = "", Reward reward = null) {
			ISocialProvider targetProvider = (ISocialProvider)GetProviderImplementation(provider);
			string userPayload = (payload == null) ? "" : payload;

			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID : "";
				instance._updateStatusDialog(provider, link, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}
			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STATUS, userPayload);
				//ProfileEvents.OnSocialActionStarted( new SocialActionStartedEvent(provider, SocialActionType.UPDATE_STATUS, userPayload) );
				targetProvider.UpdateStatusDialog(link, () => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STATUS, userPayload);
					//ProfileEvents.OnSocialActionFinished( new SocialActionFinishedEvent(provider, SocialActionType.UPDATE_STATUS, userPayload) );
				},
				(string error) => {
						ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STATUS, error, userPayload);
						//ProfileEvents.OnSocialActionFailed( new SocialActionFailedEvent (provider, SocialActionType.UPDATE_STATUS, error, userPayload) );
				});
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:38,代码来源:SoomlaProfile.cs

示例14: UpdateStatusWithConfirmation

		/// <summary>
		/// Updates the user's status with confirmation dialog on the given provider.
		/// Supported platforms: Facebook, Twitter, Google+
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> the given status should be posted to.</param>
		/// <param name="status">The actual status text.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		/// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
		/// <param name="customMessage">The message to show in the dialog</param>
		public static void UpdateStatusWithConfirmation(Provider provider, string status, string payload="", Reward reward = null, string customMessage = null) {

			ISocialProvider targetProvider = (ISocialProvider)GetProviderImplementation(provider);
			string userPayload = (payload == null) ? "" : payload;

			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID : "";
				instance._updateStatus(provider, status, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), true, customMessage);
			}

			else
			{
				ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STATUS, userPayload);
				//ProfileEvents.OnSocialActionStarted( new SocialActionStartedEvent(provider, SocialActionType.UPDATE_STATUS, userPayload) );
				ModalDialog.CreateModalWindow("Are you sure you want to update status?",
				() => targetProvider.UpdateStatus(status,
				    /* success */	() => {
					if (reward != null) {
						reward.Give();
					}
							ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STATUS, userPayload);
							//ProfileEvents.OnSocialActionFinished( new SocialActionFinishedEvent(provider, SocialActionType.UPDATE_STATUS, userPayload) );
				},
						/* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed (provider, SocialActionType.UPDATE_STATUS, error, userPayload); }
						///* fail */		(string error) => {  ProfileEvents.OnSocialActionFailed(new SocialActionFailedEvent (provider, SocialActionType.UPDATE_STATUS, error, userPayload) ); }
				) );
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:44,代码来源:SoomlaProfile.cs

示例15: SubmitScore

		/// <summary>
		/// Submit score into selected leaderboard
		/// Supported platforms: GameCenter.
		///
		/// NOTE: This operation requires a successful login.
		/// </summary>
		/// <param name="provider">The <c>Provider</c> to fetch contacts from.</param>
		/// <param name="targetLeaderboard">The <c>Leaderboard</c> score will be written to.</param>
		/// <param name="score">Value of score will be written to leaderboard.</param>
		/// <param name="payload">A string to receive when the function returns.</param>
		public static void SubmitScore(Provider provider, Leaderboard targetLeaderboard, int score, string payload = "", Reward reward = null) {
			IGameServicesProvider targetProvider = (IGameServicesProvider)GetProviderImplementation(provider);
			string userPayload = (payload == null) ? "" : payload;
			if (targetProvider == null)
				return;

			if (targetProvider.IsNativelyImplemented())
			{
				//fallback to native
				string rewardId = reward != null ? reward.ID: "";
				instance._submitScore(provider, targetLeaderboard, score, ProfilePayload.ToJSONObj(userPayload, rewardId).ToString());
			}
			else
			{
				ProfileEvents.OnSubmitScoreStarted(new SubmitScoreStartedEvent(provider, targetLeaderboard, payload));
				targetProvider.SubmitScore(targetLeaderboard, score, (Score newScore) => {
					if (reward != null) {
						reward.Give();
					}
					ProfileEvents.OnSubmitScoreFinished(new SubmitScoreFinishedEvent(provider, targetLeaderboard, newScore, payload));
				}, (string message) => {
					ProfileEvents.OnSubmitScoreFailed(new SubmitScoreFailedEvent(provider, targetLeaderboard, message, payload));
				});
			}
		}
开发者ID:trananh1992,项目名称:unity3d-profile,代码行数:35,代码来源:SoomlaProfile.cs


注:本文中的Reward.Give方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。