Example #1
0
        private void Share()
        {
            string shareImgPath = Application.persistentDataPath + "/tempPics/shareImage.png";

            ShareContent content = new ShareContent();

            switch (currentShareType)
            {
            case ShareType.WeChat:

                content.SetText("分享的内容");
                content.SetTitle("分享的标题");
                content.SetAddress("分享的位置");
                content.SetDesc("分享的描述");
                content.SetComment("分享的评论");

                content.SetImagePath(shareImgPath);

                //设置分享的类型
                content.SetShareType(ContentType.Auto);

                //直接分享
                ssdk.ShareContent(PlatformType.WeChatMoments, content);

                break;

            case ShareType.Weibo:

                string currentThoughts = "1234566789";
                content.SetText(currentThoughts);
                content.SetImagePath(shareImgPath);

                //设置分享的类型
                content.SetShareType(ContentType.Image);

                //直接分享
                ssdk.ShareContent(PlatformType.SinaWeibo, content);

                break;
            }
        }