mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Merge pull request #66 from MollerVictor/master
Added support for publishing workshop items to the main app from anot…
This commit is contained in:
commit
13c8b543cc
@ -24,6 +24,7 @@ public class Editor
|
|||||||
public ItemType? Type { get; set; }
|
public ItemType? Type { get; set; }
|
||||||
public string Error { get; internal set; } = null;
|
public string Error { get; internal set; } = null;
|
||||||
public string ChangeNote { get; set; } = "";
|
public string ChangeNote { get; set; } = "";
|
||||||
|
public uint WorkshopUploadAppId { get; set; }
|
||||||
|
|
||||||
public enum VisibilityType : int
|
public enum VisibilityType : int
|
||||||
{
|
{
|
||||||
@ -109,7 +110,7 @@ private void StartCreatingItem()
|
|||||||
if ( !Type.HasValue )
|
if ( !Type.HasValue )
|
||||||
throw new System.Exception( "Editor.Type must be set when creating a new item!" );
|
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 )
|
private void OnItemCreated( SteamNative.CreateItemResult_t obj, bool Failed )
|
||||||
@ -130,7 +131,7 @@ private void OnItemCreated( SteamNative.CreateItemResult_t obj, bool Failed )
|
|||||||
|
|
||||||
private void PublishChanges()
|
private void PublishChanges()
|
||||||
{
|
{
|
||||||
UpdateHandle = workshop.ugc.StartItemUpdate( workshop.steamworks.AppId, Id );
|
UpdateHandle = workshop.ugc.StartItemUpdate(WorkshopUploadAppId, Id );
|
||||||
|
|
||||||
if ( Title != null )
|
if ( Title != null )
|
||||||
workshop.ugc.SetItemTitle( UpdateHandle, Title );
|
workshop.ugc.SetItemTitle( UpdateHandle, Title );
|
||||||
|
@ -98,7 +98,18 @@ public Query CreateQuery()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Editor CreateItem( ItemType type )
|
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>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user