Exemplo n.º 1
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo apolloAccountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == null)
        {
            apolloAccountInfo.set_OpenId(ApolloConfig.CustomOpenId);
            apolloAccountInfo.set_Platform(0);
            return(apolloAccountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref apolloAccountInfo);

        if (record == null)
        {
            if (this.CurPlatform == null && this.CurPlatform != apolloAccountInfo.get_Platform())
            {
                ApolloConfig.platform = (this.CurPlatform = apolloAccountInfo.get_Platform());
            }
            return(apolloAccountInfo);
        }
        if (record == 16 && apolloAccountInfo != null && apolloAccountInfo.get_Platform() == 1 && refreshToken)
        {
            this.accountService.remove_RefreshAtkEvent(new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent));
            this.accountService.add_RefreshAtkEvent(new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent));
            this.accountService.RefreshAccessToken();
            return(null);
        }
        return(null);
    }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo accountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == ApolloPlatform.None)
        {
            accountInfo.OpenId   = ApolloConfig.CustomOpenId;
            accountInfo.Platform = ApolloPlatform.None;
            return(accountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref accountInfo);

        if (record == ApolloResult.Success)
        {
            Debug.Log("GetAccountInfo Success");
            if (this.m_CurPlatform != accountInfo.Platform)
            {
                ApolloConfig.platform = this.m_CurPlatform = accountInfo.Platform;
            }
            return(accountInfo);
        }
        if (((record == ApolloResult.TokenInvalid) && (accountInfo != null)) && ((accountInfo.Platform == ApolloPlatform.Wechat) && refreshToken))
        {
            Debug.Log("try to refresh token");
            this.accountService.RefreshAtkEvent += new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAccessToken();
            return(null);
        }
        Debug.Log(string.Format("GetRecord Fail result is {0}", record));
        Debug.Log(string.Format("current platform is {0}", (accountInfo != null) ? ((object)accountInfo.Platform) : ((object)0)));
        return(null);
    }
Exemplo n.º 4
0
    public bool PayQQVip(string serviceCode, string serviceName, int serviceType)
    {
        if (!ApolloConfig.payEnabled)
        {
            return(false);
        }
        if (!this.InitPay())
        {
            return(false);
        }
        this.m_bPayQQVIP = true;
        ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
        Pay4MonthInfo     payInfo     = new Pay4MonthInfo();
        string            str         = MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString();

        payInfo.serviceCode     = serviceCode;
        payInfo.serviceName     = serviceName;
        payInfo.serviceType     = (APO_PAY_MONTH_TYPE)serviceType;
        payInfo.autoPay         = 0;
        payInfo.remark          = "aid=mvip.youxi.inside.yxzj_1104466820";
        payInfo.coinIcon        = 0x7f020001;
        payInfo.offerId         = ApolloConfig.offerID;
        payInfo.unit            = "ge";
        payInfo.zoneId          = str;
        payInfo.valueChangeable = 0;
        payInfo.saveValue       = "1";
        if (!this.payService.Pay(payInfo))
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Pay_Failed);

            return(false);
        }
        return(true);
    }
Exemplo n.º 5
0
    public ApolloAccountInfo GetAccountInfo(bool refreshToken = false)
    {
        ApolloAccountInfo accountInfo = new ApolloAccountInfo();

        if (ApolloConfig.platform == ApolloPlatform.None)
        {
            accountInfo.OpenId   = ApolloConfig.CustomOpenId;
            accountInfo.Platform = ApolloPlatform.None;
            return(accountInfo);
        }
        ApolloResult record = this.accountService.GetRecord(ref accountInfo);

        if (record == ApolloResult.Success)
        {
            if ((this.CurPlatform == ApolloPlatform.None) && (this.CurPlatform != accountInfo.Platform))
            {
                ApolloConfig.platform = this.CurPlatform = accountInfo.Platform;
            }
            return(accountInfo);
        }
        if (((record == ApolloResult.TokenInvalid) && (accountInfo != null)) && ((accountInfo.Platform == ApolloPlatform.Wechat) && refreshToken))
        {
            this.accountService.RefreshAtkEvent -= new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAtkEvent += new RefreshAccessTokenHandler(this.OnRefreshAccessTokenEvent);
            this.accountService.RefreshAccessToken();
            return(null);
        }
        return(null);
    }
    public bool InitPay(ApolloAccountInfo accountInfo)
    {
        string payEnv = ApolloConfig.payEnv;

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

            return(false);
        }
        if (this.payService == null)
        {
            this.payService           = (IApollo.Instance.GetService(2) as IApolloPayService);
            this.payService.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 ShareSendHeartPandroa(int actID, string openId, string title, string desc, string pic_url, string previewText, string gameTag, string extInfo, string mediaId, string messageExt)
    {
        Singleton <ApolloHelper> .GetInstance().m_bShareQQBox = false;

        if (!MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            return;
        }
        IApolloSnsService apolloSnsService = IApollo.Instance.GetService(1) as IApolloSnsService;

        MonoSingleton <ShareSys> .instance.OnShareCallBack();

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.QQ)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string targetUrl = "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=" + accountInfo.OpenId + "&ADTAG=gameobj.msg_heart";
                apolloSnsService.SendToQQGameFriend(actID, openId, title, desc, targetUrl, pic_url, previewText, gameTag, extInfo);
            }
        }
        else
        {
            apolloSnsService.SendToWXGameFriend(openId, title, desc, mediaId, messageExt, gameTag, extInfo);
        }
    }
Exemplo n.º 8
0
    public bool Pay(string quantity, string productId = "")
    {
        if (!ApolloConfig.payEnabled)
        {
            return(false);
        }
        if (!this.InitPay())
        {
            return(false);
        }
        ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
        PayInfo           payInfo     = new PayInfo();
        string            str         = MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString();

        payInfo.coinIcon        = 0x7f020001;
        payInfo.offerId         = ApolloConfig.offerID;
        payInfo.unit            = "ge";
        payInfo.zoneId          = str;
        payInfo.valueChangeable = 0;
        payInfo.saveValue       = quantity;
        if (!this.payService.Pay(payInfo))
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Pay_Failed);

            return(false);
        }
        return(true);
    }
Exemplo n.º 9
0
    private void OnLogin(ApolloPlatform platform)
    {
        if (!this.m_IsSwitchToLoginPlatform)
        {
            Singleton <CUIManager> .GetInstance().OpenSendMsgAlert(5, enUIEventID.None);

            this.m_IsSwitchToLoginPlatform = true;
            if (!this.accountService.IsPlatformInstalled(platform))
            {
                if (this.CurPlatform == ApolloPlatform.Wechat)
                {
                    Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloPlatform>(EventID.ApolloHelper_Platform_Not_Installed, ApolloPlatform.Wechat);

                    return;
                }
                if ((this.CurPlatform != ApolloPlatform.QQ) && (this.CurPlatform != ApolloPlatform.QRWechat))
                {
                    Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloPlatform>(EventID.ApolloHelper_Platform_Not_Installed, platform);

                    return;
                }
            }
            if (!this.m_IsLoginEventHandlerRegistered)
            {
                this.m_IsLoginEventHandlerRegistered = true;
                this.accountService.LoginEvent      += new AccountLoginHandle(this.OnLoginEvent);
            }
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                this.m_LastOpenID = accountInfo.OpenId;
            }
            this.accountService.Login(platform);
        }
    }
    public string GetAccessToken(ApolloPlatform platform)
    {
        string            result      = string.Empty;
        ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

        if (accountInfo != null)
        {
            for (int i = 0; i < accountInfo.TokenList.Count; i++)
            {
                ApolloToken apolloToken = accountInfo.TokenList[i];
                if (platform == ApolloPlatform.Wechat)
                {
                    if (apolloToken != null && apolloToken.Type == ApolloTokenType.Access)
                    {
                        result = apolloToken.Value;
                    }
                }
                else if ((platform == ApolloPlatform.QQ || platform == ApolloPlatform.Guest) && apolloToken != null && apolloToken.Type == ApolloTokenType.Access)
                {
                    result = apolloToken.Value;
                }
            }
        }
        return(result);
    }
Exemplo n.º 11
0
    public void ShareSendHeart(string openId, string title, string desc, string extInfo)
    {
        Singleton <ApolloHelper> .GetInstance().m_bShareQQBox = false;

        if (MonoSingleton <ShareSys> .GetInstance().IsInstallPlatform())
        {
            byte[] buffer = (Resources.Load("Share/120", typeof(Texture2D)) as Texture2D).EncodeToPNG();
            int    length = 0;
            if (buffer != null)
            {
                length = buffer.Length;
            }
            IApolloSnsService service = IApollo.Instance.GetService(1) as IApolloSnsService;
            MonoSingleton <ShareSys> .instance.OnShareCallBack();

            if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.QQ)
            {
                ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
                if (accountInfo != null)
                {
                    string targetUrl = "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=" + accountInfo.OpenId + "&ADTAG=gameobj.msg_heart";
                    string imgUrl    = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                    service.SendToQQGameFriend(1, openId, title, desc, targetUrl, imgUrl, title, "MSG_HEART_SEND", extInfo);
                }
            }
            else
            {
                service.SendToWXGameFriend(openId, title, desc, "9Wste6_dDgZtoVmC6CQTh0jj29kGEp0jrVSYrGWvtZLvSTDN9fUb-_sNjacaGITt", "messageExt", "MSG_heart_send", extInfo);
            }
        }
    }
Exemplo n.º 12
0
 public bool JudgeLoginAccountInfo(ref ApolloAccountInfo accountInfo)
 {
     if ((accountInfo.Platform == ApolloPlatform.None) && !this.IsNoneModeSupport)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 13
0
    public string GetOpenID()
    {
        ApolloAccountInfo accountInfo = this.GetAccountInfo(false);

        if (accountInfo != null)
        {
            return(accountInfo.OpenId);
        }
        return(string.Empty);
    }
Exemplo n.º 14
0
 public void TdirAsync(ApolloAccountInfo info, Action successCallBack, Action failCallBack, bool reasync)
 {
     this.preVersion   = null;
     this.isPreEnabled = false;
     this.m_info       = info;
     this.mSyncTime    = 0;
     this.SetIpAndPort();
     this.m_GetTdirTime = Time.time;
     base.StartCoroutine(this.QueryTdirAsync(info, successCallBack, failCallBack, reasync));
 }
Exemplo n.º 15
0
        private void BeginRecord(SCPKG_MULTGAME_BEGINLOAD beginLoadPkg)
        {
            this.ClearRecord();
            if (beginLoadPkg == null)
            {
                return;
            }
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .get_instance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            if (accountInfo == null)
            {
                return;
            }
            uint num = 0u;

            for (int i = 0; i < beginLoadPkg.astCampInfo.Length; i++)
            {
                CSDT_CAMPINFO cSDT_CAMPINFO = beginLoadPkg.astCampInfo[i];
                for (uint num2 = 0u; num2 < cSDT_CAMPINFO.dwPlayerNum; num2 += 1u)
                {
                    CSDT_CAMPPLAYERINFO cSDT_CAMPPLAYERINFO = cSDT_CAMPINFO.astCampPlayerInfo[(int)((UIntPtr)num2)];
                    if (Utility.UTF8Convert(cSDT_CAMPPLAYERINFO.szOpenID) == accountInfo.get_OpenId())
                    {
                        num = cSDT_CAMPPLAYERINFO.stPlayerInfo.astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                        break;
                    }
                }
                if (num > 0u)
                {
                    break;
                }
            }
            if (num > 0u)
            {
                this.recordStream = new MemoryStream(1048576);
                this.recordWriter = new BinaryWriter(this.recordStream);
                this.recordWriter.Write(CVersion.GetAppVersion());
                this.recordWriter.Write(CVersion.GetUsedResourceVersion());
                this.recordWriter.Write(CVersion.GetRevisonNumber());
                this.recordWriter.Write(num);
                this.recordWriter.Write(DateTime.get_Now().get_Ticks());
                this.recordWriter.Write(beginLoadPkg.stDeskInfo.bMapType);
                this.recordWriter.Write(beginLoadPkg.stDeskInfo.dwMapId);
                this.recordWriter.Write(masterRoleInfo.Name);
                this.recordWriter.Write(masterRoleInfo.HeadUrl);
                this.recordWriter.Write(masterRoleInfo.m_rankGrade);
                this.recordWriter.Write(masterRoleInfo.m_rankClass);
            }
        }
Exemplo n.º 16
0
    public string GetAccountInfoStr(ref ApolloAccountInfo info)
    {
        string str = "===== Account Info =====\n";

        str = ((str + string.Format("OpenId:{0}\n", info.OpenId)) + string.Format("Pf:{0}\n", info.Pf) + string.Format("PfKey:{0}\n", info.PfKey)) + string.Format("Platform:{0}\n", info.Platform) + "TokenList Begin:\n";
        foreach (ApolloToken token in info.TokenList)
        {
            str = str + string.Format("{0}:{1}\n", token.Type, token.Value);
        }
        return(str + "TokenList End:\n" + "===== Account Info =====");
    }
        public void PrepareReport()
        {
            this._eventsLoadingTime.Clear();
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            DebugHelper.Assert(accountInfo != null, "account info is null");
            this._eventsLoadingTime.Add(new KeyValuePair <string, string>("OpenID", (accountInfo != null) ? accountInfo.OpenId : "0"));
            this._eventsLoadingTime.Add(new KeyValuePair <string, string>("LevelID", Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapId.ToString()));
            this._eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPLevel", Singleton <GameContextEx> .GetInstance().IsMobaMode().ToString()));
            this._eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPMode", Singleton <GameContextEx> .GetInstance().IsMobaMode().ToString()));
            this._eventsLoadingTime.Add(new KeyValuePair <string, string>("bLevelNo", Singleton <GameContextEx> .GetInstance().GameContextSoloInfo.LevelNo.ToString()));
        }
Exemplo n.º 18
0
    public void SetUserName()
    {
        if (this.Enable)
        {
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            if (accountInfo != null)
            {
                GSDK.SetUserName(ApolloConfig.platform, accountInfo.get_OpenId());
            }
        }
    }
Exemplo n.º 19
0
    public void SetUserName()
    {
        if (this.m_bInit)
        {
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            if (accountInfo != null)
            {
                GSDK.SetUserName((int)ApolloConfig.platform, accountInfo.OpenId);
            }
        }
    }
    public static void SetUserToken()
    {
        ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

        if (accountInfo != null)
        {
            ApolloToken token = accountInfo.GetToken(ApolloTokenType.Access);
            if (token != null)
            {
                NetworkAccelerator.setUserToken(accountInfo.OpenId, token.Value);
            }
        }
    }
Exemplo n.º 21
0
        public static string GetBindQQGroupSignature()
        {
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            if (accountInfo != null)
            {
                object[] objArray1 = new object[] { accountInfo.OpenId, "_", Singleton <ApolloHelper> .GetInstance().GetAppId(), "_", Singleton <ApolloHelper> .GetInstance().GetAppKey(), "_", GetGroupGuildId(), "_", GetGuildLogicWorldId() };
                string   input     = string.Concat(objArray1);
                Debug.LogError("signature=" + input);
                return(Utility.CreateMD5Hash(input));
            }
            return(string.Empty);
        }
Exemplo n.º 22
0
        private void InitTssSdk()
        {
            int nPlatform = 1;

            if (ApolloConfig.platform == ApolloPlatform.Wechat)
            {
                nPlatform = 2;
            }
            ApolloAccountInfo accountInfo = new ApolloAccountInfo();

            IApollo.Instance.GetAccountService().GetRecord(ref accountInfo);
            this.m_OpenID = accountInfo.OpenId;
            this.CreateTssSDKSys(this.m_OpenID, nPlatform);
        }
    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 thumbDataLen = 0;

        if (array != null)
        {
            thumbDataLen = 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 = string.Concat(new string[]
                {
                    "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=",
                    accountInfo.OpenId,
                    "&ADTAG=gameobj.msg_invite&",
                    ApolloHelper.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
        {
            apolloSnsService.SendToWeixin(title, desc, "MSG_INVITE", array, thumbDataLen, roomInfo);
        }
    }
Exemplo n.º 24
0
        private void BeginRecord(SCPKG_MULTGAME_BEGINLOAD beginLoadPkg)
        {
            this.ClearRecord();
            if (beginLoadPkg != null)
            {
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

                if (masterRoleInfo != null)
                {
                    ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

                    if (accountInfo != null)
                    {
                        uint dwHeroID = 0;
                        for (int i = 0; i < beginLoadPkg.astCampInfo.Length; i++)
                        {
                            CSDT_CAMPINFO csdt_campinfo = beginLoadPkg.astCampInfo[i];
                            for (uint j = 0; j < csdt_campinfo.dwPlayerNum; j++)
                            {
                                CSDT_CAMPPLAYERINFO csdt_campplayerinfo = csdt_campinfo.astCampPlayerInfo[j];
                                if (Utility.UTF8Convert(csdt_campplayerinfo.szOpenID) == accountInfo.OpenId)
                                {
                                    dwHeroID = csdt_campplayerinfo.stPlayerInfo.astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID;
                                    break;
                                }
                            }
                            if (dwHeroID > 0)
                            {
                                break;
                            }
                        }
                        if (dwHeroID > 0)
                        {
                            this.recordStream = new MemoryStream(0x100000);
                            this.recordWriter = new BinaryWriter(this.recordStream);
                            this.recordWriter.Write(CVersion.GetAppVersion());
                            this.recordWriter.Write(CVersion.GetUsedResourceVersion());
                            this.recordWriter.Write(dwHeroID);
                            this.recordWriter.Write(DateTime.Now.Ticks);
                            this.recordWriter.Write(beginLoadPkg.stDeskInfo.bMapType);
                            this.recordWriter.Write(beginLoadPkg.stDeskInfo.dwMapId);
                            this.recordWriter.Write(masterRoleInfo.Name);
                            this.recordWriter.Write(masterRoleInfo.HeadUrl);
                            this.recordWriter.Write(masterRoleInfo.m_rankGrade);
                            this.recordWriter.Write(masterRoleInfo.m_rankClass);
                        }
                    }
                }
            }
        }
Exemplo n.º 25
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);
     }
 }
Exemplo n.º 26
0
    private void OnLoginEvent(ApolloResult loginResult, ApolloAccountInfo loginfo)
    {
        Debug.Log("OnLoginEvent called");
        this.m_IsSwitchToLoginPlatform = false;
        if (loginResult == ApolloResult.Success)
        {
            if (loginfo != null)
            {
                if ((this.m_LastOpenID != null) && (loginfo.OpenId != this.m_LastOpenID))
                {
                    Singleton <CUIManager> .GetInstance().OpenMessageBox(Singleton <CTextManager> .GetInstance().GetText("Common_Login_Different_Account_Tip_Force"), enUIEventID.Login_Change_Account_Yes, false);

                    return;
                }
                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, loginfo);
            }
        }
        else if (loginResult == ApolloResult.UserCancel)
        {
            Debug.Log("Login Fail. User cancel");
            BugLocateLogSys.Log(string.Format("Login Fail. User cancel", new object[0]));
            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Canceled);
        }
        else
        {
            Debug.Log(string.Format("Login Fail. Error code is {0}", loginResult));
            BugLocateLogSys.Log(string.Format("Login Fail. Error code is {0}", loginResult));
            List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                new KeyValuePair <string, string>("status", "1"),
                new KeyValuePair <string, string>("errorcode", loginResult.ToString())
            };
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_PlatformLogin", events, true);

            Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ApolloHelper_Login_Failed);
        }
        if (this.accountService != null)
        {
            this.accountService.LoginEvent -= new AccountLoginHandle(this.OnLoginEvent);
        }
        else
        {
            BugLocateLogSys.Log("accountService == null");
        }
        this.m_IsLoginEventHandlerRegistered = false;
        this.m_IsLoginReturn = true;
        BugLocateLogSys.Log("LoginEvent Thread:" + Thread.CurrentThread.ManagedThreadId);
    }
Exemplo n.º 27
0
 private void OnRefreshAccessTokenEvent(ApolloResult result, ListView <ApolloToken> tokenList)
 {
     if (result == ApolloResult.Success)
     {
         ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
         if ((accountInfo != null) && this.JudgeLoginAccountInfo(ref accountInfo))
         {
             Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, accountInfo);
         }
     }
     else if (tokenList != null)
     {
         for (int i = 0; i < tokenList.Count; i++)
         {
         }
     }
 }
    public string GetAccountInfoStr(ref ApolloAccountInfo info)
    {
        string text = "===== Account Info =====\n";

        text += string.Format("OpenId:{0}\n", info.OpenId);
        text += string.Format("Pf:{0}\n", info.Pf);
        text += string.Format("PfKey:{0}\n", info.PfKey);
        text += string.Format("Platform:{0}\n", info.Platform);
        text += "TokenList Begin:\n";
        foreach (ApolloToken current in info.TokenList)
        {
            text += string.Format("{0}:{1}\n", current.Type, current.Value);
        }
        text += "TokenList End:\n";
        text += "===== Account Info =====";
        return(text);
    }
    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 ShareInviteFriend(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;

        if (texture2D == null)
        {
            DebugHelper.Assert(false, "Texture2D  Share/120 == null");
            return;
        }
        byte[] array = texture2D.EncodeToPNG();
        if (array != null)
        {
            int num = array.Length;
        }
        IApolloSnsService apolloSnsService = IApollo.Instance.GetService(1) as IApolloSnsService;

        if (apolloSnsService == null)
        {
            DebugHelper.Assert(false, "IApollo.Instance.GetService(ApolloServiceType.Sns) == null");
            return;
        }
        MonoSingleton <ShareSys> .instance.OnShareCallBack();

        if (Singleton <ApolloHelper> .GetInstance().CurPlatform == ApolloPlatform.QQ)
        {
            ApolloAccountInfo accountInfo = this.GetAccountInfo(false);
            if (accountInfo != null)
            {
                string targetUrl = "http://gamecenter.qq.com/gcjump?appid=1104466820&pf=invite&from=androidqq&plat=qq&originuin=" + accountInfo.OpenId + "&ADTAG=gameobj.msg_invite";
                string imgUrl    = "http://image.smoba.qq.com/yywj/share_pic/120.png";
                apolloSnsService.SendToQQGameFriend(1, openId, title, desc, targetUrl, imgUrl, title, "MSG_INVITE", extInfo);
            }
        }
        else
        {
            apolloSnsService.SendToWXGameFriend(openId, title, desc, "9Wste6_dDgZtoVmC6CQTh0jj29kGEp0jrVSYrGWvtZLvSTDN9fUb-_sNjacaGITt", "messageExt", "MSG_INVITE", extInfo);
        }
    }