Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
 public CombinationKeyInfo(string name, CombinationKey key)
 {
     Name = name;
     Key  = key;
 }