Creating Workshop Items
Creating An Item
Creating an item is pretty straight forward.
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( "My New Item" )
.WithDescription( itemDescription )
.WithTag( "Map" )
.SubmitAsync();
Uploading An Item
The previous example doesn't include any files with the item. To do that we use Ugc.Editor.WithContent.
This will upload the contents of that folder as your entry.
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( "My New Item" )
.WithDescription( itemDescription )
.WithTag( "Map" )
.WithContent( pathToFolder )
.SubmitAsync();
Showing Progress
The submit function Ugc.Editor.SubmitAsync takes an optional parameter of a IProgress<float>.
You should be able to use this to show some progress.
class ProgressClass : IProgress<float>
{
float lastvalue = 0;
public void Report( float value )
{
if ( lastvalue >= value ) return;
lastvalue = value;
Console.WriteLine( value );
}
}
...
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( "My New Item" )
.WithDescription( itemDescription )
.WithTag( "Map" )
.WithContent( pathToFolder )
.SubmitAsync( new ProgressClass() );