/// <summary> /// Stops listening to Local and Networed message on this GameObject's box for this board type. This /// can be done at any time and is useful for 1-off listeners or other time sensative listeners. /// </summary> public static void Disconnect(FFMessageBox <EventType> .EventListener function, GameObject go) { string id = BaseMessageBoard.LocalIdEntry(go.GetInstanceID()); FFMessageBox <EventType> box; if (messageBoard.TryGetValue(id, out box)) { box.Disconnect(function); } }
/// <summary> /// Connect to Local and Networked message on this GameObject's box for this board type. Connecting /// will make this function called when it is sent a message directly or indirectly /// (via SendToLocal/Up/Down/ToAllConnected or by another client calling SendToNet/Up/Down/ToAllConnected) /// </summary> public static void Connect(FFMessageBox <EventType> .EventListener function, GameObject go) { GetReady(); string id = BaseMessageBoard.LocalIdEntry(go.GetInstanceID()); FFMessageBox <EventType> box; if (messageBoard.TryGetValue(id, out box)) { box.Connect(function); } else { box = new FFMessageBox <EventType>(messageBoardSystem, id); box.Connect(function); messageBoard.Add(id, box); } }
/// <summary> /// Returns an existing or new box for the given entry which can /// be used to connect/disconnect/send messages /// </summary> public static FFMessageBox <EventType> Box(string entry) { GetReady(); ++lookupCountGlobal; ++lookupCountLocal; if (messageBoard.ContainsKey(entry)) { var box = messageBoard[entry]; box.Active(activeLocal && activeGlobal); return(box); } else { var box = new FFMessageBox <EventType>(messageBoardSystem, entry); box.Active(activeLocal && activeGlobal); messageBoard.Add(entry, box); return(box); } }