|
/* |
|
Keys can map to multiple different values (1-to-many relationship). |
|
Key names are restricted to alpha-numeric characters and the '_' character. |
|
Both keys and values cannot exceed 255 characters in length. |
|
Key-value tags are searchable by exact match only. |
|
|
|
Taken from https://partner.steamgames.com/documentation/ugc |
|
*/ |
|
|
|
|
|
// OnSteamUGCQueryCompleted should be set up the same way OnSubmitItemUpdateResultCallResult currently is |
|
|
|
var subscribedItemIDs = new PublishedFileId_t[(int)SteamUGC.GetNumSubscribedItems()]; |
|
SteamUGC.GetSubscribedItems(subscribedItemIDs, (uint)subscribedItemIDs.Length); |
|
|
|
var query = SteamUGC.CreateQueryUGCDetailsRequest(subscribedItemIDs, (uint)subscribedItemIDs.Length); |
|
SteamUGC.SetReturnKeyValueTags(query, true); |
|
SteamUGC.SetReturnOnlyIDs(query, true); |
|
|
|
var handle = SteamUGC.SendQueryUGCRequest(query); |
|
OnSteamUGCQueryCompleted.Set(handle); |
|
|
|
|
|
void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t pCallback, bool bIOFailure) |
|
{ |
|
if (pCallback.m_eResult != EResult.k_EResultOK) |
|
{ |
|
return; |
|
} |
|
|
|
/* |
|
TODO: Look into why pCallback.m_unTotalMatchingResults exists (pagination?) |
|
It could mean we cannot use resultIndex to get the ID from subscribedItemIDs like we currently do below |
|
*/ |
|
|
|
var handle = pCallback.m_handle; |
|
|
|
for (var resultIndex = 0; resultIndex < pCallback.m_unNumResultsReturned; resultIndex++) |
|
{ |
|
var itemID = subscribedItemIDs[resultIndex]; |
|
var keyValueTags = new Dictionary<string, List<string>>(); |
|
|
|
var numerOfKeyValueTags = SteamUGC.GetQueryUGCNumKeyValueTags(handle, resultIndex); |
|
|
|
for (var keyValueTagIndex = 0; keyValueTagIndex < numerOfKeyValueTags; keyValueTagIndex++) |
|
{ |
|
string key; |
|
string value; |
|
|
|
// Given the info at the top of the file 255 as the size for both key and value should work?! |
|
if (!SteamUGC.GetQueryUGCKeyValueTag(handle, keyValueTagIndex, out key, 255, out value, 255)) |
|
{ |
|
continue; |
|
} |
|
|
|
List<string> values; |
|
if (!numerOfKeyValueTags.TryGetValue(key, out values)) |
|
{ |
|
values = new List<string>(); |
|
numerOfKeyValueTags[key] = values; |
|
} |
|
|
|
values.add(value); |
|
} |
|
|
|
/* |
|
We now have and can use: |
|
- itemID |
|
- keyValueTags |
|
*/ |
|
} |
|
|
|
SteamUGC.ReleaseQueryUGCRequest(query); |
|
} |