Exemplo n.º 1
0
    public void OnShareButtonClick()
    {
        ScreenCapture.CaptureScreenshot("Screenshot.png");
        ShareContent content = new ShareContent();

        //公共信息设置
        content.SetText(resultText.text);
        content.SetImagePath(Application.persistentDataPath + "/Screenshot.png");
        content.SetTitle("我的share");
        content.SetTitleUrl("https://github.com/LintonLiang");
        content.SetSite("Lintonliang");
        content.SetSiteUrl("https://github.com/LintonLiang");
        content.SetUrl("https://github.com/LintonLiang");
        content.SetUrlDescription("我的Github主页");
        content.SetShareType(ContentType.Image);

        //各个平台特例的设置
        //新建一个content,添加上特殊的信息,对公共信息进行补充和替换,相当于C#中的继承
        ShareContent sinaContent = new ShareContent();

        sinaContent.SetText(resultText.text + "\n 通过新浪微博分享");
        content.SetShareContentCustomize(PlatformType.SinaWeibo, sinaContent);



        ssdk.ShowPlatformList(null, content, 100, 100);
    }
Exemplo n.º 2
0
    public static void ShowShareMenu()
    {
        ShareContent content = new ShareContent();

        content.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");
        content.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png");
        content.SetTitle("AR游");
        content.SetShareType(ContentType.Webpage);
        content.SetTitleUrl("http://download.vszapp.com");
        content.SetUrl("http://download.vszapp.com");


        // ShareContent content = new ShareContent();
        // content.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");
        // content.SetTitle("AR游");
        // content.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png");
        // content.SetUrl("http://download.vszapp.com");
        // content.SetShareType(ContentType.Webpage);
        // ssdk.ShareContent (PlatformType.WeChatMoments, content);



        ShareContent SinaShareParams = new ShareContent();

        SinaShareParams.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");
        SinaShareParams.SetImageUrl("https://gitee.com/visizencom/ar_game/raw/054c0ae483c0b9a65319815d5d76b92aea4668fc/Images/Logo.png");
        SinaShareParams.SetShareType(ContentType.Webpage);
        SinaShareParams.SetObjectID("SinaID");
        content.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams);

        //通过分享菜单分享
        ssdk.ShowPlatformList(null, content, 100, 100);
    }
Exemplo n.º 3
0
    public void OnShareButtonClick()
    {
        ScreenCapture.CaptureScreenshot("Screenshot.png");
        ShareContent content = new ShareContent();

        content.SetText(resultText.text);
        content.SetImagePath(Application.persistentDataPath + "/Screenshot.png");
        content.SetTitle("TestShader");
        content.SetTitleUrl("http://www.baidu.com");
        content.SetSite("随便");
        content.SetSiteUrl("http://www.baidu.com");
        content.SetUrl("http://www.baidu.com");
        content.SetShareType(ContentType.Image);



        ShareContent SinaWeiboContent = new ShareContent();

        SinaWeiboContent.SetText(resultText.text + "via 新浪微博");
        content.SetShareContentCustomize(PlatformType.SinaWeibo, SinaWeiboContent);
        //PlatformType[] platforms = {PlatformType.SinaWeibo,};
        //哪些平台不显示
        string[] platforms = { "0", "2", "3", "4", "5" };
        content.SetHidePlatforms(platforms);
        ssdk.ShowPlatformList(null, content, 100, 100);
    }
Exemplo n.º 4
0
    /// <summary>
    /// 分享视频
    /// </summary>
    /// <param name="path"></param>
    public bool ShareVideo(string path)
    {
        if (path == null)
        {
            return(false);
        }
        Debug.Log("path===" + path);
        ssdk.DisableSSO(false);
        if (ssdk.IsClientValid(PlatformType.SinaWeibo) == false)
        {
            return(false);
        }
        ShareContent content = new ShareContent();

        content.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");
        content.SetFilePath(path);
        content.SetTitle("AR游");
        content.SetShareType(ContentType.File);
        content.SetTitleUrl("http://download.vszapp.com");
        content.SetUrl("http://download.vszapp.com");



#if UNITY_ANDROID
        String[] plats = new String[3];
        plats[0] = PlatformType.QQ.ToString();
        plats[1] = PlatformType.WeChat.ToString();
        plats[2] = PlatformType.WeChatMoments.ToString();
        content.SetHidePlatforms(plats);
#elif UNITY_IOS || UNITY_IPHONE
        PlatformType[] plats = new PlatformType[1];
        plats[0] = PlatformType.SinaWeibo;
#endif



        ShareContent SinaShareParams = new ShareContent();
        SinaShareParams.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");

        SinaShareParams.SetTitle("AR游");
        SinaShareParams.SetShareType(ContentType.File);


        SinaShareParams.SetFilePath(path);
        SinaShareParams.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams);
#if UNITY_ANDROID
        //通过分享菜单分享
        ssdk.ShowPlatformList(null, content, 100, 100);
#elif UNITY_IOS || UNITY_IPHONE
        //通过分享菜单分享
        ssdk.ShowPlatformList(plats, content, 100, 100);
#endif


        return(true);
    }
    public void ShareGames(PlatformType platformType)
    {
        ShareContent customizeShareParams = new ShareContent();

        customizeShareParams.SetText("lock at me");
        customizeShareParams.SetUrl("");
        customizeShareParams.SetShareType(ContentType.Text);
        customizeShareParams.SetObjectID("");
        customizeShareParams.SetShareContentCustomize(platformType, customizeShareParams);
        shareSdk.ShareContent(platformType, customizeShareParams);
    }
Exemplo n.º 6
0
        /**
         * 执行分享到朋友圈的操作
         */
        private void shareAchievement(PlatformType platformType)
        {
            ShareContent s = new ShareContent();

            s.SetText("");
            s.SetImagePath(picPath);
            s.SetShareType(ContentType.Image);
            s.SetObjectID("");
            s.SetShareContentCustomize(platformType, s);
            shareSdk.ShareContent(platformType, s);
        }
Exemplo n.º 7
0
    // 分享接口
    public void ShareGames(PlatformType platformType)
    {
        ShareContent customizeShareParams = new ShareContent();

        customizeShareParams.SetText("给你发了一个29元大红包,快来领取你的红包!");
        customizeShareParams.SetUrl("http://www.baidu.com");
        customizeShareParams.SetShareType(ContentType.Webpage);
        customizeShareParams.SetObjectID("");
        customizeShareParams.SetImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527429848373&di=33c254c11436d40b23a2390ffe249845&imgtype=0&src=http%3A%2F%2Fa.hiphotos.baidu.com%2Fzhidao%2Fwh%253D680%252C800%2Fsign%3D4cf11667fb1f3a295a9dddc8a1159009%2F8644ebf81a4c510f195c55a36b59252dd52aa5eb.jpg");
        customizeShareParams.SetShareContentCustomize(platformType, customizeShareParams);
        shareSdk.ShareContent(platformType, customizeShareParams);
    }
Exemplo n.º 8
0
    /// <summary>
    /// 分享图片
    /// </summary>
    /// <param name="path"></param>
    private bool ShareImage(string path)
    {
        if (path == null)
        {
            return(false);
        }
        PlatformType[] plats = new PlatformType[4];
        plats[0] = PlatformType.WeChat;
        plats[1] = PlatformType.WeChatMoments;
        plats[2] = PlatformType.QQ;
        plats[3] = PlatformType.SinaWeibo;
        ssdk.DisableSSO(false);
        ShareContent content = new ShareContent();

        content.SetText("视觉美景+智能呈现  只留精彩,不留遗憾"); //智能交互宣传
        content.SetImagePath(path);
        content.SetTitle("AR游");                 //AR游
        content.SetShareType(ContentType.Image);
        content.SetTitleUrl("http://download.vszapp.com");
        content.SetUrl("http://download.vszapp.com");

        ShareContent qqParams = new ShareContent();

        qqParams.SetImagePath(path);
        qqParams.SetShareType(ContentType.Image);
        qqParams.SetShareContentCustomize(PlatformType.QQ, qqParams);

        ShareContent wechatParams = new ShareContent();

        wechatParams.SetImagePath(path);
        wechatParams.SetTitle("AR游");//AR游
        wechatParams.SetShareType(ContentType.Image);
        wechatParams.SetShareContentCustomize(PlatformType.WeChat, wechatParams);

        ShareContent wechatMomentParams = new ShareContent();

        wechatMomentParams.SetImagePath(path);
        wechatMomentParams.SetTitle("AR游");//AR游
        wechatMomentParams.SetShareType(ContentType.Image);
        wechatMomentParams.SetShareContentCustomize(PlatformType.WeChatMoments, wechatParams);

        ShareContent SinaShareParams = new ShareContent();

        SinaShareParams.SetText("视觉美景+智能呈现  只留精彩,不留遗憾");
        SinaShareParams.SetImagePath(path);
        SinaShareParams.SetShareType(ContentType.Image);
        SinaShareParams.SetShareContentCustomize(PlatformType.SinaWeibo, SinaShareParams);

        //通过分享菜单分享
        ssdk.ShowPlatformList(plats, content, 100, 100);
        return(true);
    }
Exemplo n.º 9
0
    public void ShareToWeChatMethod()
    {
        ShareContent content = new ShareContent();

        //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台)
        //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了)
        String[] platfsList = { ((int)PlatformType.QQ).ToString(), ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() };
        content.SetHidePlatforms(platfsList);

        content.SetText("想来挑战一下最新的I wanna 系列吗");
        content.SetImageUrl("https://img.tapimg.com/market/lcs/f8f7cc26ddba562add50519262cf2ea0_360.png?imageMogr2/auto-orient/strip");
        content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
        content.SetTitle("I wanna destroy the Cube");

        //(Android only) 针对Android绕过审核的多图分享,传图片String数组

        // String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" };
        //content.SetImageArray(imageArray);

        content.SetTitleUrl("https://www.taptap.com/app/146786");
        //  content.SetSite("Mob-ShareSDK");
        content.SetSiteUrl("https://www.taptap.com/app/146786");
        content.SetUrl("https://www.taptap.com/app/146786");
        // content.SetComment("test description");
        //content.SetMusicUrl("");
        content.SetShareType(ContentType.Image);

        //不同平台分享不同内容

        ShareContent customizeShareParams = new ShareContent();

        customizeShareParams.SetText("Sina share content");
        customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
        customizeShareParams.SetShareType(ContentType.Text);
        customizeShareParams.SetObjectID("SinaID");
        content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

        //优先客户端分享
        // content.SetEnableClientShare(true);

        //使用微博API接口应用内分享 iOS only
        // content.SetEnableSinaWeiboAPIShare(true);

        //通过分享菜单分享
        ssdk.ShowPlatformList(null, content, 100, 100);
    }
Exemplo n.º 10
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        float btnWidth  = 165 * scale;
        float btnHeight = 30 * scale;
        float btnTop    = 20 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(14 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize"))
        {
            print(ssdk == null);

            ssdk.Authorize(PlatformType.QQ);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            ssdk.GetUserInfo(PlatformType.SinaWeibo);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Text);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);
            //优先客户端分享
            // content.SetEnableClientShare(true);
            //使用微博高级接口进行本地图片 文字 应用内分享 17年6月30日后需申请高级接口
            // content.SetEnableAdvancedInterfaceShare(true);
            //通过分享菜单分享
            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
//			content.SetTitleUrl("http://www.mob.com");
//			content.SetSite("Mob-ShareSDK");
            // content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://qjsj.youzu.com/jycs/");
//			content.SetComment("test description");
//			content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Webpage);
            ssdk.ShareContent(PlatformType.WeChat, content);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo "))
        {
            //获取新浪微博好友,第一页,每页15条数据
            print("Click Btn Of Get Friends SinaWeibo");
            ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        {
            ssdk.DisableSSO(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend "))
        {
            //关注新浪微博
            ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件分享【本接口功能仅暂时支持iOS】
            ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnWidth += 80 * scale;
        btnTop   += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】
            ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }
    }
Exemplo n.º 11
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        //float btnWidth = 165 * scale;
        float btnWidth  = Screen.width / 5 * 2;
        float btnHeight = Screen.height / 25;
        float btnTop    = 30 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(13 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize"))
        {
            print(ssdk == null);
            ssdk.Authorize(PlatformType.QQ);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            ssdk.GetUserInfo(PlatformType.QQ);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu"))
        {
            ShareContent content = new ShareContent();

            //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台)
            //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了)
            String[] platfsList = { ((int)PlatformType.QQ).ToString(), ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() };
            content.SetHidePlatforms(platfsList);

            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");

            //(Android only) 针对Android绕过审核的多图分享,传图片String数组
            String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" };
            content.SetImageArray(imageArray);

            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Text);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);
            //优先客户端分享
            // content.SetEnableClientShare(true);

            //使用微博API接口应用内分享 iOS only
            // content.SetEnableSinaWeiboAPIShare(true);

            //通过分享菜单分享
            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
//			content.SetTitleUrl("http://www.mob.com");
//			content.SetSite("Mob-ShareSDK");
            // content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://qjsj.youzu.com/jycs/");
//			content.SetComment("test description");
//			content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Webpage);
            ssdk.ShareContent(PlatformType.WeChat, content);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo "))
        {
            //获取新浪微博好友,第一页,每页15条数据
            print("Click Btn Of Get Friends SinaWeibo");
            ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        {
            ssdk.DisableSSO(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend "))
        {
            //关注新浪微博
            ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件分享【本接口功能仅暂时支持iOS】
            ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnWidth += 80 * scale;
        btnTop   += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】
            ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SMS Authorize"))
        {
            ssdk.Authorize(PlatformType.SMS);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share wxMiniProgram (ios only)"))
        {
            ShareContent content = new ShareContent();
            content.SetTitle("MiniProgram");
            content.SetText("test MiniProgram");
            content.SetUrl("http://www.mob.com");
            content.SetMiniProgramPath("pages/index/index");
            content.SetThumbImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg");
            content.SetMiniProgramHdThumbImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg");
            content.SetMiniProgramUserName("gh_afb25ac019c9");
            content.SetMiniProgramWithShareTicket(true);
            content.SetMiniProgramType(0);
            content.SetShareType(ContentType.MiniProgram);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.WeChat, content);
            ssdk.ShareContent(PlatformType.WeChat, shareContent);
        }
    }
Exemplo n.º 12
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"))
        {
            print(ssdk == null);

            ssdk.Authorize(PlatformType.SinaWeibo);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            ssdk.GetUserInfo(PlatformType.SinaWeibo);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Image);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);
            ssdk.ShowShareContentEditor(PlatformType.TencentWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);
            ssdk.ShareContent(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo "))
        {
            //获取新浪微博好友,第一页,每页15条数据
            print("Click Btn Of Get Friends SinaWeibo");
            ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        {
            ssdk.DisableSSO(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Add Friend "))
        {
            //关注新浪微博
            ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }
    }
Exemplo n.º 13
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        //float btnWidth = 165 * scale;
        float btnWidth  = Screen.width / 5 * 2;
        float btnHeight = Screen.height / 25;
        float btnTop    = 30 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(13 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize"))
        {
            print(ssdk == null);
            ssdk.Authorize(PlatformType.Douyin);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            ssdk.GetUserInfo(PlatformType.Douyin);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight),
                       "Show Share Menu"))
        {
            ShareContent content = new ShareContent();

            //	//(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台)
            //	//(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了)
            String[] platfsList =
            {
                ((int)PlatformType.QQ).ToString(), ((int)PlatformType.Facebook).ToString(),
                ((int)PlatformType.TencentWeibo).ToString()
            };
            content.SetHidePlatforms(platfsList);

            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");

            //(Android only) 针对Android绕过审核的多图分享,传图片String数组
            String[] imageArray =
            {
                "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg",
                "/sdcard/test.jpg"
            };
            content.SetImageArray(imageArray);

            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl(
                "http://i.y.qq.com/v8/playsong.html?hostuin=0&songid=&songmid=002x5Jje3eUkXT&_wv=1&source=qq&appshare=iphone&media_mid=002x5Jje3eUkXT");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl(
                "http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Text);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);
            //优先客户端分享
            content.SetEnableClientShare(true);

            //使用微博API接口应用内分享 iOS only
            content.SetEnableSinaWeiboAPIShare(true);

            //通过分享菜单分享
            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            //content.SetTitleUrl("http://www.mob.com");
            //content.SetSite("Mob-ShareSDK");
            //content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://qjsj.youzu.com/jycs/");
            //content.SetComment("test description");
            //content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);
            ssdk.ShareContent(PlatformType.QQ, content);


//            //  开发者要自己传入Activity 在9.0及其以上的系统
//            //  AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
//            //  AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
//            //  content.SetActivity(jo);
//            //  Debug.Log("QQQ 测试传入的activity  ==================>>> " + jo);

//                ShareContent content = new ShareContent();
//                content.SetFilePath("/storage/emulated/0/douyin.mp4");
//                content.SetShareType(ContentType.Video);
//                ssdk.ShareContent (PlatformType.Douyin, content);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight),
                       "Get Friends SinaWeibo "))
        {
            //获取新浪微博好友,第一页,每页15条数据
            print("Click Btn Of Get Friends SinaWeibo");
//			ssdk.GetFriendList (PlatformType.SinaWeibo, 15, 0);
            ssdk.openMiniProgram("gh_afb25ac019c9", "pages/index/index", 0);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight),
                       "Get Token SinaWeibo "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        {
            ssdk.DisableSSO(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight),
                       "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend "))
        {
            //关注新浪微博
            ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件分享【本接口功能仅暂时支持iOS】
            ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnWidth += 80 * scale;
        btnTop   += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight),
                       "ShowShareMenuWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】
            ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight),
                       "ShowShareViewWithContentName"))
        {
            Hashtable customFields = new Hashtable();
            //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SMS Authorize"))
        {
            ssdk.Authorize(PlatformType.SMS);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight),
                       "Share wxMiniProgram (ios only)"))
        {
            ShareContent content = new ShareContent();
            content.SetTitle("MiniProgram");
            content.SetText("test MiniProgram");
            content.SetUrl("http://www.mob.com");
            content.SetMiniProgramPath("pages/index/index");
            content.SetThumbImageUrl(
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg");
            content.SetMiniProgramHdThumbImage(
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg");
            content.SetMiniProgramUserName("gh_afb25ac019c9");
            content.SetMiniProgramWithShareTicket(true);
            content.SetMiniProgramType(0);
            content.SetShareType(ContentType.MiniProgram);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.WeChat, content);
            ssdk.ShareContent(PlatformType.WeChat, shareContent);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Sina LinkCard"))
        {
#if UNITY_IPHONE
            ShareContent content = new ShareContent();
            content.SetText("sina LinkCard");
            content.SetUrl("http://www.mob.com");
            content.SetImageUrl("http://www.mob.com/assets/images/ShareSDK_pic_1-09d293a6.png");//必须为网络图片
            content.SetSinaLinkCard(true);
            content.SetSinaCardTitle("这是Title");
            content.SetSinaCardSummary("这是Summary");
            content.SetShareType(ContentType.Webpage);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content);
            ssdk.ShareContent(PlatformType.SinaWeibo, shareContent);
#elif UNITY_ANDROID
            JsonData jsonData = new JsonData();
            jsonData["url"]    = "http://wx4.sinaimg.cn/large/006WfoFPly1fq0jo9svnaj30dw0dwdhv.jpg";
            jsonData["width"]  = "120";
            jsonData["height"] = "120";


            ShareContent content = new ShareContent();
            content.SetText("sina LinkCard");
            content.SetSinaCardCreateAtAndroid("2019-01-24");
            content.SetSinaCardDisplayNameAndroid("displayName");
            content.SetSinaCardSummary("Summary");
            content.SetSinaCardURLAndroid("http://www.mob.com/");
            content.SetSinaCardTypeAndroid("webpage");
            content.SetSinaCardImageAndroid(jsonData);
            content.SetEnableClientShare(true);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content);

            ssdk.ShareContent(PlatformType.SinaWeibo, shareContent);
#endif
        }
    }
Exemplo n.º 14
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        //float btnWidth = 165 * scale;
        float btnWidth  = Screen.width / 5 * 2;
        float btnWidth2 = btnWidth + 80 * scale;

        float btnHeight = Screen.height / 25;
        float btnTop    = 30 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(13 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize"))
        {
            print(ssdk == null);

#if UNITY_ANDROID
            ssdk.Authorize(PlatformType.SinaWeibo);
#elif UNITY_IPHONE
            ssdk.Authorize(PlatformType.Facebook);
#endif
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info"))
        {
            //ssdk.GetUserInfo(PlatformType.Douyin);

            print("share result :" + ssdk.GetUserInfo(PlatformType.QQ));
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu"))
        {
            ShareContent content = new ShareContent();

            //	//(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台)
            //	//(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了)
            String[] platfsList = { ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() };
            content.SetHidePlatforms(platfsList);

            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");

            //(Android only) 针对Android绕过审核的多图分享,传图片String数组
            String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" };
            content.SetImageArray(imageArray);

            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://i.y.qq.com/v8/playsong.html?hostuin=0&songid=&songmid=002x5Jje3eUkXT&_wv=1&source=qq&appshare=iphone&media_mid=002x5Jje3eUkXT");
            content.SetShareType(ContentType.Image);

            //不同平台分享不同内容
            ShareContent customizeShareParams = new ShareContent();
            customizeShareParams.SetText("Sina share content");
            customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            customizeShareParams.SetShareType(ContentType.Text);
            customizeShareParams.SetObjectID("SinaID");
            content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);
            //优先客户端分享
            content.SetEnableClientShare(true);

            //使用微博API接口应用内分享 iOS only
            content.SetEnableSinaWeiboAPIShare(true);

            //通过分享菜单分享
            ssdk.ShowPlatformList(null, content, 100, 100);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            content.SetTitleUrl("http://www.mob.com");
            content.SetSite("Mob-ShareSDK");
            content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://www.mob.com");
            content.SetComment("test description");
            content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);

            ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Content"))
        {
            ShareContent content = new ShareContent();
            content.SetText("this is a test string.");
            content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            content.SetTitle("test title");
            //content.SetTitleUrl("http://www.mob.com");
            //content.SetSite("Mob-ShareSDK");
            //content.SetSiteUrl("http://www.mob.com");
            content.SetUrl("http://qjsj.youzu.com/jycs/");
            //content.SetComment("test description");
            //content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            content.SetShareType(ContentType.Image);
            ssdk.ShareContent(PlatformType.Oasis, content);


//            //  开发者要自己传入Activity 在9.0及其以上的系统
//            //  AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
//            //  AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
//            //  content.SetActivity(jo);
//            //  Debug.Log("QQQ 测试传入的activity  ==================>>> " + jo);

//                ShareContent content = new ShareContent();
//                content.SetFilePath("/storage/emulated/0/douyin.mp4");
//                content.SetShareType(ContentType.Video);
//                ssdk.ShareContent (PlatformType.Douyin, content);
        }

        //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo "))
        //{
        //获取新浪微博好友,第一页,每页15条数据
        //print ("Click Btn Of Get Friends SinaWeibo");
//			ssdk.GetFriendList (PlatformType.SinaWeibo, 15, 0);
        //ssdk.openMiniProgram("gh_afb25ac019c9","pages/index/index",0);
        //}

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Get Token "))
        {
            Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.QQ);
            print("share result :");
            print(MiniJSON.jsonEncode(authInfo));
        }

        //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap , btnTop, btnWidth, btnHeight), "Close SSO Auth"))
        //{
        //ssdk.DisableSSO (true);
        //}

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Remove Authorize "))
        {
            ssdk.CancelAuthorize(PlatformType.QQ);
        }

        //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend "))
        //{
        //关注新浪微博
        //ssdk.AddFriend (PlatformType.SinaWeibo, "3189087725");
        //}

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShareWithContentName(IOS only)"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件分享【本接口功能仅暂时支持iOS】
            ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareMenuWithContentName(IOS only)"))
        {
            Hashtable customFields = new Hashtable();
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】
            ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareViewWithContentName(IOS only)"))
        {
            Hashtable customFields = new Hashtable();
            //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】
            customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "SMS Authorize"))
        {
            ssdk.Authorize(PlatformType.SMS);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "submitPolicyGrantResult"))
        {
            Debug.Log("ssdk ======> " + ssdk);
            Debug.Log("mobsdk ======> " + mobsdk);

            mobsdk.submitPolicyGrantResult(true);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "getPrivacyPolicy"))
        {
            Debug.Log("ssdk ======> " + ssdk);
            Debug.Log("mobsdk ======> " + mobsdk);
                        #if UNITY_IPHONE
            mobsdk.getPrivacyPolicy(true);
#elif UNITY_ANDROID
            mobsdk.getPrivacyPolicy(true);
            Debug.Log("mobsdk getPrivacyPolicy======> " + mobsdk.getPrivacyPolicy(true));
#endif
        }


        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share wxMiniProgram"))
        {
#if UNITY_IPHONE
            ShareContent content = new ShareContent();
            content.SetTitle("MiniProgram");
            content.SetText("test MiniProgram");
            content.SetUrl("http://www.mob.com");
            content.SetMiniProgramPath("pages/index/index");
            content.SetThumbImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg");
            content.SetMiniProgramHdThumbImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg");
            content.SetMiniProgramUserName("gh_afb25ac019c9");
            content.SetMiniProgramWithShareTicket(true);
            // iOS/Android 微信小程序的版本(0-正式,1-开发,2-体验)
            content.SetMiniProgramType(0);
            //content.SetShareType (ContentType.MiniProgram);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.WeChat, content);
            ssdk.ShareContent(PlatformType.WeChat, shareContent);
#elif UNITY_ANDROID
            ShareContent content = new ShareContent();
            content.SetTitle("MiniProgram");
            content.SetText("test MiniProgram");
            content.SetUrl("http://www.mob.com");
            content.SetMiniProgramType(0);
            content.SetMiniProgramUserName("gh_52568203455c");
            content.SetImageUrl("http://pic28.photophoto.cn/20130818/0020033143720852_b.jpg");
            content.SetShareType(ContentType.MiniProgram);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.WeChat, content);
            ssdk.ShareContent(PlatformType.WeChat, shareContent);
#endif
        }



        //
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Share qqMiniProgram(IOS only)"))
        {
#if UNITY_IPHONE
            ShareContent content = new ShareContent();
            content.SetTitle("MiniProgram");
            content.SetText("test MiniProgram");
            content.SetUrl("http://www.mob.com");
            content.SetThumbImageUrl("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png");
            content.SetMiniProgramPath("pages/index/index");
            content.SetMiniProgramHdThumbImage("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png");
            content.SetMiniProgramAppID("1108318575");
            content.SetMiniProgramWebpageUrl("www.qq.com");
            //iOS/Android QQ小程序的类型,默认正式版(3),可选测试版(1)、预览版(4)
            content.SetMiniProgramType(3);
            content.SetShareType(ContentType.MiniProgram);

            ShareContent shareContent = new ShareContent();
            shareContent.SetShareContentCustomize(PlatformType.QQ, content);
            ssdk.ShareContent(PlatformType.QQ, shareContent);
#elif UNITY_ANDROID
            //===============================================================
            //when you test QQ miniprogram, you should use this params
            //At the same time, the package name and signature should
            //correspond to the package name signature of the specific
            //QQ sharing small program applied in the background of tencent
            //===============================================================
            //ShareContent content = new ShareContent();
            //content.SetTitle("MiniProgram");
            //content.SetText("test MiniProgram");
            //content.SetTitleUrl("http://www.mob.com");
            //content.SetImageUrl("http://www.3wyu.com/wp-content/uploads/6e0eaf15gy1fvr5tnm2dfj20f108gtad.jpg");//必须为网络图片
            //content.SetShareType(ContentType.QQ_MINI_PROGRAM);
            //content.SetMiniProgramAppID("1108318575");
            //content.SetMiniProgramPath("page/share/index.html?share_name=QQ%E9%9F%B3%E4%B9%90&share_key=5aIqFGg&from=disk");
            //content.SetQQMiniProgramType("");

            //ShareContent shareContent = new ShareContent();
            //shareContent.SetShareContentCustomize(PlatformType.QQ, content);
            //ssdk.ShareContent(PlatformType.QQ, shareContent);
#endif
        }

        //btnTop += btnHeight + 20 * scale;
        //if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Sina LinkCard"))
        //{
        //#if UNITY_IPHONE
        //ShareContent content = new ShareContent();
        //content.SetText("sina LinkCard");
        //content.SetUrl("http://www.mob.com");
        //content.SetImageUrl("http://www.mob.com/assets/images/ShareSDK_pic_1-09d293a6.png");//必须为网络图片
        //content.SetSinaLinkCard(true);
        //content.SetSinaCardTitle("这是Title");
        //content.SetSinaCardSummary("这是Summary");
        //content.SetShareType(ContentType.Webpage);

        //ShareContent shareContent = new ShareContent();
        //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content);
        //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent);


        //#elif UNITY_ANDROID
        //JsonData jsonData = new JsonData();
        //jsonData["url"] = "http://wx4.sinaimg.cn/large/006WfoFPly1fq0jo9svnaj30dw0dwdhv.jpg";
        //jsonData["width"] = "120";
        //jsonData["height"] = "120";


        //ShareContent content = new ShareContent();
        //content.SetText("sina LinkCard");
        //content.SetSinaCardCreateAtAndroid("2019-01-24");
        //content.SetSinaCardDisplayNameAndroid("displayName");
        //content.SetSinaCardSummary("Summary");
        //content.SetSinaCardURLAndroid("http://www.mob.com/");
        //content.SetSinaCardTypeAndroid("webpage");
        //content.SetSinaCardImageAndroid(jsonData);
        //content.SetEnableClientShare(true);

        //ShareContent shareContent = new ShareContent();
        //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content);

        //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent);
        //#endif
        //}
    }
Exemplo n.º 15
0
    public void OnClickCallBack()
    {
        GetComponent <AudioSource> ().Play();
        switch (_extraButtonType)
        {
        case ExtraButtonType.EBT_HELP:
        {
            Debug.Log("call help layer");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_LIKE:
        {
            Debug.Log("call like api");
                                #if UNITY_IPHONE
            Hashtable userData = new Hashtable();
            //ShareREC.editLastingRecording ("我天籁般的的叫声,是时候让你们听到了!", userData, null);
            ShareREC.openSocial("我天籁般的的叫声,是时候让你们听到了!", userData, SocialPageType.Share, null);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_MUSIC:
        {
            Debug.Log("call music on/off");
//				JsonData jd = LoadJson.LoadSavedUserInfo ();
//				int music = (int)(jd["Music"]);
//				if (music == 1) {
//					//PlayerPrefs.SetInt ("Music", 0);
//					jd["Music"] = new JsonData(0);
//					GetComponent<Image> ().sprite = _musicOff;
//				} else {
//					//PlayerPrefs.SetInt ("Music", 1);
//					jd["Music"] = new JsonData(1);
//					GetComponent<Image> ().sprite = _musicOn;
//				}
//				//PlayerPrefs.Save ();
//				LoadJson.SaveUserInfo(jd);
        }
        break;

        case ExtraButtonType.EBT_RANK:
        {
            Debug.Log("call rank layer");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_SHARE:
        {
                                #if UNITY_IPHONE
            Debug.Log("call share api");
            Hashtable userData = new Hashtable();
            ShareREC.openSocial("我天籁般的的叫声,是时候让你们听到了!", userData, SocialPageType.Share, null);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_WX:
        {
            Debug.Log("call weixin api");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_GAMESHARE:
        {
            Debug.Log("call url share api");
            string shareTitle = "这游戏有毒,我已中毒至深,尖叫根本停不下来!";
            string shareDesc  = "与全世界一起尖叫!谁才是声控之王?是你吗?";

            string shareTitleEn = "This game is poisonous and i have been poisoned deeply! I can't stop playing and screaming!";
            string shareDescEn  = "Scream with people around the world! Who is the king of voice control? Is that you?";

            string shareSite = "尖叫鸟";
            string shareUrl  = "https://api.shaojishiduo.com/GameScream/share?s=" + PlayerPrefs.GetString("ShareID");
            string shareImg  = "http://liteapp-1252384896.costj.myqcloud.com/scream/images/bird_icon_256.png";

            ShareContent content = new ShareContent();
            content.SetText(shareDesc);
            content.SetImageUrl(shareImg);
            content.SetTitle(shareTitle);
            content.SetTitleUrl(shareUrl);
            content.SetSite(shareSite);
            content.SetSiteUrl(shareUrl);
            content.SetUrl(shareUrl);
            content.SetComment(shareDesc);
            content.SetShareType(ContentType.Webpage);

            //不同平台分享不同内容
            //				ShareContent customizeShareParams = new ShareContent();
            //				customizeShareParams.SetText(shareDesc);
            //				customizeShareParams.SetImageUrl(shareImg);
            //				customizeShareParams.SetShareType(ContentType.Webpage);
            //				customizeShareParams.SetObjectID("SinaID");
            //				content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

            //Instagram
            //				ShareContent sInstagram = new ShareContent();
            //				sInstagram.SetText(shareDesc);
            //				sInstagram.SetImageUrl(shareImg);
            //				sInstagram.SetShareType(ContentType.Image);
            //				content.SetShareContentCustomize(PlatformType.Instagram, sInstagram);

            //fbfb
            ShareContent sFacebook = new ShareContent();
            sFacebook.SetText(shareTitleEn);
            sFacebook.SetTitle(shareDescEn);
            sFacebook.SetImageUrl(shareImg);
            sFacebook.SetShareType(ContentType.Webpage);
            content.SetShareContentCustomize(PlatformType.Facebook, sFacebook);

            //Twitter
            ShareContent sTwitter = new ShareContent();
            sTwitter.SetText(shareDescEn + " Download:" + shareUrl);
            sTwitter.SetImageUrl(shareImg);
            sTwitter.SetUrl(shareUrl);
            sTwitter.SetShareType(ContentType.Auto);
            content.SetShareContentCustomize(PlatformType.Twitter, sTwitter);

            PlatformType[] pfs = { PlatformType.WeChat,   PlatformType.WeChatMoments,
                                   PlatformType.Facebook,
                                   PlatformType.QQ,       PlatformType.QZone, PlatformType.Twitter };

            //通过分享菜单分享
            ssdk.ShowPlatformList(pfs, content, 100, 100);
        }
        break;

        case ExtraButtonType.EBT_MONEYINFO:
        {
            Debug.Log("Money Info Mask");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_SETTING:
        {
            Debug.Log("Setting Mask");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_REBIRTH:
        {
            Debug.Log("Rebirth");
            if (PlayerPrefs.GetInt("Money") > 0)
            {
//					Dictionary<string,string> dic = new Dictionary<string,string> ();
//					dic.Add ("amount", "1");
//					JsonData jd = NetUtil.RequestMsg (NetUtil.MsgConsumeMoney, dic);
                ssdk.gameObject.GetComponent <PlayerManager>().ConsumeMoney(1);
                ssdk.gameObject.GetComponent <CameraMove> ().RebirthPlayer();
                DataManager._waitForRebirth = false;
                DataManager._isUsedRebirth  = true;
                _mask.gameObject.SetActive(false);
            }
            else
            {
                Debug.Log("playerprefs not enough money");
                Debug.Log("Show Get money mask");
//					DataManager._waitOperate = true;
//					transform.parent.gameObject.GetComponent<RebirthMask> ()._lessMoneyTip.gameObject.SetActive (true);
                gameObject.GetComponentInParent <RebirthMask>().setLessMoneyTipMask(true);
            }
        }
        break;

        case ExtraButtonType.EBT_APPSCORE:
        {
            Debug.Log("Link to AppStore");
                                #if UNITY_IPHONE || UNITY_EDITOR
            //Debug.Log ("aaaaaaaaaaa");
            const string APP_ID = "1211127073";                    //1211127073
            var          url    = string.Format(
                "https://itunes.apple.com/app/viewContentsUserReviews/id{0}",
                APP_ID);                        //itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=
            Application.OpenURL(url);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_SKIN:
        {
            _mask.gameObject.SetActive(true);
        }
        break;
        }
    }
Exemplo n.º 16
0
    public void OnClickCallBack()
    {
        string shareUrl = "https://api.shaojishiduo.com/GameScream/share?s=" + PlayerPrefs.GetString("ShareID");

        switch (_type)
        {
        case ShareInfoButtonType.SIB_COPYLINK:
        {
            GameObject canvas = GameObject.Find("Canvas");
            GameObject tip    = GameObject.Instantiate(_copyTipPrefab, new Vector3(Screen.width / 2, Screen.height / 2, 0.0f), Quaternion.identity);
            tip.transform.SetParent(canvas.transform);
            //tip.transform.position = new Vector3 (0, 0, 0);
            ClipboardManager.CopyToClipboard("尖叫鸟!这游戏有毒,我已中毒至深,尖叫根本停不下来!你也来试试吧!" + shareUrl);
        }
        break;

        case ShareInfoButtonType.SIB_SHARELINK:
        {
            string shareTitle = "这游戏有毒,我已中毒至深,尖叫根本停不下来!";
            string shareDesc  = "与全世界一起尖叫!谁才是声控之王?是你吗?";

            string shareTitleEn = "This game is poisonous and i have been poisoned deeply! I can't stop playing and screaming!";
            string shareDescEn  = "Scream with people around the world! Who is the king of voice control? Is that you?";

            string shareSite = "尖叫鸟";
            //string shareUrl = "https://api.shaojishiduo.com/GameScream/share?s=" + PlayerPrefs.GetString("ShareID");
            string shareImg = "http://liteapp-1252384896.costj.myqcloud.com/scream/images/bird_icon_256.png";

            ShareContent content = new ShareContent();
            content.SetText(shareDesc);
            content.SetImageUrl(shareImg);
            content.SetTitle(shareTitle);
            content.SetTitleUrl(shareUrl);
            content.SetSite(shareSite);
            content.SetSiteUrl(shareUrl);
            content.SetUrl(shareUrl);
            content.SetComment(shareDesc);
            content.SetShareType(ContentType.Webpage);
            //不同平台分享不同内容
            //				ShareContent customizeShareParams = new ShareContent();
            //				customizeShareParams.SetText(shareDesc);
            //				customizeShareParams.SetImageUrl(shareImg);
            //				customizeShareParams.SetShareType(ContentType.Webpage);
            //				customizeShareParams.SetObjectID("SinaID");
            //				content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

            //Instagram
            //				ShareContent sInstagram = new ShareContent();
            //				sInstagram.SetText(shareDesc);
            //				sInstagram.SetImageUrl(shareImg);
            //				sInstagram.SetShareType(ContentType.Image);
            //				content.SetShareContentCustomize(PlatformType.Instagram, sInstagram);

            //fbfb
            ShareContent sFacebook = new ShareContent();
            sFacebook.SetText(shareTitleEn);
            sFacebook.SetTitle(shareDescEn);
            sFacebook.SetImageUrl(shareImg);
            sFacebook.SetShareType(ContentType.Webpage);
            content.SetShareContentCustomize(PlatformType.Facebook, sFacebook);

            //Twitter
            ShareContent sTwitter = new ShareContent();
            sTwitter.SetText(shareDescEn + " Download:" + shareUrl);
            sTwitter.SetImageUrl(shareImg);
            sTwitter.SetUrl(shareUrl);
            sTwitter.SetShareType(ContentType.Auto);
            content.SetShareContentCustomize(PlatformType.Twitter, sTwitter);

            PlatformType[] pfs = { PlatformType.WeChat,   PlatformType.WeChatMoments,
                                   PlatformType.Facebook,
                                   PlatformType.QQ,       PlatformType.QZone, PlatformType.Twitter };

            //通过分享菜单分享
            ssdk.ShowPlatformList(pfs, content, 100, 100);
        }
        break;
        }
    }
Exemplo n.º 17
0
    private void OnGUI()
    {
        GUI.skin = this.demoSkin;
        float num = 1f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            num = (float)(Screen.width / 320);
        }
        float num2 = 165f * num;
        float num3 = 30f * num;
        float num4 = 20f * num;
        float num5 = 20f * num;

        GUI.skin.button.fontSize = Convert.ToInt32(14f * num);
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Authorize"))
        {
            Debug.Log(this.ssdk == null);
            this.ssdk.Authorize(PlatformType.SinaWeibo);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get User Info"))
        {
            this.ssdk.GetUserInfo(PlatformType.SinaWeibo);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Show Share Menu"))
        {
            ShareContent shareContent = new ShareContent();
            shareContent.SetText("this is a test string.");
            shareContent.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent.SetTitle("test title");
            shareContent.SetTitleUrl("http://www.mob.com");
            shareContent.SetSite("Mob-ShareSDK");
            shareContent.SetSiteUrl("http://www.mob.com");
            shareContent.SetUrl("http://www.mob.com");
            shareContent.SetComment("test description");
            shareContent.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent.SetShareType(2);
            ShareContent shareContent2 = new ShareContent();
            shareContent2.SetText("Sina share content");
            shareContent2.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG");
            shareContent2.SetShareType(2);
            shareContent2.SetObjectID("SinaID");
            shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, shareContent2);
            this.ssdk.ShowPlatformList(null, shareContent, 100, 100);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Show Share View"))
        {
            ShareContent shareContent3 = new ShareContent();
            shareContent3.SetText("this is a test string.");
            shareContent3.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent3.SetTitle("test title");
            shareContent3.SetTitleUrl("http://www.mob.com");
            shareContent3.SetSite("Mob-ShareSDK");
            shareContent3.SetSiteUrl("http://www.mob.com");
            shareContent3.SetUrl("http://www.mob.com");
            shareContent3.SetComment("test description");
            shareContent3.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent3.SetShareType(2);
            this.ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, shareContent3);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Share Content"))
        {
            ShareContent shareContent4 = new ShareContent();
            shareContent4.SetText("this is a test string.");
            shareContent4.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg");
            shareContent4.SetTitle("test title");
            shareContent4.SetTitleUrl("http://www.mob.com");
            shareContent4.SetSite("Mob-ShareSDK");
            shareContent4.SetSiteUrl("http://www.mob.com");
            shareContent4.SetUrl("http://www.mob.com");
            shareContent4.SetComment("test description");
            shareContent4.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3");
            shareContent4.SetShareType(2);
            this.ssdk.ShareContent(PlatformType.SinaWeibo, shareContent4);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get Friends SinaWeibo "))
        {
            Debug.Log("Click Btn Of Get Friends SinaWeibo");
            this.ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Get Token SinaWeibo "))
        {
            Hashtable authInfo = this.ssdk.GetAuthInfo(PlatformType.SinaWeibo);
            Debug.Log("share result :");
            Debug.Log(MiniJSON.jsonEncode(authInfo));
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Close SSO Auth"))
        {
            this.ssdk.DisableSSO(true);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Remove Authorize "))
        {
            this.ssdk.CancelAuthorize(PlatformType.SinaWeibo);
        }
        if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Add Friend "))
        {
            this.ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725");
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShareWithContentName"))
        {
            Hashtable hashtable = new Hashtable();
            hashtable["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable);
        }
        num2 += 80f * num;
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareMenuWithContentName"))
        {
            Hashtable hashtable2 = new Hashtable();
            hashtable2["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShowPlatformListWithContentName("ShareSDK", hashtable2, null, 100, 100);
        }
        num4 += num3 + 20f * num;
        if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareViewWithContentName"))
        {
            Hashtable hashtable3 = new Hashtable();
            hashtable3["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg";
            this.ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable3);
        }
    }