mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 06:38:01 +03:00
Added support for publishing workshop items to the main app from another app.
This commit is contained in:
parent
cc4bdcea8d
commit
2b4c62bd28
@ -24,6 +24,7 @@ namespace Facepunch.Steamworks
|
||||
public ItemType? Type { get; set; }
|
||||
public string Error { get; internal set; } = null;
|
||||
public string ChangeNote { get; set; } = "";
|
||||
public uint WorkshopUploadAppId { get; set; }
|
||||
|
||||
public enum VisibilityType : int
|
||||
{
|
||||
@ -109,7 +110,7 @@ namespace Facepunch.Steamworks
|
||||
if ( !Type.HasValue )
|
||||
throw new System.Exception( "Editor.Type must be set when creating a new item!" );
|
||||
|
||||
CreateItem = workshop.ugc.CreateItem( workshop.steamworks.AppId, (SteamNative.WorkshopFileType)(uint)Type, OnItemCreated );
|
||||
CreateItem = workshop.ugc.CreateItem( WorkshopUploadAppId, (SteamNative.WorkshopFileType)(uint)Type, OnItemCreated );
|
||||
}
|
||||
|
||||
private void OnItemCreated( SteamNative.CreateItemResult_t obj, bool Failed )
|
||||
@ -130,7 +131,7 @@ namespace Facepunch.Steamworks
|
||||
|
||||
private void PublishChanges()
|
||||
{
|
||||
UpdateHandle = workshop.ugc.StartItemUpdate( workshop.steamworks.AppId, Id );
|
||||
UpdateHandle = workshop.ugc.StartItemUpdate(WorkshopUploadAppId, Id );
|
||||
|
||||
if ( Title != null )
|
||||
workshop.ugc.SetItemTitle( UpdateHandle, Title );
|
||||
|
@ -98,7 +98,18 @@ namespace Facepunch.Steamworks
|
||||
/// </summary>
|
||||
public Editor CreateItem( ItemType type )
|
||||
{
|
||||
return new Editor() { workshop = this, Type = type };
|
||||
return CreateItem(this.steamworks.AppId, type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Editor object with the intention of creating a new item.
|
||||
/// Your item won't actually be created until you call Publish() on the object.
|
||||
/// Your item will be published to the provided appId.
|
||||
/// </summary>
|
||||
/// <remarks>You need to add app publish permissions for cross app uploading to work.</remarks>
|
||||
public Editor CreateItem( uint workshopUploadAppId, ItemType type )
|
||||
{
|
||||
return new Editor() { workshop = this, WorkshopUploadAppId = workshopUploadAppId, Type = type };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user