mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-02-03 09:10:41 +03:00
LocalPriceFormatted
This commit is contained in:
parent
aa666a3149
commit
37f6192213
@ -37,16 +37,16 @@ namespace Steamworks
|
||||
public static event Action OnDefinitionsUpdated;
|
||||
|
||||
public static async Task<SteamItemDef[]> GetItemsWithPricesAsync()
|
||||
public static string Currency { get; internal set; }
|
||||
{
|
||||
var priceRequest = await Internal.RequestPrices();
|
||||
if ( !priceRequest.HasValue || priceRequest.Value.Result != Result.OK )
|
||||
return null;
|
||||
|
||||
Console.WriteLine( $"Currency: {priceRequest?.Currency}" );
|
||||
Currency = priceRequest?.Currency;
|
||||
|
||||
var num = Internal.GetNumItemsWithPrices();
|
||||
|
||||
Console.WriteLine( $"num: {num}" );
|
||||
if ( num <= 0 )
|
||||
return null;
|
||||
|
||||
|
@ -8,6 +8,11 @@ namespace Steamworks
|
||||
{
|
||||
internal SteamItemDef_t _id;
|
||||
|
||||
public SteamItemDef( int defId )
|
||||
{
|
||||
_id = defId;
|
||||
}
|
||||
|
||||
public int Id => _id.Value;
|
||||
|
||||
/// <summary>
|
||||
@ -146,6 +151,8 @@ namespace Steamworks
|
||||
}
|
||||
}
|
||||
|
||||
public string LocalPriceFormatted => Utility.FormatPrice( SteamInventory.Currency, LocalPrice / 100.0 );
|
||||
|
||||
/// <summary>
|
||||
/// If the price has been discounted, LocalPrice will differ from LocalBasePrice
|
||||
/// (assumed, this isn't documented)
|
||||
@ -164,7 +171,6 @@ namespace Steamworks
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentPrice;
|
||||
public int BasePrice;
|
||||
public string LocalBasePriceFormatted => Utility.FormatPrice( SteamInventory.Currency, LocalPrice / 100.0 );
|
||||
}
|
||||
}
|
@ -27,12 +27,7 @@ namespace Steamworks
|
||||
return new IPAddress( Swap( ipAddress ) );
|
||||
}
|
||||
|
||||
internal static string FormatPrice(string currency, ulong price)
|
||||
{
|
||||
return FormatPrice(currency, price / 100.0);
|
||||
}
|
||||
|
||||
public static string FormatPrice(string currency, double price)
|
||||
public static string FormatPrice(string currency, double price)
|
||||
{
|
||||
var decimaled = price.ToString("0.00");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user