Пример #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
 public static void getCredential(PlatformType type, GetCredentialResultEvent resultHandler)
 {
     if (Application.platform != RuntimePlatform.IPhonePlayer)
     {
         if (Application.platform == RuntimePlatform.Android)
         {
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Get Token.
        /// </summary>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='callback'>
        /// Callback.
        /// </param>
        public static void getCredential(PlatformType type, GetCredentialResultEvent resultHandler)
        {
            _getCredentialResultEvent = resultHandler;

            __iosShareSDKGetCredential((int)type, _callbackObjectName);
        }
Пример #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>
		/// Shows the share view.
		/// </summary>
		/// <param name='type'>
		/// Type.
		/// </param>
		/// <param name='content'>
		/// Content.
		/// </param>
		/// <param name='callback'>
		/// Callback.
		/// </param>
		public static void getCredential (PlatformType type, GetCredentialResultEvent resultHandler)
		{
			if (Application.platform == RuntimePlatform.IPhonePlayer)
			{
				#if UNITY_IPHONE
				ios.ShareSDK.getCredential (type, resultHandler);
				#endif
			}
			else if (Application.platform == RuntimePlatform.Android)
			{
				#if UNITY_ANDROID
				#endif
			}
		}
Пример #6
0
 public static void getCredential(PlatformType type, GetCredentialResultEvent resultHandler)
 {
     ShareSDK._getCredentialResultEvent = resultHandler;
     ShareSDK.__iosShareSDKGetCredential((int)type, ShareSDK._callbackObjectName);
 }