mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-26 21:48:16 +03:00
Workshop item stats
This commit is contained in:
parent
cccc426d0f
commit
0b3db02843
@ -39,7 +39,7 @@ namespace Facepunch.Steamworks.Test
|
|||||||
|
|
||||||
Query.Order = Workshop.Order.RankedByTextSearch;
|
Query.Order = Workshop.Order.RankedByTextSearch;
|
||||||
Query.QueryType = Workshop.QueryType.MicrotransactionItems;
|
Query.QueryType = Workshop.QueryType.MicrotransactionItems;
|
||||||
Query.SearchText = "shit";
|
Query.SearchText = "black";
|
||||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
Query.RequireTags.Add( "LongTShirt Skin" );
|
||||||
Query.Run();
|
Query.Run();
|
||||||
|
|
||||||
@ -56,6 +56,8 @@ namespace Facepunch.Steamworks.Test
|
|||||||
foreach ( var item in Query.Items )
|
foreach ( var item in Query.Items )
|
||||||
{
|
{
|
||||||
Console.WriteLine( "{0}", item.Title );
|
Console.WriteLine( "{0}", item.Title );
|
||||||
|
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
|
||||||
|
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,12 @@ namespace Facepunch.Steamworks
|
|||||||
public string DiscussUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/discussions/{0}", Id ); } }
|
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 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 @@ namespace Facepunch.Steamworks
|
|||||||
workshop.ugc.GetQueryUGCResult( data.Handle, (uint)i, ref details );
|
workshop.ugc.GetQueryUGCResult( data.Handle, (uint)i, ref details );
|
||||||
|
|
||||||
Items[i] = Item.From( details, workshop );
|
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;
|
TotalResults = (int)data.TotalMatchingResults;
|
||||||
@ -110,6 +116,15 @@ namespace Facepunch.Steamworks
|
|||||||
Callback = null;
|
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
|
public bool IsRunning
|
||||||
{
|
{
|
||||||
get { return Callback != null; }
|
get { return Callback != null; }
|
||||||
@ -155,5 +170,17 @@ namespace Facepunch.Steamworks
|
|||||||
// ReleaseQueryUGCRequest
|
// ReleaseQueryUGCRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum ItemStatistic : uint
|
||||||
|
{
|
||||||
|
NumSubscriptions = 0,
|
||||||
|
NumFavorites = 1,
|
||||||
|
NumFollowers = 2,
|
||||||
|
NumUniqueSubscriptions = 3,
|
||||||
|
NumUniqueFavorites = 4,
|
||||||
|
NumUniqueFollowers = 5,
|
||||||
|
NumUniqueWebsiteViews = 6,
|
||||||
|
ReportScore = 7,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user