Exemple #1
0
    public void NativeShare(ShareType type, string msg = "")
    {
        string Message = "";

        for (int i = 0; i < Messages.Count; i++)
        {
            if (Messages[i].ShareType == type)
            {
                if (Messages[i].Append.Append == AppendAction.Begin)
                {
                    Message += msg + " ";
                }
                Message = AppendMessages(Message, i, Messages[i].Append.Append, msg);
                if (Messages[i].Append.Append == AppendAction.End)
                {
                    Message += msg;
                }
            }
        }

        Debug.Log(Message);

        #if UNITY_IOS
        string[] array = new string[] { Message };
        SharingBinding.shareItems(array);
        #endif

        #if UNITY_ANDROID
        EtceteraAndroid.shareWithNativeShareIntent(Message, null, null);
        #endif
    }
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Share URL and Text"))
        {
            // Note that calling setPopoverPosition is only required on iOS 8 when on an iPad
            SharingBinding.setPopoverPosition(Input.touches[0].position.x / 2f, (Screen.height - Input.touches[0].position.y) / 2f);
            SharingBinding.shareItems(new string[] { "http://prime31.com", "Here is some text with the URL" });
        }


        if (GUILayout.Button("Share Screenshot"))
        {
            var pathToImage = System.IO.Path.Combine(Application.persistentDataPath, screenshotFilename);
            if (!System.IO.File.Exists(pathToImage))
            {
                Debug.LogError("there is no screenshot avaialable at path: " + pathToImage);
                return;
            }

            // Note that calling setPopoverPosition is only required on iOS 8 when on an iPad
            SharingBinding.setPopoverPosition(Input.touches[0].position.x / 2f, (Screen.height - Input.touches[0].position.y) / 2f);
            SharingBinding.shareItems(new string[] { pathToImage });
        }


        if (GUILayout.Button("Share Screenshot and Text"))
        {
            var pathToImage = System.IO.Path.Combine(Application.persistentDataPath, screenshotFilename);
            if (!System.IO.File.Exists(pathToImage))
            {
                Debug.LogError("there is no screenshot avaialable at path: " + pathToImage);
                return;
            }

            // Note that calling setPopoverPosition is only required on iOS 8 when on an iPad
            SharingBinding.setPopoverPosition(Input.touches[0].position.x / 2f, (Screen.height - Input.touches[0].position.y) / 2f);
            SharingBinding.shareItems(new string[] { pathToImage, "Here is some text with the image" });
        }

        endColumn();


        if (bottomRightButton("Facebook..."))
        {
            Application.LoadLevel("FacebookTestScene");
        }
    }
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Share URL and Text"))
        {
            SharingBinding.shareItems(new string[] { "http://prime31.com", "Here is some text with the URL" });
        }


        if (GUILayout.Button("Share Screenshot"))
        {
            var pathToImage = System.IO.Path.Combine(Application.persistentDataPath, screenshotFilename);
            if (!System.IO.File.Exists(pathToImage))
            {
                Debug.LogError("there is no screenshot avaialable at path: " + pathToImage);
                return;
            }

            SharingBinding.shareItems(new string[] { pathToImage });
        }


        if (GUILayout.Button("Share Screenshot and Text"))
        {
            var pathToImage = System.IO.Path.Combine(Application.persistentDataPath, screenshotFilename);
            if (!System.IO.File.Exists(pathToImage))
            {
                Debug.LogError("there is no screenshot avaialable at path: " + pathToImage);
                return;
            }

            SharingBinding.shareItems(new string[] { pathToImage, "Here is some text with the image" });
        }

        endColumn();


        if (bottomRightButton("Facebook..."))
        {
            Application.LoadLevel("FacebookTestScene");
        }
    }
        public void Share(string text, string link, string imagePath)
        {
                        #if API_SHARE_NATIVE
            List <string> items = new List <string>();

            if (text != null)
            {
                items.Add(text);
            }
            if (link != null)
            {
                items.Add(link);
            }
            if (imagePath != null)
            {
                items.Add(imagePath);
            }

            SharingBinding.shareItems(items.ToArray());

            items.Clear();
                        #endif
        }
Exemple #5
0
        public void ShareGame(ButtonEventArgs args)
        {
            if (!CoreUtility.Me.ShowInternetConnection())
            {
                return;
            }
            MyDebug.Log("GameUtility::ShareGame => Share to: " + args.data);
            CoreUtility.Me.shareMode = ShareMode.Game;
            string shareText = GetRandomShareMessage();

            MyDebug.Log(args.data + ": Share is => " + shareText);
#if UNITY_EDITOR
            GameAnax.Core.Utility.Popup.PopupMessages.Me.NativeFuncionNonAvailableMessage();
            return;
#endif
            if (args.data.Equals("Facebook", StringComparison.OrdinalIgnoreCase))
            {
#if SOCIALNETWORKING
                FBService.Me.ShareTextOnFB(shareText, STORE_LONG_URL);
#endif
            }
            else if (args.data.Equals("Native", StringComparison.OrdinalIgnoreCase))
            {
#if UNITY_IOS && SOCIALNETWORKING
                SharingBinding.shareItems(new[] { shareText, STORE_SHORT_URL }, _excludeActivity);
#endif
#if UNITY_ANDROID && ETCETERA
                EtceteraB.shareWithNativeShareIntent(shareText + "\n" + STORE_SHORT_URL, "", "Share On", null);
#endif
            }
            else if (args.data.Equals("Twitter", StringComparison.OrdinalIgnoreCase))
            {
#if SOCIALNETWORKING
                FBService.Me.ShareOnTwitter(shareText, STORE_SHORT_URL);
#endif
            }
        }
Exemple #6
0
 // Shows the share sheet with the given items with a list of excludedActivityTypes. See Apple's docs for more information on excludedActivityTypes.
 public void shareItems(string[] items, string[] excludedActivityTypes)
 {
     SharingBinding.shareItems(items, excludedActivityTypes);
 }
Exemple #7
0
 // Shows the share sheet with the given items. Items can be text, urls or full and proper paths to sharable files
 public void ShareItems(string[] items)
 {
     SharingBinding.shareItems(items);
 }