//--------------------------------------------------------------------- public EcEngine(ref EcEngineSettings settings, IEcEngineListener listener) { mInstance = this; mListener = listener; Settings = settings; mEntityMgr = new EntityMgr(1, "Client"); mEntityMgr.regComponent <ClientAutoPatcher <DefAutoPatcher> >(); mEntityMgr.regComponent <ClientNode <DefNode> >(); mEntityMgr.regComponent <ClientSuperSocket <DefSuperSocket> >(); mEntityMgr.regEntityDef <EtAutoPatcher>(); mEntityMgr.regEntityDef <EtNode>(); mEntityMgr.regEntityDef <EtSuperSocket>(); EtNode = mEntityMgr.createEntity <EtNode>(null, null); var co_node = EtNode.getComponent <ClientNode <DefNode> >(); CoSuperSocket = co_node.CoSuperSocket; // 通知业务层初始化 if (mListener != null) { mListener.init(mEntityMgr, EtNode); } }
//--------------------------------------------------------------------- public EsEngine(ref EsEngineSettings settings, IEsEngineListener listener) { mInstance = this; mListener = listener; Settings = settings; // 日志设置 //{ // ILogFactory log_factory = new Log4NetLogFactory(settings.Log4NetConfigPath); // EbLogFactory.SetLogFactory(log_factory); // mLog = EbLogFactory.GetLog(this.GetType().Name); // EbLog.NoteCallback = mLog.Info; // EbLog.WarningCallback = mLog.Warn; // EbLog.ErrorCallback = mLog.Error; //} // 处理未捕获的异常 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(_unhandledExceptionEventHandler); EbLog.Note("-----------EsEngine启动开始--------------"); // EntityMgr初始化 mEntityMgr = new EntityMgr(Settings.NodeType, Settings.NodeTypeString); mEntityMgr.regComponent <ServerNode <DefNode> >(); mEntityMgr.regComponent <ServerSuperSocket <DefSuperSocket> >(); mEntityMgr.regEntityDef <EtNode>(); mEntityMgr.regEntityDef <EtSuperSocket>(); EtNode = mEntityMgr.createEntity <EtNode>(null, null); var co_node = EtNode.getComponent <ServerNode <DefNode> >(); CoSuperSocket = co_node.CoSuperSocket; EbLog.Note("-----------EsEngine启动完毕--------------"); // 通知业务层初始化 if (mListener != null) { mListener.init(mEntityMgr, EtNode); } }