mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Added ugc addtional previews
This commit is contained in:
parent
11bc35f254
commit
0d9db585f5
33
Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs
Normal file
33
Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Steamworks.Data
|
||||||
|
{
|
||||||
|
public struct UgcAdditionalPreview
|
||||||
|
{
|
||||||
|
internal UgcAdditionalPreview( string urlOrVideoID, string originalFileName, ItemPreviewType itemPreviewType )
|
||||||
|
{
|
||||||
|
this.UrlOrVideoID = urlOrVideoID;
|
||||||
|
this.OriginalFileName = originalFileName;
|
||||||
|
this.ItemPreviewType = itemPreviewType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string UrlOrVideoID { get; private set; }
|
||||||
|
public string OriginalFileName { get; private set; }
|
||||||
|
internal ItemPreviewType ItemPreviewType { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Flags that specify the type of preview an item has:
|
||||||
|
/// Image = 0,
|
||||||
|
/// YouTubeVideo = 1,
|
||||||
|
/// Sketchfab = 2,
|
||||||
|
/// EnvironmentMap_HorizontalCross = 3,
|
||||||
|
/// EnvironmentMap_LatLong = 4,
|
||||||
|
/// ReservedMax = 255
|
||||||
|
/// </summary>
|
||||||
|
public int GetItemPreviewType() => (int)ItemPreviewType;
|
||||||
|
}
|
||||||
|
}
|
11
Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs.meta
Normal file
11
Facepunch.Steamworks/Structs/UgcAdditionalPreview.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 48f086235d5dbeb44bccbb40802e30fb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -113,6 +113,11 @@ public Item( PublishedFileId id ) : this()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PublishedFileId[] Children;
|
public PublishedFileId[] Children;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Additional previews of this item or collection, available only from WithAdditionalPreviews(true) queries
|
||||||
|
/// </summary>
|
||||||
|
public UgcAdditionalPreview[] AdditionalPreviews { get; internal set; }
|
||||||
|
|
||||||
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;
|
||||||
|
@ -153,6 +153,7 @@ public Query WithFileId( params PublishedFileId[] files )
|
|||||||
ReturnsDefaultStats = WantsDefaultStats ?? true, //true by default
|
ReturnsDefaultStats = WantsDefaultStats ?? true, //true by default
|
||||||
ReturnsMetadata = WantsReturnMetadata ?? false,
|
ReturnsMetadata = WantsReturnMetadata ?? false,
|
||||||
ReturnsChildren = WantsReturnChildren ?? false,
|
ReturnsChildren = WantsReturnChildren ?? false,
|
||||||
|
ReturnsAdditionalPreviews = WantsReturnAdditionalPreviews ?? false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ public struct ResultPage : System.IDisposable
|
|||||||
internal bool ReturnsDefaultStats;
|
internal bool ReturnsDefaultStats;
|
||||||
internal bool ReturnsMetadata;
|
internal bool ReturnsMetadata;
|
||||||
internal bool ReturnsChildren;
|
internal bool ReturnsChildren;
|
||||||
|
internal bool ReturnsAdditionalPreviews;
|
||||||
|
|
||||||
public IEnumerable<Item> Entries
|
public IEnumerable<Item> Entries
|
||||||
{
|
{
|
||||||
@ -83,7 +84,27 @@ public IEnumerable<Item> Entries
|
|||||||
item.Children = children;
|
item.Children = children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO GetQueryUGCAdditionalPreview
|
|
||||||
|
if ( ReturnsAdditionalPreviews )
|
||||||
|
{
|
||||||
|
var previewsCount = SteamUGC.Internal.GetQueryUGCNumAdditionalPreviews( Handle, i );
|
||||||
|
if ( previewsCount > 0 )
|
||||||
|
{
|
||||||
|
item.AdditionalPreviews = new UgcAdditionalPreview[previewsCount];
|
||||||
|
for ( uint j = 0; j < previewsCount; j++ )
|
||||||
|
{
|
||||||
|
string previewUrlOrVideo;
|
||||||
|
string originalFileName; //what is this???
|
||||||
|
ItemPreviewType previewType = default;
|
||||||
|
if ( SteamUGC.Internal.GetQueryUGCAdditionalPreview(
|
||||||
|
Handle, i, j, out previewUrlOrVideo, out originalFileName, ref previewType ) )
|
||||||
|
{
|
||||||
|
item.AdditionalPreviews[j] = new UgcAdditionalPreview(
|
||||||
|
previewUrlOrVideo, originalFileName, previewType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
yield return item;
|
yield return item;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user