static Func <bool> CreatePressTestFunc(KeyCode key, KeyPressType pressType, float[] para) { if (pressType < KeyPressType.JoyStickBegin) { if (key == KeyCode.None) { return(() => false); } int mask = (int)key & KeyMask; // use excluder to check key mask if (mask != 0) { key = key - mask; } } switch (pressType) { default: case KeyPressType.Up: return(() => Input.GetKeyUp(key) && NotExcluderByOther()); case KeyPressType.Down: return(() => Input.GetKeyDown(key) && NotExcluderByOther()); case KeyPressType.Press: return(() => Input.GetKey(key) && NotExcluderByOther()); case KeyPressType.UpHPrior: return(() => Input.GetKeyUp(key)); case KeyPressType.PressHPrior: return(() => Input.GetKey(key)); case KeyPressType.ClickNoMove: return(() => key.IsClickNoMove()); case KeyPressType.Click: ClickPressInfo.Register(key, para); return(() => key.IsClickPress()); case KeyPressType.ClickCD: ClickCDPressInfo.Register(key, para); return(() => key.IsClickCDPress()); case KeyPressType.DoublePress: DoublePressInfo.Register(key, para); return(() => key.IsDoublePress()); case KeyPressType.LongPress: LongPressInfo.Register(key, para); return(() => key.IsLongPress()); case KeyPressType.DirU: s_keyAxisU = key; return(delegate { return s_curAxisV > PETools.PEMath.Epsilon; }); case KeyPressType.DirD: s_keyAxisD = key; return(delegate { return s_curAxisV < -PETools.PEMath.Epsilon; }); case KeyPressType.DirR: s_keyAxisR = key; return(delegate { return s_curAxisH > PETools.PEMath.Epsilon; }); case KeyPressType.DirL: s_keyAxisL = key; return(delegate { return s_curAxisH < -PETools.PEMath.Epsilon; }); case KeyPressType.MouseWheelU: return(delegate { return Input.GetAxis("Mouse ScrollWheel") > PETools.PEMath.Epsilon; }); case KeyPressType.MouseWheelD: return(delegate { return Input.GetAxis("Mouse ScrollWheel") < -PETools.PEMath.Epsilon; }); } }