diff --git a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs index 5045028..21d943d 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.Item.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.Item.cs @@ -63,6 +63,19 @@ namespace Facepunch.Steamworks workshop.OnItemInstalled += OnItemInstalled; } + public void Subscribe() + { + workshop.ugc.SubscribeItem(Id); + SubscriptionCount++; + } + + public void UnSubscribe() + { + workshop.ugc.UnsubscribeItem(Id); + SubscriptionCount--; + } + + private void OnFileDownloaded( ulong fileid, Callbacks.Result result ) { if ( fileid != Id ) return; diff --git a/Facepunch.Steamworks/Interfaces/Workshop.cs b/Facepunch.Steamworks/Interfaces/Workshop.cs index 27e04e1..a9bde30 100644 --- a/Facepunch.Steamworks/Interfaces/Workshop.cs +++ b/Facepunch.Steamworks/Interfaces/Workshop.cs @@ -123,6 +123,37 @@ namespace Facepunch.Steamworks return new Item( itemid, this ); } + /// + /// The amount of item's the user is subscribed to for this App + /// + public uint GetAmountSubsribed() + { + return ugc.GetNumSubscribedItems(); + } + /// + /// Creates a list of all item's that the user is currently subscribed + /// to for this App. This does not query titles or descriptions but + /// allows you to get the directories, state and ID of any subscribed Item. + /// This is mostly useful for getting all subscribed items install location. + /// + public Item[] GetSubscribedItems(uint amount) + { + Item[] items; + PublishedFileId_t[] vecSubscribedItems = new PublishedFileId_t[amount]; + uint subAmount = ugc.GetSubscribedItems(vecSubscribedItems, amount); + + if (subAmount < amount) + items = new Item[subAmount]; + else + items = new Item[amount]; + + for(int i =0, length = items.Length; i /// How a query should be ordered. diff --git a/Facepunch.Steamworks/SteamNative/SteamNative.SteamUGC.cs b/Facepunch.Steamworks/SteamNative/SteamNative.SteamUGC.cs index 7c5650f..d44321b 100644 --- a/Facepunch.Steamworks/SteamNative/SteamNative.SteamUGC.cs +++ b/Facepunch.Steamworks/SteamNative/SteamNative.SteamUGC.cs @@ -284,9 +284,12 @@ namespace SteamNative } // uint - public uint GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID /*PublishedFileId_t **/, uint cMaxEntries /*uint32*/ ) + public uint GetSubscribedItems( PublishedFileId_t[] pvecPublishedFileID /*PublishedFileId_t **/, uint cMaxEntries /*uint32*/ ) { - return platform.ISteamUGC_GetSubscribedItems( (IntPtr) pvecPublishedFileID, cMaxEntries ); + fixed (PublishedFileId_t* pvecPublishedFileID_ptr = pvecPublishedFileID) + { + return platform.ISteamUGC_GetSubscribedItems((IntPtr)pvecPublishedFileID_ptr, cMaxEntries); + } } // SteamAPICall_t