Beispiel #1
0
    public bool isTheSameAs(ClothesDetails newItem)
    {
        if (!ItemName.text.Equals(newItem.getName()))
        {
            //Debug.Log("new Item" + newItem.name + " has a different name to " + this.name);
            return(false);
        }
        if (price != newItem.getPrice())
        {
            //Debug.Log("new Item" + newItem.name + " has a different price to " + this.name);
            return(false);
        }
        if (!ItemColour.text.Equals(newItem.getColour()))
        {
            //Debug.Log("new Item" + newItem.name + " has a different colour to " + this.name);
            return(false);
        }
        string size = "Medium";

        if (newItem.gameObject.transform.parent.gameObject.GetComponentInParent <ClothesDisplay>() != null)
        {
            size = newItem.gameObject.transform.parent.gameObject.GetComponentInParent <ClothesDisplay>().sizeField;
            if (size == "Default")
            {
                size = "Medium";
            }
        }
        if (!ItemSize.text.Equals(size))
        {
            //Debug.Log("new Item" + newItem.name + " has a different size to " + this.name);
            return(false);
        }
        //Debug.Log("new Item" + newItem.name + " is identical to " + this.name);
        return(true);
    }
Beispiel #2
0
    public void addItem(ClothesDetails newItem)
    {
        Debug.Log("Adding Item named " + newItem.getName());
        //Check if this item is already in the basket
        foreach (BasketEntry b in basketEntries)
        {
            if (b.isTheSameAs(newItem))
            {
                b.increaseQuantity();
                return;
            }
        }
        GameObject newEntry = Instantiate(basketEntry, new Vector3(0, 0, 0), basketMenu.transform.rotation, entryContainer);

        Debug.Log(basketEntries.Count);
        newEntry.transform.localPosition = new Vector3(2, 75 + (-30 * basketEntries.Count), 0);
        newEntry.GetComponent <BasketEntry>().importDetails(newItem);
        basketEntries.Add(newEntry.GetComponent <BasketEntry>());
    }
Beispiel #3
0
 public void importDetails(ClothesDetails details)
 {
     ItemName.text   = details.getName();
     ItemColour.text = details.getColour();
     if (details.gameObject.transform.parent.gameObject.GetComponentInParent <ClothesDisplay>() != null)
     {
         ItemSize.text = details.gameObject.transform.parent.gameObject.GetComponentInParent <ClothesDisplay>().sizeField;
         if (details.gameObject.transform.parent.gameObject.GetComponentInParent <ClothesDisplay>().sizeField == "Default")
         {
             ItemSize.text = "Medium";
         }
     }
     else
     {
         ItemSize.text = "Medium";
     }
     ItemQuantity.text = quantityValue.ToString();
     price             = details.getPrice();
     ItemCost.text     = "£" + (price).ToString();
 }
    // Start is called before the first frame update
    void Start()
    {
        parent            = transform.parent.GetComponent <ClothesDetails>();
        itemNameText.text = parent.getName();
        dateText.text     = parent.day + "/" + parent.month + "/" + parent.year;
        priceText.text    = "£" + parent.getPrice().ToString();
        string tempSizeText = "";

        foreach (string size in parent.getSize())
        {
            if (tempSizeText.Length == 0)
            {
                tempSizeText += size.Substring(0, 1);
            }
            else
            {
                tempSizeText += "/" + size.Substring(0, 1);
            }
        }

        sizeText.text   = tempSizeText;
        colourText.text = parent.getColour();
    }