예제 #1
0
	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 !");
			}
			
		}

	}
예제 #2
0
 /// <summary>
 /// Gets the user info.
 /// </summary>
 /// <param name='type'>
 /// Type.
 /// </param>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public static void getUserInfo(PlatformType type, GetUserInfoResultEvent resultHandler)
 {
     _getUserInfoResultEvent = resultHandler;
     __iosShareSDKGetUserInfo ((int)type, _callbackObjectName);
 }
예제 #3
0
 public static void getUserInfo(PlatformType type, GetUserInfoResultEvent resultHandler)
 {
     if (Application.platform != RuntimePlatform.IPhonePlayer)
     {
         if (Application.platform == RuntimePlatform.Android)
         {
             AndroidUtils.getInstance().showUser((int)type, resultHandler);
         }
     }
 }
예제 #4
0
    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);
        }
    }
예제 #5
0
 /// <summary>
 /// Gets the user info.
 /// </summary>
 /// <param name='type'>
 /// Type.
 /// </param>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public static void getUserInfo(PlatformType type, GetUserInfoResultEvent resultHandler)
 {
     _getUserInfoResultEvent = resultHandler;
     __iosShareSDKGetUserInfo((int)type, _callbackObjectName);
 }
예제 #6
0
파일: ShareSDK.cs 프로젝트: xinwei2016/test
 /// <summary>
 /// Gets the user info.
 /// </summary>
 /// <param name='type'>
 /// Type.
 /// </param>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public static void getUserInfo(PlatformType type, GetUserInfoResultEvent resultHandler)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
     #if UNITY_IPHONE
         ios.ShareSDK.getUserInfo (type, resultHandler);
     #endif
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
     #if UNITY_ANDROID
         AndroidUtils.getInstance().showUser((int) type, resultHandler);
     #endif
     }
 }
예제 #7
0
 /// <summary>
 /// Request the user info of the specified platform.
 /// </summary>
 /// <param name="platform">Platform.</param>
 public void showUser(int platform, GetUserInfoResultEvent resultHandler)
 {
     showUserHandler = resultHandler;
     ssdk.CallStatic("showUser", platform);
 }
예제 #8
0
 public void showUser(int platform, GetUserInfoResultEvent resultHandler)
 {
     this.showUserHandler = resultHandler;
     this.ssdk.CallStatic("showUser", new object[]
     {
         platform
     });
 }
예제 #9
0
파일: Demo.cs 프로젝트: AhrenLi/2048
    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);
        }
    }
예제 #10
0
 /// <summary>
 /// Request the user info of the specified platform.
 /// </summary>
 /// <param name="platform">Platform.</param>
 public void showUser(int platform, GetUserInfoResultEvent resultHandler)
 {
     showUserHandler = resultHandler;
     ssdk.CallStatic("showUser", platform);
 }