示例#1
0
 public void MultiShare()
 {
     SoomlaProfile.MultiShare(
         "I Reached Level " + GameManager.instance.levelShow + " On Frog Smash !",
         ""
         );
 }
示例#2
0
    /// <summary>
    /// Shares a screenshot on one of the available social platforms.
    /// </summary>
    /// <param name="screenshotWidth">Width of the screenshot.</param>
    /// <param name="screenshotHeight">Height of the screenshot.</param>
    /// <param name="screenshotCamera">The camera used to take the screenshot.</param>
    /// <param name="useOneCamera">if set to <c>true</c> take screenshot as seen by one camera.
    ///     Else, take screenshot as seen by player (views of all cameras combined).</param>
    /// <param name="shareMessage">The message to share along with the screenshot.</param>
    /// <param name="screenshotFilePath">The path to the prepared screenshot, if available.
    ///     Else, this is the path to save the screenshot to.</param>
    /// <param name="screenshotProvided">if set to <c>true</c> the screenshot is already provided
    ///     in the specified file path, and needs only to be shared.</param>
    /// <param name="deleteOnShare">if set to <c>true</c> delete the local copy of the screenshot
    ///     after it has been successfully shared.</param>
    private void MultiShareScreenshot(int screenshotWidth, int screenshotHeight,
                                      Camera screenshotCamera, bool useOneCamera,
                                      string shareMessage, string screenshotFilePath,
                                      bool screenshotProvided, bool deleteOnShare)
    {
        // If width is not specified, use screen width
        int width = (screenshotWidth > 0) ? screenshotWidth : Screen.width;
        // If height is not specified, use screen height
        int height = (screenshotHeight > 0) ? screenshotHeight : Screen.height;

        // If camera is not specified, use main camera
        Camera camera = (screenshotCamera != null) ? screenshotCamera : Camera.main;

        // If file path is not specified, save the screenshot to a generic location
        string filePath = !string.IsNullOrEmpty(screenshotFilePath) ? screenshotFilePath :
                          Application.persistentDataPath + "/CRCScreen_" + DateTime.Now.GetTimestamp() + ".png";

        // Take screenshot and save it to file
        if (!screenshotProvided || (screenshotProvided && string.IsNullOrEmpty(screenshotFilePath)))
        {
            if (useOneCamera)
            {
                // Screenshot as seen from one camera
                Texture2D screenshot = ScreenshotUtils.TakeScreenshotSave(width, height, camera, filePath);
                UpdateScreenshot(screenshot);
            }
            else
            {
                // Screenshot as seen by player
                Application.CaptureScreenshot(filePath);
            }
        }

        // Open the multishare window and pass in the screenshot path
        SoomlaProfile.MultiShare(shareMessage, filePath);

        // Delete local copy of screenshot
        // TODO: Wait until multishare finishes before deleting
        if (deleteOnShare && ScreenshotUtils.IsScreenshotReady(filePath))
        {
            //System.IO.File.Delete(filePath);
        }
    }
示例#3
0
 public void MultiShare()
 {
     SoomlaProfile.MultiShare(
         "I'm happy. I can be shared everywhere."
         );
 }
示例#4
0
 /// <summary>
 /// Shares the specified message on one of the available social platforms.
 /// </summary>
 /// <param name="shareMessage">The message to share.</param>
 public void MultiShareText(string shareMessage)
 {
     SoomlaProfile.MultiShare(shareMessage);
 }