Fan website of IMMORTAL: Gates of Pyre.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

44 lines
1.1 KiB

using System.Collections.Generic;
namespace Model.Entity.Parts;
public class EntityHotkeyModel : IEntityPartInterface
{
public string Type { get; set; } = "EntityHotkeyModel";
public string Hotkey { get; set; }
public bool HoldSpace { get; set; } = false;
public string HotkeyGroup { get; set; }
public bool IsSelectedHotkey(List<string> keys)
{
return keys.Contains(Hotkey.ToUpper());
}
public bool IsSelectedHotkeyGroup(List<string> keys)
{
return keys.Contains(HotkeyGroup.ToUpper());
}
public bool IsSelectedHoldSpace(List<string> keys)
{
return (keys.Contains("SPACE") || keys.Contains(" ")) == HoldSpace;
}
public bool IsSelectedHotkeyGroupWithSpace(List<string> keys)
{
var foundKey = false;
var foundHold = false;
foreach (var key in keys)
{
if (key.ToUpper().Equals(HotkeyGroup.ToUpper())) foundKey = true;
if (key.ToUpper().Equals("SPACE") || key.ToUpper().Equals(" ")) foundHold = true;
}
if (foundKey && foundHold == HoldSpace) return true;
return false;
}
}