Unstable 1.1.14.0
This commit is contained in:
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Steam Achievement.
|
||||
/// </summary>
|
||||
public struct Achievement
|
||||
{
|
||||
internal string Value;
|
||||
@@ -18,7 +21,7 @@ namespace Steamworks.Data
|
||||
public override string ToString() => Value;
|
||||
|
||||
/// <summary>
|
||||
/// True if unlocked
|
||||
/// Gets whether or not the achievement has been unlocked.
|
||||
/// </summary>
|
||||
public bool State
|
||||
{
|
||||
@@ -30,15 +33,24 @@ namespace Steamworks.Data
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier of the achievement. This is the "API Name" on Steamworks.
|
||||
/// </summary>
|
||||
public string Identifier => Value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the display name of the achievement.
|
||||
/// </summary>
|
||||
public string? Name => SteamUserStats.Internal?.GetAchievementDisplayAttribute( Value, "name" );
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description of the achievement.
|
||||
/// </summary>
|
||||
public string? Description => SteamUserStats.Internal?.GetAchievementDisplayAttribute( Value, "desc" );
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Should hold the unlock time if State is true
|
||||
/// If <see cref="State"/> is <see langword="true"/>, this value represents the time that the achievement was unlocked.
|
||||
/// </summary>
|
||||
public DateTime? UnlockTime
|
||||
{
|
||||
@@ -56,7 +68,7 @@ namespace Steamworks.Data
|
||||
|
||||
/// <summary>
|
||||
/// Gets the icon of the achievement. This can return a null image even though the image exists if the image
|
||||
/// hasn't been downloaded by Steam yet. You can use GetIconAsync if you want to wait for the image to be downloaded.
|
||||
/// hasn't been downloaded by Steam yet. You should use <see cref="GetIconAsync(int)"/> if you want to wait for the image to be downloaded.
|
||||
/// </summary>
|
||||
public Image? GetIcon()
|
||||
{
|
||||
@@ -66,8 +78,9 @@ namespace Steamworks.Data
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the icon of the achievement, waits for it to load if we have to
|
||||
/// Gets the icon of the achievement, yielding until the icon is received or the <paramref name="timeout"/> is reached.
|
||||
/// </summary>
|
||||
/// <param name="timeout">The timeout in milliseconds before the request will be canceled. Defaults to <c>5000</c>.</param>
|
||||
public async Task<Image?> GetIconAsync( int timeout = 5000 )
|
||||
{
|
||||
if (SteamUserStats.Internal is null) { return null; }
|
||||
@@ -109,7 +122,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the fraction (0-1) of users who have unlocked the specified achievement, or -1 if no data available.
|
||||
/// Gets a decimal (0-1) representing the global amount of users who have unlocked the specified achievement, or -1 if no data available.
|
||||
/// </summary>
|
||||
public float GlobalUnlocked
|
||||
{
|
||||
@@ -125,7 +138,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make this achievement earned
|
||||
/// Unlock this achievement.
|
||||
/// </summary>
|
||||
public bool Trigger( bool apply = true )
|
||||
{
|
||||
@@ -142,7 +155,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset this achievement to not achieved
|
||||
/// Reset this achievement to be locked.
|
||||
/// </summary>
|
||||
public bool Clear()
|
||||
{
|
||||
@@ -150,4 +163,4 @@ namespace Steamworks.Data
|
||||
return SteamUserStats.Internal.ClearAchievement( Value );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Text;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the ID of a Steam application.
|
||||
/// </summary>
|
||||
public struct AppId
|
||||
{
|
||||
public uint Value;
|
||||
@@ -27,4 +30,4 @@ namespace Steamworks
|
||||
return value.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,24 @@ using System.Text;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about a DLC.
|
||||
/// </summary>
|
||||
public struct DlcInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="Steamworks.AppId"/> of the DLC.
|
||||
/// </summary>
|
||||
public AppId AppId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the DLC.
|
||||
/// </summary>
|
||||
public string Name { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the DLC is available.
|
||||
/// </summary>
|
||||
public bool Available { get; internal set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,29 @@ using System.Text;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents download progress.
|
||||
/// </summary>
|
||||
public struct DownloadProgress
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not the download is currently active.
|
||||
/// </summary>
|
||||
public bool Active;
|
||||
|
||||
/// <summary>
|
||||
/// How many bytes have been downloaded.
|
||||
/// </summary>
|
||||
public ulong BytesDownloaded;
|
||||
|
||||
/// <summary>
|
||||
/// How many bytes in total the download is.
|
||||
/// </summary>
|
||||
public ulong BytesTotal;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of bytes left that need to be downloaded.
|
||||
/// </summary>
|
||||
public ulong BytesRemaining => BytesTotal - BytesDownloaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,16 @@ using System.Text;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents details of a file.
|
||||
/// </summary>
|
||||
public struct FileDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// The size of the file in bytes.
|
||||
/// </summary>
|
||||
public ulong SizeInBytes;
|
||||
public string Sha1;
|
||||
public uint Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,4 +261,4 @@ namespace Steamworks
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,17 @@ namespace Steamworks.Data
|
||||
public uint Height;
|
||||
public byte[] Data;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the color of the pixel at the specified position.
|
||||
/// </summary>
|
||||
/// <param name="x">X-coordinate</param>
|
||||
/// <param name="y">Y-coordinate</param>
|
||||
/// <returns>The color.</returns>
|
||||
/// <exception cref="System.ArgumentException">If the X and Y or out of bounds.</exception>
|
||||
public Color GetPixel( int x, int y )
|
||||
{
|
||||
if ( x < 0 || x >= Width ) throw new System.Exception( "x out of bounds" );
|
||||
if ( y < 0 || y >= Height ) throw new System.Exception( "y out of bounds" );
|
||||
if ( x < 0 || x >= Width ) throw new System.ArgumentException( "x out of bounds" );
|
||||
if ( y < 0 || y >= Height ) throw new System.ArgumentException( "y out of bounds" );
|
||||
|
||||
Color c = new Color();
|
||||
|
||||
@@ -24,14 +31,21 @@ namespace Steamworks.Data
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns "{Width}x{Height} ({length of <see cref="Data"/>}bytes)"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Width}x{Height} ({Data.Length}bytes)";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a color.
|
||||
/// </summary>
|
||||
public struct Color
|
||||
{
|
||||
public byte r, g, b, a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Steam lobby.
|
||||
/// </summary>
|
||||
public struct Lobby
|
||||
{
|
||||
public SteamId Id { get; internal set; }
|
||||
@@ -18,8 +21,8 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to join this room. Will return RoomEnter.Success on success,
|
||||
/// and anything else is a failure
|
||||
/// Try to join this room. Will return <see cref="RoomEnter.Success"/> on success,
|
||||
/// and anything else is a failure.
|
||||
/// </summary>
|
||||
public async Task<RoomEnter> Join()
|
||||
{
|
||||
@@ -41,9 +44,9 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invite another user to the lobby
|
||||
/// will return true if the invite is successfully sent, whether or not the target responds
|
||||
/// returns false if the local user is not connected to the Steam servers
|
||||
/// Invite another user to the lobby.
|
||||
/// Will return <see langword="true"/> if the invite is successfully sent, whether or not the target responds
|
||||
/// returns <see langword="false"/> if the local user is not connected to the Steam servers
|
||||
/// </summary>
|
||||
public bool InviteFriend( SteamId steamid )
|
||||
{
|
||||
@@ -51,12 +54,12 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns the number of users in the specified lobby
|
||||
/// Gets the number of users in this lobby.
|
||||
/// </summary>
|
||||
public int MemberCount => SteamMatchmaking.Internal?.GetNumLobbyMembers( Id ) ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns current members. Need to be in the lobby to see the users.
|
||||
/// Returns current members in the lobby. The current user must be in the lobby in order to see the users.
|
||||
/// </summary>
|
||||
public IEnumerable<Friend> Members
|
||||
{
|
||||
@@ -72,7 +75,7 @@ namespace Steamworks.Data
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get data associated with this lobby
|
||||
/// Get data associated with this lobby.
|
||||
/// </summary>
|
||||
public string? GetData( string key )
|
||||
{
|
||||
@@ -80,7 +83,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data associated with this lobby
|
||||
/// Set data associated with this lobby.
|
||||
/// </summary>
|
||||
public bool SetData( string key, string value )
|
||||
{
|
||||
@@ -91,7 +94,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a metadata key from the lobby
|
||||
/// Removes a metadata key from the lobby.
|
||||
/// </summary>
|
||||
public bool DeleteData( string key )
|
||||
{
|
||||
@@ -99,7 +102,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all data for this lobby
|
||||
/// Get all data for this lobby.
|
||||
/// </summary>
|
||||
public IEnumerable<KeyValuePair<string, string>> Data
|
||||
{
|
||||
@@ -119,7 +122,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets per-user metadata for someone in this lobby
|
||||
/// Gets per-user metadata for someone in this lobby.
|
||||
/// </summary>
|
||||
public string? GetMemberData( Friend member, string key )
|
||||
{
|
||||
@@ -127,7 +130,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets per-user metadata (for the local user implicitly)
|
||||
/// Sets per-user metadata (for the local user implicitly).
|
||||
/// </summary>
|
||||
public void SetMemberData( string key, string value )
|
||||
{
|
||||
@@ -135,35 +138,44 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a string to the chat room
|
||||
/// Sends a string to the chat room.
|
||||
/// </summary>
|
||||
public bool SendChatString( string message )
|
||||
{
|
||||
var data = System.Text.Encoding.UTF8.GetBytes( message );
|
||||
//adding null terminator as it's used in Helpers.MemoryToString
|
||||
var data = System.Text.Encoding.UTF8.GetBytes( message + '\0' );
|
||||
return SendChatBytes( data );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends bytes the the chat room
|
||||
/// this isn't exposed because there's no way to read raw bytes atm,
|
||||
/// and I figure people can send json if they want something more advanced
|
||||
/// Sends bytes to the chat room.
|
||||
/// </summary>
|
||||
internal unsafe bool SendChatBytes( byte[] data )
|
||||
public unsafe bool SendChatBytes( byte[] data )
|
||||
{
|
||||
fixed ( byte* ptr = data )
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, data.Length );
|
||||
return SendChatBytesUnsafe( ptr, data.Length );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends bytes to the chat room from an unsafe buffer.
|
||||
/// </summary>
|
||||
public unsafe bool SendChatBytesUnsafe( byte* ptr, int length )
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SendLobbyChatMsg( Id, (IntPtr)ptr, length );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes metadata for a lobby you're not necessarily in right now.
|
||||
/// <para>
|
||||
/// You never do this for lobbies you're a member of, only if your
|
||||
/// this will send down all the metadata associated with a lobby.
|
||||
/// This is an asynchronous call.
|
||||
/// Returns false if the local user is not connected to the Steam servers.
|
||||
/// Returns <see langword="false"/> if the local user is not connected to the Steam servers.
|
||||
/// Results will be returned by a LobbyDataUpdate_t callback.
|
||||
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false.
|
||||
/// If the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to <see langword="false"/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool Refresh()
|
||||
{
|
||||
@@ -171,8 +183,8 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Max members able to join this lobby. Cannot be over 250.
|
||||
/// Can only be set by the owner
|
||||
/// Max members able to join this lobby. Cannot be over <c>250</c>.
|
||||
/// Can only be set by the owner of the lobby.
|
||||
/// </summary>
|
||||
public int MaxMembers
|
||||
{
|
||||
@@ -180,26 +192,42 @@ namespace Steamworks.Data
|
||||
set => SteamMatchmaking.Internal?.SetLobbyMemberLimit( Id, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the lobby as public.
|
||||
/// </summary>
|
||||
public bool SetPublic()
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Public );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the lobby as private.
|
||||
/// </summary>
|
||||
public bool SetPrivate()
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Private );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the lobby as invisible.
|
||||
/// </summary>
|
||||
public bool SetInvisible()
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.Invisible );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the lobby as friends only.
|
||||
/// </summary>
|
||||
public bool SetFriendsOnly()
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyType( Id, LobbyType.FriendsOnly );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set whether or not the lobby can be joined.
|
||||
/// </summary>
|
||||
/// <param name="b">Whether or not the lobby can be joined.</param>
|
||||
public bool SetJoinable( bool b )
|
||||
{
|
||||
return SteamMatchmaking.Internal != null && SteamMatchmaking.Internal.SetLobbyJoinable( Id, b );
|
||||
@@ -207,7 +235,7 @@ namespace Steamworks.Data
|
||||
|
||||
/// <summary>
|
||||
/// [SteamID variant]
|
||||
/// Allows the owner to set the game server associated with the lobby. Triggers the
|
||||
/// Allows the owner to set the game server associated with the lobby. Triggers the
|
||||
/// Steammatchmaking.OnLobbyGameCreated event.
|
||||
/// </summary>
|
||||
public void SetGameServer( SteamId steamServer )
|
||||
@@ -220,7 +248,7 @@ namespace Steamworks.Data
|
||||
|
||||
/// <summary>
|
||||
/// [IP/Port variant]
|
||||
/// Allows the owner to set the game server associated with the lobby. Triggers the
|
||||
/// Allows the owner to set the game server associated with the lobby. Triggers the
|
||||
/// Steammatchmaking.OnLobbyGameCreated event.
|
||||
/// </summary>
|
||||
public void SetGameServer( string ip, ushort port )
|
||||
@@ -232,7 +260,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
|
||||
/// Gets the details of the lobby's game server, if set. Returns true if the lobby is
|
||||
/// valid and has a server set, otherwise returns false.
|
||||
/// </summary>
|
||||
public bool GetGameServer( ref uint ip, ref ushort port, ref SteamId serverId )
|
||||
@@ -241,7 +269,7 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// You must be the lobby owner to set the owner
|
||||
/// Gets or sets the owner of the lobby. You must be the lobby owner to set the owner
|
||||
/// </summary>
|
||||
public Friend Owner
|
||||
{
|
||||
@@ -250,8 +278,8 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the specified SteamId owns the lobby
|
||||
/// Check if the specified SteamId owns the lobby.
|
||||
/// </summary>
|
||||
public bool IsOwnedBy( SteamId k ) => Owner.Id == k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Steamworks
|
||||
internal PartyBeaconID_t Id;
|
||||
|
||||
/// <summary>
|
||||
/// Creator of the beacon
|
||||
/// Gets the owner of the beacon.
|
||||
/// </summary>
|
||||
public SteamId Owner
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace Steamworks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creator of the beacon
|
||||
/// Gets metadata related to the beacon.
|
||||
/// </summary>
|
||||
public string? MetaData
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace Steamworks
|
||||
|
||||
/// <summary>
|
||||
/// Will attempt to join the party. If successful will return a connection string.
|
||||
/// If failed, will return null
|
||||
/// If failed, will return <see langword="null"/>
|
||||
/// </summary>
|
||||
public async Task<string?> JoinAsync()
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace Steamworks
|
||||
|
||||
/// <summary>
|
||||
/// When a user follows your beacon, Steam will reserve one of the open party slots for them, and send your game a ReservationNotification callback.
|
||||
/// When that user joins your party, call OnReservationCompleted to notify Steam that the user has joined successfully
|
||||
/// When that user joins your party, call this method to notify Steam that the user has joined successfully.
|
||||
/// </summary>
|
||||
public void OnReservationCompleted( SteamId steamid )
|
||||
{
|
||||
@@ -73,11 +73,11 @@ namespace Steamworks
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn off the beacon
|
||||
/// Turn off the beacon.
|
||||
/// </summary>
|
||||
public bool Destroy()
|
||||
{
|
||||
return Internal != null && Internal.DestroyBeacon( Id );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Text;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a screenshot that was taken by a user.
|
||||
/// </summary>
|
||||
public struct Screenshot
|
||||
{
|
||||
internal ScreenshotHandle Value;
|
||||
@@ -19,19 +22,16 @@ namespace Steamworks.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags a user as being visible in the screenshot
|
||||
/// Sets the location of the screenshot.
|
||||
/// </summary>
|
||||
public bool SetLocation( string location )
|
||||
{
|
||||
return SteamScreenshots.Internal != null && SteamScreenshots.Internal.SetLocation( Value, location );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags a user as being visible in the screenshot
|
||||
/// </summary>
|
||||
public bool TagPublishedFile( PublishedFileId file )
|
||||
{
|
||||
return SteamScreenshots.Internal != null && SteamScreenshots.Internal.TagPublishedFile( Value, file );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,4 +142,4 @@ namespace Steamworks.Data
|
||||
return (Address?.GetHashCode() ?? 0) + SteamId.GetHashCode() + ConnectionPort.GetHashCode() + QueryPort.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public struct SteamServerInit
|
||||
{
|
||||
public IPAddress? IpAddress;
|
||||
public ushort SteamPort;
|
||||
public IPAddress? IpAddress;
|
||||
public ushort GamePort;
|
||||
public ushort QueryPort;
|
||||
public InitServerMode Mode;
|
||||
@@ -60,18 +59,8 @@ namespace Steamworks
|
||||
Mode = InitServerMode.Authentication;
|
||||
VersionString = "1.0.0.0";
|
||||
IpAddress = null;
|
||||
SteamPort = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the Steam quert port
|
||||
/// </summary>
|
||||
public SteamServerInit WithRandomSteamPort()
|
||||
{
|
||||
SteamPort = (ushort)new Random().Next( 10000, 60000 );
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into usQueryPort, then it causes the game server API to use
|
||||
/// "GameSocketShare" mode, which means that the game is responsible for sending and receiving UDP packets for the master
|
||||
|
||||
@@ -151,4 +151,4 @@ namespace Steamworks.Data
|
||||
return SteamUserStats.Internal != null && SteamUserStats.Internal.StoreStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Text;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the ID of a user or steam lobby.
|
||||
/// </summary>
|
||||
public struct SteamId
|
||||
{
|
||||
public ulong Value;
|
||||
@@ -26,4 +29,4 @@ namespace Steamworks
|
||||
|
||||
public bool IsValid => Value != default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct UgcAdditionalPreview
|
||||
{
|
||||
internal UgcAdditionalPreview( string urlOrVideoID, string originalFileName, ItemPreviewType itemPreviewType )
|
||||
{
|
||||
this.UrlOrVideoID = urlOrVideoID;
|
||||
this.OriginalFileName = originalFileName;
|
||||
this.ItemPreviewType = itemPreviewType;
|
||||
}
|
||||
|
||||
public string UrlOrVideoID { get; private set; }
|
||||
public string OriginalFileName { get; private set; }
|
||||
public ItemPreviewType ItemPreviewType { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48f086235d5dbeb44bccbb40802e30fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -44,7 +44,12 @@ namespace Steamworks.Ugc
|
||||
/// Workshop item that is meant to be voted on for the purpose of selling in-game
|
||||
/// </summary>
|
||||
public static Editor NewMicrotransactionFile => new Editor( WorkshopFileType.Microtransaction );
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Workshop item that is meant to be managed by the game. It is queryable by the API, but isn't visible on the web browser.
|
||||
/// </summary>
|
||||
public static Editor NewGameManagedFile => new Editor(WorkshopFileType.GameManagedItem);
|
||||
|
||||
public Editor ForAppId( AppId id ) { this.consumerAppId = id; return this; }
|
||||
|
||||
public string? Title { get; private set; }
|
||||
@@ -136,14 +141,7 @@ namespace Steamworks.Ugc
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool HasTag( string tag )
|
||||
{
|
||||
if (Tags != null && Tags.Contains(tag)) { return true; }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<PublishResult> SubmitAsync( IProgress<float>? progress = null )
|
||||
public async Task<PublishResult> SubmitAsync( IProgress<float>? progress = null, Action<PublishResult>? onItemCreated = null )
|
||||
{
|
||||
var result = default( PublishResult );
|
||||
if (SteamUGC.Internal is null) { return result; }
|
||||
@@ -184,6 +182,9 @@ namespace Steamworks.Ugc
|
||||
FileId = created.Value.PublishedFileId;
|
||||
result.NeedsWorkshopAgreement = created.Value.UserNeedsToAcceptWorkshopLegalAgreement;
|
||||
result.FileId = FileId;
|
||||
|
||||
if ( onItemCreated != null )
|
||||
onItemCreated( result );
|
||||
}
|
||||
|
||||
result.FileId = FileId;
|
||||
@@ -260,7 +261,7 @@ namespace Steamworks.Ugc
|
||||
case ItemUpdateStatus.UploadingContent:
|
||||
{
|
||||
var uploaded = total > 0 ? ((float)processed / (float)total) : 0.0f;
|
||||
progress?.Report( 0.2f + uploaded * 0.7f );
|
||||
progress?.Report( 0.2f + uploaded * 0.6f );
|
||||
break;
|
||||
}
|
||||
case ItemUpdateStatus.UploadingPreviewFile:
|
||||
@@ -311,4 +312,4 @@ namespace Steamworks.Ugc
|
||||
/// </summary>
|
||||
public bool NeedsWorkshopAgreement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,15 @@ namespace Steamworks.Ugc
|
||||
/// The number of downvotes of this item
|
||||
/// </summary>
|
||||
public uint VotesDown => details.VotesDown;
|
||||
/// <summary>
|
||||
/// Dependencies/children of this item or collection, available only from WithDependencies(true) queries
|
||||
/// </summary>
|
||||
public PublishedFileId[]? Children;
|
||||
|
||||
/// <summary>
|
||||
/// Additional previews of this item or collection, available only from WithAdditionalPreviews(true) queries
|
||||
/// </summary>
|
||||
public UgcAdditionalPreview[]? AdditionalPreviews { get; internal set; }
|
||||
|
||||
public bool IsInstalled => (State & ItemState.Installed) == ItemState.Installed;
|
||||
public bool IsDownloading => (State & ItemState.Downloading) == ItemState.Downloading;
|
||||
@@ -410,7 +419,21 @@ namespace Steamworks.Ugc
|
||||
{
|
||||
return new Ugc.Editor( Id );
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> AddDependency( PublishedFileId child )
|
||||
{
|
||||
if ( SteamUGC.Internal is null ) { return false; }
|
||||
var r = await SteamUGC.Internal.AddDependency( Id, child );
|
||||
return r?.Result == Result.OK;
|
||||
}
|
||||
|
||||
public async Task<bool> RemoveDependency( PublishedFileId child )
|
||||
{
|
||||
if ( SteamUGC.Internal is null ) { return false; }
|
||||
var r = await SteamUGC.Internal.RemoveDependency( Id, child );
|
||||
return r?.Result == Result.OK;
|
||||
}
|
||||
|
||||
public Result Result => details.Result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,8 @@ namespace Steamworks.Ugc
|
||||
ReturnsKeyValueTags = WantsReturnKeyValueTags ?? false,
|
||||
ReturnsDefaultStats = WantsDefaultStats ?? true, //true by default
|
||||
ReturnsMetadata = WantsReturnMetadata ?? false,
|
||||
ReturnsChildren = WantsReturnChildren ?? false,
|
||||
ReturnsAdditionalPreviews = WantsReturnAdditionalPreviews ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Steamworks.Ugc
|
||||
internal bool ReturnsKeyValueTags;
|
||||
internal bool ReturnsDefaultStats;
|
||||
internal bool ReturnsMetadata;
|
||||
internal bool ReturnsChildren;
|
||||
internal bool ReturnsAdditionalPreviews;
|
||||
|
||||
public IEnumerable<Item> Entries
|
||||
{
|
||||
@@ -74,8 +76,36 @@ namespace Steamworks.Ugc
|
||||
}
|
||||
}
|
||||
|
||||
// TODO GetQueryUGCAdditionalPreview
|
||||
// TODO GetQueryUGCChildren
|
||||
uint numChildren = item.details.NumChildren;
|
||||
if ( ReturnsChildren && numChildren > 0 )
|
||||
{
|
||||
var children = new PublishedFileId[numChildren];
|
||||
if ( SteamUGC.Internal.GetQueryUGCChildren( Handle, i, children, numChildren ) )
|
||||
{
|
||||
item.Children = children;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ReturnsAdditionalPreviews )
|
||||
{
|
||||
var previewsCount = SteamUGC.Internal.GetQueryUGCNumAdditionalPreviews( Handle, i );
|
||||
if ( previewsCount > 0 )
|
||||
{
|
||||
item.AdditionalPreviews = new UgcAdditionalPreview[previewsCount];
|
||||
for ( uint j = 0; j < previewsCount; j++ )
|
||||
{
|
||||
string previewUrlOrVideo;
|
||||
string originalFileName; //what is this???
|
||||
ItemPreviewType previewType = default;
|
||||
if ( SteamUGC.Internal.GetQueryUGCAdditionalPreview(
|
||||
Handle, i, j, out previewUrlOrVideo, out originalFileName, ref previewType ) )
|
||||
{
|
||||
item.AdditionalPreviews[j] = new UgcAdditionalPreview(
|
||||
previewUrlOrVideo, originalFileName, previewType );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yield return item;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user