Пример #1
0
 public void Unregister(KoreographyEventCallback callback)
 {
     basicEvent -= callback;
 }
Пример #2
0
 public void Register(KoreographyEventCallback callback)
 {
     basicEvent += callback;
 }
Пример #3
0
    public void UnregisterForEvents(string eventID, KoreographyEventCallback callback)
    {
        if (string.IsNullOrEmpty(eventID))
        {
            Debug.LogError("Cannot unregister for events with an empty event identifier!");
        }
        else
        {
            KeyValuePair<string,EventObj> mapping = eventBoard.Find(x=>x.Key == eventID);

            // KeyValuePair generics treat the key as a property, which can return null.
            if (!string.IsNullOrEmpty(mapping.Key))
            {
                // Remove the Obj->Koreographer link.
                mapping.Value.Unregister(callback);

                if (mapping.Value.IsClear())
                {
                    // If there isn't a reason for this to exist anymore, clean it up!

                    // Remove the Koreographer->Koreography link.
                    DisconnectEventFromLoadedKoreography(mapping);

                    eventBoard.Remove(mapping);
                }
            }
        }
    }
Пример #4
0
    public void RegisterForEvents(string eventID, KoreographyEventCallback callback)
    {
        if (string.IsNullOrEmpty(eventID))
        {
            Debug.LogError("Cannot register for events with an empty event identifier!");
        }
        else
        {
            KeyValuePair<string,EventObj> mapping = eventBoard.Find(x=>x.Key == eventID);

            // KeyValuePair generics treat the key as a property, which can return null.
            if (string.IsNullOrEmpty(mapping.Key))
            {
                mapping = new KeyValuePair<string, EventObj>(eventID, new EventObj());
                eventBoard.Add(mapping);

                // New Mapping (we haven't encountered this event ID before).  Register with previously
                //  loaded Koreography!
                // Adds the Koreographer->Koreography link.
                ConnectEventToLoadedKoreography(mapping);
            }

            // Add the Obj->Koreographer link.
            mapping.Value.Register(callback);
        }
    }
Пример #5
0
    public void UnregisterForEvents(string eventDef, KoreographyEventCallback callback)
    {
        KoreographyTrack koreoTrack = mTracks.Find(x=>x.EventID == eventDef);

        if (koreoTrack != null)
        {
            koreoTrack.UnregisterForEvents(callback);
        }
        else
        {
            Debug.LogWarning("WARNING: no Koreography Track with event definition '" + eventDef + "' to unregister from.");
        }
    }
Пример #6
0
 public void UnregisterForEvents(KoreographyEventCallback callback)
 {
     koreographyEventCallbacks -= callback;
 }