public void OnButtonClick() { Debug.Log("测试1"); Hashtable content = new Hashtable(); Debug.Log("imagePath = " +imagePath); if (System.IO.File.Exists(imagePath)) { content["image"] = imagePath; Debug.Log("存在"); } Debug.Log("不存在"); content["content"] = "我正在玩城市跑酷游戏,非常好玩,一起来玩吧!"; content["title"] = "城市跑酷"; content["url"] = "http://weibo.com/u/5338688253/home?wvr=5"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://weibo.com/u/5338688253/home?wvr=5"; content["site"] = ""; Debug.Log("测试3"); ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); Debug.Log("测试5"); ShareSDK.showShareMenu(content, 100, 100, MenuArrowDirection.Up, evt); Debug.Log("测试4"); }
/// <summary> /// OGUI share to the specified platform. /// </summary> /// <param name="platform">Platform.</param> /// <param name="content">Content.</param> /// <param name="resultHandler">Result handler.</param> public void onekeyShare(int platform, Hashtable content, ShareResultEvent resultHandler) { shareHandler = resultHandler; String json = MiniJSON.jsonEncode(content); ssdk.CallStatic("onekeyShare", platform, json); }
public static void Share(PlatformType platform, string title, string text, string image, ContentType type, ShareResultEvent evt) { Hashtable hashtable = new Hashtable(); hashtable["title"] = ((platform != PlatformType.WeChatTimeline) ? title : text); hashtable["content"] = ((type != ContentType.News) ? (text + ShareSDK.ShareConfig.url) : text); hashtable["image"] = ((type != ContentType.Image) ? ((type != ContentType.News) ? string.Empty : ShareSDK.IconPath) : image); hashtable["url"] = ((type != ContentType.News) ? string.Empty : ShareSDK.ShareConfig.url); hashtable["type"] = Convert.ToString((int)type); ShareUtils.shareContent(platform, hashtable, evt); }
/// <summary> /// Shares the content. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='resultHandler'> /// Callback. /// </param> public static void shareContent(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string contentStr = null; if (content != null) { contentStr = MiniJSON.jsonEncode(content); } __iosShareSDKShare((int)type, contentStr, _callbackObjectName); }
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 = 10 * scale; GUI.skin.button.fontSize = Convert.ToInt32(16 * scale); btnTop += btnHeight + 10 * scale; btnTop += btnHeight + 10 * scale; if (quanju.share == 0) { Hashtable content = new Hashtable(); content["content"] = "We are playing LOR,a mobilegame for android,Fighting with me!"; content["image"] = Application.persistentDataPath + "/Screenshot.png"; // string path = "file://"+Application.dataPath+"/Plugins/"+"IOS/dreamp.png"; // content["image"] = path; content["title"] = "Form LOR mobilephone"; content["description"] = "test description"; content["url"] = "http://xbwcc.com.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://xbwcc.com.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; //开启,调用客户端授权 (only in android) content["disableSSOWhenAuthorize"] = false; content["shareTheme"] = "classic";//ShareTheme has only two value which are skyblue and classic ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu(null, content, 100, 100, MenuArrowDirection.Any, evt); quanju.share = 1; } }
/// <summary> /// Shows the share menu. /// </summary> /// <param name='types'> /// Types. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='x'> /// X. /// </param> /// <param name='y'> /// Y. /// </param> /// <param name='direction'> /// Direction. /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareMenu(PlatformType[] types, Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string platTypesStr = null; if (types != null) { List <int> platTypesArr = new List <int>(); foreach (PlatformType type in types) { platTypesArr.Add((int)type); } platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKShowShareMenu(platTypesStr, MiniJSON.jsonEncode(content), x, y, (int)direction, _callbackObjectName); }
void OnClick(dfControl control, dfMouseEventArgs args) { Hashtable content = new Hashtable(); content["content"] = "我正在玩2048,非常好玩,我的最高得分为:"+PlayerPrefs.GetFloat("highScore",0)+ ", 下载地址为:https://github.com/AhrenLi/2048"; string imageName = Time.time +".jpg"; Application.CaptureScreenshot(imageName); content["image"] = Application.persistentDataPath + "/" + imageName; ; content["title"] = "豪华版2048"; content["description"] = "我正在玩2048,非常好玩,我的最高得分为:" + PlayerPrefs.GetFloat("highScore", 0) + ", 下载地址为:https://github.com/AhrenLi/2048"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu(null, content, 100, 100, MenuArrowDirection.Up, evt); }
/// <summary> /// share content to multiple platform /// </summary> /// <param name='types'> /// Types. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='resultHandler'> /// Callback. /// </param> public static void oneKeyShareContent(PlatformType[] types, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string platTypesStr = null; if (types != null) { List <int> platTypesArr = new List <int>(); foreach (PlatformType type in types) { platTypesArr.Add((int)type); } platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKOneKeyShare(platTypesStr, MiniJSON.jsonEncode(content), _callbackObjectName); }
public void ShareToPlatform(PlatformType platform) { Hashtable content = new Hashtable(); if(Application.systemLanguage==SystemLanguage.Chinese){ content["content"] = "<莉莉灰姑娘3D-梦幻公主换装> 让小朋友们爱不释手的全新3D公主换装游戏"; content["title"] = "《莉莉灰姑娘3D》"; content["description"] = "<莉莉灰姑娘3D-梦幻公主换装> 让小朋友们爱不释手的全新3D公主换装游戏"; } else{ content["content"] = "<Lily Cinderella 3D- Dreamy Princess Dressing> delicate&dreamy pictures, warm colors are kids’ favorite"; content["title"] = "Lily Cinderella 3D- Dreamy Princess Dressing"; content["description"] = "<Lily Cinderella 3D- Dreamy Princess Dressing> delicate&dreamy pictures, warm colors are kids’ favorite"; } content["image"] = "https://is2-ssl.mzstatic.com/image/thumb/Purple5/v4/8b/fb/4a/8bfb4a26-f996-b455-dc79-2b6035b7fd88/pr_source.jpg/1024x1024ss-80.png"; content["url"] = "http://zyg-share.zhuoyouapp.com/share?id=987077808"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://zyg-share.zhuoyouapp.com/share?id=987077808"; content["site"] = "ShareSDK"; // content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.shareContent (platform, content, evt); }
public static void shareContent(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { ShareSDK._shareResultEvent = resultHandler; string content2 = MiniJSON.jsonEncode(content); ShareSDK.__iosShareSDKShare((int)type, content2, ShareSDK._callbackObjectName); }
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 = 10 * scale; GUI.skin.button.fontSize = Convert.ToInt32(16 * scale); if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Authorize")) { AuthResultEvent evt = new AuthResultEvent(AuthResultHandler); ShareSDK.authorize(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info")) { GetUserInfoResultEvent evt = new GetUserInfoResultEvent(GetUserInfoResultHandler); ShareSDK.getUserInfo(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; // string path = "file://"+Application.dataPath+"/Plugins/"+"IOS/dream.jpg"; // content["image"] = path; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://www.mob.com"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://www.mob.com"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; //开启,调用客户端授权 (only in android) content["disableSSOWhenAuthorize"] = false; content["shareTheme"] = "classic";//ShareTheme has only two value which are skyblue and classic ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu (null, content, 100, 100, MenuArrowDirection.Up, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://www.mob.com"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://www.mob.com"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; //关闭,调用客户端授权(only in android) content["disableSSOWhenAuthorize"] = true; content["shareTheme"] = "skyblue";//ShareTheme has only two value which are skyblue and classic ShareSDK.customSinaWeiboShareContent(content, "sina weibo test string", InheritedValue.VALUE, null); ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareView (PlatformType.Any, content, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Content")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://www.mob.com"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://www.mob.com"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.shareContent (PlatformType.SinaWeibo, content, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { GetFriendsResultEvent evt = new GetFriendsResultEvent(GetFriendsResultHandler); ShareSDK.getFriends (PlatformType.SinaWeibo, null, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { GetCredentialResultEvent evt = new GetCredentialResultEvent(GetTokenResultHandler); ShareSDK.getCredential (PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 10 * scale; if (GUI.Button (new Rect ((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Check Client Is Installed")) { //(only in IOS) bool IsClientInstalledWechat = ShareSDK.isClientInstalled (PlatformType.WeChatSession); bool IsClientInstalledQQ = ShareSDK.isClientInstalled (PlatformType.QQ); if(IsClientInstalledWechat == true){ print ("wechat IS installed !"); }else if (IsClientInstalledWechat == false){ print ("wechat NOT installed !"); } if(IsClientInstalledQQ == true){ print ("QQ IS installed !"); }else if (IsClientInstalledQQ == false){ print ("QQ NOT installed !"); } } }
public static void showShareMenu(PlatformType[] types, Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler) { if (Application.platform != RuntimePlatform.IPhonePlayer) { if (Application.platform == RuntimePlatform.Android) { AndroidUtils.getInstance().onekeyShare(content, resultHandler); } } }
/// <summary> /// Shows the share view. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareView(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; __iosShareSDKShowShareView ((int)type, MiniJSON.jsonEncode(content), _callbackObjectName); }
/// <summary> /// Shares the content. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='resultHandler'> /// Callback. /// </param> public static void shareContent(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string contentStr = null; if (content != null) { contentStr = MiniJSON.jsonEncode(content); } __iosShareSDKShare ((int)type, contentStr, _callbackObjectName); }
/// <summary> /// Shares the content. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='resultHandler'> /// Callback. /// </param> public static void shareContent(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { if (Application.platform == RuntimePlatform.IPhonePlayer) { #if UNITY_IPHONE ios.ShareSDK.shareContent (type, content, resultHandler); #endif } else if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID AndroidUtils.getInstance().share((int) type, content, resultHandler); #endif } }
/// <summary> /// Share the content to the specified platform. /// </summary> /// <param name="platform">Platform.</param> /// <param name="content">Content.</param> /// <param name="resultHandler">Result handler.</param> public void share(int platform, Hashtable content, ShareResultEvent resultHandler) { shareHandler = resultHandler; String json = MiniJSON.jsonEncode(content); ssdk.CallStatic("share", platform, json); }
/// <summary> /// GUI share. /// </summary> /// <param name="content">Content.</param> /// <param name="resultHandler">Result handler.</param> public void onekeyShare(Hashtable content, ShareResultEvent resultHandler) { onekeyShare(0, content, resultHandler); }
private void OnShareBtnClick(GameObject go) { if (GameUISharePopUp.isSharing) { return; } int num = Convert.ToInt32(go.name); this.SendShareLog(num); Globals.Instance.EffectSoundMgr.Play("ui/ui_001"); if (!string.IsNullOrEmpty(this.imagePath) && !File.Exists(this.imagePath)) { return; } ContentType type = ContentType.Text; PlatformType platformType = (PlatformType)num; if (platformType != PlatformType.WeChatSession) { if (platformType != PlatformType.WeChatTimeline) { if (platformType == PlatformType.SinaWeibo) { type = (string.IsNullOrEmpty(this.imagePath) ? ContentType.Text : ContentType.Image); goto IL_C2; } if (platformType != PlatformType.YiXinTimeline) { goto IL_C2; } } type = (string.IsNullOrEmpty(this.imagePath) ? ContentType.News : ContentType.Image); } else { type = ContentType.News; } IL_C2: string @string = Singleton<StringManager>.Instance.GetString("shareTxt6", new object[] { GameSetting.Data.ServerName, GameSetting.ServerID }); ShareResultEvent evt = new ShareResultEvent(this.ShareResultHandler); ShareSDK.Share((PlatformType)num, @string, this.contentTxt, this.imagePath, type, evt); GameUISharePopUp.isSharing = true; this.flagShare = true; this.flagShareInitTime = Time.time; }
public static void oneKeyShareContent(PlatformType[] types, Hashtable content, ShareResultEvent resultHandler) { ShareSDK._shareResultEvent = resultHandler; List<PlatformType> json = new List<PlatformType>(types); string platTypes = MiniJSON.jsonEncode(json); string content2 = MiniJSON.jsonEncode(content); ShareSDK.__iosShareSDKOneKeyShare(platTypes, content2, ShareSDK._callbackObjectName); }
public static void showShareMenu(PlatformType[] types, Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler) { ShareSDK._shareResultEvent = resultHandler; List<PlatformType> json = new List<PlatformType>(types); string platTypes = MiniJSON.jsonEncode(json); string content2 = MiniJSON.jsonEncode(content); ShareSDK.__iosShareSDKShowShareMenu(platTypes, content2, x, y, (int)direction, ShareSDK._callbackObjectName); }
/// <summary> /// Shows the share view. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareView(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; __iosShareSDKShowShareView((int)type, MiniJSON.jsonEncode(content), _callbackObjectName); }
/// <summary> /// share content to multiple platform /// </summary> /// <param name='types'> /// Types. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='resultHandler'> /// Callback. /// </param> public static void oneKeyShareContent(PlatformType[] types, Hashtable content, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string platTypesStr = null; if (types != null) { List<int> platTypesArr = new List<int>(); foreach (PlatformType type in types) { platTypesArr.Add((int)type); } platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKOneKeyShare (platTypesStr, MiniJSON.jsonEncode(content), _callbackObjectName); }
/// <summary> /// Shows the share menu. /// </summary> /// <param name='types'> /// Types. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='x'> /// X. only for iPad /// </param> /// <param name='y'> /// Y. only for iPad /// </param> /// <param name='direction'> /// Direction. only for iPad /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareMenu(Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler) { Debug.Log("Application.platform = " + Application.platform); if (Application.platform == RuntimePlatform.IPhonePlayer) { #if UNITY_IPHONE ios.ShareSDK.showShareMenu (types, content, x, y, direction, resultHandler); #endif } else if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID // The android platform doesn't have this method, you can modify the PlatformGridView class of OnekeyShare in java layer to achieve this function Debug.Log("content = " + content); if (resultHandler == null) { Debug.Log("resultHandler = null"); } else { Debug.Log("resultHandler != null"); } AndroidUtils.getInstance().onekeyShare(content, resultHandler); #endif } }
/// <summary> /// Shows the share menu. /// </summary> /// <param name='types'> /// Types. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='x'> /// X. /// </param> /// <param name='y'> /// Y. /// </param> /// <param name='direction'> /// Direction. /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareMenu(PlatformType[] types, Hashtable content, int x, int y, MenuArrowDirection direction, ShareResultEvent resultHandler) { _shareResultEvent = resultHandler; string platTypesStr = null; if (types != null) { List<int> platTypesArr = new List<int>(); foreach (PlatformType type in types) { platTypesArr.Add((int)type); } platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKShowShareMenu (platTypesStr, MiniJSON.jsonEncode(content), x, y, (int)direction, _callbackObjectName); }
public static void oneKeyShareContent(PlatformType[] types, Hashtable content, ShareResultEvent resultHandler) { if (Application.platform != RuntimePlatform.IPhonePlayer) { if (Application.platform == RuntimePlatform.Android) { for (int i = 0; i < types.Length; i++) { PlatformType platform = types[i]; AndroidUtils.getInstance().share((int)platform, content, resultHandler); } } } }
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")) { AuthResultEvent evt = new AuthResultEvent(AuthResultHandler); ShareSDK.authorize(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info")) { GetUserInfoResultEvent evt = new GetUserInfoResultEvent(GetUserInfoResultHandler); ShareSDK.getUserInfo(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu(null, content, 100, 100, MenuArrowDirection.Up, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareSDK.customSinaWeiboShareContent(content, "sina weibo test string", InheritedValue.VALUE, null); ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareView(PlatformType.Any, content, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Content")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.shareContent(PlatformType.SinaWeibo, content, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { GetFriendsResultEvent evt = new GetFriendsResultEvent(GetFriendsResultHandler); ShareSDK.getFriends(PlatformType.SinaWeibo, null, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { GetCredentialResultEvent evt = new GetCredentialResultEvent(GetTokenResultHandler); ShareSDK.getCredential(PlatformType.SinaWeibo, evt); } }
public static void showShareView(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { if (Application.platform != RuntimePlatform.IPhonePlayer) { if (Application.platform == RuntimePlatform.Android) { AndroidUtils.getInstance().onekeyShare(content, resultHandler); } } }
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")) { AuthResultEvent evt = new AuthResultEvent(AuthResultHandler); ShareSDK.authorize(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info")) { GetUserInfoResultEvent evt = new GetUserInfoResultEvent(GetUserInfoResultHandler); ShareSDK.getUserInfo(PlatformType.SinaWeibo, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareMenu (null, content, 100, 100, MenuArrowDirection.Up, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.showShareView (PlatformType.Any, content, evt); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Content")) { Hashtable content = new Hashtable(); content["content"] = "this is a test string."; content["image"] = "http://img.baidu.com/img/image/zhenrenmeinv0207.jpg"; content["title"] = "test title"; content["description"] = "test description"; content["url"] = "http://sharesdk.cn"; content["type"] = Convert.ToString((int)ContentType.News); content["siteUrl"] = "http://sharesdk.cn"; content["site"] = "ShareSDK"; content["musicUrl"] = "http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"; ShareResultEvent evt = new ShareResultEvent(ShareResultHandler); ShareSDK.shareContent (PlatformType.SinaWeibo, content, evt); } }
/// <summary> /// Shows the share view. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='content'> /// Content. /// </param> /// <param name='callback'> /// Callback. /// </param> public static void showShareView(PlatformType type, Hashtable content, ShareResultEvent resultHandler) { if (Application.platform == RuntimePlatform.IPhonePlayer) { #if UNITY_IPHONE ios.ShareSDK.showShareView (type, content, resultHandler); #endif } else if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID AndroidUtils.getInstance().onekeyShare(content, resultHandler); // if you want to skip the PlatformGridView, use the following line // AndroidUtils.getInstance().onekeyShare((int) type, content, resultHandler); #endif } }
public void share(int platform, Hashtable content, ShareResultEvent resultHandler) { this.shareHandler = resultHandler; string text = MiniJSON.jsonEncode(content); this.ssdk.CallStatic("share", new object[] { platform, text }); }