示例#1
0
文件: Common.cs 项目: Lantnr/MyTest
        /// <summary>检查执行货物方法</summary>
        public void CheckGoods()
        {
            double timeStamp = (DateTime.Now.Ticks - 621355968000000000) / 10000;

            if (!(timeStamp >= Variable.GRWT))
            {
                return;
            }
            var _base = Variable.BASE_RULE.FirstOrDefault(m => m.id == "3001");

            if (_base == null)
            {
                return;
            }
            var temp        = _base.value.Split('-');
            var reflashtime = RNG.Next(int.Parse(temp[0]), int.Parse(temp[1]));

#if DEBUG
            reflashtime = 1;
#endif

            var interval = 1000 * 60 * reflashtime;
            Variable.GRWT = Variable.GRT = CommonHelper.StopTime(interval) + (Variable.GRWTS * 1000);
            var bus = new Business();
            var war = new Share.War();
            bus.RefreshGoods();
            war.RefreshWarGoods();
            bus.Dispose();
            war.Dispose();
        }
示例#2
0
        /// <summary>模块启动</summary>
        public void Start(int count)
        {
            DisplayGlobal.log.Write(string.Format("进入定时模块 当前计数{0}", count));
            CommonHelper.GetCDTSTM(GetType().Namespace, count, true);
            var bus = new Business();
            var war = new Share.War();

            bus.InitGoods();
            war.RefreshWarGoods();
            bus.Dispose();
            war.Dispose();
            _globalTimer.Enabled    = true;
            _goodsTimer.Enabled     = true;
            _powerTimer.Enabled     = true;
            _timer_24.Enabled       = true;
            _war_timer.Enabled      = true;
            _activity_timer.Enabled = true;
        }