/// <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; } }
public void ShareInTable() { #if UNITY_IPHONE ssdk = gameObject.GetComponent <ShareSDK>(); ssdk.shareHandler = ShareResultHandler; ShareContent content = new ShareContent(); content.SetText("Play Pusoy online with me! Click to join my table!"); content.SetUrl("https://www.unlipoker.com"); content.SetTitle("Unlipoker"); content.SetShareType(ContentType.Auto); ssdk.ShareContent(PlatformType.FacebookMessenger, content); #endif #if UNITY_ANDROID // Get the required Intent and UnityPlayer classes. AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // Construct the intent. AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent"); intent.Call <AndroidJavaObject>("setAction", intentClass.GetStatic <string>("ACTION_SEND")); intent.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TEXT"), "Play Pusoy online with me! Click to join my table! http://www.unlipoker.com"); intent.Call <AndroidJavaObject>("setPackage", "com.facebook.orca"); intent.Call <AndroidJavaObject>("setType", "*/*"); // Display the chooser. AndroidJavaObject currentActivity = unityPlayerClass.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaObject chooser = intentClass.CallStatic <AndroidJavaObject>("createChooser", intent, "Share"); currentActivity.Call("startActivity", chooser); #endif }
/// <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); }
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 ShareWebpage(string title, string text, string url, string imageUrl) { // ShareContent content = new ShareContent(); //content.SetText("this is a test string."); //content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); //content.SetTitle("test title"); //// content.SetTitleUrl("http://www.mob.com"); //// content.SetSite("Mob-ShareSDK"); //// content.SetSiteUrl("http://www.mob.com"); //content.SetUrl("http://qjsj.youzu.com/jycs/"); //// content.SetComment("test description"); //// content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); //content.SetShareType(ContentType.Webpage); //ssdk.ShareContent(PlatformType.WeChat, content); //string imagePath = WriteShareImage(texture); //if (!string.IsNullOrEmpty(imagePath)) //{ ShareContent content = new ShareContent(); content.SetTitle(title); content.SetText(text); content.SetUrl(url); content.SetImageUrl(imageUrl); content.SetTitleUrl(url); //content.SetImagePath(imagePath); content.SetShareType(ContentType.Webpage); shareSDK.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 ShowShareMenu() { ShareContent content = new ShareContent(); content.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); content.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png"); content.SetTitle("AR游"); content.SetShareType(ContentType.Webpage); content.SetTitleUrl("http://download.vszapp.com"); content.SetUrl("http://download.vszapp.com"); // ShareContent content = new ShareContent(); // content.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); // content.SetTitle("AR游"); // content.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png"); // content.SetUrl("http://download.vszapp.com"); // content.SetShareType(ContentType.Webpage); // ssdk.ShareContent (PlatformType.WeChatMoments, content); ShareContent SinaShareParams = new ShareContent(); SinaShareParams.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); SinaShareParams.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png"); SinaShareParams.SetShareType(ContentType.Webpage); SinaShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); }
// Use this for initialization void Start() { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg"); content.SetTitle("test title"); content.SetShareType(ContentType.Image); ssdk.shareHandler = ShareResultHandler; //Share by the menu ssdk.ShowPlatformList(null, content, 100, 100); /* * //share by the content editor * ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); * * //share directly * ssdk.ShareContent(PlatformType.SinaWeibo, content); */ ssdk.authHandler = AuthResultHandler; ssdk.Authorize(PlatformType.SinaWeibo); ssdk.showUserHandler = GetUserInfoResultHandler; ssdk.GetUserInfo(PlatformType.SinaWeibo); }
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); }
/// <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); }
private void EventInit() { UIEventListener.Get(GameUtility.FindDeepChild(gameObject, "Btn_Close").gameObject).onClick = delegate { ViewCenter.Instance.GetPanel <Panel_MessageBox>(PanelType.MessageBox).ShowMessageBox(Tags.TextPrompt.sIsLeaveRoom, "", delegate { DealCommand.Instance.SendLeaveRoom(); }, "", null); }; UIEventListener.Get(GameUtility.FindDeepChild(gameObject, "Btn_DismissRoom").gameObject).onClick = delegate { if (DataCenter.Instance.gamedata.IsFangZhu) { ViewCenter.Instance.GetPanel <Panel_MessageBox>(PanelType.MessageBox).ShowMessageBox(Tags.TextPrompt.sIsDismissRoom, "", delegate { DealCommand.Instance.SendDissolveRoom(); }, "", null); } }; UIEventListener.Get(GameUtility.FindDeepChild(gameObject, "Btn_InviteFriends").gameObject).onClick = delegate { ShareContent content = new ShareContent(); content.SetText(Tags.Title_Name + ",快来和我一起玩游戏吧!\n房间号:" + DataCenter.Instance.gamedata.RoomNum + "\n玩法:" + label_当前玩法.text); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle(Tags.Title_Name + "!房号:" + DataCenter.Instance.gamedata.RoomNum); 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.Webpage); WeiXinCenter.Instance.ShareWeChatFriend(content); }; }
void doShare(PlatformType type) { // 显示分享菜单 ShareContent content = new ShareContent(); content.SetText(Message.getText("gameTitle")); content.SetImageUrl("https://xuerong.github.io/mazeAndPacman/resource/icon.png"); content.SetTitle(Message.getText("gameTitle")); content.SetTitleUrl("https://xuerong.github.io/mazeAndPacman/"); // content.SetSite("迷宫与吃豆人"); // content.SetSiteUrl("https://xuerong.github.io/mazeAndPacman/"); content.SetUrl("https://xuerong.github.io/mazeAndPacman/"); // content.SetComment("迷宫与吃豆人"); // content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); // content.SetFilePath("https://xuerong.github.io/mazeAndPacman/resource/mi.apk"); content.SetShareType(ContentType.Webpage); //通过分享菜单分享 // ssdk.ShowPlatformList (null, content, 100, 100); //直接通过编辑界面分享 // ssdk.ShowShareContentEditor (PlatformType.WeChat, content); // // //直接分享 ssdk.ShareContent(type, content); shareWeChat1.transform.parent.gameObject.SetActive(false); }
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); }
void SetShareContent() { content.SetText(shareText); content.SetImageUrl(Mediator.GetValue("shareImageUrl").ToString() + shareImageName + ".jpg"); content.SetTitle(shareTitle); content.SetUrl(Mediator.GetValue("shareUrl").ToString()); content.SetShareType(ContentType.Image); }
public static void shareImageWeChatMomentsBtnClick() { ShareContent content = new ShareContent(); content.SetImagePath(GetDefaultFilePath()); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.WeChatMoments, 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); }
/// <summary> /// 分享图片URL /// </summary> /// <param name="text"></param> /// <param name="imageURL"></param> public void ShareImageURL(string text, string imageURL) { ShareContent content = new ShareContent(); content.SetTitle(text); content.SetImageUrl(imageURL); content.SetShareType(ContentType.Image); ssdk.ShowPlatformList(new PlatformType[] { PlatformType.WeChat, PlatformType.WeChatMoments }, content, 100, 100); }
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="path"></param> public bool ShareVideo(string path) { if (path == null) { return(false); } Debug.Log("path===" + path); ssdk.DisableSSO(false); if (ssdk.IsClientValid(PlatformType.SinaWeibo) == false) { return(false); } ShareContent content = new ShareContent(); content.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); content.SetFilePath(path); content.SetTitle("AR游"); content.SetShareType(ContentType.File); content.SetTitleUrl("http://download.vszapp.com"); content.SetUrl("http://download.vszapp.com"); #if UNITY_ANDROID String[] plats = new String[3]; plats[0] = PlatformType.QQ.ToString(); plats[1] = PlatformType.WeChat.ToString(); plats[2] = PlatformType.WeChatMoments.ToString(); content.SetHidePlatforms(plats); #elif UNITY_IOS || UNITY_IPHONE PlatformType[] plats = new PlatformType[1]; plats[0] = PlatformType.SinaWeibo; #endif ShareContent SinaShareParams = new ShareContent(); SinaShareParams.SetText("视觉美景+智能呈现 只留精彩,不留遗憾"); SinaShareParams.SetTitle("AR游"); SinaShareParams.SetShareType(ContentType.File); SinaShareParams.SetFilePath(path); SinaShareParams.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams); #if UNITY_ANDROID //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); #elif UNITY_IOS || UNITY_IPHONE //通过分享菜单分享 ssdk.ShowPlatformList(plats, content, 100, 100); #endif return(true); }
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); }
public void inviteFriend() { RoomCreateVo roomvo = GlobalDataScript.roomVo; if (GlobalDataScript.roomVo != null) { GlobalDataScript.totalTimes = roomvo.realRoundNumber(); GlobalDataScript.surplusTimes = roomvo.realRoundNumber(); string str = ""; str += "南京麻将,"; if (roomvo.paofen > 0) { str += "跑" + roomvo.realPaofen() + ","; } if (roomvo.roundtype == 0) { str += "进园子"; str += " " + roomvo.realYuanzishu() + ","; str += roomvo.realYuanziRule() + "家干,"; } else { str += "敞开头,"; str += "圈数:" + roomvo.realRoundNumber() + ","; } if (roomvo.zashu > 0) { str += "砸" + roomvo.realZaShu() + ","; } if (roomvo.zhanzhuangbi) { str += "比下胡,"; } /* * if (roomvo.guozhuangbi) { * str += "过庄比,"; * } */ str += "有胆,你就来!"; string title = "点点南京麻将 " + "房间号:" + roomvo.roomId; ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetTitle(title); customizeShareParams.SetText(str); customizeShareParams.SetUrl(APIS.ShareUrl); customizeShareParams.SetImageUrl(APIS.ImageUrl); customizeShareParams.SetShareType(ContentType.Webpage); customizeShareParams.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, customizeShareParams); } }
/** * 执行分享到朋友圈的操作 */ 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 ShareGames(PlatformType platformType) { ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("lock at me"); customizeShareParams.SetUrl(""); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID(""); customizeShareParams.SetShareContentCustomize(platformType, customizeShareParams); shareSdk.ShareContent(platformType, customizeShareParams); }
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); }
public void DoShareTestFriend() { ShareContent content = new ShareContent(); content.SetText("潮汕麻将四人玩法\n邀请胶己人一起来麻将,三缺一就等你了"); content.SetImageUrl("http://www.27toy.com/images/108.png"); content.SetTitle("胶己人雀友会"); content.SetUrl("http://27toy.com/"); content.SetShareType(ContentType.Webpage); ssdk.ShareContent(PlatformType.WeChat, 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); }
public static void shareWeChatMomentsBtnClick(string shareContent, string imageUrl, string title, string downUrl) { ShareContent content = new ShareContent(); content.SetText(shareContent); content.SetImageUrl(imageUrl); content.SetTitle(title); content.SetUrl(downUrl); content.SetShareType(ContentType.Webpage); ssdk.ShareContent(PlatformType.WeChatMoments, content); }
public void fenxiang_WX() { ShareContent content = new ShareContent(); content.SetTitle("标题"); content.SetText("内容"); content.SetImageUrl("https://www.gamersky.com/showimage/id_gamersky.shtml?http://img1.gamersky.com/image2019/07/20190725_ls_red_141_2/gamersky_042origin_083_2019725182972C.jpg"); content.SetUrl(""); content.SetShareType(ContentType.Image); shareSdk.ShareContent(PlatformType.WeChat, content); }
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); }