1.服务端添加NPC,特别关注npcid,会作为message的参数传送到前端。QF中
function clicknpc(actor, npcid)
local npcobj = getnpcbyindex(npcid)
GameEvent.push(EventCfg.onClicknpc, actor, npcid, npcobj)
end
登陆脚本中已经添加了事件
GameEvent.add(EventCfg.onClicknpc, Global.ClickNpcResponse, Global, 1)
执行
function Global.ClickNpcResponse(actor, npcid)
Message.sendmsg(actor, ssrNetMsgCfg.Global_ClickNpcResponse, npcid) --msgid=1000
end
2.客户端监听到message,获取到了npcid,从cfg_npc_open中取到模块id
3.从模块id中,获取到Ui的配置
ssrObjCfg.MapMove = {
ID = 30300,
UI_TYPE = ssrConstCfg.UI_NORMAL,
RP_EVENT = ssrEventCfg.MapMove,
OBJ_PATH = "ssr/ssrgame/ui/normalui/MapMoveObj",
UI_PATH = "ssr/ssrgame/ui/normalui/MapMoveUI",
EXPORT_PATH = "ssr/ssrgame/ui/ccexport/normal/MapMove",
NET_MESSAGE = ssrNetMsgCfg.MapMove,
}