Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. SteamInventoryResult_t myInventoryHandle;
  2. public static List<int> inventoryItemDefs;
  3.  
  4. private Callback<SteamInventoryFullUpdate_t> updateResult;
  5.  
  6. void Start () {
  7. //DEBUG_DestroyAllItems();
  8. inventoryItemDefs = new List<int> ();
  9. RefreshInventory ();
  10. //DEBUG_GrantTestItems ();
  11. }
  12.  
  13. void RefreshInventory() {
  14. SteamInventory.GetAllItems (out myInventoryHandle);
  15. updateResult = Callback<SteamInventoryFullUpdate_t>.Create (OnInventoryFullUpdate);
  16. }
  17.  
  18. void OnInventoryFullUpdate(SteamInventoryFullUpdate_t fullUpdate) {
  19.  
  20. uint itemCount = 0;
  21. SteamItemDetails_t[] itemDetails;
  22.  
  23. if (SteamInventory.GetResultItems (myInventoryHandle, null, ref itemCount)) {
  24. Debug.Log ("Item Count:" + itemCount);
  25.  
  26. itemDetails = new SteamItemDetails_t[itemCount];
  27. SteamInventory.GetResultItems (myInventoryHandle, itemDetails, ref itemCount);
  28.  
  29. foreach (SteamItemDetails_t itemDetail in itemDetails) {
  30. int itemDef = (int)itemDetail.m_iDefinition;
  31. inventoryItemDefs.Add (itemDef);
  32. //Debug.Log ("Item:" + itemDef);
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement