private static void sendCommand(int command, string value, delegate_flow_cmd callback) { FlowEvent newCmd = new FlowEvent(); newCmd.command = command; newCmd.value.data = value; cmdBuffer.Add(newCmd); if (cmdCbDictionary.ContainsKey(command)) { cmdCbDictionary.Remove(command); } cmdCbDictionary.Add(command, callback); }
public static void registerListener(int command, delegate_flow_cmd listener) { if (listenerCmdDictionary.ContainsKey(command)) { List <delegate_flow_cmd> listeners; listenerCmdDictionary.TryGetValue(command, out listeners); listeners.Add(listener); } else { List <delegate_flow_cmd> listeners = new List <delegate_flow_cmd>(); listeners.Add(listener); listenerCmdDictionary.Add(command, listeners); } }