private bool InitNetWork() { //1 初始化程序集 TypeManager.Instance.Add(DLLType.Common, Assembly.GetAssembly(typeof(TypeManager))); TypeManager.Instance.Add(DLLType.Client, Assembly.GetAssembly(this.GetType())); //TypeManager.Instance.Add(DLLType.Client, Assembly.GetAssembly(this.GetType())); //2 初始化Opcode m_opcodeTypeDictionary = new OpcodeTypeDictionary(); if (!m_opcodeTypeDictionary.Init()) { Log.Error("OpcodeTypeDictionary Initialise Fail"); return(false); } //3 初始化Dispacher m_messageDispather = new MessageDispather(); if (!MessageDispather.Instance.Init()) { Log.Error("MessageDispather Initialise Fail"); return(false); } //Log.Info("handler Type = " + m_messageDispather.Handlers.Keys.First()); //Log.Info("hander个数:" + m_messageDispather.Handlers.Values.ToList().Count); //初始化对象池 m_objectPool = new ObjectPool(); //MessageFactory.Adapting(m_objectPool); //3 其他配置 return(true); }
private void Start() { Instance = this; //2 初始化网络 Log.Info("初始化网络开始!"); InitNetWork(); }
private bool InitNetConfigure(ServerBaseGlobalConfigure config) { ServerBaseGlobalConfigure gameServerGlobalConfig = config; m_Globalfigure = gameServerGlobalConfig as ServerBaseGlobalConfigure; m_serverConfig = m_Globalfigure.Global.Servers[0]; Log.Info($"Server Ip = {m_serverConfig.EndPortIP} Port = {m_serverConfig.EndPortPort}"); return(true); }
public void Initialize(ServerBaseGlobalConfigure config) { //Log.Info(Application.dataPath + "/" + configPath); //1 初始化配置 if (!InitNetConfigure(config)) { Log.Info("读取配置文件失败"); } Start(); }