mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat: add VirtualKey.GetFancyName()
This commit is contained in:
parent
29da317b2c
commit
7329465573
3 changed files with 252 additions and 4 deletions
File diff suppressed because it is too large
Load diff
25
Dalamud/Game/ClientState/Keys/VirtualKeyAttribute.cs
Normal file
25
Dalamud/Game/ClientState/Keys/VirtualKeyAttribute.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Dalamud.Game.ClientState.Keys
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Attribute describing a VirtualKey.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
|
internal sealed class VirtualKeyAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VirtualKeyAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fancyName">Fancy name of this key.</param>
|
||||||
|
public VirtualKeyAttribute(string fancyName)
|
||||||
|
{
|
||||||
|
this.FancyName = fancyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the fancy name of this virtual key.
|
||||||
|
/// </summary>
|
||||||
|
public string FancyName { get; init; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Dalamud/Game/ClientState/Keys/VirtualKeyExtensions.cs
Normal file
20
Dalamud/Game/ClientState/Keys/VirtualKeyExtensions.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using Dalamud.Utility;
|
||||||
|
|
||||||
|
namespace Dalamud.Game.ClientState.Keys
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Extension methods for <see cref="VirtualKey"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static class VirtualKeyExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get the fancy name associated with this key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The they key to act on.</param>
|
||||||
|
/// <returns>The key's fancy name.</returns>
|
||||||
|
public static string GetFancyName(this VirtualKey key)
|
||||||
|
{
|
||||||
|
return key.GetAttribute<VirtualKeyAttribute>().FancyName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue