public KeyMap <TTarget> SetPrefix( Keys key, Action <Keys, TTarget> transitAction, Action <Keys, TTarget> returnAction, Func <Keys, TTarget, bool> returnJudge, bool isConsumeKeyOnReturn ) { var keyMap = new KeyMap <TTarget>(); SetAction( key, (target) => { if (transitAction != null) { transitAction(key, target); } _currentPrefix = _PrefixedKeyMaps[key]; } ); _PrefixedKeyMaps[key] = new PrefixRegistration( keyMap, returnAction, returnJudge, isConsumeKeyOnReturn ); return(keyMap); }
public PrefixRegistration( KeyMap <TTarget> keyMap, Action <Keys, TTarget> returnAction, Func <Keys, TTarget, bool> returnJudge, bool isConsumeKey ) { KeyMap = keyMap; ReturnAction = returnAction; ReturnJudge = returnJudge; IsConsumeKeyOnReturn = isConsumeKey; }