Esempio n. 1
0
 public void ThreadProc(object state)
 {
     do
     {
         Thread.Sleep(1000);
     }while (!this.Persistence.Initialized);
     for (;;)
     {
         try
         {
             DateTime now = TimeUtil.NowDateTime();
             Global.UpdateNowTime(now);
             if (now > this.CheckRoleTimerProcTime)
             {
                 this.CheckRoleTimerProcTime = now.AddSeconds(1.428);
                 int signUpCnt;
                 int startCnt;
                 this.CheckRoleTimerProc(now, out signUpCnt, out startCnt);
                 ClientAgentManager.Instance().SetGameTypeLoad(this.GameType, signUpCnt, startCnt);
             }
             if (now > this.SaveServerStateProcTime)
             {
                 this.SaveServerStateProcTime = now.AddSeconds(30.0);
                 if (now.Hour >= 3 && now.Hour < 4)
                 {
                     this.ClearRolePairFightCount();
                     this.Persistence.UpdateTianTiRankData(now, false, false);
                 }
             }
             if (now > this.CheckGameFuBenTime)
             {
                 this.CheckGameFuBenTime = now.AddSeconds(1000.0);
                 this.CheckGameFuBenTimerProc(now);
             }
             AsyncDataItem[] asyncEvArray = ZhengBaManagerK.Instance().Update();
             ClientAgentManager.Instance().BroadCastAsyncEvent(this.GameType, asyncEvArray);
             this.Persistence.WriteRoleInfoDataProc();
             CoupleArenaService.getInstance().Update();
             CoupleWishService.getInstance().Update();
             zhengDuoService.Instance().Update(now);
             BangHuiMatchService.Instance().Update(now);
             CompService.Instance().Update(now);
             TianTi5v5Service.ThreadProc(null);
             Zork5v5Service.Instance().Update(now);
             int sleepMS = (int)(TimeUtil.NowDateTime() - now).TotalMilliseconds;
             this.Persistence.SaveCostTime(sleepMS);
             sleepMS = 1000 - sleepMS;
             if (sleepMS < 50)
             {
                 sleepMS = 50;
             }
             Thread.Sleep(sleepMS);
         }
         catch (Exception ex)
         {
             LogManager.WriteExceptionUseCache(ex.ToString());
         }
     }
 }
Esempio n. 2
0
 public static void OnStopServer()
 {
     try
     {
         CoupleArenaService.getInstance().OnStopServer();
         CoupleWishService.getInstance().OnStopServer();
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.Message);
     }
 }
Esempio n. 3
0
 public int CoupleWishJoinParty(int fromRole, int fromZone, int toCoupleId)
 {
     return(CoupleWishService.getInstance().CoupleWishJoinParty(fromRole, fromZone, toCoupleId));
 }
Esempio n. 4
0
 public int CoupleWishAdmire(int fromRole, int fromZone, int admireType, int toCoupleId)
 {
     return(CoupleWishService.getInstance().CoupleWishAdmire(fromRole, fromZone, admireType, toCoupleId));
 }
Esempio n. 5
0
 public void CoupleWishReportCoupleStatue(CoupleWishReportStatueData req)
 {
     CoupleWishService.getInstance().CoupleWishReportCoupleStatue(req);
 }
Esempio n. 6
0
 public int CoupleWishPreDivorce(int man, int wife)
 {
     return(CoupleWishService.getInstance().CoupleWishPreDivorce(man, wife));
 }
Esempio n. 7
0
 public CoupleWishSyncData CoupleWishSyncCenterData(DateTime oldThisWeek, DateTime oldLastWeek, DateTime oldStatue)
 {
     return(CoupleWishService.getInstance().CoupleWishSyncCenterData(oldThisWeek, oldLastWeek, oldStatue));
 }
Esempio n. 8
0
 public List <CoupleWishWishRecordData> CoupleWishGetWishRecord(int roleId)
 {
     return(CoupleWishService.getInstance().CoupleWishGetWishRecord(roleId));
 }
Esempio n. 9
0
 public int CoupleWishWishRole(CoupleWishWishRoleReq req)
 {
     return(CoupleWishService.getInstance().CoupleWishWishRole(req));
 }
Esempio n. 10
0
        public void ThreadProc(object state)
        {
            Persistence.InitConfig();
            ZhengBaManagerK.Instance().InitConfig();
            DateTime lastRunTime = TimeUtil.NowDateTime();

            Persistence.LoadTianTiRankData(lastRunTime);
            ZhengBaManagerK.Instance().ReloadSyncData(lastRunTime);
            CoupleArenaService.getInstance().StartUp();
            CoupleWishService.getInstance().StartUp();

            do
            {
                try
                {
                    DateTime now = TimeUtil.NowDateTime();
                    Global.UpdateNowTime(now);

                    //处理游戏逻辑
                    if (now > CheckRoleTimerProcTime)
                    {
                        CheckRoleTimerProcTime = now.AddSeconds(CheckRoleTimerProcInterval);
                        int signUpCnt, startCnt;
                        CheckRoleTimerProc(now, out signUpCnt, out startCnt);
                        ClientAgentManager.Instance().SetGameTypeLoad(GameType, signUpCnt, startCnt);
                    }

                    if (now > SaveServerStateProcTime)
                    {
                        SaveServerStateProcTime = now.AddSeconds(SaveServerStateProcInterval);

                        if (now.Hour >= 3 && now.Hour < 4)
                        {
                            ClearRolePairFightCount();
                            Persistence.UpdateTianTiRankData(now);
                        }
                    }

                    if (now > CheckGameFuBenTime)
                    {
                        CheckGameFuBenTime = now.AddSeconds(CheckGameFuBenInterval);
                        CheckGameFuBenTimerProc(now);
                    }

                    AsyncDataItem[] asyncEvArray = ZhengBaManagerK.Instance().Update();
                    ClientAgentManager.Instance().BroadCastAsyncEvent(GameType, asyncEvArray);

                    Persistence.WriteRoleInfoDataProc();

                    CoupleArenaService.getInstance().Update();
                    CoupleWishService.getInstance().Update();

                    int sleepMS = (int)((TimeUtil.NowDateTime() - now).TotalMilliseconds);
                    Persistence.SaveCostTime(sleepMS);
                    sleepMS = 1000 - sleepMS; //最大睡眠1000ms,最少睡眠50ms
                    if (sleepMS < 50)
                    {
                        sleepMS = 50;
                    }

                    Thread.Sleep(sleepMS);
                }
                catch (System.Exception ex)
                {
                    LogManager.WriteExceptionUseCache(ex.ToString());
                }
            } while (true);
        }