public ShopEffect(ShopEffectGroup effectGroup, ShopEffectEntity entity) { Id = entity.Id; EffectGroup = effectGroup; Effect = new ReactiveProperty <uint>(entity.Effect); _name = this.WhenAnyValue(x => x.Effect.Value) .Select(effectId => ResourceService.Instance.Effects.First(effect => effect.Id == effectId).Name) .ToProperty(this, x => x.Name); }
public async Task NewEffect(ShopEffectGroup effectGroup) { using (var db = _databaseService.Open <GameContext>()) { var effectEntity = new ShopEffectEntity { EffectGroupId = effectGroup.Id }; db.Effects.Add(effectEntity); await db.SaveChangesAsync(); effectGroup.Effects.Add(new ShopEffect(effectGroup, effectEntity)); } }
public ShopEffect(ShopEffectEntity entity) { Id = entity.Id; Effect = entity.Effect; }