public void Dress(BagItemBean bagItem) { if (bagItem.part == 1) { if (equipmentData.weapon != 0) { BagDataManager.Instance.AddItem(equipmentData.weapon, 1, true); } equipmentData.weapon = bagItem.ID; } if (bagItem.part == 2) { if (equipmentData.helment != 0) { BagDataManager.Instance.AddItem(equipmentData.helment, 1, true); } equipmentData.helment = bagItem.ID; } if (bagItem.part == 3) { if (equipmentData.clothes != 0) { BagDataManager.Instance.AddItem(equipmentData.clothes, 1, true); } equipmentData.clothes = bagItem.ID; } if (bagItem.part == 4) { if (equipmentData.pants != 0) { BagDataManager.Instance.AddItem(equipmentData.pants, 1, true); } equipmentData.pants = bagItem.ID; } if (bagItem.part == 5) { if (equipmentData.shoes != 0) { BagDataManager.Instance.AddItem(equipmentData.shoes, 1, true); } equipmentData.shoes = bagItem.ID; } if (bagItem.part == 6) { if (equipmentData.necklace != 0) { BagDataManager.Instance.AddItem(equipmentData.necklace, 1, true); } equipmentData.necklace = bagItem.ID; } if (bagItem.part == 7) { if (equipmentData.ring != 0) { BagDataManager.Instance.AddItem(equipmentData.ring, 1, true); } equipmentData.ring = bagItem.ID; } Save(); MarkDirty(); }
public void UpdateItem(string icon, BagItemBean bagItemBean) { item = bagItemBean; IconImage.sprite = Resources.Load <Sprite>(icon); }