public ApolloHelper()
 {
     this.info = new ApolloInfo(ApolloConfig.QQAppID, ApolloConfig.WXAppID, ApolloConfig.maxMessageBufferSize, string.Empty);
     IApollo.get_Instance().Initialize(this.info);
     IApollo.get_Instance().SetApolloLogger(5, null);
     this.accountService                  = IApollo.get_Instance().GetAccountService();
     this.payService                      = null;
     this.registerInfo                    = new RegisterInfo();
     this.snsService                      = (IApollo.get_Instance().GetService(1) as IApolloSnsService);
     this.reportService                   = (IApollo.get_Instance().GetService(3) as IApolloReportService);
     this.quickLoginService               = (IApollo.get_Instance().GetService(7) as IApolloQuickLoginService);
     this.m_IsSwitchToLoginPlatform       = false;
     this.m_IsLoginEventHandlerRegistered = false;
     this.m_IsLoginReturn                 = false;
     this.CurPlatform                     = 0;
     this.m_LastOpenID                    = null;
     this.m_LastTriedPlatform             = 0;
     this.m_IsLastTriedPlatformSet        = false;
     if (File.Exists(Application.persistentDataPath + "/customOpenId.txt"))
     {
         this.IsNoneModeSupport = true;
     }
     else
     {
         this.IsNoneModeSupport = false;
     }
 }
    public bool GetMySnsInfo(OnRelationNotifyHandle handler)
    {
        if (this.GetAccountInfo(false) == null)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Need_Login);

            return(false);
        }
        if (this.snsService == null)
        {
            this.snsService = (IApollo.get_Instance().GetService(1) as IApolloSnsService);
            if (this.snsService == null)
            {
                return(false);
            }
        }
        this.snsService.remove_onRelationEvent(handler);
        this.snsService.add_onRelationEvent(handler);
        switch (Singleton <ApolloHelper> .GetInstance().CurPlatform)
        {
        case 1:
            return(this.snsService.QueryMyInfo(1));

        case 2:
        case 3:
            return(this.snsService.QueryMyInfo(2));

        default:
            return(false);
        }
    }
    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 ShareQQBox(string actID, string boxID, string title, string desc)
    {
        Singleton <ApolloHelper> .GetInstance().m_bShareQQBox = false;

        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        Texture2D texture2D = Resources.Load("Share/120", typeof(Texture2D)) as Texture2D;

        byte[] array = texture2D.EncodeToPNG();
        if (array != null)
        {
            int num = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.get_Instance().GetService(1) as IApolloSnsService;

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 2)
        {
            this.m_bShareQQBox = true;
            string text  = string.Format("http://gamecenter.qq.com/giftbox/release/index/grap.html?actid={0}&_wv=1031&boxid={1}&appid={2}", actID, boxID, ApolloConfig.appID);
            string text2 = "http://image.smoba.qq.com/yywj/share_pic/120.png";
            apolloSnsService.SendToQQ(2, title, desc, text, text2);
        }
    }
    public void ShareSendHeart(string openId, string title, string desc, string extInfo)
    {
        Singleton <ApolloHelper> .GetInstance().m_bShareQQBox = false;

        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        Texture2D texture2D = Resources.Load("Share/120", typeof(Texture2D)) as Texture2D;

        byte[] array = texture2D.EncodeToPNG();
        if (array != null)
        {
            int num = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.get_Instance().GetService(1) as IApolloSnsService;

        MonoSingleton <ShareSys> .get_instance().OnShareCallBack();

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 2)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string text  = "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=" + accountInfo.get_OpenId() + "&ADTAG=gameobj.msg_heart";
                string text2 = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                apolloSnsService.SendToQQGameFriend(1, openId, title, desc, text, text2, title, "MSG_HEART_SEND", extInfo);
            }
        }
        else
        {
            apolloSnsService.SendToWXGameFriend(openId, title, desc, "9Wste6_dDgZtoVmC6CQTh0jj29kGEp0jrVSYrGWvtZLvSTDN9fUb-_sNjacaGITt", "messageExt", "MSG_heart_send", extInfo);
        }
    }
    public void OpenWeiXinDeeplink(int linkType, string url)
    {
        IApolloCommonService apolloCommonService = IApollo.get_Instance().GetService(8) as IApolloCommonService;

        if (apolloCommonService != null)
        {
            string text = "INDEX";
            if (linkType == 0)
            {
                text = "INDEX";
            }
            else if (linkType == 1)
            {
                text = "DETAIL";
            }
            else if (linkType == 2)
            {
                text = "LIBRARY";
            }
            else if (linkType == 3)
            {
                text = url;
            }
            apolloCommonService.OpenWeiXinDeeplink(text);
        }
    }
 public void GetNoticeData(int type, string scene)
 {
     try
     {
         INotice          notice           = IApollo.get_Instance().GetService(5) as INotice;
         ApolloNoticeInfo apolloNoticeInfo = new ApolloNoticeInfo();
         notice.GetNoticeData(type, scene, ref apolloNoticeInfo);
         for (int i = 0; i < apolloNoticeInfo.get_DataList().get_Count(); i++)
         {
             ApolloNoticeData apolloNoticeData = apolloNoticeInfo.get_DataList().get_Item(i);
         }
         NoticeSys.NOTICE_STATE noticeState = NoticeSys.NOTICE_STATE.LOGIN_Before;
         if (scene == "1")
         {
             noticeState = NoticeSys.NOTICE_STATE.LOGIN_Before;
         }
         else if (scene == "2")
         {
             noticeState = NoticeSys.NOTICE_STATE.LOGIN_After;
         }
         MonoSingleton <NoticeSys> .GetInstance().OnOpenForm(apolloNoticeInfo, noticeState);
     }
     catch (Exception ex)
     {
         DebugHelper.Assert(false, "Error In GetNoticeData, {0}", new object[]
         {
             ex.get_Message()
         });
     }
 }
    public bool InitPay()
    {
        string payEnv = ApolloConfig.payEnv;

        if (this.GetAccountInfo(false) == null)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Need_Login);

            return(false);
        }
        if (this.payService == null)
        {
            this.payService = (IApollo.get_Instance().GetService(2) as IApolloPayService);
            this.payService.add_PayEvent(new OnApolloPaySvrEvenHandle(this.OnPaySuccess));
        }
        this.registerInfo.environment = payEnv;
        this.registerInfo.enableLog   = 1;
        if (this.payService.Initialize(this.registerInfo))
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Pay_Init_Success);

            return(true);
        }
        Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Pay_Init_Failed);

        return(false);
    }
 public void ApolloRepoertEvent(string eventName, List <KeyValuePair <string, string> > events, bool isReal)
 {
     try
     {
         IApolloReportService apolloReportService = IApollo.get_Instance().GetService(3) as IApolloReportService;
         apolloReportService.ApolloRepoertEvent(eventName, events, isReal);
     }
     catch (Exception var_1_20)
     {
     }
 }
Exemple #10
0
 public void DestroyConnector()
 {
     if (this.connector != null)
     {
         this.connector.remove_ConnectEvent(new ConnectEventHandler(this.onConnectEvent));
         this.connector.remove_DisconnectEvent(new DisconnectEventHandler(this.onDisconnectEvent));
         this.connector.remove_ReconnectEvent(new ReconnectEventHandler(this.onReconnectEvent));
         this.connector.remove_ErrorEvent(new ConnectorErrorEventHandler(this.onConnectError));
         this.connector.Disconnect();
         IApollo.get_Instance().DestroyApolloConnector(this.connector);
         this.connector = null;
         this.connected = false;
     }
 }
Exemple #11
0
    public void InviteFriendToRoom(string title, string desc, string roomInfo)
    {
        Singleton <ApolloHelper> .GetInstance().m_bShareQQBox = false;

        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 num = 0;

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

        if (apolloSnsService == null)
        {
            return;
        }
        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 2)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string text = string.Concat(new string[]
                {
                    "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=",
                    accountInfo.get_OpenId(),
                    "&ADTAG=gameobj.msg_invite&",
                    ApolloHelper.QQ_SHARE_GAMEDATA,
                    "=",
                    roomInfo
                });
                string text2 = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                apolloSnsService.SendToQQ(2, title, desc, text, text2);
            }
        }
        else
        {
            apolloSnsService.SendToWeixin(title, desc, "MSG_INVITE", array, num, roomInfo);
        }
    }
Exemple #12
0
 private void InitTssSdk()
 {
     if (this.bEnableTSS)
     {
         int nPlatform = 1;
         if (ApolloConfig.platform == 1)
         {
             nPlatform = 2;
         }
         ApolloAccountInfo apolloAccountInfo = new ApolloAccountInfo();
         IApollo.get_Instance().GetAccountService().GetRecord(ref apolloAccountInfo);
         this.m_OpenID = apolloAccountInfo.get_OpenId();
         this.CreateTssSDKSys(this.m_OpenID, nPlatform);
     }
 }
Exemple #13
0
    public int GetChannelID()
    {
        IApolloCommonService apolloCommonService = IApollo.get_Instance().GetService(8) as IApolloCommonService;

        if (apolloCommonService == null)
        {
            return(0);
        }
        string channelId = apolloCommonService.GetChannelId();
        int    result    = 0;
        bool   flag      = int.TryParse(channelId, ref result);

        if (flag)
        {
            return(result);
        }
        return(0);
    }
Exemple #14
0
    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 num = 0;

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

        if (apolloSnsService == null)
        {
            return;
        }
        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == 2)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string text  = "http://youxi.vip.qq.com/m/act/b1068bb755_sgame_104290.html?_wv=1&QQ_SHARE_GAMEDATA=" + roomInfo;
                string text2 = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                apolloSnsService.SendToQQ(2, title, desc, text, text2);
            }
        }
        else
        {
            apolloSnsService.SendToWeixin(title, desc, "MSG_INVITE", array, num, roomInfo);
        }
    }
Exemple #15
0
 public bool CreateConnector(ConnectorParam param)
 {
     this.DestroyConnector();
     if (param == null)
     {
         return(false);
     }
     this.initParam = param;
     this.connected = false;
     this.connector = IApollo.get_Instance().CreateApolloConnection(ApolloConfig.platform, 16777215u, param.url);
     if (this.connector == null)
     {
         return(false);
     }
     Console.WriteLine("Create Connect Entered!{0}  {1}", ApolloConfig.platform, param.url);
     this.connector.add_ConnectEvent(new ConnectEventHandler(this.onConnectEvent));
     this.connector.add_DisconnectEvent(new DisconnectEventHandler(this.onDisconnectEvent));
     this.connector.add_ReconnectEvent(new ReconnectEventHandler(this.onReconnectEvent));
     this.connector.add_ErrorEvent(new ConnectorErrorEventHandler(this.onConnectError));
     this.connector.SetSecurityInfo(param.enc, param.keyMaking, ConnectorParam.DH);
     return(this.connector.Connect(BaseConnector.connectTimeout) == null);
 }
Exemple #16
0
    public List <string> GetNoticeUrl(int type, string scene)
    {
        List <string> list = new List <string>();

        if (Singleton <BattleLogic> .GetInstance().isRuning)
        {
            return(list);
        }
        INotice          notice           = IApollo.get_Instance().GetService(5) as INotice;
        ApolloNoticeInfo apolloNoticeInfo = new ApolloNoticeInfo();

        notice.GetNoticeData(type, scene, ref apolloNoticeInfo);
        for (int i = 0; i < apolloNoticeInfo.get_DataList().get_Count(); i++)
        {
            ApolloNoticeData apolloNoticeData = apolloNoticeInfo.get_DataList().get_Item(i);
            if (apolloNoticeData.get_ContentType() == 2)
            {
                list.Add(apolloNoticeData.get_ContentUrl());
            }
        }
        return(list);
    }
Exemple #17
0
    public void ReportCatchExcption(Exception e)
    {
        IApolloReportService apolloReportService = IApollo.get_Instance().GetService(3) as IApolloReportService;

        apolloReportService.HandleException(e);
    }
Exemple #18
0
    public void HideScrollNotice()
    {
        INotice notice = IApollo.get_Instance().GetService(5) as INotice;

        notice.HideNotice();
    }