void Init()
        {
            var        cache   = new ShareCacheStruct <ShareRealItemCnt>();
            List <int> itemIds = GameConfigMgr.Instance().getHappyDataKeys();

            memoryRealInfoDataModel.HappyData hd = null;
            for (int i = 0; i < itemIds.Count; ++i)
            {
                if (null == cache.FindKey(itemIds[i])) // first add
                {
                    ShareRealItemCnt sric = new ShareRealItemCnt();
                    hd          = GameConfigMgr.Instance().getHappyData(itemIds[i]);
                    sric.itemID = hd.itemID;
                    sric.num    = hd.RefleshNum;
                    cache.Add(sric);
                }
            }

            string timestr = GameConfigMgr.Instance().getString("timer_item_cnt", "600000,600000");

            string[] tt = timestr.Split(',');
            int      b0 = int.Parse(tt[0]);
            int      b1 = int.Parse(tt[1]);

            TimerMgr.Singleton().add(typeof(RealItemCntUpdate).ToString(), actionrealItemCnt, b0, b1);

            bool openDebug = GameConfigMgr.Instance().getInt("timer_open_debug", 0) == 1;

            if (openDebug)
            {
                timestr = GameConfigMgr.Instance().getString("time_hdm_cnt", "600000,600000");
                tt      = timestr.Split(',');
                b0      = int.Parse(tt[0]);
                b1      = int.Parse(tt[1]);
                TimerMgr.Singleton().add("HappyModeData_EnterNum", action_HappyModeData_enterNum, b0, b1);
            }
            else
            {
                //每天05点执行
                try
                {
                    timestr = GameConfigMgr.Instance().getString("time_hdm_cnt_timming", "05:15");
                }
                catch
                {
                    timestr = "05:15";
                }
                TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryDayExecute, "EveryDayTask", timestr));
                ConsoleLog.showNotifyInfo("HappyModeData_EnterNum begin:" + timestr);
            }
        }
示例#2
0
        void init()
        {
            bool openDebug = GameConfigMgr.Instance().getInt("timer_open_debug", 0) == 1;

            if (openDebug)
            {
                string   debugParm = GameConfigMgr.Instance().getString("timer_user_ranking_clear", "330000,330000");
                string[] words     = debugParm.Split(',');
                TimerMgr.Singleton().add("RankingClear", ccccc, int.Parse(words[0]), int.Parse(words[1]));
            }
            else
            {
                string theStr = GameConfigMgr.Instance().getString("timer_user_ranking_clear_timming", "05:00");
                //每天0点执行
                TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryWeekExecute, "EveryDayTask", theStr));
                ConsoleLog.showNotifyInfo("timer_user_ranking_clear_timming begin:" + theStr);
            }
        }
示例#3
0
 public sortMethod(sortType t, string parm, PlanCallback f)
 {
     _f = f;
     if (sortType.None == t)
     {
     }
     else if (sortType.Interval == t)
     {
         string [] p = parm.Split(',');
         int       p1 = 0, p2 = 0;
         try
         {
             p1 = int.Parse(p[0]);
             p2 = int.Parse(p[1]);
         }
         catch (Exception e)
         {
             p1 = 1000;
             p2 = 1000 * 60 * 60;
         }
         _timer = new Timer(timeCb, null, p1, p2);
     }
     else if (sortType.Timing == t)
     {
         string[] timers = parm.Split(',');
         for (int i = 0; i < timers.Length; ++i)
         {
             try
             {
                 DateTime dt = Convert.ToDateTime(timers[i]);
             }
             catch (Exception e)
             {
                 ConsoleLog.showErrorInfo(i, e.Message + ":datePase Error;" + timers[i]);
                 continue;
             }
             TimeListener.Append(PlanConfig.EveryDayPlan(_f, "EveryDayTask", timers[i]));
         }
     }
     else if (sortType.week == t)
     {
     }
 }
        public static void Run()
        {
            //AppstoreClientManager.Current.InitConfig();
            //var dispatch = TaskDispatch.StartTask();
            //dispatch.Add(new StudyTask());

            lock (thisLock)
            {
                _isRunning = false;
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

#if NO_MERGE_SERVICE_DATA
            var httpHost = GetSection().HttpHost;
            var httpPort = GetSection().HttpPort;
            var httpName = GetSection().HttpName;
            if (!string.IsNullOrEmpty(httpHost))
            {
                var names = httpName.Split(',');
                new NewHttpListener(httpHost, httpPort, new HashSet <string>(names));
            }


            LoadGlobalData();

            // 上传该服务器的状态
            TimeListener.Append(PlanConfig.EveryMinutePlan(submitServerStatus, "submitServerStatus", "00:00", "23:59", ConfigurationManager.AppSettings["ServerStatusSendInterval"].ToInt()));
            // 自动机器人,64争霸赛
            TimeListener.Append(PlanConfig.EveryMinutePlan(LoopAction, "LoopAction", "00:00", "23:59", 3));
            // new GameActiveCenter(null);
            // new GuildGameActiveCenter(null);
            //每天执行用于整点刷新
            TimeListener.Append(PlanConfig.EveryDayPlan(UserHelper.DoZeroRefreshDataTask, "DoZeroRefreshDataTask", "00:00"));
            //TimeListener.Append(PlanConfig.EveryMinutePlan(UserHelper.DoZeroRefreshDataTask, "DoZeroRefreshDataTask", "08:00", "22:00", 60));
            //每天5点执行用于整点刷新
            TimeListener.Append(PlanConfig.EveryDayPlan(UserHelper.DoEveryDayRefreshDataTask, "EveryDayRefreshDataTask", "05:00"));
            // 每周二,周五
            TimeListener.Append(PlanConfig.EveryWeekPlan(UserHelper.DoTuesdayRefreshTask, "TuesdayRefreshTask", DayOfWeek.Tuesday, "04:00"));
            //TimeListener.Append(PlanConfig.EveryWeekPlan(UserHelper.DoFridayRefreshTask, "FridayRefreshTask", DayOfWeek.Friday, "04:00"));

            DataHelper.InitData();

            InitRanking();


            if (DataHelper.IsFirstOpenService)
            {
                string ncikName    = string.Empty;
                var    botsNameSet = new ShareCacheStruct <Config_BotsName>();
                for (int i = 0; i < 5; ++i)
                {
                    ncikName  = botsNameSet.FindKey(random.Next(botsNameSet.Count)).String;
                    ncikName += botsNameSet.FindKey(random.Next(botsNameSet.Count)).Value;
                    UserCenterUser ucu = Util.CreateUserCenterUser(Util.GetRandomGUIDPwd(), "0000", GameEnvironment.ProductServerId);
                    Action1005.CreateRole(ucu.UserID, "", ucu.ServerID, ucu.OpenID, ucu.RetailID, ncikName, random.Next(1) + 1, "");
                }
            }
            //Bots.InitBots();

            //if (competition64 == null)
            //{
            //    competition64 = new Competition64();
            //    competition64.Initialize();
            //}

            GlobalRemoteService.Reuest();

            stopwatch.Stop();
            new BaseLog().SaveLog("系统全局运行环境加载所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");

            SendServerStatus(ServerStatus.Unhindered, 0);
#else
            MERGE_SERVICE.Run();
#endif
            lock (thisLock)
            {
                _isRunning = true;
            }
        }
 public virtual void StartServer()
 {
     //每天0点执行
     TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryDayExecute, "EveryDayTask", "00:00"));
 }