WorkshopQuery.UploaderAppId

This commit is contained in:
Garry Newman 2016-10-06 12:13:15 +01:00
parent 28baea049c
commit e98441f28d
2 changed files with 17 additions and 3 deletions

View File

@ -36,20 +36,22 @@ public void Query()
Query.Order = Workshop.Order.RankedByTextSearch;
Query.QueryType = Workshop.QueryType.Items_Mtx;
Query.SearchText = "rock";
Query.SearchText = "shit";
Query.Run();
// Block, wait for result
// (don't do this in realtime)
Query.Block();
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "{0}\n", item.Description );
}
for ( int i=0; i<100; i++ )

View File

@ -64,6 +64,7 @@ public enum QueryType
public WorkshopQuery CreateQuery()
{
var q = new WorkshopQuery();
q.AppId = steamworks.AppId;
q.workshop = this;
return q;
}
@ -101,6 +102,17 @@ public class WorkshopQuery
internal ulong Handle;
internal QueryCompleted Callback;
/// <summary>
/// The AppId you're querying. This defaults to this appid.
/// </summary>
public uint AppId { get; set; }
/// <summary>
/// The AppId of the app used to upload the item. This defaults to 0
/// which means all/any.
/// </summary>
public uint UploaderAppId { get; set; }
public QueryType QueryType { get; set; } = QueryType.Items;
public Order Order { get; set; } = Order.RankedByVote;
@ -124,7 +136,7 @@ public void Run()
if ( Page <= 0 )
throw new System.Exception( "Page should be 1 or above" );
Handle = workshop.ugc.CreateQueryAllUGCRequest( (uint)Order, (uint)QueryType, workshop.steamworks.AppId, workshop.steamworks.AppId, (uint)Page );
Handle = workshop.ugc.CreateQueryAllUGCRequest( (uint)Order, (uint)QueryType, UploaderAppId, AppId,( uint)Page );
if ( !string.IsNullOrEmpty( SearchText ) )
workshop.ugc.SetSearchText( Handle, SearchText );