mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Workshop item stats
This commit is contained in:
parent
cccc426d0f
commit
0b3db02843
@ -39,7 +39,7 @@ public void Query()
|
||||
|
||||
Query.Order = Workshop.Order.RankedByTextSearch;
|
||||
Query.QueryType = Workshop.QueryType.MicrotransactionItems;
|
||||
Query.SearchText = "shit";
|
||||
Query.SearchText = "black";
|
||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
||||
Query.Run();
|
||||
|
||||
@ -56,6 +56,8 @@ public void Query()
|
||||
foreach ( var item in Query.Items )
|
||||
{
|
||||
Console.WriteLine( "{0}", item.Title );
|
||||
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
|
||||
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,12 @@ public Editor Edit()
|
||||
public string DiscussUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/discussions/{0}", Id ); } }
|
||||
|
||||
public string StartsUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/stats/{0}", Id ); } }
|
||||
|
||||
public int SubscriptionCount { get; internal set; }
|
||||
public int FavouriteCount { get; internal set; }
|
||||
public int FollowerCount { get; internal set; }
|
||||
public int WebsiteViews { get; internal set; }
|
||||
public int ReportScore { get; internal set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,12 @@ void OnResult( QueryCompleted.Data data )
|
||||
workshop.ugc.GetQueryUGCResult( data.Handle, (uint)i, ref details );
|
||||
|
||||
Items[i] = Item.From( details, workshop );
|
||||
|
||||
Items[i].SubscriptionCount = GetStat( data.Handle, i, ItemStatistic.NumSubscriptions );
|
||||
Items[i].FavouriteCount = GetStat( data.Handle, i, ItemStatistic.NumFavorites );
|
||||
Items[i].FollowerCount = GetStat( data.Handle, i, ItemStatistic.NumFollowers );
|
||||
Items[i].WebsiteViews = GetStat( data.Handle, i, ItemStatistic.NumUniqueWebsiteViews );
|
||||
Items[i].ReportScore = GetStat( data.Handle, i, ItemStatistic.ReportScore );
|
||||
}
|
||||
|
||||
TotalResults = (int)data.TotalMatchingResults;
|
||||
@ -110,6 +116,15 @@ void OnResult( QueryCompleted.Data data )
|
||||
Callback = null;
|
||||
}
|
||||
|
||||
private int GetStat( ulong handle, int index, ItemStatistic stat )
|
||||
{
|
||||
uint val = 0;
|
||||
if ( !workshop.ugc.GetQueryUGCStatistic( handle, (uint)index, (uint)stat, ref val ) )
|
||||
return 0;
|
||||
|
||||
return (int) val;
|
||||
}
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get { return Callback != null; }
|
||||
@ -155,5 +170,17 @@ public void Dispose()
|
||||
// ReleaseQueryUGCRequest
|
||||
}
|
||||
}
|
||||
|
||||
private enum ItemStatistic : uint
|
||||
{
|
||||
NumSubscriptions = 0,
|
||||
NumFavorites = 1,
|
||||
NumFollowers = 2,
|
||||
NumUniqueSubscriptions = 3,
|
||||
NumUniqueFavorites = 4,
|
||||
NumUniqueFollowers = 5,
|
||||
NumUniqueWebsiteViews = 6,
|
||||
ReportScore = 7,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user