private void dtTicker(object sender, EventArgs e) { Village.datetime = Village.datetime.AddMinutes(1); if (Village.datetime.Minute == 59) { Village.naruto.energy -= 3; ProfileBar.updateStats(); } timedate.Text = Village.datetime.ToString("HH:mm"); if (framekey.Equals("Home")) { Home.Opacity_on(); } }
private void Confirm_buy(object sender, RoutedEventArgs e) { buyinfo.Visibility = Visibility.Visible; if (naruto.yen >= itemcost * numberbuy) { naruto.yen -= numberbuy * itemcost; ProfileBar.updateStats(); foreach (Item i in naruto.inventory) { if (i.Xinv == 4 & i.Yinv == 1) { buyconfirm.Visibility = Visibility.Hidden; buyinfo.Text = "You have full inventory."; buyinfo.Foreground = Brushes.Red; } else { if (i.Xinv == 4) { currentx = 0; sety = 1; } else if (i.Xinv > currentx) { currentx = i.Xinv; } } } Item item = new Item(itemname, tag, numberbuy, itemconsumable, itemstackable); item.Xinv = currentx + 1; item.Yinv = sety; naruto.inventory.Add(item); buyconfirm.Visibility = Visibility.Hidden; buyinfo.Text = "You have bought " + numberbuy.ToString() + "x " + itemname + " for " + (numberbuy * itemcost).ToString() + " yen succefuly."; buyinfo.Foreground = Brushes.Green; } else { buyconfirm.Visibility = Visibility.Hidden; buyinfo.Text = "You don't have enough money"; buyinfo.Foreground = Brushes.Red; } }