public void authorize(int platform, AuthResultEvent resultHandler) { this.authHandler = resultHandler; this.ssdk.CallStatic("authorize", new object[] { platform }); }
public static void authorize(PlatformType type, AuthResultEvent resultHandler) { if (Application.platform != RuntimePlatform.IPhonePlayer) { if (Application.platform == RuntimePlatform.Android) { AndroidUtils.getInstance().authorize((int)type, resultHandler); } } }
public void OnPlayerAuth(AuthResultEvent ev) { if (ev.Success) { var player = new ClientPlayer() { UserID = ev.PlayerID }; MainBehaviour.Networking.Send(new JoinWorldEvent()); ClientEvents.PlayerLogin(player); GameObject.SetActive(false); UIManager.Notifications.ShowNotification("Welcome to Lisergy"); } else { Log.Error($"Auth failed"); } }
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 !"); } } }
/// <summary> /// Authorize the specified type, observer and resultHandler. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='observer'> /// Observer. /// </param> /// <param name='resultHandler'> /// Result handler. /// </param> public static void authorize(PlatformType type, AuthResultEvent resultHandler) { _authResultEvent = resultHandler; __iosShareSDKAuthorize ((int)type, _callbackObjectName); }
/// <summary> /// Authorize the specified type, observer and resultHandler. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='observer'> /// Observer. /// </param> /// <param name='resultHandler'> /// Result handler. /// </param> public static void authorize(PlatformType type, AuthResultEvent resultHandler) { _authResultEvent = resultHandler; __iosShareSDKAuthorize((int)type, _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 = 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); } }
/// <summary> /// Authorize the specified type, observer and resultHandler. /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='observer'> /// Observer. /// </param> /// <param name='resultHandler'> /// Result handler. /// </param> public static void authorize(PlatformType type, AuthResultEvent resultHandler) { if (Application.platform == RuntimePlatform.IPhonePlayer) { #if UNITY_IPHONE ios.ShareSDK.authorize (type, resultHandler); #endif } else if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID AndroidUtils.getInstance().authorize((int) type, resultHandler); #endif } }
/// <summary> /// Authorize the specified platform. /// </summary> /// <param name="platform">Platform.</param> /// <param name="resultHandler">Result handler.</param> public void authorize(int platform, AuthResultEvent resultHandler) { authHandler = resultHandler; ssdk.CallStatic("authorize", platform); }
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); } }
private void OnAuthTest(AuthResultEvent ev) { Awaiter.Wait(CanStartTest, StartTest); }