mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 15:15:51 +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" +
|
.WithDescription( "This item was created by Facepunch Steamworks unit tests.\n\n" +
|
||||||
"It should have technically been deleted so you should never get to " +
|
"It should have technically been deleted so you should never get to " +
|
||||||
"read this unless something terrible has happened." )
|
"read this unless something terrible has happened." )
|
||||||
|
.WithTag( "Arsehole" )
|
||||||
|
.WithTag( "Spiteful" )
|
||||||
|
.WithTag( "Fat-Head" )
|
||||||
.SubmitAsync();
|
.SubmitAsync();
|
||||||
|
|
||||||
Assert.IsTrue( result.Success );
|
Assert.IsTrue( result.Success );
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Steamworks.Data;
|
using Steamworks.Data;
|
||||||
|
|
||||||
@ -55,6 +56,16 @@ internal Editor( WorkshopFileType filetype ) : this()
|
|||||||
public Editor WithContent( string folderName ) { return WithContent( new System.IO.DirectoryInfo( folderName ) ); }
|
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 )
|
public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||||
{
|
{
|
||||||
var result = default( PublishResult );
|
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 ( Language != null ) SteamUGC.Internal.SetItemUpdateLanguage( handle, Language );
|
||||||
if ( ContentFolder != null ) SteamUGC.Internal.SetItemContent( handle, ContentFolder.FullName );
|
if ( ContentFolder != null ) SteamUGC.Internal.SetItemContent( handle, ContentFolder.FullName );
|
||||||
if ( PreviewFile != null ) SteamUGC.Internal.SetItemPreview( handle, PreviewFile );
|
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;
|
result.Result = Steamworks.Result.Fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user