Пример #1
0
        public ShopItemInfo(ShopItem shopItem, ShopItemInfoEntity entity, GameDataService gameDataService)
        {
            Id          = entity.Id;
            PriceGroup  = gameDataService.ShopPrices[entity.PriceGroupId];
            EffectGroup = gameDataService.ShopEffects[entity.EffectGroupId];
            IsEnabled   = entity.IsEnabled;
            Discount    = entity.DiscountPercentage;

            ShopItem = shopItem;
        }
Пример #2
0
        public ShopItemInfo(ShopItem item, ShopItemInfoEntity entity)
        {
            Id   = entity.Id;
            Item = item;

            var priceGroup = ShopService.Instance.PriceGroups.First(x => x.Id == entity.PriceGroupId);

            PriceGroup = new ReactiveProperty <ShopPriceGroup>(priceGroup);

            var effectGroup = ShopService.Instance.EffectGroups.First(x => x.Id == entity.EffectGroupId);

            EffectGroup = new ReactiveProperty <ShopEffectGroup>(effectGroup);

            DiscountPercentage = new ReactiveProperty <byte>(entity.DiscountPercentage);
            IsEnabled          = new ReactiveProperty <bool>(entity.IsEnabled);
        }
Пример #3
0
        public async Task NewItemInfo(ShopItem item)
        {
            using (var db = _databaseService.Open <GameContext>())
            {
                var itemInfoEntity = new ShopItemInfoEntity
                {
                    ShopItemId    = item.ItemNumber,
                    EffectGroupId = EffectGroups.First().Id,
                    PriceGroupId  = PriceGroups.First().Id
                };
                db.ItemInfos.Add(itemInfoEntity);
                await db.SaveChangesAsync();

                item.ItemInfos.Add(new ShopItemInfo(item, itemInfoEntity));
            }
        }