protected EventTable GetEventTable() { if (mEventTable == null) { mEventTable = new EventTable(); } return(mEventTable); }
public override void Release() { if (mEventTable != null) { mEventTable.Clear(); mEventTable = null; } base.Release(); }
private EventTable GetPreListenEventTable(string target) { EventTable table = null; if (!mPreListenerEventsMap.ContainsKey(target)) { table = new EventTable(); mPreListenerEventsMap.Add(target, table); } else { table = mPreListenerEventsMap[target]; } return(table); }
public ModuleEvent Event(string target, string type) { ModuleEvent moduleEvent = null; BaseBizModule module = GetModule(target); if (module != null) { moduleEvent = module.Event(type); } else { EventTable table = GetPreListenEventTable(target); moduleEvent = table.GetEvent(type); } return(moduleEvent); }
public BaseBizModule CreateModule(string name, object args = null) { if (mModulesMap.ContainsKey(name)) { return(null); } BaseBizModule module = null; Type type = Type.GetType(mDomain + "." + name); if (type != null) { module = Activator.CreateInstance(type) as BaseBizModule; } else { module = new LuaModule(name); } mModulesMap.Add(name, module); // if (mPreListenerEventsMap.ContainsKey(name)) { EventTable eventTable = mPreListenerEventsMap[name]; mPreListenerEventsMap.Remove(name); module.SetEventTable(eventTable); } module.Create(args); // if (mMessageCacheMap.ContainsKey(name)) { List <MessageObject> list = mMessageCacheMap[name]; foreach (var messageObject in list) { module.HandleMessage(messageObject.msg, messageObject.args); } mMessageCacheMap.Remove(name); } return(module); }
internal void SetEventTable(EventTable eventTable) { mEventTable = eventTable; }