Exemplo n.º 1
0
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); //

        #endregion

        #region 初始化

        public void InitByBase(GroupShopOne _this, GroupShopRecord tbTable)
        {
            _this.mDbData = new DBGroupShopOne();
            if (_this.mDbData.ItemData == null)
            {
                _this.mDbData.ItemData = new ItemBaseData();
            }
            _this.tbGroupShop         = tbTable;
            _this.mDbData.GroupShopId = tbTable.Id;
            _this.OverTime            = DateTime.Now.AddHours(tbTable.ExistTime);
            var items = new Dictionary <int, int>();

            ShareDrop.DropMother(tbTable.MotherID, items);
            var itemsCount = items.Count;

            if (itemsCount < 1)
            {
                ShareItemFactory.Create(22000, _this.mDbData.ItemData);
            }
            else
            {
                var itemT = items.First();
                var item  = ShareItemFactory.Create(itemT.Key, _this.mDbData.ItemData);
                item.SetCount(itemT.Value);
                if (itemsCount > 1)
                {
                    Logger.Warn("GroupShopOne InitByBase itemsCount ={0} GroupShopRecord={1}", itemsCount, tbTable.Id);
                }
            }
            _this.overTrigger = TeamServerControl.tm.CreateTrigger(_this.OverTime, () => TimeOver(_this));
        }
Exemplo n.º 2
0
        private void Reset(GroupShopOne _this)
        {
            if (_this.overTrigger != null)
            {
                TeamServerControl.tm.DeleteTrigger(_this.overTrigger);
                _this.overTrigger = null;
            }
            var guid = GroupShop.GetNextGuid();

            GroupShop.ResetShopItem(_this, guid);
            var items = new Dictionary <int, int>();

            ShareDrop.DropMother(_this.tbGroupShop.MotherID, items);
            var itemsCount = items.Count;

            if (itemsCount < 1)
            {
                ShareItemFactory.Create(22000, _this.mDbData.ItemData);
            }
            else
            {
                var itemT = items.First();
                var item  = ShareItemFactory.Create(itemT.Key, _this.mDbData.ItemData);
                item.SetCount(itemT.Value);
                if (itemsCount > 1)
                {
                    Logger.Warn("GroupShopOne InitByBase itemsCount ={0} GroupShopRecord={1}", itemsCount,
                                _this.tbGroupShop.Id);
                }
            }
            _this.OverTime    = DateTime.Now.AddHours(_this.tbGroupShop.ExistTime);
            _this.overTrigger = TeamServerControl.tm.CreateTrigger(_this.OverTime, () => TimeOver(_this));
        }