Share() public method

public Share ( string shareText, string imagePath, string url, string subject = "" ) : void
shareText string
imagePath string
url string
subject string
return void
コード例 #1
0
    public void NativeShare()
    {
        var nativeShare = new NativeShare();

        nativeShare.SetText("Check out this match!\n\nCopy the link below and paste it in your browser or directly in the GO:View app to watch it:\n\n" + match.GetSharecodeUrl());
        nativeShare.Share();
    }
コード例 #2
0
 public void Share()
 {
     NativeGallery.SaveImageToGallery(PhotoFilePath, "TestAR", "Screenshot.png");
     myNativeShare = new NativeShare();
     myNativeShare.AddFile(PhotoFilePath);
     myNativeShare.Share();
 }
コード例 #3
0
    public void shareScore()
    {
        FindObjectOfType <GameCode>().playSound(GameCode.Sound.Button);
        string screenshotName = "mimo_highscore.png";

        // wait for graphics to render
        new WaitForEndOfFrame();
        string screenShotPath = Application.persistentDataPath + "/" + screenshotName;

        ScreenCapture.CaptureScreenshot(screenshotName, 1);
        new WaitForSeconds(0.5f);

        string appPackageName = Application.identifier;

        var shareSubject = "Fam! I challenge you to beat my high score in" +
                           " Mimo";
        var shareMessage = "Fam! I challenge you to beat my high score in" +
                           " Mimo" +
                           "\nDownload Mimo from the link below." +
                           "\n\n" +
                           "https://play.google.com/store/apps/details?id=" + appPackageName;

        NativeShare shareIntent = new NativeShare();

        shareIntent.AddFile(screenShotPath, null);
        shareIntent.SetSubject(shareSubject);
        shareIntent.SetText(shareMessage);
        shareIntent.SetTitle("Share your score with friends...");

        shareIntent.Share();
    }
コード例 #4
0
ファイル: SaveScreenShoot.cs プロジェクト: Mario021/rappi_ar
    IEnumerator C_TakePhoto()
    {
        isProcessing = true;
        yield return(new WaitForEndOfFrame());


        string file = "Screen_" + GetTimestamp(DateTime.Now) + ".png";

        ScreenCapture.CaptureScreenshot(file);

        file = Application.persistentDataPath + "/" + file;
        int count = 0;

        while (!System.IO.File.Exists(file) || count > 4)
        {
            yield return(null);
        }

        if (count > 4)
        {
            Debug.Log("Error too much time taking photo");
        }
        else
        {
            NativeShare nativeShare = new NativeShare();
            nativeShare.AddFile(file);
            nativeShare.Share();
        }


        isProcessing = false;
    }
コード例 #5
0
    public void SaveImage()
    {
        var saved = RenderTexture.active;

        RenderTexture.active = paintingTexture;

        Texture2D t2d = new Texture2D(paintingTexture.width, paintingTexture.height, TextureFormat.ARGB32, mipChain: false);

        t2d.ReadPixels(new Rect(0, 0, paintingTexture.width, paintingTexture.height), 0, 0);

        RenderTexture.active = saved;

        byte[] pngBytes = t2d.EncodeToPNG();

        Debug.Log("SAVING " + Application.persistentDataPath);
        Directory.CreateDirectory(Application.persistentDataPath + "/gallery");
        string randomName = Guid.NewGuid().ToString();

        if (image1.activeSelf == true)
        {
            randomName = "1-" + randomName;
        }
        else
        {
            randomName = "2-" + randomName;
        }

        string savePath = Application.persistentDataPath + $"/gallery/{randomName}.png";

        File.WriteAllBytes(savePath, pngBytes);
        NativeShare.Share("hi", savePath, "", "subject", "image/png", true, "");
    }
コード例 #6
0
    public void OnShare()
    {
        //get stuff from the canvas.
        for (int f = 0; f < canvas.transform.childCount; f++)
        {
            Transform currentItem = canvas.transform.GetChild(f);

            //search by name
            if (currentItem.name.Equals("Title"))
            {
                title = currentItem.GetComponentInChildren <Text>().text;
            }

            //search by name
            if (currentItem.name.Equals("Description Scroller"))
            {
                description = currentItem.GetComponentInChildren <Text>().text;
            }
        }

        //set subject
        subject = "Historical Information on " + title;

        //create nativeshare object
        NativeShare native = new NativeShare();

        //set variables for nativeshare object
        native.SetSubject(subject);
        native.SetText(description);
        native.SetTitle(title);
        native.AddFile("Assets/Images/startscreen2.jpg", ".jpg");

        //try some freaky shit
        native.Share();
    }
コード例 #7
0
    public void ShareScreenshot(byte[] pngData)
    {
        var pngDataPath = Application.persistentDataPath + "/screenshot-share.png";

        File.WriteAllBytes(pngDataPath, pngData);
        NativeShare.Share("", pngDataPath, null, "", "image/png", true, "Share");
    }
コード例 #8
0
 private IEnumerator delayedShare(string screenShotPath, string text)
 {
     while (!File.Exists(screenShotPath))
     {
         yield return(new WaitForSeconds(0.05f));
     }
     NativeShare.Share(text, screenShotPath, "", "", "image/png", chooser: true, "");
 }
コード例 #9
0
    public void OnShare()
    {
        var share = new NativeShare();

        share.SetSubject(FrameworkValues.ShareSubject);
        share.SetText(FrameworkValues.ShareText + "\n https://play.google.com/store/apps/details?id=com.FazApp.TestApp");
        share.Share();
    }
コード例 #10
0
    public void ShareText(string text)
    {
#if UNITY_ANDROID
        AndroidNativeFunctions.ShareText(text, "", "Robo Flight");
#elif UNITY_IOS
        NativeShare.Share(text);
#endif
    }
コード例 #11
0
        public void SharePicture(string path)
        {
#if UseNativeShare
            NativeShare share = new NativeShare();
            share.AddFile(path);
            share.Share();
#endif
        }
コード例 #12
0
        public void ShareText(string text)
        {
#if UseNativeShare
            NativeShare share = new NativeShare();
            share.SetText(text);
            share.Share();
#endif
        }
コード例 #13
0
    private IEnumerator TakeSanpShotAndShare()
    {
        yield return(new WaitForEndOfFrame());

        Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

        ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        ss.Apply();

        string filePath = Path.Combine(Application.temporaryCachePath, "shared img.png");

        File.WriteAllBytes(filePath, ss.EncodeToPNG());

        Destroy(ss);

        ns.AddFile(filePath).SetSubject("Shared File").SetText("Hello From Unity");
        ns.Share();
    }
コード例 #14
0
    public void Share()
    {
        NativeShare ns = new NativeShare();

        ns.SetTitle("Check Out This AWESOME Game");
        ns.SetText("I Just GOT " + GameController.numCorrect + "/10 on the Fast Facts: FBLA QUIZ!! \n" +
                   "https://github.com/kinzorPark/FBLA-Mobile-App-Development");
        ns.Share();
    }
コード例 #15
0
        public void OnClickShare()
        {
            PlayTouchSound();
            var v_nativeShare = new NativeShare();

            v_nativeShare.SetTitle("Download Gravity-Slither game");
            v_nativeShare.SetText("Hey there! Download Gravity-Slither game from Google Play Store with the following link https://LINK"); // TODO: Update Google Play Store link
            v_nativeShare.Share();
        }
コード例 #16
0
        public void OnShare()
        {
            FirebaseManager.LogEvent("share_button_click");
            var share = new NativeShare();

            share.SetSubject(FrameworkValues.ShareSubject);
            share.SetText(FrameworkValues.ShareText + "\n" + "https://play.google.com/store/apps/details?id=" + Application.identifier);
            share.Share();
        }
コード例 #17
0
    //CaptureScreenshot runs asynchronously, so you'll need to either capture the screenshot early and wait a fixed time
    //for it to save, or set a unique image name and check if the file has been created yet before sharing.
    IEnumerator delayedShare(string screenShotPath, string text)
    {
        while (!File.Exists(screenShotPath))
        {
            yield return(new WaitForSeconds(.05f));
        }

        NativeShare.Share(text, true, "Robo Flight", "", screenShotPath, "", "image/*");
    }
コード例 #18
0
    private void NativeShare_Image(string screenShotPath)
    {
        string text        = "";
        string url         = "";
        string chooserText = "Select sharing app";

        text = "Test subject.";
        NativeShare.Share("Test text", screenShotPath, url, text, "image/png", chooser: true, chooserText);
    }
コード例 #19
0
        private IEnumerator Share()
        {
            yield return(new WaitForEndOfFrame());

            var ns = new NativeShare().SetSubject(GameConstants.Social.Share.Subject)
                     .SetTitle(GameConstants.Social.Share.Content).SetText(string.Format(GameConstants.Social.Share.BodyFormat, _scoreDataManager.CurrentScore))
                     .AddFile(ScreenCapture.CaptureScreenshotAsTexture(), "HighScore.png");

            ns.Share();
        }
コード例 #20
0
    IEnumerator delayedShare(string screenShotPath, string text)
    {
        while (!File.Exists(screenShotPath))
        {
            yield return(new WaitForSeconds(.05f));
        }

        NativeShare.Share(text, screenShotPath, "", "", "image/png", true, "");
        print(Application.persistentDataPath);//вывод изображения
    }
コード例 #21
0
    //CaptureScreenshot runs asynchronously, so you'll need to either capture the screenshot early and wait a fixed time
    //for it to save, or set a unique image name and check if the file has been created yet before sharing.
    IEnumerator delayedShare(string screenShotPath, string text)
    {
        while (!File.Exists(screenShotPath))
        {
            yield return(new WaitForSeconds(.1f));
        }

        NativeShare.Share(text, screenShotPath, "", "", "image/png", true, "");
        print("Screenshot shared");
    }
コード例 #22
0
ファイル: MainMenu.cs プロジェクト: TheGrimsey/DodgerV2
    IEnumerator Share()
    {
        yield return(new WaitForEndOfFrame());

        NativeShare nativeShare = new NativeShare();

        nativeShare.SetTitle("Share Highscore.");
        nativeShare.SetText(string.Format(ShareText, scoreKeeper.HighScore));
        nativeShare.Share();
    }
コード例 #23
0
    //CaptureScreenshot runs asynchronously, so you'll need to either capture the screenshot early and wait a fixed time
    //for it to save, or set a unique image name and check if the file has been created yet before sharing.
    IEnumerator DelayedShare(string screenShotPath, string text)
    {
        while (!File.Exists(screenShotPath))
        {
            // WaitForSeconds freezes if the game is paused (Time.timeScale = 0).
            // This method is not affected by this.
            yield return(new WaitForSecondsRealtime(.05f));
        }

        NativeShare.Share(text, screenShotPath, "", "", "image/png", true, "");
    }
コード例 #24
0
 IEnumerator delayedShare(string screenShotPath, string text)
 {
     Debug.Log("Sshare delayed");
     while (!File.Exists(screenShotPath))
     {
         Debug.Log("Sshare waiting yeild");
         yield return(new WaitForSeconds(.05f));
     }
     NativeShare.Share(text, screenShotPath, "", "", "image/png", true, "");
     Invoke("delayedUIVisibility", 2f);
 }
コード例 #25
0
    public void ShareApp()
    {
        //TODO setup native share as in readme file
        NativeShare nativeShare = new NativeShare();
        //share url stores
        string playStoreURL = "https://sudden-dev.com/pubbles";

        nativeShare.SetText(settingsObject.GetStringFromHashtable("ShareButtonText") + "\n\n " + playStoreURL);
        nativeShare.Share();
        EventSystem.current.SetSelectedGameObject(null);
    }
コード例 #26
0
    public void ShareCode()
    {
        NativeShare share     = new NativeShare();
        string      shareText = StaticStrings.SharePrivateLinkMessage + " " + RoomIDText.GetComponent <Text>().text + "\n\n" + StaticStrings.SharePrivateLinkMessage2 + " ";

#if UNITY_ANDROID
        shareText += "https://play.google.com/store/apps/details?id=" + StaticStrings.AndroidPackageName;
#elif UNITY_IOS
        shareText += "https://itunes.apple.com/us/app/apple-store/id" + StaticStrings.ITunesAppID;
#endif
        share.Share(shareText, null, null, "Share via");
    }
コード例 #27
0
    IEnumerator RecordFrameAndShare()
    {
        yield return(new WaitForEndOfFrame());

        var         texture     = ScreenCapture.CaptureScreenshotAsTexture();
        NativeShare shareScreen = new NativeShare();

        shareScreen.SetSubject("Prez Hopper");
        shareScreen.AddFile(texture, "score.png");
        shareScreen.SetText("Check out my score on Prez Hopper!");
        shareScreen.Share();        // cleanup
        Object.Destroy(texture);
    }
コード例 #28
0
        private IEnumerator ShareImageCoroutine()
        {
            yield return(new WaitForEndOfFrame());

            var ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

            ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
            ss.Apply();
            string filePath = Path.Combine(Application.temporaryCachePath, "shared img.png");

            File.WriteAllBytes(filePath, ss.EncodeToPNG());
            NativeShare.Share(filePath, true, "ru.indalo.Turbine");
        }
コード例 #29
0
        public static void ShareFiles(IEnumerable <string> filePaths, string text = "", string subject = "")
        {
            var nativeShare = new NativeShare().SetSubject(subject).SetText(text);

            if (filePaths != null)
            {
                foreach (var path in filePaths)
                {
                    nativeShare.AddFile(path);
                }
            }
            nativeShare.Share();
        }
コード例 #30
0
    public IEnumerator ShareHintWondow()
    {
        Vector2   screen  = new Vector2(Screen.width, Screen.height);
        PixleSize picSize = new PixleSize()
        {
            Input = Vector2.Scale(ScalerRect.size / 100, screen)
        };
        Rect rectToScreenShot =
            new Rect(
                Vector2.Scale(ScalerRect.position / 100, screen),
                picSize.Input
                );

        Texture2D screenShot = new Texture2D(picSize.X, picSize.Y, TextureFormat.RGB24, true);

        screenShot.ReadPixels(rectToScreenShot, 0, 0);
        screenShot.Apply();
        int random = Random.Range(1, 55465463);

        byte[] dataToSave  = screenShot.EncodeToJPG();
        string fileName    = "Hint" + WordSpawner.Clue + random + ".jpg";
        string destination = Path.Combine(Application.persistentDataPath, fileName);


        if (File.Exists(destination))
        {
            File.Delete(destination);
        }

        while (File.Exists(destination))
        {
            yield return(new WaitForSeconds(0.1f));
        }

        File.WriteAllBytes(destination, dataToSave);

        while (!File.Exists(destination))
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log(destination + "\n" + Application.persistentDataPath);

        string body = "برای حل این معما به کمک نیاز دارم." +
                      "\n" +
                      " بازی چارسو رو میتونی اینجا دانلود کنی:" +
                      "\n" +
                      "https://charsoog.ir";

        NativeShare.Share(body, destination);
    }