コード例 #1
0
 private void PlaySound(EventBaseData ev)
 {
     if (eventSounds.ContainsKey(ev.GetType().ToString()))
     {
         PlaySound(eventSounds[ev.GetType().ToString()]);
     }
 }
コード例 #2
0
    public void TriggerEvent(EventBaseData e)
    {
        EventDelegate del;

        if (delegates.TryGetValue(e.GetType(), out del))
        {
            del.Invoke(e);
            foreach (EventDelegate k in delegates[e.GetType()].GetInvocationList())
            {
                if (onceLookups.ContainsKey(k))
                {
                    delegates[e.GetType()] -= k;

                    if (delegates[e.GetType()] == null)
                    {
                        delegates.Remove(e.GetType());
                    }

                    registeredDeligates.Remove(onceLookups[k]);
                    onceLookups.Remove(k);
                }
            }
        }
        if (delegates.TryGetValue(typeof(EventBaseData), out del))
        {
            del.Invoke(e);
        }
    }