public void OnPointerDown(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { if (item != null) { if (click == true) { GetItem(); } else { item_Poiner = this; StartCoroutine(doubleclick()); } } } else if (eventData.button == PointerEventData.InputButton.Middle) { if (item != null) { UpgradeItem(); } } else if (eventData.button == PointerEventData.InputButton.Right) { DropItem(); } }
private IEnumerator Add_item(game_item item, Transform _transform, GameObject UIButton, INV_handle add_t) { if (DontDestroy.first.Loading) { yield break; } Transform child = Instantiate(UIButton).transform; Image image = child.GetChild(0).GetComponent <Image>(); Inv_slot ci = child.GetComponent <Inv_slot>(); ci.item = item; item.count = 9999; ci.ai = add_t; child.name = item.name; child.SetParent(_transform); Sprite sd = null; while (sd == null) { if (ITEMS.main.item_icons.TryGetValue(item.id_sprite, out sd)) { image.sprite = sd; } yield return(new WaitForSeconds(3 * Time.deltaTime)); } image.color = item.rarity.color; child.localPosition = Vector3.zero; child.localScale = new Vector3(1, 1, 1); yield return(null); }
public game_item(item_type _type, int _id_sprite, SpriteGender _gender, int _Order_ID, string _name, Basic_Stats stats, UseBoost pstats, item_rarity.rarity _rarity, bool Is_armor, int item_level = 0) { ID = ITEM_COUNTER; ITEM_COUNTER++; bstats = stats; this.pstats = pstats; IsArmor = Is_armor; NAME = _name; type = _type; id_sprite = _id_sprite; gender = _gender; ORD = _Order_ID; slot_pointer = null; count = 1; if (_id_sprite == -1) { id_sprite = CONSUMABLE_SP_ID; CONSUMABLE_SP_ID--; } if (ORD == -1) { ORD = CONSUMABLE_SP_ID; } rarity = new item_rarity(bstats, _rarity, item_level); }
IEnumerator Start() { while (Info_update.instanse == null) { yield return(new WaitForSeconds(Time.deltaTime)); } Info_update.instanse.UpdateItemInfo = this; slot = Inv_slot.item_Poiner; }
public void Update() { if (slot != Inv_slot.item_Poiner) { slot = Inv_slot.item_Poiner; if (slot != null && slot.item != null) { stats = slot.item.bstats; pstats = slot.item.pstats; } } }
public void AddWearableSlot(Inv_slot slot) { foreach (item_type type in slot.type_of_ITEM) { if (type == item_type.none) { continue; } slot.type = slot_type.wearable; slot.link = this; dec.Add(type, slot); } }
public void UseItem(game_item item) { if (item.type == item_type.consumable) { AddItem.MyPlayer.Use_Consumable(item); Inv_slot.ConsumeItem(); } else if (item.type != item_type.none) { link.SendItem(item); Debug.Log("done!"); } }
public void GetItem() { item_Poiner = this; switch (type) { case slot_type.all_items_inv: ai.item_add(); break; case slot_type.inventory: ai.UseItem(item); break; case slot_type.wearable: ai.item_add(); break; case slot_type.dropped: ai.PickItem(item); break; } }
IEnumerator Start() { slot = GetComponent <Inv_slot>(); srenderer = GetComponent <SpriteRenderer>(); while (INV_handle.main == null) { yield return(new WaitForSeconds(Time.deltaTime * 3)); } slot.ai = INV_handle.main; p = AddItem.MyPlayer.transform; ItemDrop.DroppedItems.Add(this); loaded = true; if (!GotItem) { RandomItem(); } }
public void AddSlot(Inv_slot slot) { slots.Add(slot); slot.type = slot_type.inventory; }