New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下单台服务器启动有没有回调函数呢?? #1005

Open
zhongG opened this Issue Mar 28, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@zhongG

zhongG commented Mar 28, 2018

因为是动态添加server 使用脚步调用pomelo add 自动添加新的服务器。

例如我的目录是
--connector
----handler
-----gameHandler.js

之前我是在
/**

  • gameHandler.js
    **/

var pomelo=require("pomelo")
var RoomManager=require("../roomManager.js”)

moudule,exports=function(app){
return new Hadler(app)
}

var Handler=function(app){
RoomManager.dictionRm={}//
RoomManager.initSomeRoom();//之前我是这样去初始化一些数据
this.app=app;
}

但是我总是感觉这样初始化数据是不对的,如果我有多台服 我要根据每台服的配置文件中自定义字段去初始化,程序运行到创建Handler的时候 pomelo.app,getServerById(SERVERID) 还无法获取到服务器实例返回值为空。

我想知道 是不是有什么方法能在 after enter之后 触发某个回调 用以去调用 想操作的那些函数

@whtiehack

This comment has been minimized.

whtiehack commented Mar 28, 2018

看一下 lifecycle.js

@zhongG

This comment has been minimized.

zhongG commented Mar 29, 2018

@whtiehack 谢了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment