mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 14:48:02 +03:00
Icon loading
This commit is contained in:
parent
2cff8ccea1
commit
9657f3b32e
@ -57,6 +57,12 @@ namespace Facepunch.Steamworks.Test
|
|||||||
Console.WriteLine( " - - " + ach.State );
|
Console.WriteLine( " - - " + ach.State );
|
||||||
Console.WriteLine( " - - " + ach.UnlockTime );
|
Console.WriteLine( " - - " + ach.UnlockTime );
|
||||||
Console.WriteLine( " - - " + ach.Percentage );
|
Console.WriteLine( " - - " + ach.Percentage );
|
||||||
|
|
||||||
|
if ( ach.Icon != null )
|
||||||
|
{
|
||||||
|
Console.WriteLine( " - - " + ach.Icon.Width + " x " + ach.Icon.Height );
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine( "" );
|
Console.WriteLine( "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,8 @@ namespace Facepunch.Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UnlockTime { get; private set; }
|
public DateTime UnlockTime { get; private set; }
|
||||||
|
|
||||||
|
private int iconId { get; set; } = -1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this achievement is linked to a stat this will return the progress.
|
/// If this achievement is linked to a stat this will return the progress.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -106,6 +108,30 @@ namespace Facepunch.Steamworks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Image _icon;
|
||||||
|
|
||||||
|
public Image Icon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ( iconId <= 0 ) return null;
|
||||||
|
|
||||||
|
if ( _icon == null )
|
||||||
|
{
|
||||||
|
_icon = new Image();
|
||||||
|
_icon.Id = iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _icon.IsLoaded )
|
||||||
|
return _icon;
|
||||||
|
|
||||||
|
if ( !_icon.TryLoad( client.native.utils ) )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return _icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Achievement( Client client, int index )
|
public Achievement( Client client, int index )
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
@ -114,6 +140,8 @@ namespace Facepunch.Steamworks
|
|||||||
Name = client.native.userstats.GetAchievementDisplayAttribute( Id, "name" );
|
Name = client.native.userstats.GetAchievementDisplayAttribute( Id, "name" );
|
||||||
Description = client.native.userstats.GetAchievementDisplayAttribute( Id, "desc" );
|
Description = client.native.userstats.GetAchievementDisplayAttribute( Id, "desc" );
|
||||||
|
|
||||||
|
iconId = client.native.userstats.GetAchievementIcon( Id );
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user