---------MsgUtil
MsgUtil.addEventListener("50800101", loginBack);
MsgUtil.addEventListener("connectError", onConnectionError);
MsgUtil.removeEventListener("50700101");//一般不需要remove消息号,会一直监听
MsgUtil.removeEventListener("userInfoComplete");
MsgUtil.callFunc(str, bc);//str是消息号
MsgUtil.callFunc("configComplete", null);
--------pure mvc
AppFacade.getInstance().SendNotification(NotiConst.S_RIVERLAKE_INFO);
registerMultiCommand(typeof(SkillCommand),NotiConst.S_RAMA_SKILL_CHANGE);
override public IList<string> ListNotificationInterests(){return new List<string>() { NotiConst.R_MIALDETAIL_INFO};}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///MVC
local o = LuaUtil.getWinParam(self.windowName,0,WinParam.ACTION_CLOSE,nil);
LuaUtil.senEvent(NotiConst.WIN_SHOW_HIDE, o);
等价于
AppFacade.getInstance().SendNotification
LuaUtil.addMvcMsg("MARRIAGE_NPC", function(mp)self:onMarriedNPC(mp);end);
等价于
在mediator或command里面监听
///MVC
///监听消息号,有对mp处理
LuaUtil.addLuaMsg(50102011, function(mp) self:rCangZhenGeInfo(mp) end)
等价于
在luaUtil的msgDic存方法,在connection里面监听了消息号,然后直接msgDic调用lua方法
///监听消息号,有对mp处理
///C#也能监听到
self:addEvent("tsMonsterInfo", function(o) self:refreshData(o); end);
等价于
MsgUtil.addEventListener(str, fun);
MsgUtil.callFunc("tsMonsterInfo", nil);
等价于
MsgUtil.callFunc("tsMonsterInfo", nil);
///C#也能监听到
///只作用于lua内
self:addLuaEvent("FationItemSelected", function(o)self:onFationListClick(o);end);
等价于
Lua_MsgUtil.addEventListener(str, fun);
Lua_MsgUtil.callFunc("FationItemSelected",self.data);
等价于
Lua_MsgUtil.callFunc("FationItemSelected",self.data);
///只作用于lua内