Beispiel #1
0
 /// <summary>
 /// Fetch all items and print the results to the console.
 /// </summary>
 public void getAllTest()
 {
     if (SteamworksPlayerInventory.GetAllItems((status, results) =>
     {
         if (status)
         {
             Debug.Log("Query returned " + results.Length + " items.");
         }
         else
         {
             Debug.Log("Query failed.");
         }
     }))
     {
         Debug.Log("Get All Items request sent to Steam.");
     }
     else
     {
         Debug.Log("Get All Items failed to send to Steam.");
     }
 }
Beispiel #2
0
        /// <summary>
        /// <para>Updates the InventoryItemDefinition.Instances list of each of the referenced Item Definitions with the results of a 'Get All Items' query against the current user's Steam Inventory.</para>
        /// <para>This will cause the Instances member of each item to reflect the current state of the users inventory.</para>
        /// <para> <para>
        /// <para>This will trigger the Item Instances Updated event after steam responds with the users inventory items and the items have been updated to reflect the correct instances.</para>
        /// </summary>
        public void RefreshInventory()
        {
            foreach (var item in ItemDefinitions)
            {
                if (item.Instances == null)
                {
                    item.Instances = new List <SteamItemDetails_t>();
                }
                else
                {
                    item.Instances.Clear();
                }
            }

            var result = SteamworksPlayerInventory.GetAllItems(null);

            if (!result)
            {
                Debug.LogWarning("[SteamworksInventorySettings.RefreshInventory] - Call failed");
            }
        }