コード例 #1
0
        /// <summary>
        /// Binds a key to a method
        /// </summary>
        /// <param name="player"></param>
        /// <param name="key"></param>
        /// <param name="state"></param>
        /// <param name="handler"></param>
        /// <returns></returns>
        public static bool BindKey(string key, KeyState state, Action <string, KeyState> handler)
        {
            Action <string, string> rawClosure = (string command, string state) =>
            {
                handler(command, (KeyState)Enum.Parse(typeof(KeyState), state, true));
            };

            closures[handler] = rawClosure;
            return(MtaClient.BindKey(key, state.ToString().ToLower(), rawClosure));
        }
コード例 #2
0
 /// <summary>
 /// Binds a key to a command
 /// </summary>
 /// <param name="player"></param>
 /// <param name="key"></param>
 /// <param name="state"></param>
 /// <param name="command"></param>
 /// <returns></returns>
 public static bool BindKey(string key, KeyState state, string command)
 {
     return(MtaClient.BindKey(key, state.ToString().ToLower(), command));
 }