/// <summary> /// 分享逻辑 /// </summary> private void Share() { string shareImgPath = Application.persistentDataPath + "/tempPics/shareImage.jpg"; ShareContent content = new ShareContent(); switch (shareType) { case ShareType.WeChat: content.SetImagePath(shareImgPath); // 设置分享的类型 content.SetShareType(ContentType.Image); // 直接分享 ssdk.ShareContent(PlatformType.WeChatMoments, content); break; case ShareType.Weibo: content.SetImagePath(shareImgPath); //设置分享的类型 content.SetShareType(ContentType.Image); //直接分享 ssdk.ShareContent(PlatformType.SinaWeibo, content); break; } }
/// <summary> /// 邀请微信好友 /// </summary> /// <param name="str"></param> public void InviteFriends(string nameId, string str = "") { if (!File.Exists(Application.persistentDataPath + iconPath)) { SQDebug.PrintToScreen("VistiteFriend222=" + Application.persistentDataPath + iconPath); byte[] b = icon.EncodeToPNG(); SQDebug.PrintToScreen("VistiteFriend2221=" + b.Length); try { File.WriteAllBytes(Application.persistentDataPath + iconPath, b); } catch (Exception ex) { SQDebug.PrintToScreen(ex); } SQDebug.PrintToScreen("VistiteFriend2223=" + Application.persistentDataPath + iconPath); } SQDebug.LogError(Application.persistentDataPath + iconPath); // ShareContent content = new ShareContent(); content.SetTitle("58麻将0429"); content.SetUrl("http://139.224.57.97/down/index.html"); content.SetText("房间号:" + nameId + "\n" + str); content.SetImagePath(Application.persistentDataPath + iconPath); content.SetShareType(ContentType.Webpage); SQDebug.PrintToScreen("VistiteFriend2224="); ssdk.ShareContent(PlatformType.WeChat, content); }
/// <summary> /// 分享Link, /// url:图片的路径 /// modelName:模型本身的名字 /// modelText:模型上写的字 /// modelTransform:模型的Transform /// /// /// </summary> private bool ShareLink(string imagURL) { if (imagURL == null) { return(false); } ; MobLinkScene scene = new MobLinkScene("", "", YiyouStaticDataManager.Instance.GetHashtable()); MobLink.getMobId(scene, (mobid) => { if (mobid != null && mobid.Length > 0) { string linkUrl = GlobalParameter.LinkWebURL + mobid; ShareContent content = new ShareContent(); content.SetImagePath(imagURL); content.SetText("AR凉山游1"); content.SetComment("AR凉山游2"); content.SetSite("AR凉山游3"); content.SetSiteUrl(linkUrl); content.SetTitle("AR凉山游4"); content.SetTitleUrl(linkUrl); content.SetShareType(ContentType.Image); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } }); return(true); }
private IEnumerator CaptureShareToFirend() { //GDFunc.Instance.CaptureByUnity("share.png"); Texture2D tex = null; yield return(StartCoroutine(GDFunc.Instance.CaptureByRect(new Rect(0, 0, Screen.width, Screen.height), tex, Application.persistentDataPath + "/share.png"))); //GDFunc.Instance.CaptureByRect(new Rect(0, 0, Screen.width, Screen.height), Application.persistentDataPath + "/share.png"); //yield return null; //yield return null; ShareContent content = new ShareContent(); content.SetText(Tags.Title_Name + ",快来和我一起玩游戏吧!"); //content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); //content.SetImageUrl("http://fir.im/1946"); content.SetTitle(Tags.Title_Name); content.SetTitleUrl("http://fir.im/1946"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://fir.im/1946"); content.SetUrl("http://fir.im/1946"); content.SetComment("描述"); //content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); content.SetImagePath(Application.persistentDataPath + "/share.png"); WeiXinCenter.Instance.ShareWeChatFriend(content); }
IEnumerator SendShareScreenshot(PlatformType platform) { string imagePath = Application.persistentDataPath + "/screenshot.jpg"; // string imagePath2 = Application.streamingAssetsPath + "/screenshot.png"; // 先创建一个的空纹理,大小可根据实现需要来设置 Texture2D screenShot = new Texture2D((int)Screen.width, (int)Screen.height, TextureFormat.RGB24, false, false); screenShot.anisoLevel = 1; screenShot.filterMode = FilterMode.Bilinear; // screenShot.Resize (1280, 720); yield return(new WaitForEndOfFrame()); // 读取屏幕像素信息并存储为纹理数据, screenShot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); yield return(new WaitForEndOfFrame()); screenShot.Apply(); // 然后将这些纹理数据,成一个png图片文件 // byte[] bytes = screenShot.EncodeToJPG(); // System.IO.File.WriteAllBytes(imagePath, bytes); System.IO.File.WriteAllBytes(imagePath, screenShot.EncodeToJPG()); ShareContent content = new ShareContent(); content.SetImagePath(imagePath); content.SetShareType(ContentType.Image); ssdk.ShareContent(platform, content); }
public void OnShareButtonClick() { ScreenCapture.CaptureScreenshot("Screenshot.png"); ShareContent content = new ShareContent(); //公共信息设置 content.SetText(resultText.text); content.SetImagePath(Application.persistentDataPath + "/Screenshot.png"); content.SetTitle("我的share"); content.SetTitleUrl("https://github.com/LintonLiang"); content.SetSite("Lintonliang"); content.SetSiteUrl("https://github.com/LintonLiang"); content.SetUrl("https://github.com/LintonLiang"); content.SetUrlDescription("我的Github主页"); content.SetShareType(ContentType.Image); //各个平台特例的设置 //新建一个content,添加上特殊的信息,对公共信息进行补充和替换,相当于C#中的继承 ShareContent sinaContent = new ShareContent(); sinaContent.SetText(resultText.text + "\n 通过新浪微博分享"); content.SetShareContentCustomize(PlatformType.SinaWeibo, sinaContent); ssdk.ShowPlatformList(null, content, 100, 100); }
public void OnShareButtonClick() { ScreenCapture.CaptureScreenshot("Screenshot.png"); ShareContent content = new ShareContent(); content.SetText(resultText.text); content.SetImagePath(Application.persistentDataPath + "/Screenshot.png"); content.SetTitle("TestShader"); content.SetTitleUrl("http://www.baidu.com"); content.SetSite("随便"); content.SetSiteUrl("http://www.baidu.com"); content.SetUrl("http://www.baidu.com"); content.SetShareType(ContentType.Image); ShareContent SinaWeiboContent = new ShareContent(); SinaWeiboContent.SetText(resultText.text + "via 新浪微博"); content.SetShareContentCustomize(PlatformType.SinaWeibo, SinaWeiboContent); //PlatformType[] platforms = {PlatformType.SinaWeibo,}; //哪些平台不显示 string[] platforms = { "0", "2", "3", "4", "5" }; content.SetHidePlatforms(platforms); ssdk.ShowPlatformList(null, content, 100, 100); }
public static void shareImageWeChatMomentsBtnClick() { ShareContent content = new ShareContent(); content.SetImagePath(GetDefaultFilePath()); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.WeChatMoments, content); }
public void QQShare() { AddShareCallBack(); ShareContent content = new ShareContent(); content.SetImagePath(ScreenshotManager.Instance.savedPath); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.QQ, content); }
/// <summary> /// 分享图片 /// </summary> /// <param name="plat"></param> public void ShareImg(PlatformType plat) { ShareContent content = new ShareContent(); content.SetImagePath(Application.persistentDataPath + imagePath); content.SetShareType(ContentType.Image); ssdk.ShareContent(plat, content); }
public void fenxiang_WX() { ShareContent content = new ShareContent(); content.SetText("文本"); content.SetImagePath("/Snapseed/1.jpep"); content.SetTitle("标题"); content.SetShareType(ContentType.Image); shareSdk.ShareContent(PlatformType.WeChat, content); }
//微信分享宣传 public void ShareWeChatMoments(string roomId = null) { ShareContent content = new ShareContent(); content.SetImagePath(roomId); // content.SetUrl("www.qiqihaermj.youhao88.com:8081/index2.html"); content.SetShareType(ContentType.Image); shareSdk.ShareContent(PlatformType.WeChatMoments, content); }
private void ShareImage(string filePath, PlatformType type) { ShareContent content = new ShareContent(); content.SetImagePath(filePath); if (type == PlatformType.WeChatMoments || type == PlatformType.WeChat) { content.SetShareType(ContentType.Image); } m_ShareSDK.ShareContent(type, content); }
//图文分享 private void OnShareClick(GameObject go) { Application.CaptureScreenshot("CaptureScreenshot.png"); ShareContent content = new ShareContent(); content.SetText(""); content.SetTitle(""); content.SetShareType(ContentType.Image); content.SetImagePath(Application.persistentDataPath + "/CaptureScreenshot.png"); ApplicationMgr.Instance.ShareSDK.ShowPlatformList(null, content, 150, 150); }
/** * 执行分享到朋友圈的操作 */ private void shareAchievement(PlatformType platformType) { ShareContent s = new ShareContent(); s.SetText(""); s.SetImagePath(picPath); s.SetShareType(ContentType.Image); s.SetObjectID(""); s.SetShareContentCustomize(platformType, s); shareSdk.ShareContent(platformType, s); }
public void WeMomentShare() { AddShareCallBack(); ShareContent content = new ShareContent(); content.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); // content.SetTitle("AR游"); //AR游 content.SetImagePath(ScreenshotManager.Instance.savedPath); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.WeChatMoments, content); }
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; } }
public void ShareImage(Texture2D texture) { string imagePath = WriteShareImage(texture); if (!string.IsNullOrEmpty(imagePath)) { ShareContent content = new ShareContent(); content.SetImagePath(imagePath); content.SetShareType(ContentType.Image); shareSDK.ShowPlatformList(null, content, 100, 100); } }
/// <summary> /// 分享链接 /// </summary> /// <param name="roomID"></param> /// <param name="text"></param> /// <param name="titlePrefix"></param> public void ShareURL(string text, string titlePrefix, string url) { ShareContent content = new ShareContent(); content.SetTitle(titlePrefix); content.SetText(text); ToolsFunc.SetShareIcon(); content.SetImagePath(Application.persistentDataPath + "/icon.png"); content.SetUrl(url); content.SetShareType(ContentType.Webpage); ssdk.ShowPlatformList(new PlatformType[] { PlatformType.WeChat, PlatformType.WeChatMoments }, content, 100, 100); }
/// <summary> /// 分享图片 /// </summary> /// <param name="path"></param> private bool ShareImage(string path) { if (path == null) { return(false); } PlatformType[] plats = new PlatformType[4]; plats[0] = PlatformType.WeChat; plats[1] = PlatformType.WeChatMoments; plats[2] = PlatformType.QQ; plats[3] = PlatformType.SinaWeibo; ssdk.DisableSSO(false); ShareContent content = new ShareContent(); content.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); //智能交互宣传 content.SetImagePath(path); content.SetTitle("AR游"); //AR游 content.SetShareType(ContentType.Image); content.SetTitleUrl("http://download.vszapp.com"); content.SetUrl("http://download.vszapp.com"); ShareContent qqParams = new ShareContent(); qqParams.SetImagePath(path); qqParams.SetShareType(ContentType.Image); qqParams.SetShareContentCustomize(PlatformType.QQ, qqParams); ShareContent wechatParams = new ShareContent(); wechatParams.SetImagePath(path); wechatParams.SetTitle("AR游");//AR游 wechatParams.SetShareType(ContentType.Image); wechatParams.SetShareContentCustomize(PlatformType.WeChat, wechatParams); ShareContent wechatMomentParams = new ShareContent(); wechatMomentParams.SetImagePath(path); wechatMomentParams.SetTitle("AR游");//AR游 wechatMomentParams.SetShareType(ContentType.Image); wechatMomentParams.SetShareContentCustomize(PlatformType.WeChatMoments, wechatParams); ShareContent SinaShareParams = new ShareContent(); SinaShareParams.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); SinaShareParams.SetImagePath(path); SinaShareParams.SetShareType(ContentType.Image); SinaShareParams.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams); //通过分享菜单分享 ssdk.ShowPlatformList(plats, content, 100, 100); return(true); }
void ShareShotTexture() { string tempText = "我在CodingSudoku游戏的" + _SudokuManager._TitleText.text + "模式中,仅花了" + _SudokuManager._TimeText.text.Replace("\n", "") + "就结束了游戏,非常漂亮!"; ShareContent content = new ShareContent(); content.SetText(tempText); content.SetImagePath(_Path); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); }
/// <summary> /// Share a local image /// <para> /// Callback result: 0 = Begin 1 = Success 2 = Failed 3 = Cancled 4 = Begin Upload /// </para> /// </summary> public static int ShareImage(PlatformType type, string path, string text, Action <int, int> callback = null, int contentType = -1) { #if !UNITY_EDITOR if (m_shareContent == null) { m_shareContent = new ShareContent(); } var title = Util.GetString(9005, 5); var titleUrl = Util.GetString(9005, 6); m_shareContent.SetImagePath(path); if (type == PlatformType.SinaWeibo) { m_shareContent.SetText(title + titleUrl); } else if (type == PlatformType.QZone || type == PlatformType.QQ) { m_shareContent.SetTitle(title); m_shareContent.SetTitleUrl(titleUrl); m_shareContent.SetText(text); if (type == PlatformType.QZone) { #if UNITY_ANDROID m_shareContent.SetSite(""); m_shareContent.SetSiteUrl(titleUrl); #endif } } else if (type == PlatformType.WeChat || type == PlatformType.WeChatMoments) { if (contentType == -1) { contentType = ContentType.Image; } m_shareContent.SetShareType(contentType); m_shareContent.SetTitle(title); if (contentType == ContentType.Webpage) { m_shareContent.SetUrl(titleUrl); } m_shareContent.SetText(text); } m_onShare = callback; return(m_shareSDK.ShareContent(type, m_shareContent)); #endif return(0); }
private IEnumerator Capture(PlatformType type) { if (bNeedHideView) { shareview.GetComponent <CanvasGroup>().alpha = 0; } string pathSave = Application.persistentDataPath + "/" + "share.png"; if (File.Exists(pathSave)) { File.Delete(pathSave); } yield return(new WaitForEndOfFrame()); var path = ShareTools.CaptureScreenshot("share.png"); while (!File.Exists(path)) { yield return(0); } if (bNeedHideView) { shareview.GetComponent <CanvasGroup>().alpha = 1; bNeedHideView = false; } ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImagePath(Application.persistentDataPath + "/share.png"); content.SetTitle("test title"); content.SetShareType(ContentType.Image); if (type == PlatformType.QZone) { content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetTitleUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); //content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg"); } //ssdk.ShareContent(PlatformType.SinaWeibo, content); //ssdk.Authorize(type); ssdk.ShowShareContentEditor(type, content); }
/// <summary> /// 截屏分享 /// </summary> /// <param name="str"></param> /// <returns></returns> IEnumerator JiePing(PlatformType platType = PlatformType.WeChat) { yield return(new WaitForSeconds(0.2f)); CaptureScreenshot2(new Rect(0, 0, Screen.width, Screen.height), Application.persistentDataPath + imagePath); yield return(new WaitForSeconds(0.5f)); ShareContent content = new ShareContent(); content.SetImagePath(Application.persistentDataPath + imagePath); content.SetShareType(ContentType.Image); ssdk.ShareContent(platType, content); }
public void Capture(string path) { ShareContent content = new ShareContent(); content.SetText("结算"); // content.SetImageUrl("http://www.27toy.com/images/108.png"); content.SetTitle("胶己人雀友会"); content.SetUrl("http://27toy.com/"); // content.SetComment("分享结算"); content.SetShareType(ContentType.Image); //Application.CaptureScreenshot("shot4Share.png"); content.SetImagePath(path); ssdk.ShareContent(PlatformType.WeChat, content); }
/// <summary> /// 分享房间号 /// </summary> /// <param name="roomID"></param> /// <param name="titlePrefix">标题前缀</param> public void ShareRoomID(uint roomID, string text, string titlePrefix) { ShareContent content = new ShareContent(); content.SetTitle(titlePrefix + "房间号:" + roomID.ToString()); content.SetText(text); ToolsFunc.SetShareIcon(); content.SetImagePath(Application.persistentDataPath + "/icon.png"); content.SetUrl(Player.Instance.shareUrl + roomID.ToString()); content.SetShareType(ContentType.Webpage); ssdk.ShowPlatformList(new PlatformType[] { PlatformType.WeChat, PlatformType.WeChatMoments }, content, 100, 100); }
private IEnumerator savePic() { yield return(new WaitForSeconds(1f)); string pstr = GameInfo.Instance.roomId.ToString(); string path = Application.persistentDataPath + "/" + pstr + ".png"; ShareContent content = new ShareContent(); //content.SetTitle("【九尾麻将馆】"); //content.SetText("房间号:1001 ,封顶32番,自摸翻倍 密码:234423"); //content.SetComment("快来人,三缺一啦"); content.SetImagePath(path); content.SetShareType(ContentType.Image); //ssdk.ShowPlatformList(null, content, 100, 100); ssdk.ShowShareContentEditor(PlatformType.WeChat, content); }
//分享游戏给我的好友 public void ShowGameToMyFriends() { //byte[] b = icon.EncodeToPNG(); //File.WriteAllBytes(iconPath, b); ShareContent content = new ShareContent(); content.SetTitle(",玩法最全面的沈阳麻将!"); content.SetUrl("http://139.224.57.97/down/index.html"); content.SetText("起手一枝花,手气好到家!"); content.SetImagePath(Application.persistentDataPath + iconPath); content.SetShareType(ContentType.Webpage); SQDebug.Log("分享"); ssdk.ShareContent(PlatformType.WeChat, content); }
public void ShareClick() { Debug.Log("Share Click"); ScreenCapture.CaptureScreenshot(Utils.GetShareGameResultFileName()); ShareContent content = new ShareContent(); content.SetTitle(""); string url = Utils.GetShareGameResultUrl(); Debug.Log("share image url: " + url); content.SetImagePath(url); content.SetShareType(ContentType.Image); StartCoroutine(Share(content)); }
/// <summary> /// 分享截屏 /// </summary> public void ShareCapture(PlatformType[] aPlatforms = null) { ShareContent content = new ShareContent(); ScreenCapture.CaptureScreenshot("Shot4Share.png"); //设置图片路径 content.SetImagePath(Application.persistentDataPath + "/Shot4Share.png"); content.SetShareType(ContentType.Image); //ssdk.ShowShareContentEditor(PlatformType.WeChat, content); if (aPlatforms == null) { aPlatforms = new PlatformType[] { PlatformType.WeChat, PlatformType.WeChatMoments }; } GameData.ResultCodeStr = "平台数量" + aPlatforms.Length.ToString(); ssdk.ShowPlatformList(aPlatforms, content, 100, 100); }