mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
GetIcon should be uint, add more overloads for HQ icons
Apparently "hq" is a language internally.
This commit is contained in:
parent
47ac918e46
commit
3c5f6271ce
1 changed files with 52 additions and 6 deletions
|
|
@ -137,18 +137,30 @@ namespace Dalamud.Data
|
|||
/// </summary>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
|
||||
public TexFile GetIcon(int iconId)
|
||||
public TexFile GetIcon(uint iconId)
|
||||
{
|
||||
return this.GetIcon(this.Language, iconId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TexFile"/> containing the icon with the given ID, of the given quality.
|
||||
/// </summary>
|
||||
/// <param name="isHq">A value indicating whether the icon should be HQ.</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
|
||||
public TexFile GetIcon(bool isHq, uint iconId)
|
||||
{
|
||||
var type = isHq ? "hq/" : string.Empty;
|
||||
return this.GetIcon(type, iconId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TexFile"/> containing the icon with the given ID, of the given language.
|
||||
/// </summary>
|
||||
/// <param name="iconLanguage">The requested language.</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
|
||||
public TexFile GetIcon(ClientLanguage iconLanguage, int iconId)
|
||||
public TexFile GetIcon(ClientLanguage iconLanguage, uint iconId)
|
||||
{
|
||||
var type = iconLanguage switch
|
||||
{
|
||||
|
|
@ -168,7 +180,7 @@ namespace Dalamud.Data
|
|||
/// <param name="type">The type of the icon (e.g. 'hq' to get the HQ variant of an item icon).</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
|
||||
public TexFile GetIcon(string type, int iconId)
|
||||
public TexFile GetIcon(string type, uint iconId)
|
||||
{
|
||||
type ??= string.Empty;
|
||||
if (type.Length > 0 && !type.EndsWith("/"))
|
||||
|
|
@ -177,7 +189,8 @@ namespace Dalamud.Data
|
|||
var filePath = string.Format(IconFileFormat, iconId / 1000, type, iconId);
|
||||
var file = this.GetFile<TexFile>(filePath);
|
||||
|
||||
if (file != default(TexFile) || type.Length <= 0) return file;
|
||||
if (type == string.Empty || file != default)
|
||||
return file;
|
||||
|
||||
// Couldn't get specific type, try for generic version.
|
||||
filePath = string.Format(IconFileFormat, iconId / 1000, string.Empty, iconId);
|
||||
|
|
@ -185,6 +198,14 @@ namespace Dalamud.Data
|
|||
return file;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TexFile"/> containing the HQ icon with the given ID.
|
||||
/// </summary>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
|
||||
public TexFile GetHqIcon(uint iconId)
|
||||
=> this.GetIcon(true, iconId);
|
||||
|
||||
/// <summary>
|
||||
/// Get the passed <see cref="TexFile"/> as a drawable ImGui TextureWrap.
|
||||
/// </summary>
|
||||
|
|
@ -201,13 +222,30 @@ namespace Dalamud.Data
|
|||
public TextureWrap GetImGuiTexture(string path)
|
||||
=> this.GetImGuiTexture(this.GetFile<TexFile>(path));
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TextureWrap"/> containing the icon with the given ID.
|
||||
/// </summary>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
|
||||
public TextureWrap GetImGuiTextureIcon(uint iconId)
|
||||
=> this.GetImGuiTexture(this.GetIcon(iconId));
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TextureWrap"/> containing the icon with the given ID, of the given quality.
|
||||
/// </summary>
|
||||
/// <param name="isHq">A value indicating whether the icon should be HQ.</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
|
||||
public TextureWrap GetImGuiTextureIcon(bool isHq, uint iconId)
|
||||
=> this.GetImGuiTexture(this.GetIcon(isHq, iconId));
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TextureWrap"/> containing the icon with the given ID, of the given language.
|
||||
/// </summary>
|
||||
/// <param name="iconLanguage">The requested language.</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
|
||||
public TextureWrap GetImGuiTextureIcon(ClientLanguage iconLanguage, int iconId)
|
||||
public TextureWrap GetImGuiTextureIcon(ClientLanguage iconLanguage, uint iconId)
|
||||
=> this.GetImGuiTexture(this.GetIcon(iconLanguage, iconId));
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -216,9 +254,17 @@ namespace Dalamud.Data
|
|||
/// <param name="type">The type of the icon (e.g. 'hq' to get the HQ variant of an item icon).</param>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
|
||||
public TextureWrap GetImGuiTextureIcon(string type, int iconId)
|
||||
public TextureWrap GetImGuiTextureIcon(string type, uint iconId)
|
||||
=> this.GetImGuiTexture(this.GetIcon(type, iconId));
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="TextureWrap"/> containing the HQ icon with the given ID.
|
||||
/// </summary>
|
||||
/// <param name="iconId">The icon ID.</param>
|
||||
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
|
||||
public TextureWrap GetImGuiTextureHqIcon(uint iconId)
|
||||
=> this.GetImGuiTexture(this.GetHqIcon(iconId));
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue