public void MoveProductDownInqueue(int productNumber)
 {
     if (currentProducts.Count != productNumber - 1)
     {
         MachineProduct temp1 = currentProducts[productNumber];
         MachineProduct temp2 = currentProducts[productNumber + 1];
         currentProducts[productNumber + 1] = temp1;
         currentProducts[productNumber]     = temp2;
         UpdateQueue();
     }
 }
 public void MoveProductUpInQueue(int productNumber)
 {
     if (productNumber != 0)
     {
         MachineProduct temp1 = currentProducts[productNumber];
         MachineProduct temp2 = currentProducts[productNumber - 1];
         currentProducts[productNumber]     = temp2;
         currentProducts[productNumber - 1] = temp1;
         UpdateQueue();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Checks the material storage to see if there's enough materials and if true will process the product
        /// </summary>
        public bool CanProcessProduct(MachineProduct product)
        {
            if (materialStorageLink.usedStorage.TryConsumeList(product.materialToAmounts))
            {
                currentProduction = ProcessProduction(product.Product, product.ProductionTime);
                StartCoroutine(currentProduction);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Checks the material storage to see if there's enough materials and if true will process the product
        /// </summary>
        public bool CanProcessProduct(MachineProduct product)
        {
            if (materialStorage.TryRemoveCM3Materials(product.materialToAmounts))
            {
                currentProduction = ProcessProduction(product.Product, product.ProductionTime);
                StartCoroutine(currentProduction);
                return(true);
            }

            return(false);
        }
 public void AddToQueue(MachineProduct product)
 {
     if (currentProducts.Count <= maxProductsInQueue)
     {
         currentProducts.Add(product);
         UpdateQueue();
     }
     else
     {
         Logger.Log("Tried to add to Autolathe queue, but queue was full", Category.Machines);
     }
 }
Beispiel #6
0
 private void buyBtn_Click(object sender, EventArgs e)
 {
     if (mainDataGrid.SelectedCells.Count == 0 || machine.PaymentBuffer.Sum() == 0)
     {
         MessageBox.Show("Для покупки необходимо выбрать товар и внести деньги!");
         return;
     }
     mp = machine.Products[mainDataGrid.CurrentRow.Index * mainDataGrid.CurrentCell.ColumnIndex];
     if ((double)mp.Cost > machine.PaymentBuffer.Sum())
     {
         MessageBox.Show("Внесенная сумма меньше стоимости товара!");
         return;
     }
     timerBuy.Interval = interval;
     timerBuy.Enabled  = true;
     stateLabel.Text   = "Производится\nпокупка...";
     DisableBtns(new Button[] { buyBtn, addMoneyBtn });
 }