/// <summary> /// Add listener on actions /// </summary> /// <param name="componentAction">name of event</param> /// <param name="listener">callback</param> public void AddComponentListener(EnumComponentAction componentAction, Action <IComponentActionData> listener) { if (!_commponentActionDispatcher.ContainsKey(componentAction)) { _commponentActionDispatcher.Add(componentAction, new List <Action <IComponentActionData> >()); } _commponentActionDispatcher[componentAction].Add(listener); }
/// <summary> /// Remove listener of componen action /// </summary> /// <param name="componentAction">name of action</param> /// <param name="listener">call back</param> public void RemoveComponentListener(EnumComponentAction componentAction, Action <IComponentActionData> listener) { if (_commponentActionDispatcher.ContainsKey(componentAction)) { for (int i = 0; i < _commponentActionDispatcher[componentAction].Count; i++) { if (_commponentActionDispatcher[componentAction][i] == listener) { _commponentActionDispatcher[componentAction].RemoveAt(i); } } } }
public WordComponentActionData(EnumComponentAction componentAction, Vector3 wordTouchedPosition) { _componentAction = componentAction; _wordTouchedPosition = wordTouchedPosition; }
/// <summary> /// Remove listener from component manager /// </summary> /// <param name="componentAction">action name</param> /// <param name="listener">action listener</param> protected void RemoveComponentListener(EnumComponentAction componentAction, Action <IComponentActionData> listener) { ComponentsActionsManager.Instance.RemoveComponentListener(componentAction, listener); }