Exemple #1
0
 public void ReportBuyDianEvent()
 {
     try
     {
         if (!string.IsNullOrEmpty(this.m_curBuyDianInfo.buy_dia_channel))
         {
             List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                 new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                 new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                 new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                 new KeyValuePair <string, string>("openid", Singleton <ApolloHelper> .GetInstance().GetOpenID()),
                 new KeyValuePair <string, string>("buy_dia_channel", this.m_curBuyDianInfo.buy_dia_channel),
                 new KeyValuePair <string, string>("buy_dia_id", this.m_curBuyDianInfo.buy_dia_id),
                 new KeyValuePair <string, string>("pay_type_result", this.m_curBuyDianInfo.pay_type_result),
                 new KeyValuePair <string, string>("callback_result", this.m_curBuyDianInfo.callback_result),
                 new KeyValuePair <string, string>("apollo_stage", this.m_curBuyDianInfo.apollo_stage),
                 new KeyValuePair <string, string>("apollo_result", this.m_curBuyDianInfo.apollo_result),
                 new KeyValuePair <string, string>("buy_quantity", this.m_curBuyDianInfo.buy_quantity),
                 new KeyValuePair <string, string>("callback_time", this.m_curBuyDianInfo.call_back_time.ToString())
             };
             Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Buydia", events, true);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception.ToString());
     }
     this.m_curBuyDianInfo.clear();
 }
Exemple #2
0
 public void ReportBuyPropEvent(string buy_prop_id_result)
 {
     try
     {
         if (!string.IsNullOrEmpty(this.m_curBuyPropInfo.buy_prop_channel))
         {
             List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                 new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                 new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                 new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                 new KeyValuePair <string, string>("openid", "NULL"),
                 new KeyValuePair <string, string>("buy_prop_channel", this.m_curBuyPropInfo.buy_prop_channel),
                 new KeyValuePair <string, string>("buy_prop_id", this.m_curBuyPropInfo.buy_prop_id),
                 new KeyValuePair <string, string>("buy_quantity", this.m_curBuyPropInfo.buy_quantity),
                 new KeyValuePair <string, string>("buy_prop_way", this.m_curBuyPropInfo.buy_prop_way),
                 new KeyValuePair <string, string>("buy_prop_id_result", buy_prop_id_result)
             };
             float num = Time.time - this.m_curBuyPropInfo.buy_prop_id_time;
             events.Add(new KeyValuePair <string, string>("buy_prop_id_time", num.ToString()));
             Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Buyprop", events, true);
         }
     }
     catch (Exception exception)
     {
         Debug.Log(exception.ToString());
     }
     this.m_curBuyPropInfo.clear();
 }
Exemple #3
0
        protected override void DealConnectSucc()
        {
            if (MonoSingleton <CTongCaiSys> .instance.IsCanUseTongCai())
            {
                LookUpDNSOfServerTongcai(ApolloConfig.loginOnlyIpOrUrl, 0);
            }
            this.reconPolicy.StopPolicy();
            Singleton <ReconnectIpSelect> .instance.SetLobbySuccessUrl(base.initParam.ip);

            if (this.ConnectedEvent != null)
            {
                this.ConnectedEvent(this);
            }
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            MonoSingleton <TssdkSys> .GetInstance().OnAccountLogin();

            List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                new KeyValuePair <string, string>("openid", "NULL"),
                new KeyValuePair <string, string>("status", "0"),
                new KeyValuePair <string, string>("type", "platform"),
                new KeyValuePair <string, string>("errorCode", "SUCC")
            };

            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_SvrConnectFail", events, true);
        }
Exemple #4
0
 private static void InsertData(Version obj)
 {
     if (CheckData(obj) == false)
     {
         CVersion.Insert(obj, new DAL());
     }
     ;
 }
 public uint GetCachedResourceVersion()
 {
     if (this.m_resourcePackerInfoSet == null)
     {
         return(CVersion.GetVersionNumber(CVersion.GetVersion()));
     }
     return(CVersion.GetVersionNumber(this.m_resourcePackerInfoSet.m_version));
 }
Exemple #6
0
 public static string GetRevisonNumber()
 {
     if (CVersion.s_revisionNumber == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_revisionNumber);
 }
Exemple #7
0
 public static string GetBuildNumber()
 {
     if (CVersion.s_buildNumber == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_buildNumber);
 }
Exemple #8
0
 public static string GetPublish()
 {
     if (CVersion.s_publish == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_publish);
 }
Exemple #9
0
 public static string GetCodeVersion()
 {
     if (CVersion.s_codeVersion == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_codeVersion);
 }
Exemple #10
0
 public static string GetResourceVersion()
 {
     if (CVersion.s_resourceVersion == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_resourceVersion);
 }
Exemple #11
0
 public static string GetiOSBundleVersion()
 {
     if (CVersion.s_iOSBundleVersion == null)
     {
         CVersion.Initialize();
     }
     return(CVersion.s_iOSBundleVersion);
 }
Exemple #12
0
 public static int GetAndroidVersionCode()
 {
     if (CVersion.s_androidVersionCode == null)
     {
         CVersion.Initialize();
     }
     return(int.Parse(CVersion.s_androidVersionCode.Trim()));
 }
        public string SearchVersionJsonContent(int Versionid)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢指定筆記內容
            CVersion myVersion = CVersionFactory.fn筆記版本控制查詢用VersionID查(Versionid).FirstOrDefault();

            return(myVersion.fJsonContent);
        }
        private void WriteHeader(Stream sm, byte flags)
        {
            BinaryWriter binaryWriter = new BinaryWriter(sm);
            uint         num          = 0u;

            uint.TryParse(CVersion.GetRevisonNumber(), ref num);
            binaryWriter.Write(num);
            binaryWriter.Write(flags);
            sm.Flush();
        }
        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);
            }
        }
        public bool BeginReplay(string path, bool generateReplayLog = true)
        {
            if (!File.Exists(path))
            {
                this.isReplay = false;
                return(false);
            }
            bool result;

            try
            {
                this.streamPath   = path;
                this.isReplayAbc  = path.EndsWith(".abc");
                this.replayStream = new FileStream(path, 3, 1);
                this.replayReader = new BinaryReader(this.replayStream);
                if (this.isReplayAbc)
                {
                    string text  = this.replayReader.ReadString();
                    string text2 = this.replayReader.ReadString();
                    if (!CVersion.IsSynchronizedVersion(text, text2))
                    {
                        this.replayReader.Close();
                        this.replayStream.Close();
                        throw new Exception("ABC version not match!");
                    }
                    this.replayReader.ReadString();
                    this.replayReader.ReadUInt32();
                    this.replayReader.ReadInt64();
                    this.replayReader.ReadByte();
                    this.replayReader.ReadUInt32();
                    this.replayReader.ReadString();
                    this.replayReader.ReadString();
                    this.replayReader.ReadByte();
                    this.replayReader.ReadUInt32();
                }
                else
                {
                    this.bufferUsedSize = 0;
                }
                this.isReplay = true;
                result        = true;
            }
            catch (Exception)
            {
                this.replayStream = null;
                this.replayReader = null;
                this.isReplay     = false;
                result            = false;
            }
            return(result);
        }
Exemple #17
0
        private uint onTryReconnect(uint nCount, uint nMax)
        {
            if ((this.curNetworkReachability != Application.internetReachability) && MonoSingleton <CTongCaiSys> .instance.isTongCaiValid)
            {
                string connectUrl = Singleton <ReconnectIpSelect> .instance.GetConnectUrl(ConnectorType.Relay, nCount);

                base.initParam.SetVip(connectUrl);
                this.curNetworkReachability = Application.internetReachability;
            }
            if (nCount >= 2)
            {
                try
                {
                    MonoSingleton <Reconnection> .GetInstance().ShowReconnectMsgAlert(((int)nCount) - 1, ((int)nMax) - 1);
                }
                catch (Exception exception)
                {
                    object[] inParameters = new object[] { exception.Message, exception.StackTrace };
                    DebugHelper.Assert(false, "Exception In GameConnector Try Reconnect, {0} {1}", inParameters);
                }
            }
            if (nCount == 2)
            {
                List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                    new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                    new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                    new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                    new KeyValuePair <string, string>("ping", Singleton <FrameSynchr> .instance.GameSvrPing.ToString())
                };
                if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
                {
                    events.Add(new KeyValuePair <string, string>("Network", "3G or 4G"));
                }
                else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
                {
                    events.Add(new KeyValuePair <string, string>("Network", "WIFI"));
                }
                else
                {
                    events.Add(new KeyValuePair <string, string>("Network", "NoSignal"));
                }
                events.Add(new KeyValuePair <string, string>("FrameNum", Singleton <FrameSynchr> .instance.CurFrameNum.ToString()));
                events.Add(new KeyValuePair <string, string>("IsFighting", Singleton <BattleLogic> .instance.isFighting.ToString()));
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("GameConnector.onTryReconnect", events, true);
            }
            NetworkModule instance = Singleton <NetworkModule> .GetInstance();

            instance.m_GameReconnetCount++;
            return(nCount);
        }
Exemple #18
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);
                        }
                    }
                }
            }
        }
Exemple #19
0
        private void writeVersion()
        {
            updateVer.Clear();

            CVersion ver = null;

            ver           = new CVersion();
            ver.level     = (int)ELevel.主题;
            ver.upDate    = "2019/11/12";
            ver.upContext = "自动烧机测试线(USB充电器自动生产线)1套" + "[AUTO-CSX-YH190901-1]";
            ver.upVer     = "V1.0.0";
            ver.upAthour  = "kp.lin";
            updateVer.Add(ver);
        }
Exemple #20
0
        private void writeVersion()
        {
            updateVer.Clear();

            CVersion ver = null;

            ver           = new CVersion();
            ver.level     = (int)ELevel.主题;
            ver.upDate    = "2019/11/12";
            ver.upContext = "深圳坤兴自动老化测试线" + "[AUTO-CSX-KX191101-2]";
            ver.upVer     = "V1.0.0";
            ver.upAthour  = "kp.lin";
            updateVer.Add(ver);
        }
        public ListView <GameReplayModule.ReplayFileInfo> ListReplayFiles(bool removeObsolete = true)
        {
            ListView <GameReplayModule.ReplayFileInfo> listView = new ListView <GameReplayModule.ReplayFileInfo>();
            string        replayFolder  = GameReplayModule.ReplayFolder;
            DirectoryInfo directoryInfo = new DirectoryInfo(replayFolder);

            if (directoryInfo.get_Exists())
            {
                string[] files = Directory.GetFiles(directoryInfo.get_FullName(), "*.abc", 0);
                for (int i = 0; i < files.Length; i++)
                {
                    try
                    {
                        string       text         = files[i];
                        FileStream   fileStream   = new FileStream(text, 3, 1);
                        BinaryReader binaryReader = new BinaryReader(fileStream);
                        string       text2        = binaryReader.ReadString();
                        string       text3        = binaryReader.ReadString();
                        bool         flag         = false;
                        if (CVersion.IsSynchronizedVersion(text2, text3))
                        {
                            binaryReader.ReadString();
                            listView.Add(new GameReplayModule.ReplayFileInfo
                            {
                                path          = text,
                                heroId        = binaryReader.ReadUInt32(),
                                startTime     = binaryReader.ReadInt64(),
                                mapType       = binaryReader.ReadByte(),
                                mapId         = binaryReader.ReadUInt32(),
                                userName      = binaryReader.ReadString(),
                                userHead      = binaryReader.ReadString(),
                                userRankGrade = binaryReader.ReadByte(),
                                userRankClass = binaryReader.ReadUInt32()
                            });
                            flag = true;
                        }
                        binaryReader.Close();
                        fileStream.Close();
                        if (!flag && removeObsolete)
                        {
                            File.Delete(text);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(listView);
        }
Exemple #22
0
    public void Event_ApplicationPause(bool pause)
    {
        if (Singleton <BattleLogic> .instance.isRuning)
        {
            return;
        }
        List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

        list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
        list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
        list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
        list.Add(new KeyValuePair <string, string>("openid", "NULL"));
        list.Add(new KeyValuePair <string, string>("GameType", Singleton <GameBuilder> .GetInstance().m_kGameType.ToString()));
        list.Add(new KeyValuePair <string, string>("MapID", Singleton <GameBuilder> .GetInstance().m_iMapId.ToString()));
        list.Add(new KeyValuePair <string, string>("Status", pause.ToString()));
        if (pause)
        {
            BeaconHelper.m_Time = Time.time;
            list.Add(new KeyValuePair <string, string>("PauseTime", string.Empty));
        }
        else
        {
            list.Add(new KeyValuePair <string, string>("PauseTime", (Time.time - BeaconHelper.m_Time).ToString()));
            BeaconHelper.m_Time = 0f;
        }
        string text  = string.Empty;
        string text2 = string.Empty;

        if (Singleton <BattleLogic> .instance.isRuning && Singleton <BattleLogic> .GetInstance().battleStat != null)
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat != null)
            {
                if (campStat.ContainsKey(1u) && Singleton <GamePlayerCenter> .instance.GetHostPlayer() != null && Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1)
                {
                    text = campStat[1u].campScore.ToString();
                }
                if (campStat.ContainsKey(2u))
                {
                    text2 = campStat[2u].campScore.ToString();
                }
            }
        }
        list.Add(new KeyValuePair <string, string>("MyScore", text));
        list.Add(new KeyValuePair <string, string>("EnemyScore", text2));
        list.Add(new KeyValuePair <string, string>("RoomID", string.Empty));
        Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_ApplicationPause", list, true);
    }
Exemple #23
0
    public void Login(ApolloPlatform platform, ulong uin = 0, string pwd = null)
    {
        switch (platform)
        {
        case ApolloPlatform.None:
        {
            if (ApolloConfig.CustomOpenId == null)
            {
            }
            ApolloResult result = NoneAccountService.Initialize(new NoneAccountInitInfo(ApolloConfig.CustomOpenId));
            if (result == ApolloResult.Success)
            {
                break;
            }
            List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
                new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
                new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
                new KeyValuePair <string, string>("openid", "NULL")
            };
            float num = Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime;

            events.Add(new KeyValuePair <string, string>("totaltime", num.ToString()));
            events.Add(new KeyValuePair <string, string>("errorcode", result.ToString()));
            events.Add(new KeyValuePair <string, string>("error_msg", "null"));
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", events, true);

            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, result);

            return;
        }

        case ApolloPlatform.WTLogin:
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, ApolloResult.Empty);

            return;
        }
        ApolloConfig.Uin      = uin;
        ApolloConfig.Password = pwd;
        ApolloConfig.platform = this.CurPlatform = platform;
        if ((ApolloConfig.platform == ApolloPlatform.None) && this.IsNoneModeSupport)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, this.GetAccountInfo(false));
        }
        else
        {
            this.OnLogin(platform);
        }
    }
        protected override void DealConnectError(ApolloResult result)
        {
            this.lastResult = result;
            this.reconPolicy.StartPolicy(result, 10);
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
            list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
            list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
            list.Add(new KeyValuePair <string, string>("openid", "NULL"));
            list.Add(new KeyValuePair <string, string>("status", "0"));
            list.Add(new KeyValuePair <string, string>("type", "platform"));
            list.Add(new KeyValuePair <string, string>("errorCode", result.ToString()));
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_SvrConnectFail", list, true);
        }
Exemple #25
0
        public ListView <ReplayFileInfo> ListReplayFiles(bool removeObsolete = true)
        {
            ListView <ReplayFileInfo> view = new ListView <ReplayFileInfo>();
            DirectoryInfo             info = new DirectoryInfo(ReplayFolder);

            if (info.Exists)
            {
                string[] strArray = Directory.GetFiles(info.FullName, "*.abc", SearchOption.TopDirectoryOnly);
                for (int i = 0; i < strArray.Length; i++)
                {
                    try
                    {
                        string       path                = strArray[i];
                        FileStream   input               = new FileStream(path, FileMode.Open, FileAccess.Read);
                        BinaryReader reader              = new BinaryReader(input);
                        string       appVersion          = reader.ReadString();
                        string       usedResourceVersion = reader.ReadString();
                        bool         flag                = false;
                        if (CVersion.IsSynchronizedVersion(appVersion, usedResourceVersion))
                        {
                            ReplayFileInfo item = new ReplayFileInfo {
                                path          = path,
                                heroId        = reader.ReadUInt32(),
                                startTime     = reader.ReadInt64(),
                                mapType       = reader.ReadByte(),
                                mapId         = reader.ReadUInt32(),
                                userName      = reader.ReadString(),
                                userHead      = reader.ReadString(),
                                userRankGrade = reader.ReadByte(),
                                userRankClass = reader.ReadUInt32()
                            };
                            view.Add(item);
                            flag = true;
                        }
                        reader.Close();
                        input.Close();
                        if (!flag && removeObsolete)
                        {
                            File.Delete(path);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(view);
        }
        protected override void DealConnectFail(ApolloResult result, ApolloLoginInfo loginInfo)
        {
            this.reconPolicy.StartPolicy(result, 6);
            MonoSingleton <Reconnection> .get_instance().QueryIsRelayGaming(result);

            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
            list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
            list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
            list.Add(new KeyValuePair <string, string>("openid", "NULL"));
            list.Add(new KeyValuePair <string, string>("status", "0"));
            list.Add(new KeyValuePair <string, string>("type", "challenge"));
            list.Add(new KeyValuePair <string, string>("errorCode", result.ToString()));
            Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_SvrConnectFail", list, true);
        }
Exemple #27
0
    public void Login(ApolloPlatform platform, ulong uin = 0uL, string pwd = null)
    {
        switch (platform)
        {
        case 0:
        {
            if (ApolloConfig.CustomOpenId == null)
            {
            }
            ApolloResult apolloResult = NoneAccountService.Initialize(new NoneAccountInitInfo(ApolloConfig.CustomOpenId));
            if (apolloResult != null)
            {
                List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();
                list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
                list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
                list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
                list.Add(new KeyValuePair <string, string>("openid", "NULL"));
                list.Add(new KeyValuePair <string, string>("totaltime", (Time.time - Singleton <CLoginSystem> .GetInstance().m_fLoginClickTime).ToString()));
                list.Add(new KeyValuePair <string, string>("errorCode", apolloResult.ToString()));
                list.Add(new KeyValuePair <string, string>("error_msg", "null"));
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_Login_MSDKClientAuth", list, true);

                Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, apolloResult);

                return;
            }
            break;
        }

        case 3:
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloResult>(EventID.ApolloHelper_Login_Failed, 7);

            return;
        }
        ApolloConfig.Uin      = uin;
        ApolloConfig.Password = pwd;
        this.CurPlatform      = platform;
        ApolloConfig.platform = platform;
        if (ApolloConfig.platform == null && this.IsNoneModeSupport)
        {
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ApolloAccountInfo>(EventID.ApolloHelper_Login_Success, this.GetAccountInfo(false));
        }
        else
        {
            this.OnLogin(platform);
        }
    }
        private uint onTryReconnect(uint nCount, uint nMax)
        {
            string connectUrl = Singleton <ReconnectIpSelect> .get_instance().GetConnectUrl(ConnectorType.Relay, nCount);

            this.initParam.SetVip(connectUrl);
            if (nCount >= 2u)
            {
                try
                {
                    MonoSingleton <Reconnection> .GetInstance().ShowReconnectMsgAlert((int)(nCount - 1u), (int)(nMax - 1u));
                }
                catch (Exception ex)
                {
                    DebugHelper.Assert(false, "Exception In GameConnector Try Reconnect, {0} {1}", new object[]
                    {
                        ex.get_Message(),
                        ex.get_StackTrace()
                    });
                }
            }
            if (nCount == 2u)
            {
                List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();
                list.Add(new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()));
                list.Add(new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()));
                list.Add(new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()));
                list.Add(new KeyValuePair <string, string>("ping", Singleton <FrameSynchr> .get_instance().GameSvrPing.ToString()));
                if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
                {
                    list.Add(new KeyValuePair <string, string>("Network", "3G or 4G"));
                }
                else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
                {
                    list.Add(new KeyValuePair <string, string>("Network", "WIFI"));
                }
                else
                {
                    list.Add(new KeyValuePair <string, string>("Network", "NoSignal"));
                }
                list.Add(new KeyValuePair <string, string>("FrameNum", Singleton <FrameSynchr> .get_instance().CurFrameNum.ToString()));
                list.Add(new KeyValuePair <string, string>("IsFighting", Singleton <BattleLogic> .get_instance().isFighting.ToString()));
                Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("GameConnector.onTryReconnect", list, true);
            }
            Singleton <NetworkModule> .GetInstance().m_GameReconnetCount++;

            return(nCount);
        }
Exemple #29
0
 public bool BeginReplay(string path, bool generateReplayLog = true)
 {
     if (!File.Exists(path))
     {
         this.isReplay = false;
         return(false);
     }
     try
     {
         this.streamPath   = path;
         this.isReplayAbc  = path.EndsWith(".abc");
         this.replayStream = new FileStream(path, FileMode.Open, FileAccess.Read);
         this.replayReader = new BinaryReader(this.replayStream);
         if (this.isReplayAbc)
         {
             string appVersion          = this.replayReader.ReadString();
             string usedResourceVersion = this.replayReader.ReadString();
             if (!CVersion.IsSynchronizedVersion(appVersion, usedResourceVersion))
             {
                 this.replayReader.Close();
                 this.replayStream.Close();
                 throw new Exception("ABC version not match!");
             }
             this.replayReader.ReadUInt32();
             this.replayReader.ReadInt64();
             this.replayReader.ReadByte();
             this.replayReader.ReadUInt32();
             this.replayReader.ReadString();
             this.replayReader.ReadString();
             this.replayReader.ReadByte();
             this.replayReader.ReadUInt32();
         }
         else
         {
             this.bufferUsedSize = 0;
         }
         this.isReplay = true;
         return(true);
     }
     catch (Exception)
     {
         this.replayStream = null;
         this.replayReader = null;
         this.isReplay     = false;
         return(false);
     }
 }
Exemple #30
0
    public void Event_ApplicationPause(bool pause)
    {
        List <KeyValuePair <string, string> > events = new List <KeyValuePair <string, string> > {
            new KeyValuePair <string, string>("g_version", CVersion.GetAppVersion()),
            new KeyValuePair <string, string>("WorldID", MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()),
            new KeyValuePair <string, string>("platform", Singleton <ApolloHelper> .GetInstance().CurPlatform.ToString()),
            new KeyValuePair <string, string>("openid", "NULL"),
            new KeyValuePair <string, string>("GameType", Singleton <GameBuilder> .GetInstance().m_kGameType.ToString()),
            new KeyValuePair <string, string>("MapID", Singleton <GameBuilder> .GetInstance().m_iMapId.ToString()),
            new KeyValuePair <string, string>("Status", pause.ToString())
        };

        if (pause)
        {
            m_Time = Time.time;
            events.Add(new KeyValuePair <string, string>("PauseTime", string.Empty));
        }
        else
        {
            float num = Time.time - m_Time;
            events.Add(new KeyValuePair <string, string>("PauseTime", num.ToString()));
            m_Time = 0f;
        }
        string str  = string.Empty;
        string str2 = string.Empty;

        if (Singleton <BattleLogic> .instance.isRuning && (Singleton <BattleLogic> .GetInstance().battleStat != null))
        {
            DictionaryView <uint, CampInfo> campStat = Singleton <BattleLogic> .GetInstance().battleStat.GetCampStat();

            if (campStat != null)
            {
                if ((campStat.ContainsKey(1) && (Singleton <GamePlayerCenter> .instance.GetHostPlayer() != null)) && (Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1))
                {
                    str = campStat[1].campScore.ToString();
                }
                if (campStat.ContainsKey(2))
                {
                    str2 = campStat[2].campScore.ToString();
                }
            }
        }
        events.Add(new KeyValuePair <string, string>("MyScore", str));
        events.Add(new KeyValuePair <string, string>("EnemyScore", str2));
        events.Add(new KeyValuePair <string, string>("RoomID", string.Empty));
        Singleton <ApolloHelper> .GetInstance().ApolloRepoertEvent("Service_ApplicationPause", events, true);
    }