mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 22:55:55 +03:00
Ugc.Editor.WithTag
This commit is contained in:
parent
a82a56bd4c
commit
43c3aa35f5
@ -20,6 +20,9 @@ public async Task CreateFile()
|
||||
.WithDescription( "This item was created by Facepunch Steamworks unit tests.\n\n" +
|
||||
"It should have technically been deleted so you should never get to " +
|
||||
"read this unless something terrible has happened." )
|
||||
.WithTag( "Arsehole" )
|
||||
.WithTag( "Spiteful" )
|
||||
.WithTag( "Fat-Head" )
|
||||
.SubmitAsync();
|
||||
|
||||
Assert.IsTrue( result.Success );
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
@ -55,6 +56,16 @@ internal Editor( WorkshopFileType filetype ) : this()
|
||||
public Editor WithContent( string folderName ) { return WithContent( new System.IO.DirectoryInfo( folderName ) ); }
|
||||
|
||||
|
||||
List<string> Tags;
|
||||
public Editor WithTag( string tag )
|
||||
{
|
||||
if ( Tags == null ) Tags = new List<string>();
|
||||
|
||||
Tags.Add( tag );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||
{
|
||||
var result = default( PublishResult );
|
||||
@ -101,6 +112,14 @@ public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||
if ( Language != null ) SteamUGC.Internal.SetItemUpdateLanguage( handle, Language );
|
||||
if ( ContentFolder != null ) SteamUGC.Internal.SetItemContent( handle, ContentFolder.FullName );
|
||||
if ( PreviewFile != null ) SteamUGC.Internal.SetItemPreview( handle, PreviewFile );
|
||||
if ( Tags != null && Tags.Count > 0 )
|
||||
{
|
||||
using ( var a = SteamParamStringArray.From( Tags.ToArray() ) )
|
||||
{
|
||||
var val = a.Value;
|
||||
SteamUGC.Internal.SetItemTags( handle, ref val );
|
||||
}
|
||||
}
|
||||
|
||||
result.Result = Steamworks.Result.Fail;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user