Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void Start()
        {
            Instance = this;


            //2 初始化网络
            Log.Info("初始化网络开始!");
            InitNetWork();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void Initialize(ServerBaseGlobalConfigure config)
        {
            //Log.Info(Application.dataPath + "/" + configPath);
            //1 初始化配置
            if (!InitNetConfigure(config))
            {
                Log.Info("读取配置文件失败");
            }

            Start();
        }