mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-28 15:45:29 +03:00
Merge pull request #276 from JannikNickel/master
Added missing functionality to UgcQuery and UgcItem
This commit is contained in:
commit
08405459bd
@ -93,7 +93,17 @@ public Item( PublishedFileId id ) : this()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAcceptedForUse => details.AcceptedForUse;
|
public bool IsAcceptedForUse => details.AcceptedForUse;
|
||||||
|
|
||||||
public bool IsInstalled => (State & ItemState.Installed) == ItemState.Installed;
|
/// <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 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;
|
||||||
public bool IsSubscribed => (State & ItemState.Subscribed) == ItemState.Subscribed;
|
public bool IsSubscribed => (State & ItemState.Subscribed) == ItemState.Subscribed;
|
||||||
@ -122,7 +132,7 @@ public bool Download( bool highPriority = false )
|
|||||||
return SteamUGC.Internal.DownloadItem( Id, highPriority );
|
return SteamUGC.Internal.DownloadItem( Id, highPriority );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemState State => (ItemState) SteamUGC.Internal.GetItemState( Id );
|
private ItemState State => (ItemState) SteamUGC.Internal.GetItemState( Id );
|
||||||
|
|
||||||
public static async Task<Item?> GetAsync( PublishedFileId id, int maxageseconds = 60 * 30 )
|
public static async Task<Item?> GetAsync( PublishedFileId id, int maxageseconds = 60 * 30 )
|
||||||
{
|
{
|
||||||
@ -156,10 +166,28 @@ public bool HasTag( string find )
|
|||||||
return Tags.Contains( find, StringComparer.OrdinalIgnoreCase );
|
return Tags.Contains( find, StringComparer.OrdinalIgnoreCase );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows the user to rate a workshop item up or down.
|
/// Allows the user to subscribe to this item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<bool> Vote( bool up )
|
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>
|
||||||
|
/// Allows the user to rate a workshop item up or down.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<bool> Vote( bool up )
|
||||||
{
|
{
|
||||||
var r = await SteamUGC.Internal.SetUserItemVote( Id, up );
|
var r = await SteamUGC.Internal.SetUserItemVote( Id, up );
|
||||||
return r?.Result == Result.OK;
|
return r?.Result == Result.OK;
|
||||||
@ -204,10 +232,10 @@ public async Task<bool> Vote( bool up )
|
|||||||
public ulong NumSecondsPlayedDuringTimePeriod { get; internal set; }
|
public ulong NumSecondsPlayedDuringTimePeriod { get; internal set; }
|
||||||
public ulong NumPlaytimeSessionsDuringTimePeriod { get; internal set; }
|
public ulong NumPlaytimeSessionsDuringTimePeriod { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The URL to the preview image for this item
|
/// The URL to the preview image for this item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PreviewImageUrl { get; internal set; }
|
public string PreviewImageUrl { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Edit this item
|
/// Edit this item
|
||||||
|
@ -14,6 +14,7 @@ public struct Query
|
|||||||
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 @@ internal Query LimitUser( SteamId steamid )
|
|||||||
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 @@ void ApplyConstraints( UGCQueryHandle_t handle )
|
|||||||
{
|
{
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user