Example #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 !");
			}
			
		}

	}
Example #2
0
 public static void getFriends(PlatformType type, Hashtable page, GetFriendsResultEvent resultHandler)
 {
     if (Application.platform != RuntimePlatform.IPhonePlayer)
     {
         if (Application.platform == RuntimePlatform.Android)
         {
         }
     }
 }
Example #3
0
        /// <summary>
        /// Get the friends list.
        /// </summary>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='page'>
        /// Paging Info : {"pageNo":1, "pageSize":1} or {"cursor":1}
        /// </param>
        /// <param name='callback'>
        /// Callback.
        /// </param>
        public static void getFriends(PlatformType type, Hashtable page, GetFriendsResultEvent resultHandler)
        {
            _getFriendsResultEvent = resultHandler;

            __iosShareSDKGetFriendsList((int)type, MiniJSON.jsonEncode(page), _callbackObjectName);
        }
Example #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);
        }
    }
		/// <summary>
		/// Shows the share view.
		/// </summary>
		/// <param name='type'>
		/// Type.
		/// </param>
		/// <param name='page'>
		/// Content.
		/// </param>
		/// <param name='callback'>
		/// Callback.
		/// </param>
		public static void getFriends (PlatformType type, Hashtable page, GetFriendsResultEvent resultHandler)
		{
			if (Application.platform == RuntimePlatform.IPhonePlayer)
			{
				#if UNITY_IPHONE
				ios.ShareSDK.getFriends (type, page, resultHandler);
				#endif
			}
			else if (Application.platform == RuntimePlatform.Android)
			{
				#if UNITY_ANDROID
				#endif
			}
		}
Example #6
0
 public static void getFriends(PlatformType type, Hashtable page, GetFriendsResultEvent resultHandler)
 {
     ShareSDK._getFriendsResultEvent = resultHandler;
     string page2 = MiniJSON.jsonEncode(page);
     ShareSDK.__iosShareSDKGetFriendsList((int)type, page2, ShareSDK._callbackObjectName);
 }