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); } }
public void OnShareClick(string roomId = null) { ShareContent content = new ShareContent(); string room = (roomId == null) ? "" : "房间号是:" + roomId; //这个地方要参考不同平台需要的参数 可以看ShareSDK提供的 分享内容参数表.docx content.SetTitle("西凉麻将3D"); //分享标题 content.SetText("正宗金昌甩九幺——西凉3D麻将,你也来试试吧!" + room); //分享文字 content.SetImageUrl("http://pic.dafuvip.com/templates/majiang/images/bj-big.jpg"); //分享图片 content.SetUrl("http://www.dafuv.com/wyxlmj?view=1"); //分享网址 content.SetShareType(ContentType.Webpage); //指定平台直接分享 shareSdk.ShowShareContentEditor(PlatformType.WeChat, content); }
public void shareByTypeWithoutCapture(PlatformType type) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); 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"); } ssdk.ShowShareContentEditor(type, content); }
void share() { ShareContent content = new ShareContent(); //这个地方要参考不同平台需要的参数 可以看ShareSDK提供的 分享内容参数表.docx content.SetText("快来和我一起玩这个游戏吧!"); //分享文字 content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/4.jpg"); //分享图片 content.SetTitle("标题title"); //分享标题 content.SetTitleUrl("http://www.qq.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.sina.com"); //分享网址 content.SetComment("描述"); content.SetMusicUrl("http://up.mcyt.net/md5/53/OTg1NjA5OQ_Qq4329912.mp3"); //分享类型为音乐时用 content.SetShareType(ContentType.Webpage); //shareSdk.ShowPlatformList(null, content, 100, 100); //弹出分享菜单选择列表 ssdk.ShowShareContentEditor(PlatformType.QQ, content); //指定平台直接分享 }
public void TestShareView() { ShareContent content = new ShareContent(); content.SetText("TestShareView"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetShareType(ContentType.Text); ssdk.ShowShareContentEditor(PlatformType.QQ, content); }
public void inviteFriend() { //if(GlobalDataScript.roomVo != null){ // RoomCreateVo roomvo = GlobalDataScript.roomVo; // GlobalDataScript.totalTimes = roomvo.roundNumber; // GlobalDataScript.surplusTimes = roomvo.roundNumber; string str = "快来和我一起牛起来吧!" + "房间类型:" + (GlobalDataScript.roomVo.gameType == 4 ? "德州扑克" : GlobalDataScript.roomVo.gameType == 1 ? "跑得快" : (GlobalDataScript.roomVo.ruleType == 1 ? "看牌抢庄" : GlobalDataScript.roomVo.ruleType == 3 ? "牛牛换庄" : GlobalDataScript.roomVo.ruleType == 4 ? "轮流当庄" : GlobalDataScript.roomVo.ruleType == 5 ? "房主霸王庄" : "最大牌为庄")) + "\n房间号:" + GlobalDataScript.roomVo.roomId; string title = "金牛王——绝无外挂公平公正的游戏!"; // string title; //if (roomvo.goldType) { // title ="【" + Application.productName + "】" + " 房间号:训练场"; //} else { // title ="【" + Application.productName + "】" + " 房间号:"+roomvo.roomId; //} ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetTitle(title); customizeShareParams.SetText(str); //配置下载地址 customizeShareParams.SetUrl("https://dafuvip.com/bY73q2"); //配置分享logo // customizeShareParams.SetImageUrl(APIS.baseUrl + "/download/logo.png"); customizeShareParams.SetShareType(ContentType.Webpage); //ContentType.Webpage //customizeShareParams.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, customizeShareParams); //} }
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 inviteFriend() { RoomVO rvo = GlobalData.getInstance().roomVO; if (rvo != null) { string title = "铁脚麻将 " + "房间号:" + rvo.roomId; ShareContent s = new ShareContent(); s.SetTitle(title); s.SetText(GameHelper.getHelper().getInviteRuleStr(rvo)); s.SetUrl(Constants.Download_URL); s.SetImageUrl(Constants.ImgUrl + "icon96.png"); s.SetShareType(ContentType.Webpage); s.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, s); } }
private IEnumerator JiepingTime(float a) { yield return(new WaitForSeconds(a)); string imagePath = Application.persistentDataPath; imagePath = imagePath + "/Screenshot.png"; ShareContent content = new ShareContent(); //content.SetText("大家好..."); content.SetImagePath(imagePath); //content.SetTitle("什么鬼"); //content.SetComment("分享一张照片"); //content.SetShareType(ContentType.Image); ssdk.ShowPlatformList(null, content, 100, 100); ssdk.ShowShareContentEditor(PlatformType.WeChat, content); }
void InvertPresss() { ShareContent content = new ShareContent(); //content.SetTitle("【开心麻将馆】"); string roomiD = GameInfo.Instance.roomId.ToString(); string pw = "无密码"; if (GameInfo.Instance.roomPassWord > 0) { pw = GameInfo.Instance.roomPassWord.ToString(); } string maxPoint = GameInfo.Instance.maxPoint.ToString(); string maxRound = GameInfo.Instance.maxRound.ToString(); string zjDouble = ""; if (GameInfo.Instance.isZjDouble == 1) { zjDouble = "庄翻倍"; } string isQiangGang = ""; if (GameInfo.Instance.canQiangGang == 1) { isQiangGang = "可抢杠"; } string isDaiGen = ""; if (GameInfo.Instance.isDaiGen == 1) { isDaiGen = "带根"; } string isZimoHu = ""; if (GameInfo.Instance.isZiMoHu == 1) { isZimoHu = "自摸胡"; } content.SetText("【房号:" + roomiD + " 密码:" + pw + "】" + maxRound + "局," + maxPoint + "封顶," + zjDouble + "," + isQiangGang + "," + isDaiGen + "," + isZimoHu + "■■■四川大众麻将■■■"); //content.SetComment("快来人,三缺一啦"); content.SetShareType(ContentType.Text); //ssdk.ShowPlatformList(null, content, 100, 100); ssdk.ShowShareContentEditor(PlatformType.WeChat, content); }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } //float btnWidth = 165 * scale; float btnWidth = Screen.width / 5 * 2; float btnHeight = Screen.height / 25; float btnTop = 30 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(13 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.Douyin); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.Douyin); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); // //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台) // //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了) String[] platfsList = { ((int)PlatformType.QQ).ToString(), ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() }; content.SetHidePlatforms(platfsList); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); //(Android only) 针对Android绕过审核的多图分享,传图片String数组 String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" }; content.SetImageArray(imageArray); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl( "http://i.y.qq.com/v8/playsong.html?hostuin=0&songid=&songmid=002x5Jje3eUkXT&_wv=1&source=qq&appshare=iphone&media_mid=002x5Jje3eUkXT"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl( "http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 content.SetEnableClientShare(true); //使用微博API接口应用内分享 iOS only content.SetEnableSinaWeiboAPIShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { 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://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content")) { 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.Image); ssdk.ShareContent(PlatformType.QQ, content); // // 开发者要自己传入Activity 在9.0及其以上的系统 // // AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // // AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); // // content.SetActivity(jo); // // Debug.Log("QQQ 测试传入的activity ==================>>> " + jo); // ShareContent content = new ShareContent(); // content.SetFilePath("/storage/emulated/0/douyin.mp4"); // content.SetShareType(ContentType.Video); // ssdk.ShareContent (PlatformType.Douyin, content); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); // ssdk.GetFriendList (PlatformType.SinaWeibo, 15, 0); ssdk.openMiniProgram("gh_afb25ac019c9", "pages/index/index", 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnWidth += 80 * scale; btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SMS Authorize")) { ssdk.Authorize(PlatformType.SMS); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share wxMiniProgram (ios only)")) { ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramPath("pages/index/index"); content.SetThumbImageUrl( "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg"); content.SetMiniProgramHdThumbImage( "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg"); content.SetMiniProgramUserName("gh_afb25ac019c9"); content.SetMiniProgramWithShareTicket(true); content.SetMiniProgramType(0); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Sina LinkCard")) { #if UNITY_IPHONE ShareContent content = new ShareContent(); content.SetText("sina LinkCard"); content.SetUrl("http://www.mob.com"); content.SetImageUrl("http://www.mob.com/assets/images/ShareSDK_pic_1-09d293a6.png");//必须为网络图片 content.SetSinaLinkCard(true); content.SetSinaCardTitle("这是Title"); content.SetSinaCardSummary("这是Summary"); content.SetShareType(ContentType.Webpage); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); #elif UNITY_ANDROID JsonData jsonData = new JsonData(); jsonData["url"] = "http://wx4.sinaimg.cn/large/006WfoFPly1fq0jo9svnaj30dw0dwdhv.jpg"; jsonData["width"] = "120"; jsonData["height"] = "120"; ShareContent content = new ShareContent(); content.SetText("sina LinkCard"); content.SetSinaCardCreateAtAndroid("2019-01-24"); content.SetSinaCardDisplayNameAndroid("displayName"); content.SetSinaCardSummary("Summary"); content.SetSinaCardURLAndroid("http://www.mob.com/"); content.SetSinaCardTypeAndroid("webpage"); content.SetSinaCardImageAndroid(jsonData); content.SetEnableClientShare(true); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); #endif } }
public void inviteFriend() { if (GlobalDataScript.roomVo != null) { RoomCreateVo roomvo = GlobalDataScript.roomVo; GlobalDataScript.totalTimes = roomvo.roundNumber; GlobalDataScript.surplusTimes = roomvo.roundNumber; string str = ""; if (roomvo.gameType == 0) { str += "【小麻将 大战场】"; } else if (roomvo.gameType == 1) { } else if (roomvo.gameType == 3) { str += "【累了困了就牛牛】"; } else if (roomvo.gameType == 4) { str += "【德州扑克】"; } if (roomvo.hong) { str += "红中麻将,"; } else { if (roomvo.roomType == 1) { str += "转转麻将,"; } else if (roomvo.roomType == 2) { str += "划水麻将,"; } else if (roomvo.roomType == 3) { str += "长沙麻将,"; } else if (roomvo.roomType == 4) { str += "广东麻将,"; } else if (roomvo.roomType == 5) { str += "赣州冲关,"; } else if (roomvo.roomType == 6) { str += "瑞金麻将,"; } else if (roomvo.gameType == 1) { str += "跑得快,"; } else if (roomvo.gameType == 3) { str += "欢乐斗牛,"; } else if (roomvo.gameType == 10) { str += "潮汕麻将,"; } } if (roomvo.gameType == 0) { str += "一缺三,"; } else if (roomvo.gameType == 1) { str += "一缺二,"; } else if (roomvo.gameType == 3) { str += "一缺四,"; } else if (roomvo.gameType == 4) { str += "一缺五,"; } if (!roomvo.goldType) { str += roomvo.roundNumber + "局,"; } if (roomvo.roomType == 5) { if (roomvo.shangxiaFanType == 1) { str += "上下翻埋地雷,"; } else { str += "上下左右翻精,"; } if (roomvo.diFen == 1) { str += "底分1分,"; } else { str += "底分2分,"; } if (roomvo.tongZhuang) { str += "通庄,"; } else { str += "分庄闲,"; } if (roomvo.pingHu == 1) { str += "可平胡,"; } else if (roomvo.pingHu == 2) { str += "有精点炮不能平胡,"; } else { str += "只可精钓,"; } } else if (roomvo.roomType == 6) { if (roomvo.keDianPao) { str += "可点炮胡,"; } if (roomvo.diFen == 1) { str += "底分1分,"; } else if (roomvo.diFen == 2) { str += "底分2分,"; } else { str += "底分5分,"; } if (roomvo.tongZhuang) { str += "通庄,"; } else { str += "分庄闲,"; } if (roomvo.lunZhuang) { str += "轮庄,"; } else { str += "霸王庄,"; } } else if (roomvo.roomType == 10) { if (roomvo.gangHu) { str += "可接炮胡,"; } if (roomvo.genZhuang) { str += "跟庄,"; } if (roomvo.pengpengHu) { str += "碰碰胡2倍,"; } if (roomvo.qiDui) { str += "七对2倍,"; } if (roomvo.qiangGangHu) { str += "抢杠胡2倍,"; } if (roomvo.hunYiSe) { str += "混一色2倍,"; } if (roomvo.qingYiSe) { str += "清一色2倍,"; } if (roomvo.gangShangKaiHua) { str += "杠上开花2倍,"; } if (roomvo.haoHuaQiDui) { str += "豪华7对4倍,"; } if (roomvo.shiSanYao) { str += "十三幺10倍,"; } if (roomvo.tianDiHu) { str += "天地胡10倍,"; } if (roomvo.shuangHaoHua) { str += "双豪华6倍,"; } if (roomvo.sanHaoHua) { str += "三豪华8倍,"; } if (roomvo.shiBaLuoHan) { str += "十八罗汉10倍,"; } if (roomvo.xiaoSanYuan) { str += "小三元4倍,"; } if (roomvo.xiaoSanYuan) { str += "小四喜4倍,"; } if (roomvo.daSanYuan) { str += "大三元6倍,"; } if (roomvo.daSiXi) { str += "大四喜6倍,"; } if (roomvo.huaYaoJiu) { str += "花幺九6倍,"; } if (roomvo.fengDing == 5) { str += "封顶5倍,"; } else if (roomvo.fengDing == 10) { str += "封顶10倍,"; } else { str += "不封顶,"; } if (roomvo.gui == 0) { str += "无鬼,"; } else if (roomvo.gui == 1) { str += "白板做鬼,"; } else if (roomvo.gui == 2) { str += "翻鬼,"; } else if (roomvo.gui == 3) { str += "翻鬼(双鬼),"; } if (roomvo.wuGuiX2) { str += "无鬼加翻,"; } if (roomvo.ma > 0) { str += "抓码数" + roomvo.ma + "个,"; if (roomvo.maGenDifen) { str += "马跟底分,"; } if (roomvo.maGenGang) { str += "马跟杠,"; } } if (roomvo.jiejiegao) { str += "节节高,"; } } else if (roomvo.gameType == 1) { if (GlobalDataScript.roomVo.zhang16) { str += "每人16张,"; } else { str += "每人15张,"; } if (GlobalDataScript.roomVo.showPai) { str += "显示牌,"; } else { str += "不显示牌,"; } if (GlobalDataScript.roomVo.xian3) { str += "首轮先出黑桃3,"; } } else if (roomvo.gameType == 3) { if (!roomvo.goldType) { str += roomvo.AA ? "AA制," : "房主付费,"; } str += roomvo.qiang ? "抢庄," : "轮庄,"; str += "底分" + roomvo.diFen + "分,"; } else if (roomvo.gameType == 4) { str += "初始分:" + roomvo.initFen_dzpk; } else { if (roomvo.roomType == 4) { if (roomvo.gangHu) { str += "可抢杠胡,"; } } else { if (roomvo.ziMo == 1) { str += "只能自摸,"; } else { str += "可抢杠胡,"; } } if (roomvo.sevenDouble) { str += "可胡七对,"; } if (roomvo.addWordCard) { str += "有风牌,"; } else { str += "无风牌,"; } if (roomvo.gui == 0) { str += "无鬼,"; } else if (roomvo.gui == 1) { str += "白板做鬼,"; } else if (roomvo.gui == 2) { str += "翻鬼,"; } else if (roomvo.gui == 3) { str += "翻鬼,双鬼,"; } if (roomvo.gangHuQuanBao) { str += "杠爆全包,"; } if (roomvo.wuGuiX2) { str += "无鬼加翻,"; } if (roomvo.xiaYu > 0) { str += "下鱼" + roomvo.xiaYu + "条,"; } if (roomvo.ma > 0) { str += "抓" + roomvo.ma + "个码,"; if (roomvo.maGenDifen) { str += "马跟底分,"; } if (roomvo.maGenGang) { str += "马跟杠,"; } } if (roomvo.magnification > 0) { str += "倍率" + roomvo.magnification; } } if (roomvo.gameType == 0) { str += "兵贵神速,痛快大战300局!"; } else if (roomvo.gameType == 1) { str += "有胆,你就来!"; } else if (roomvo.gameType == 3) { str += "决战千里,牛气冲天!"; } else if (roomvo.gameType == 4) { str += "有胆,你就来!"; } string title; if (roomvo.goldType) { title = "【" + Application.productName + "】" + " 房间号:训练场"; } else { title = "【" + Application.productName + "】" + " 房间号:" + roomvo.roomId; } ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetTitle(title); customizeShareParams.SetText(str); //配置下载地址 customizeShareParams.SetUrl(APIS.baseUrl + "/download/index.html"); //配置分享logo customizeShareParams.SetImageUrl(APIS.baseUrl + "/download/logo.png"); customizeShareParams.SetShareType(ContentType.Webpage); //ContentType.Webpage customizeShareParams.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, customizeShareParams); } }
public void inviteFriend() { if (GlobalDataScript.roomVo != null) { RoomCreateVo roomvo = GlobalDataScript.roomVo; GlobalDataScript.totalTimes = roomvo.roundNumber; GlobalDataScript.surplusTimes = roomvo.roundNumber; string str = ""; if (roomvo.hong) { str += "红中麻将,"; } else { if (roomvo.roomType == 1) { str += "转转麻将,"; } else if (roomvo.roomType == 2) { str += "划水麻将,"; } else if (roomvo.roomType == 3) { str += "长沙麻将,"; } } str += "大战" + roomvo.roundNumber + "局,"; if (roomvo.ziMo == 1) { str += "只能自摸,"; } else { str += "可抢杠胡,"; } if (roomvo.addWordCard) { str += "有风牌,"; } if (roomvo.xiaYu > 0) { str += "下鱼" + roomvo.xiaYu + "条,"; } if (roomvo.ma > 0) { str += "抓" + roomvo.ma + "个码,"; } if (roomvo.magnification > 0) { str += "倍率" + roomvo.magnification; } str += "有胆,你就来!"; string title = "微牌 " + "房间号:" + roomvo.roomId; ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetTitle(title); customizeShareParams.SetText(str); customizeShareParams.SetUrl("http://www.weipaigame.com/downLoad/index.html"); customizeShareParams.SetImageUrl(APIS.ImgUrl + "icon96.png"); customizeShareParams.SetShareType(ContentType.Webpage); customizeShareParams.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, customizeShareParams); } }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } float btnWidth = 200 * scale; float btnHeight = 45 * scale; float btnTop = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(16 * scale); if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu")) { 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.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Image); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); ssdk.ShowPlatformList(null, content, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View")) { 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.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.TencentWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Content")) { 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.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } //float btnWidth = 165 * scale; float btnWidth = Screen.width / 5 * 2; float btnWidth2 = btnWidth + 80 * scale; float btnHeight = Screen.height / 25; float btnTop = 30 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(13 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); #if UNITY_ANDROID ssdk.Authorize(PlatformType.SinaWeibo); #elif UNITY_IPHONE ssdk.Authorize(PlatformType.Facebook); #endif } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { //ssdk.GetUserInfo(PlatformType.Douyin); print("share result :" + ssdk.GetUserInfo(PlatformType.QQ)); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); // //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台) // //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了) String[] platfsList = { ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() }; content.SetHidePlatforms(platfsList); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); //(Android only) 针对Android绕过审核的多图分享,传图片String数组 String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" }; content.SetImageArray(imageArray); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://i.y.qq.com/v8/playsong.html?hostuin=0&songid=&songmid=002x5Jje3eUkXT&_wv=1&source=qq&appshare=iphone&media_mid=002x5Jje3eUkXT"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 content.SetEnableClientShare(true); //使用微博API接口应用内分享 iOS only content.SetEnableSinaWeiboAPIShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { 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://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Content")) { 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.Image); ssdk.ShareContent(PlatformType.Oasis, content); // // 开发者要自己传入Activity 在9.0及其以上的系统 // // AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // // AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); // // content.SetActivity(jo); // // Debug.Log("QQQ 测试传入的activity ==================>>> " + jo); // ShareContent content = new ShareContent(); // content.SetFilePath("/storage/emulated/0/douyin.mp4"); // content.SetShareType(ContentType.Video); // ssdk.ShareContent (PlatformType.Douyin, content); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) //{ //获取新浪微博好友,第一页,每页15条数据 //print ("Click Btn Of Get Friends SinaWeibo"); // ssdk.GetFriendList (PlatformType.SinaWeibo, 15, 0); //ssdk.openMiniProgram("gh_afb25ac019c9","pages/index/index",0); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Get Token ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.QQ); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap , btnTop, btnWidth, btnHeight), "Close SSO Auth")) //{ //ssdk.DisableSSO (true); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.QQ); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) //{ //关注新浪微博 //ssdk.AddFriend (PlatformType.SinaWeibo, "3189087725"); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShareWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareMenuWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareViewWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "SMS Authorize")) { ssdk.Authorize(PlatformType.SMS); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "submitPolicyGrantResult")) { Debug.Log("ssdk ======> " + ssdk); Debug.Log("mobsdk ======> " + mobsdk); mobsdk.submitPolicyGrantResult(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "getPrivacyPolicy")) { Debug.Log("ssdk ======> " + ssdk); Debug.Log("mobsdk ======> " + mobsdk); #if UNITY_IPHONE mobsdk.getPrivacyPolicy(true); #elif UNITY_ANDROID mobsdk.getPrivacyPolicy(true); Debug.Log("mobsdk getPrivacyPolicy======> " + mobsdk.getPrivacyPolicy(true)); #endif } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share wxMiniProgram")) { #if UNITY_IPHONE ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramPath("pages/index/index"); content.SetThumbImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg"); content.SetMiniProgramHdThumbImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg"); content.SetMiniProgramUserName("gh_afb25ac019c9"); content.SetMiniProgramWithShareTicket(true); // iOS/Android 微信小程序的版本(0-正式,1-开发,2-体验) content.SetMiniProgramType(0); //content.SetShareType (ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); #elif UNITY_ANDROID ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramType(0); content.SetMiniProgramUserName("gh_52568203455c"); content.SetImageUrl("http://pic28.photophoto.cn/20130818/0020033143720852_b.jpg"); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); #endif } // if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Share qqMiniProgram(IOS only)")) { #if UNITY_IPHONE ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetThumbImageUrl("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png"); content.SetMiniProgramPath("pages/index/index"); content.SetMiniProgramHdThumbImage("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png"); content.SetMiniProgramAppID("1108318575"); content.SetMiniProgramWebpageUrl("www.qq.com"); //iOS/Android QQ小程序的类型,默认正式版(3),可选测试版(1)、预览版(4) content.SetMiniProgramType(3); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.QQ, content); ssdk.ShareContent(PlatformType.QQ, shareContent); #elif UNITY_ANDROID //=============================================================== //when you test QQ miniprogram, you should use this params //At the same time, the package name and signature should //correspond to the package name signature of the specific //QQ sharing small program applied in the background of tencent //=============================================================== //ShareContent content = new ShareContent(); //content.SetTitle("MiniProgram"); //content.SetText("test MiniProgram"); //content.SetTitleUrl("http://www.mob.com"); //content.SetImageUrl("http://www.3wyu.com/wp-content/uploads/6e0eaf15gy1fvr5tnm2dfj20f108gtad.jpg");//必须为网络图片 //content.SetShareType(ContentType.QQ_MINI_PROGRAM); //content.SetMiniProgramAppID("1108318575"); //content.SetMiniProgramPath("page/share/index.html?share_name=QQ%E9%9F%B3%E4%B9%90&share_key=5aIqFGg&from=disk"); //content.SetQQMiniProgramType(""); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.QQ, content); //ssdk.ShareContent(PlatformType.QQ, shareContent); #endif } //btnTop += btnHeight + 20 * scale; //if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Sina LinkCard")) //{ //#if UNITY_IPHONE //ShareContent content = new ShareContent(); //content.SetText("sina LinkCard"); //content.SetUrl("http://www.mob.com"); //content.SetImageUrl("http://www.mob.com/assets/images/ShareSDK_pic_1-09d293a6.png");//必须为网络图片 //content.SetSinaLinkCard(true); //content.SetSinaCardTitle("这是Title"); //content.SetSinaCardSummary("这是Summary"); //content.SetShareType(ContentType.Webpage); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); //#elif UNITY_ANDROID //JsonData jsonData = new JsonData(); //jsonData["url"] = "http://wx4.sinaimg.cn/large/006WfoFPly1fq0jo9svnaj30dw0dwdhv.jpg"; //jsonData["width"] = "120"; //jsonData["height"] = "120"; //ShareContent content = new ShareContent(); //content.SetText("sina LinkCard"); //content.SetSinaCardCreateAtAndroid("2019-01-24"); //content.SetSinaCardDisplayNameAndroid("displayName"); //content.SetSinaCardSummary("Summary"); //content.SetSinaCardURLAndroid("http://www.mob.com/"); //content.SetSinaCardTypeAndroid("webpage"); //content.SetSinaCardImageAndroid(jsonData); //content.SetEnableClientShare(true); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); //#endif //} }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } //float btnWidth = 165 * scale; float btnWidth = Screen.width / 5 * 2; float btnHeight = Screen.height / 25; float btnTop = 30 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(13 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.QQ); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.QQ); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台) //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了) String[] platfsList = { ((int)PlatformType.QQ).ToString(), ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() }; content.SetHidePlatforms(platfsList); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); //(Android only) 针对Android绕过审核的多图分享,传图片String数组 String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" }; content.SetImageArray(imageArray); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 // content.SetEnableClientShare(true); //使用微博API接口应用内分享 iOS only // content.SetEnableSinaWeiboAPIShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { 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://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content")) { 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); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnWidth += 80 * scale; btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SMS Authorize")) { ssdk.Authorize(PlatformType.SMS); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share wxMiniProgram (ios only)")) { ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramPath("pages/index/index"); content.SetThumbImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg"); content.SetMiniProgramHdThumbImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg"); content.SetMiniProgramUserName("gh_afb25ac019c9"); content.SetMiniProgramWithShareTicket(true); content.SetMiniProgramType(0); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); } }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } float btnWidth = 165 * scale; float btnHeight = 30 * scale; float btnTop = 20 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(14 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.QQ); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { 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://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 // content.SetEnableClientShare(true); //使用微博高级接口进行本地图片 文字 应用内分享 17年6月30日后需申请高级接口 // content.SetEnableAdvancedInterfaceShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { 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://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content")) { 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); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnWidth += 80 * scale; btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } }
public void ShareWeChatMoments(ShareContent content) { #if UNITY_ANDROID || UNITY_IPHONE ssdk.ShowShareContentEditor(PlatformType.WeChatMoments, content); #endif }