//注册辅助函数 private void RegisterEvent(Dictionary <EventSignalEnum, List <ReceiverHolder> > eventDict, EventSignalEnum eventSignal, Object tag, Object receiver) { List <ReceiverHolder> receiverList = TryGetFromDict(eventDict, eventSignal); //将接收器封装到Holder中 ReceiverHolder receiverHolder = new ReceiverHolder(receiver, receiverList); receiverList.Add(receiverHolder); //将相应接收器按tag进行记录 AddToTagList(tag, receiverHolder); }
//记录对应Tag的接收器 private void AddToTagList(Object tag, ReceiverHolder receiverHolder) { List <ReceiverHolder> receiverHolderList = TryGetFromDict(mReceiverTagDict, tag); receiverHolderList.Add(receiverHolder); }