public Box StartRemovingBox(ProductManager.CurrentProduct currentProduct, int productID)
    { // Displays a temp stack that doesnt include the box getting removed
        // Returns the box that got removed
        currentProduct.originalStack = this;
        Box toReturn    = null;
        int ignoreIndex = -1;
        int counter     = 0;

        foreach (Box box in boxList)
        {
            if (box.product.uniqueID == productID)
            {
                StoreObjectReference reference = box.product.productReference;
                toReturn = Instantiate(box);
                StorageBox newStorageBox = new StorageBox(reference, toReturn.gameObject);
                newStorageBox.uniqueID = currentProduct.currentProduct.uniqueID;
                toReturn.product       = newStorageBox;
                ignoreIndex            = counter;
            }
            counter++;
        }
        if (toReturn != null)
        {
            BoxCollider collider = toReturn.GetComponent <BoxCollider>();
            collider.enabled = false;
            toReturn.gameObject.SetActive(true);
            toReturn.product.PlayCloseAnimation();
            displayingTempReducedStack = true;
            tempReducedStack           = CreateStackPlaceholder(ignoreIndex);
            foreach (Box box in boxList)
            {
                box.gameObject.SetActive(false);
            }
        }
        return(toReturn);
    }
Beispiel #2
0
    public void OnLoad(PlaceholderDisplayIndicator indicator_, ProductManager.CurrentProduct currentProduct)
    {
        //print("OnLoad");
        if (db == null)
        {
            Start();
        }
        indicator      = indicator_;
        itemToBePlaced = currentProduct;
        containers     = dm.dispensary.inventory.GetAvailableBudContainers();

        /*for (int i = 0; i < 4; i++)
         * {
         *  containers.Add(containers[i]); // temporarily duplicate the list, to test having more than 5 items in the list. works like a charm!
         * }*/
        startIndex = -2;
        endIndex   = 2;
        if (containers.Count > 0)
        {
            UpdateSlots(false);
        }
        else
        {
            UpdateSlots(true);
        }
        if (slots[2].item != null)
        {
            indicator.CreateTitlePanel(false, slots[2].item.productName, slots[2].item.boxWeight + "g Capacity");
            confirmButton.interactable = true;
        }
        else
        {
            confirmButton.interactable = false;
        }
        //inputField.Setup(bud);
    }
 public ChooseContainerPanel OpenChooseContainerPanel(PlaceholderDisplayIndicator indicator, ProductManager.CurrentProduct currentProduct)
 {
     chooseContainerPanel.gameObject.SetActive(true);
     chooseContainerPanel.OnLoad(indicator, currentProduct);
     chooseContainerPanel.panelOpen = true;
     return(chooseContainerPanel);
 }
 public void OpenChooseContainerPanel(ProductManager.CurrentProduct currentProduct)
 {
     chooseContainerPanel = uiManager.OpenChooseContainerPanel(this, currentProduct);
     chooseContainerPanel.cancelButton.onClick.RemoveAllListeners();
     chooseContainerPanel.cancelButton.onClick.AddListener(() => CloseChooseContainerPanel());
 }
Beispiel #5
0
    public void Setup(ProductManager.CurrentProduct currentProduct)
    {
        parentProduct = currentProduct;
        if (db == null)
        {
            Start();
        }
        GameSettings settings = db.settings;

        if (indicator == null)
        {
            indicator = Instantiate(db.GetStoreObject("Placeholder Indicator").gameObject_).GetComponent <PlaceholderDisplayIndicator>();
            indicator.transform.SetParent(transform);
            ProductGO productGO = gameObject.GetComponent <ProductGO>();
            if (productGO != null)
            {
                indicator.transform.localPosition    = productGO.indicatorPos;
                indicator.transform.localEulerAngles = productGO.indicatorEulers;
                indicator.transform.localScale       = productGO.indicatorScale;
            }
            else
            {
                indicator.transform.localPosition    = Vector3.zero;
                indicator.transform.localEulerAngles = Vector3.zero;
                indicator.transform.localScale       = Vector3.one;
            }
            if (currentProduct.currentProduct.NeedsContainer())
            {
                if (currentProduct.currentContainer == null)
                {
                    indicator.BeingMoved(true, "No Container Selected", "Press '" + settings.GetOpenChooseContainerPanel().ToLower() + "' to choose a container");
                }
                else
                {
                    Box.PackagedBud packagedBud = parentProduct.GetPackagedBud();
                    if (packagedBud != null)
                    {
                        string topString = "Moving " + packagedBud.weight + "g of " + packagedBud.strain.name;
                        StoreObjectReference container = parentProduct.currentContainer;
                        string bottomString            = "Container - " + container.boxWeight + "g Capacity";
                        indicator.BeingMoved(false, topString, bottomString);
                    }
                    else
                    {
                        indicator.BeingMoved(false, parentProduct.currentContainer.productName, parentProduct.currentContainer.boxWeight + "g Capacity");
                    }
                }
            }
            else
            {
                Box.PackagedBud potentialBud = parentProduct.GetPackagedBud();
                if (potentialBud != null)
                {
                    indicator.BeingMoved(false, potentialBud.strain.name, potentialBud.weight + "g");
                }
                else
                {
                    try
                    {
                        indicator.BeingMoved();
                        //indicator.BeingMoved(false, currentProduct.currentProduct.GetName(), "");
                    }
                    catch (System.NullReferenceException)
                    {
                        indicator.BeingMoved(false, "NullReferenceException", "F**k");
                    }
                }
            }
        }
    }