public void Sell() { Faction.Economy.CurrentMoney += SellCart.ComputeTotal(); List <ResourceAmount> removals = new List <ResourceAmount>(); foreach (GItem item in SellCart.Items) { removals.Add(new ResourceAmount(item.Name) { NumResources = item.CurrentAmount }); } Faction.RemoveResources(removals, Microsoft.Xna.Framework.Vector3.Zero); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confString.GetConnectionString("DefaultConnection"))); //services.AddTransient<IAllCars, MockCar>(); //services.AddTransient<ICarsCategory, MockCategory services.AddTransient <IAllCars, CarRepository>(); services.AddTransient <ICarsCategory, CategoryRepository>(); services.AddTransient <IAllOrders, OrdersRepository>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped(sp => SellCart.GetCart(sp)); services.AddMvc(); services.AddMemoryCache(); services.AddSession(); }
void sellButton_OnClicked() { float total = SellCart.ComputeTotal(); if (!(total > 0)) { Dialog.Popup(GUI, "Nothing to sell!", "Nothing to sell. Select something from the left panel.", Dialog.ButtonType.OK); return; } SoundManager.PlaySound(ContentPaths.Audio.cash); Sell(); SellCart.Items.Clear(); SellCart.ReCreateItems(); SellCart.UpdateItems(); SellTotal.Text = "Order Total: " + 0.0f.ToString("C"); }
public SellCartController(IAllCars carRepository, SellCart sellCart) { _carRepository = carRepository; _sellCart = sellCart; }
public OrderController(IAllOrders allOrders, SellCart sellCart) { _allOrders = allOrders; _sellCart = sellCart; }
void SellCart_OnItemChanged(GItem item) { SellTotal.Text = "Order Total: " + SellCart.ComputeTotal().ToString("C"); }
public OrdersRepository(AppDBContent appDBContent, SellCart sellCart) { _appDBContent = appDBContent; _sellCart = sellCart; }