Beispiel #1
0
    public void SubscribeEvent(GameEventsList.PlayerEvents EventType, System.Action <PlayerEventParams> eventHandler)
    {
        GameEventHandlers += eventHandler;
        EventIds eventIds = m_EventIdMapper.Find(x => x._eventType == EventType);

        if (eventIds == null)
        {
            eventIds            = new EventIds();
            eventIds._eventType = EventType;
            eventIds._ids.Add(eventHandler.GetHashCode());
            m_EventIdMapper.Add(eventIds);
        }
        else
        {
            eventIds._ids.Add(eventHandler.GetHashCode());
        }
    }
Beispiel #2
0
    public void UnsubscribeEvent(GameEventsList.PlayerEvents EventType, System.Action <PlayerEventParams> eventHandler)
    {
        if (eventHandler == null)
        {
            return;
        }

        GameEventHandlers -= eventHandler;

        EventIds eventIds = m_EventIdMapper.Find(x => x._eventType == EventType);

        if (eventIds != null)
        {
            eventIds._ids.Remove(eventHandler.GetHashCode());
        }
    }