mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Added missing public methods for various functions in ISteamUGC. Fixed UGC Submit process reporting invalid progress value.
This commit is contained in:
parent
06169693d0
commit
455a9f8956
@ -69,6 +69,8 @@ public Editor( PublishedFileId fileId ) : this()
|
||||
public Editor WithPrivateVisibility() { Visibility = RemoteStoragePublishedFileVisibility.Private; return this; }
|
||||
|
||||
List<string> Tags;
|
||||
Dictionary<string, string> KeyValueTags;
|
||||
|
||||
public Editor WithTag( string tag )
|
||||
{
|
||||
if ( Tags == null ) Tags = new List<string>();
|
||||
@ -78,6 +80,13 @@ public Editor WithTag( string tag )
|
||||
return this;
|
||||
}
|
||||
|
||||
public Editor AddKeyValueTag(string key, string value)
|
||||
{
|
||||
if (KeyValueTags == null) KeyValueTags = new Dictionary<string, string>();
|
||||
KeyValueTags.Add(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||
{
|
||||
var result = default( PublishResult );
|
||||
@ -134,6 +143,14 @@ public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||
}
|
||||
}
|
||||
|
||||
if (KeyValueTags != null && KeyValueTags.Count > 0)
|
||||
{
|
||||
foreach (var keyValueTag in KeyValueTags)
|
||||
{
|
||||
SteamUGC.Internal.AddItemKeyValueTag(handle, keyValueTag.Key, keyValueTag.Value);
|
||||
}
|
||||
}
|
||||
|
||||
result.Result = Steamworks.Result.Fail;
|
||||
|
||||
if ( ChangeLog == null )
|
||||
@ -171,7 +188,7 @@ public async Task<PublishResult> SubmitAsync( IProgress<float> progress = null )
|
||||
}
|
||||
case ItemUpdateStatus.UploadingPreviewFile:
|
||||
{
|
||||
progress?.Report( 8f );
|
||||
progress?.Report( 0.8f );
|
||||
break;
|
||||
}
|
||||
case ItemUpdateStatus.CommittingChanges:
|
||||
|
@ -263,6 +263,24 @@ public async Task<bool> Unsubscribe ()
|
||||
return result?.Result == Result.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds item to user favorite list
|
||||
/// </summary>
|
||||
public async Task<bool> AddFavorite()
|
||||
{
|
||||
var result = await SteamUGC.Internal.AddItemToFavorites(details.ConsumerAppID, _id);
|
||||
return result?.Result == Result.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes item from user favorite list
|
||||
/// </summary>
|
||||
public async Task<bool> RemoveFavorite()
|
||||
{
|
||||
var result = await SteamUGC.Internal.RemoveItemFromFavorites(details.ConsumerAppID, _id);
|
||||
return result?.Result == Result.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows the user to rate a workshop item up or down.
|
||||
/// </summary>
|
||||
@ -272,10 +290,21 @@ public async Task<bool> Vote( bool up )
|
||||
return r?.Result == Result.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a URL to view this item online
|
||||
/// </summary>
|
||||
public string Url => $"http://steamcommunity.com/sharedfiles/filedetails/?source=Facepunch.Steamworks&id={Id}";
|
||||
/// <summary>
|
||||
/// Gets the current users vote on the item
|
||||
/// </summary>
|
||||
public async Task<UserItemVote?> GetUserVote()
|
||||
{
|
||||
var result = await SteamUGC.Internal.GetUserItemVote(_id);
|
||||
if (!result.HasValue)
|
||||
return null;
|
||||
return UserItemVote.From(result.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a URL to view this item online
|
||||
/// </summary>
|
||||
public string Url => $"http://steamcommunity.com/sharedfiles/filedetails/?source=Facepunch.Steamworks&id={Id}";
|
||||
|
||||
/// <summary>
|
||||
/// The URl to view this item's changelog
|
||||
|
@ -194,6 +194,13 @@ public QueryType WithTag( string tag )
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryType AddRequiredKeyValueTag(string key, string value)
|
||||
{
|
||||
if (requiredKv == null) requiredKv = new Dictionary<string, string>();
|
||||
requiredKv.Add(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryType WithoutTag( string tag )
|
||||
{
|
||||
if ( excludedTags == null ) excludedTags = new List<string>();
|
||||
|
21
Facepunch.Steamworks/Structs/UserItemVote.cs
Normal file
21
Facepunch.Steamworks/Structs/UserItemVote.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks.Ugc
|
||||
{
|
||||
public struct UserItemVote
|
||||
{
|
||||
public bool VotedUp;
|
||||
public bool VotedDown;
|
||||
public bool VoteSkipped;
|
||||
|
||||
internal static UserItemVote? From(GetUserItemVoteResult_t result)
|
||||
{
|
||||
return new UserItemVote
|
||||
{
|
||||
VotedUp = result.VotedUp,
|
||||
VotedDown = result.VotedDown,
|
||||
VoteSkipped = result.VoteSkipped
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user