コード例 #1
0
        /// <summary>
        /// Купить награду
        /// </summary>
        /// <param name="_pers">Персонаж</param>
        /// <param name="costProperty">Цена награды</param>
        public void BuyReward(Pers _pers, int costProperty)
        {
            StaticMetods.PlaySound(Properties.Resources.coin);
            var editableReward = this;
            ObservableCollection <Revard> shopItems = _pers.ShopItems;

            List <Revard> uni = (_pers.InventoryItems.Union(_pers.ShopItems)).ToList();

            var vc = new ViewChangesClass(uni);

            vc.GetValBefore();

            _pers.GoldProperty -= costProperty;
            _pers.InventoryItems.Add(editableReward);

            vc.GetValAfter();

            var   header            = $"{editableReward.GetTypeOfRevard()} \"{editableReward.NameOfProperty}\" добавлен в инвентарь!!!";
            Brush col               = Brushes.Green;
            var   itemImageProperty = StaticMetods.pathToImage(Path.Combine(Directory.GetCurrentDirectory(), "Images", "good.png"));

            vc.ShowChanges(header, col, itemImageProperty);

            if (editableReward.IsArtefact)
            {
                shopItems.Remove(editableReward);
            }

            StaticMetods.AbillitisRefresh(_pers);
            StaticMetods.refreshShopItems(_pers);
        }
コード例 #2
0
 private void AssociatedObjectOnSourceInitialized(object sender, RoutedEventArgs e)
 {
     StaticMetods.PlaySound(Properties.Resources.edit);
 }
コード例 #3
0
 private void AssociatedObjectOnClosing(object sender, CancelEventArgs cancelEventArgs)
 {
     StaticMetods.PlaySound(Properties.Resources.doorClose);
 }