Exemplo n.º 1
0
    public void AddToCart(ItemConf itemConf, CostConf itemCost)
    {
        Sprite     sprite;
        GameObject item;

        if (!GetAllIcons.icons.TryGetValue(itemConf.icon, out sprite))
        {
            return;
        }
        bool exists = m_items.TryGetValue(itemConf.name, out item);

        if (!exists)
        {
            // new cart item
            item = GameObject.Instantiate(CartItem);
            if (item == null)
            {
                return;
            }
            item.transform.SetParent(transform, false);
            item.SetActive(true);
            m_items.Add(itemConf.name, item);
        }
        CartItemUI handler = item.GetComponent <CartItemUI>();

        if (exists)
        {
            handler.Increase();
        }
        else
        {
            handler.Init(itemConf, itemCost);
        }
    }
Exemplo n.º 2
0
    public void SetInfo(ItemConf item, CostConf cost)
    {
        itemConf = item;
        itemCost = cost;
        CostImg.GetComponent <Image>().color = new Color(1, 1, cost.costType == CostType.Silver ? 1 : 0);

        SetInfo(item.name, item.icon, item.type, cost.cost);
    }
Exemplo n.º 3
0
 public void Init(ItemConf itemConf, CostConf itemCost)
 {
     item                = itemConf;
     cost                = itemCost;
     itemName            = itemConf.name;
     button.image.sprite = GetAllIcons.icons[item.icon];
     CostImg.GetComponent <Image>().color = new Color(1, 1, cost.costType == CostType.Silver ? 1 : 0);
     Increase();
 }
Exemplo n.º 4
0
 private void addItem(ItemConf itemConf, GroupLog groupLog)
 {
     try
     {
         groupLog.CreateMonitoredItem(itemConf.ID, itemConf.Name);
     }
     catch (Exception exception)
     {
         ClientUtils.HandleException(this.Text, exception);
     }
 }
Exemplo n.º 5
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        ItemConf data = property.objectReferenceValue as ItemConf;

        if (data != null)
        {
            label = new GUIContent(data._id + "_" + (data._prefab == null ? "" : data._prefab.name));
        }

        ArrayDrawer.AddArrayTools(position, property);
        Rect rc = position;

        if (!property.isExpanded)
        {
            rc.width -= ArrayDrawer.widthBt * 4;
        }
        EditorGUI.PropertyField(rc, property, label, true);
    }