コード例 #1
0
    private void Start()
    {
        //Native Sharing
        m_SystemSharingDialog.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.SystemSharingDialog(MakeSharingBuilder(), PrintSharingResult);
        });

        m_SendMailDialog.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            var dialog = new UM_EmailDialogBuilder();

            dialog.SetSubject("Subject");
            dialog.SetText("Hello World!");
            dialog.SetUrl("https://stansassets.com/");

            //Juts generating simple red texture with 32x32 resolution
            var sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);
            dialog.AddImage(sampleRedTexture);
            dialog.AddRecipient("*****@*****.**");

            client.ShowSendMailDialog(dialog, PrintSharingResult);
        });


        //Sharing to Social Media
        m_Facebook.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToFacebook(MakeSharingBuilder(), PrintSharingResult);
        });


        m_Instagram.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToInstagram(MakeSharingBuilder(), PrintSharingResult);
        });


        m_Twitter.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToTwitter(MakeSharingBuilder(), PrintSharingResult);
        });

        m_Whatsapp.onClick.AddListener(() =>
        {
            var client = UM_SocialService.SharingClient;
            client.ShareToWhatsapp(MakeSharingBuilder(), PrintSharingResult);
        });
    }
コード例 #2
0
        public IEnumerator MailDialog()
        {
            var @lock  = new CallbackLock();
            var client = UM_SocialService.SharingClient;
            var dialog = new UM_EmailDialogBuilder();

            dialog.SetSubject("Subject");
            dialog.SetText("Hello World!");
            dialog.SetUrl("https://stansassets.com/");

            //Juts generating smaple red tuxture with 32x32 resolution
            Texture2D sampleRedTexture = SA_IconManager.GetIcon(Color.red, 32, 32);

            dialog.AddImage(sampleRedTexture);
            dialog.AddRecipient("*****@*****.**");

            client.ShowSendMailDialog(dialog, (result) => {
                @lock.Unlock();
                Assert.IsTrue(result.IsSucceeded);
            });

            yield return(@lock.WaitToUnlock());
        }