Merge pull request #276 from JannikNickel/master

Added missing functionality to UgcQuery and UgcItem
This commit is contained in:
Garry Newman 2019-06-23 19:27:46 +01:00 committed by GitHub
commit 08405459bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 10 deletions

View File

@ -93,6 +93,16 @@ namespace Steamworks.Ugc
/// </summary> /// </summary>
public bool IsAcceptedForUse => details.AcceptedForUse; public bool IsAcceptedForUse => details.AcceptedForUse;
/// <summary>
/// The number of upvotes of this item
/// </summary>
public uint VotesUp => details.VotesUp;
/// <summary>
/// The number of downvotes of this item
/// </summary>
public uint VotesDown => details.VotesDown;
public bool IsInstalled => (State & ItemState.Installed) == ItemState.Installed; public bool IsInstalled => (State & ItemState.Installed) == ItemState.Installed;
public bool IsDownloading => (State & ItemState.Downloading) == ItemState.Downloading; public bool IsDownloading => (State & ItemState.Downloading) == ItemState.Downloading;
public bool IsDownloadPending => (State & ItemState.DownloadPending) == ItemState.DownloadPending; public bool IsDownloadPending => (State & ItemState.DownloadPending) == ItemState.DownloadPending;
@ -156,6 +166,24 @@ namespace Steamworks.Ugc
return Tags.Contains( find, StringComparer.OrdinalIgnoreCase ); return Tags.Contains( find, StringComparer.OrdinalIgnoreCase );
} }
/// <summary>
/// Allows the user to subscribe to this item
/// </summary>
public async Task<bool> Subscribe ()
{
var result = await SteamUGC.Internal.SubscribeItem( _id );
return result?.Result == Result.OK;
}
/// <summary>
/// Allows the user to unsubscribe from this item
/// </summary>
public async Task<bool> Unsubscribe ()
{
var result = await SteamUGC.Internal.UnsubscribeItem( _id );
return result?.Result == Result.OK;
}
/// <summary> /// <summary>
/// Allows the user to rate a workshop item up or down. /// Allows the user to rate a workshop item up or down.
/// </summary> /// </summary>

View File

@ -14,6 +14,7 @@ namespace Steamworks.Ugc
UGCQuery queryType; UGCQuery queryType;
AppId consumerApp; AppId consumerApp;
AppId creatorApp; AppId creatorApp;
string searchText;
public Query( UgcType type ) : this() public Query( UgcType type ) : this()
{ {
@ -90,6 +91,8 @@ namespace Steamworks.Ugc
public Query SortByVoteScore() { userSort = UserUGCListSortOrder.VoteScoreDesc; return this; } public Query SortByVoteScore() { userSort = UserUGCListSortOrder.VoteScoreDesc; return this; }
public Query SortByModeration() { userSort = UserUGCListSortOrder.ForModeration; return this; } public Query SortByModeration() { userSort = UserUGCListSortOrder.ForModeration; return this; }
public Query WhereSearchText(string searchText) { this.searchText = searchText; return this; }
#endregion #endregion
#region Files #region Files
@ -227,6 +230,11 @@ namespace Steamworks.Ugc
{ {
SteamUGC.Internal.SetRankedByTrendDays( handle, (uint)trendDays.Value ); SteamUGC.Internal.SetRankedByTrendDays( handle, (uint)trendDays.Value );
} }
if ( !string.IsNullOrEmpty( searchText ) )
{
SteamUGC.Internal.SetSearchText( handle, searchText );
}
} }
#endregion #endregion