public IObjectPlugin createInst(string name, bool single) { bool flag = !this.m_creators.ContainsKey(name); IObjectPlugin result; if (flag) { DebugTrace.print("err gameManagerBase createInst [" + name + "] notExsit!"); result = null; } else { bool flag2 = single && this.m_objectPlugins.ContainsKey(name); if (flag2) { DebugTrace.print("err gameManagerBase createInst single [" + name + "] repeated!"); result = this.m_objectPlugins[name]; } else { Func <IClientBase, IObjectPlugin> func = this.m_creators[name]; IObjectPlugin objectPlugin = func(this); objectPlugin.controlId = name; if (single) { base.regEventDispatcher(name, objectPlugin as IGameEventDispatcher); this.m_objectPlugins[name] = objectPlugin; } result = objectPlugin; } } return(result); }
public IObjectPlugin createInst(string name, bool single) { if (!m_creators.ContainsKey(name)) { DebugTrace.print("err gameManagerBase createInst [" + name + "] notExsit!"); return(null); } if (single && m_objectPlugins.ContainsKey(name)) { DebugTrace.print("err gameManagerBase createInst single [" + name + "] repeated!"); return(m_objectPlugins[name] as IObjectPlugin); } Func <IClientBase, IObjectPlugin> create = m_creators[name]; IObjectPlugin obj = create(this); obj.controlId = name; if (single) { regEventDispatcher(name, obj as IGameEventDispatcher); m_objectPlugins[name] = obj; } return(obj); }
public void createAllSingleInst() { foreach (string current in this.m_creators.Keys) { Func <IClientBase, IObjectPlugin> func = this.m_creators[current]; IObjectPlugin objectPlugin = func(this); objectPlugin.controlId = current; this.m_objectPlugins[current] = objectPlugin; base.regEventDispatcher(current, objectPlugin as IGameEventDispatcher); } }
public void createAllSingleInst(/*Action<IObjectPlugin> cbfun */) { foreach (string key in m_creators.Keys) { Func <IClientBase, IObjectPlugin> create = m_creators[key]; IObjectPlugin obj = create(this); obj.controlId = key; m_objectPlugins[key] = obj; //if( cbfun != null ) cbfun( obj ); regEventDispatcher(key, obj as IGameEventDispatcher); } }