跳到主要内容

game_server.game_listclient

简介

基于engine的游戏服务器快捷接入listserver的功能模块

组件接口

game_listclient.gs

函数原型函数作用
bool setup(map para = )初始化模块
void start()开始服务
void stop()停止服务
void init_balance_group()通知目录服务器初始化本服务器的平衡组设置(阻塞操作,等待对端处理结果)
array join_balance_group(string group_id, map group_data)加入平衡组(阻塞操作,等待对端处理结果)
bool notify_join_balance_group(string group_id, map group_data)通知加入平衡组(非阻塞操作,不等待对端处理结果)
map collect_report_data(string state)收集服务器指定状态下的报告数据
array report_online_state()报告在线状态(阻塞操作,等待对端处理结果)
bool notify_report_online_state()通知报告离线状态(非阻塞操作,不等待对端处理结果)
array report_offline_state()报告离线状态(阻塞操作,等待对端处理结果)
bool notify_report_offline_state()通知报告离线状态(非阻塞操作,不等待对端处理结果)
array report_state(string state)报告指定状态(阻塞操作,等待对端处理结果)
bool notify_report_state(string state)通知报告指定状态(非阻塞操作,不等待对端处理结果)
array add_account_cache(string account_id, string rid, map info)通知目录服务器增加账号角色缓存(阻塞操作,等待对端处理结果)
bool notify_add_account_cache(string account_id, string rid, map info)通知目录服务器增加账号角色缓存(非阻塞操作,不等待对端处理结果)
array update_account_cache(string account_id, string rid, map info)通知目录服务器更新账号角色缓存(阻塞操作,等待对端处理结果)
bool notify_update_account_cache(string account_id, string rid, map info)通知目录服务器更新账号角色缓存(非阻塞操作,不等待对端处理结果)
array remove_account_cache(string rid)通知目录服务器移除账号角色缓存(阻塞操作,等待对端处理结果)
bool notify_remove_account_cache(string rid)通知目录服务器移除账号角色缓存(非阻塞操作,不等待对端处理结果)

样例

public void test()
{
cfg.init_by_map({
"server_id" : 1,
"disable_mongo" : true,

"server_info": {
"name": "pkg.game_server.game_listclient",
},
"listserver": {
"normal": {
"host": "localhost",
"port": 15701,
"port_recv_size": 131072
},
"via_http": {
"host": "http://localhost:4567"
},
"group": {
"enable_active": true,
"group_id": "1",
"group_data": {
"threshold": 0.8,
"order": 1,
"state": "alive",
"servers": []
}
}
}
});

engine.boot();

//
// 载入社交服功能模块
LOAD_PKG(game_listclient);

// 社交服模块安装
map para = {
"collect_func" : (string state) {
return { "here" : "1" + state };
}
};
game_listclient.setup(para);

game_listclient.start();
}