1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- local schema = require "model.schema"
- local logger = require "logger"
- local stringify = require "stringify"
- local module_name = "exampledata"
- local _M = schema.new(module_name, {
- times = 0,
- stage = 0,
- })
- local REQUEST = {}
- local CMD = {}
- local MODULE = {}
- local THIS = {}
- local function func_ret(fname, character, args)
- local f = THIS[fname]
- if not f then
- logger.error("func_ret not fname:%s !!!", fname)
- return {errno = STD_ERR.COMMON_SYS_ERR}
- end
- local errno, ret = f(character, args)
- if errno ~= 0 then
- return {errno = errno}
- end
- ret = ret or {}
- ret.errno = 0
- return ret
- end
- function MODULE.list_request_interests() return REQUEST end
- function MODULE.list_command_interests() return CMD end
- -- TODO: 解析/升级模块数据 在这里把数据初始化好
- function MODULE.parse(character)
- local d = _M.load(character)
- end
- -- TODO: 侦听事件
- function MODULE.monitor(character)
- end
- -- TODO: 类似泰利的 prepare 接口
- function MODULE.launch(character)
- local d = _M.assert_get(character)
- local u = _M.assert_runtime(character)
- end
- -- TODO: 与客户端同步数据
- function MODULE.ready(character)
- local d = _M.assert_get(character)
- logger.test("%s:ready, %s", module_name, stringify(d or {}))
- end
- -- TODO: 玩家下线时的处理
- function MODULE.saybye(character)
- end
- return MODULE
|