private static void SharePromoCode(string promoCode) { GetSocialUi.CreateInvitesView() .SetLinkParams(new LinkParams { { LinkParams.KeyPromoCode, promoCode } }) .SetCustomInviteContent(InviteContent.CreateBuilder() .WithText("Use my Promo Code to get a personal discount: " + InviteTextPlaceholders.PlaceholderPromoCode + " . " + InviteTextPlaceholders.PlaceholderAppInviteUrl) .Build()) .Show(); }
void ShowNativeSmartInvitesViewCustomized() { GetSocialUi.CreateInvitesView() .SetWindowTitle(_smartInvitesApiSection.CustomTitle) .SetLinkParams(_smartInvitesApiSection.LinkParams) .SetCustomInviteContent(_smartInvitesApiSection.CustomInviteContent) .SetInviteCallbacks( channelId => _console.LogD("Successfully sent invite for " + channelId), channelId => _console.LogW("Sending invite cancelled for " + channelId), (channelId, error) => _console.LogE(string.Format("Failed to send invite: {0} for {1}", error.Message, channelId))) .Show(); }
public void Invite() { if (GetSocial.IsInitialized) { var linkParams = new LinkParams(); linkParams.Add("invite", "invite_value"); var inviteContent = InviteContent.CreateBuilder() .WithMediaAttachment(MediaAttachment.Image(image)) .Build(); GetSocialUi.CreateInvitesView().SetCustomInviteContent(inviteContent).SetInviteCallbacks( onComplete: (channelId) => { Debug.Log("Invitation was sent via " + channelId); InitScript.Instance.ShowReward(); }, onCancel: (channelId) => Debug.Log("Invitation via " + channelId + " was cancelled"), onFailure: (channelId, error) => Debug.LogError("Invitation via" + channelId + "failed, error: " + error.Message) ).Show(); } }
IEnumerator ShareDelay() { yield return(new WaitForEndOfFrame()); Texture2D captureScreenshotAsTexture = ScreenCapture.CaptureScreenshotAsTexture(); if (GetSocial.IsInitialized) { var inviteContent = InviteContent.CreateBuilder() .WithText("Try to beat me in this game [APP_INVITE_URL]") // NOTE: if you customize the text [APP_INVITE_URL] placeholder have to be used .WithMediaAttachment(MediaAttachment.Image(captureScreenshotAsTexture)) .Build(); bool wasShown = GetSocialUi.CreateInvitesView() .SetCustomInviteContent(inviteContent) .SetInviteCallbacks( onComplete: (channelId) => Debug.Log("Invitation was sent via " + channelId), onCancel: (channelId) => Debug.Log("Invitation via " + channelId + " was cancelled"), onFailure: (channelId, error) => Debug.LogError("Invitation via" + channelId + "failed, error: " + error.Message) ) .Show(); } }
static void ShowNativeSmartInvitesView() { GetSocialUi.CreateInvitesView().Show(); }