/// <summary> /// 该组合按键是否抬起? /// </summary> public static bool IsKeyUp(CombinationKey combinationKey) { if (combinationKey.IsEmpty) { return(false); } bool isKeyUp = false; foreach (var key in combinationKey.Keys) { if (!Input.GetKey(key)) { if (Input.GetKeyUp(key)) { isKeyUp = true; } else { return(false); } } } return(isKeyUp); }
/// <summary> /// 是否按住当前组合键? /// </summary> public static bool IsKeyHold(CombinationKey combinationKey) { if (combinationKey.IsEmpty) { return(false); } foreach (var key in combinationKey.Keys) { if (!Input.GetKey(key)) { return(false); } } return(true); }
/// <summary> /// 这个组合按键当前是否启用了? /// </summary> public static bool GetKeyDown(CombinationKey combinationKey) { if (combinationKey.IsEmpty) { return(false); } bool isKeyDown = false; foreach (var key in combinationKey.Keys) { if (!Input.GetKey(key)) { return(false); } if (!isKeyDown && Input.GetKeyDown(key)) { isKeyDown = true; } } return(isKeyDown); }
public CombinationKeyInfo(string name, CombinationKey key) { Name = name; Key = key; }