private void TriggerCommand(commands_t _command, List <string> _params) { Action <List <string> > _thisAction; if (INSTANCE._commandDictionary.TryGetValue(_command, out _thisAction)) { _thisAction.Invoke(_params); } }
public static void StopCommandListening(commands_t _command, Action <List <string> > _listener) { if (INSTANCE == null) { return; } Action <List <string> > _thisAction; if (INSTANCE._commandDictionary.TryGetValue(_command, out _thisAction)) { _thisAction -= _listener; } }
public static void StartCommandListening(commands_t _command, Action <List <string> > _listener) { Action <List <string> > _thisAction; if (INSTANCE._commandDictionary.TryGetValue(_command, out _thisAction)) { _thisAction += _listener; } else { _thisAction = new Action <List <string> > (_listener); INSTANCE._commandDictionary.Add(_command, _thisAction); } }