예제 #1
0
    public void ShareRedBox(int shareType, string url, string title, string desc)
    {
        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        Texture2D texture2D = Resources.Load("Share/redbox", typeof(Texture2D)) as Texture2D;

        byte[] array = texture2D.EncodeToPNG();
        int    num   = 0;

        if (array != null)
        {
            num = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.get_Instance().GetService(1) as IApolloSnsService;

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 2)
        {
            string text = "http://image.smoba.qq.com/yywj/share_pic/redbox.png";
            apolloSnsService.SendToQQ(shareType, title, desc, url, text);
        }
        else if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 1)
        {
            apolloSnsService.SendToWeixinWithUrl(shareType, title, desc, url, "MSG_INVITE", array, num, "message Ext");
        }
    }
    public void ShareRecruitFriend(string title, string desc, string roomInfo)
    {
        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        Texture2D texture2D = Resources.Load("Share/120", typeof(Texture2D)) as Texture2D;

        byte[] array = null;
        if (texture2D)
        {
            array = texture2D.EncodeToPNG();
        }
        int imageDataLen = 0;

        if (array != null)
        {
            imageDataLen = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.Instance.GetService(1) as IApolloSnsService;

        if (apolloSnsService == null)
        {
            return;
        }
        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.QQ)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string url           = "http://youxi.vip.qq.com/m/act/b1068bb755_sgame_104290.html?_wv=1&QQ_SHARE_GAMEDATA=" + roomInfo;
                string thumbImageUrl = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                apolloSnsService.SendToQQ(ApolloShareScene.QSession, title, desc, url, thumbImageUrl);
            }
        }
        else
        {
            ApolloAccountInfo accountInfo2 = this.GetAccountInfo(false);
            if (accountInfo2 != null)
            {
                string url2 = string.Format("http://game.weixin.qq.com/cgi-bin/act?actid=4381&messageExt={0}&k=bZML6lvwyQRcCItiE6oDJg&q=0&jsapi_ticket=1#wechat_redirect", roomInfo);
                apolloSnsService.SendToWeixinWithUrl(ApolloShareScene.Session, title, desc, url2, "MSG_INVITE", array, imageDataLen, roomInfo);
            }
        }
    }
    public void ShareRedBox(int shareType, string url, string title, string desc, Texture2D tex, string imgurl)
    {
        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        byte[] array        = tex.EncodeToPNG();
        int    imageDataLen = 0;

        if (array != null)
        {
            imageDataLen = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.Instance.GetService(1) as IApolloSnsService;

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.QQ)
        {
            apolloSnsService.SendToQQ((ApolloShareScene)shareType, title, desc, url, imgurl);
        }
        else if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.Wechat)
        {
            apolloSnsService.SendToWeixinWithUrl((ApolloShareScene)shareType, title, desc, url, "MSG_INVITE", array, imageDataLen, "message Ext");
        }
    }