public void RigisterEvent(string eventName, Action callback) { string publisherName = "Script.Publishers." + eventName + "Publisher"; Type publisherType = Type.GetType(publisherName, true, true); //语言特性,反射 if (!_publishers.ContainsKey(eventName)) { var publisherObj = Activator.CreateInstance(publisherType); _publishers.Add(eventName, publisherObj); } IPublisher tempPublisher = _publishers[eventName] as IPublisher; tempPublisher.AddEvent(callback); }