public void Delete(E_SUBJECT subjectType, Action callback) { if (m_delegateMap.ContainsKey(subjectType) == false) { return; } m_delegateMap[subjectType] -= callback; }
public void Add(E_SUBJECT subjectType, Action callback) { if (m_delegateMap.ContainsKey(subjectType) == false) { m_delegateMap[subjectType] = delegate() { }; } m_delegateMap[subjectType] += callback; }
public void Notify(E_SUBJECT subjectType) { if (m_delegateMap.ContainsKey(subjectType) == false) { return; } foreach (Action delegator in m_delegateMap[subjectType].GetInvocationList()) { try { delegator(); } catch (Exception exception) { Debug.LogWarning("Notify 함수에서 콜백 함수에 대한 예외가 발생하였습니다.."); Debug.LogException(exception); } } }