Exemple #1
0
def protocol_msg(code_path, mess_name_ids):
	file_name		= code_path + 'Msg.lua'
	file_protocols	= code_path + 'Protocols.lua'

	_str_msg_head	= 'module("Msg", package.seeall)\n\n\n'
	_str_msg		= ''
	_str_protocols	= ''
	for mess_name_id in mess_name_ids:
		mess_name 	= mess_name_id['mess_name']
		mess_id 	= mess_name_id['mess_id']
		mess_note	= mess_name_id['mess_note']
		_str_msg += '-- [' + str(mess_id) + ']' + mess_note + '\n' + tool.lua_proto_name_msg(mess_name).ljust(35, chr(32)) + ' = ' + str(mess_id) + '\n\n'
		_str_protocols += 'require "' + tool.lua_class_name(mess_name) + '"\n'

	_str_msg = _str_msg_head + _str_msg[:-1]
	with open(file_name, 'w+') as fd:
		fd.write(_str_msg)

	with open(file_protocols, 'w+') as fd:
		fd.write(_str_protocols)
Exemple #2
0
def protocol_msg(code_path, mess_name_ids):
    file_name = code_path + 'Msg.lua'
    file_protocols = code_path + 'Protocols.lua'

    _str_msg_head = 'module("Msg", package.seeall)\n\n\n'
    _str_msg = ''
    _str_protocols = ''
    for mess_name_id in mess_name_ids:
        mess_name = mess_name_id['mess_name']
        mess_id = mess_name_id['mess_id']
        mess_note = mess_name_id['mess_note']
        _str_msg += '-- [' + str(
            mess_id) + ']' + mess_note + '\n' + tool.lua_proto_name_msg(
                mess_name).ljust(35, chr(32)) + ' = ' + str(mess_id) + '\n\n'
        _str_protocols += 'require "' + tool.lua_class_name(mess_name) + '"\n'

    _str_msg = _str_msg_head + _str_msg[:-1]
    with open(file_name, 'w+') as fd:
        fd.write(_str_msg)

    with open(file_protocols, 'w+') as fd:
        fd.write(_str_protocols)
Exemple #3
0
def protocol_msg(code_path, mess_name_ids):
    file_name = code_path + 'Msg.lua'
    file_protocols = code_path + 'Protocols.lua'

    # _str_msg_head	= 'local M = {}\nlocal moduleName = ...\n_G[moduleName] = M\nsetmetatable(M, {__index = _G})\nlocal _ENV = M\n\n\n'
    _str_msg_head = 'Msg = {}\nsetmetatable(Msg, {__index = _G})\nlocal _ENV = Msg\n'
    _str_msg = ''
    _str_protocols = ''
    for mess_name_id in mess_name_ids:
        mess_name = mess_name_id['mess_name']
        mess_id = mess_name_id['mess_id']
        mess_note = mess_name_id['mess_note']
        _str_msg += '-- [' + str(
            mess_id) + ']' + mess_note + '\n' + tool.lua_proto_name_msg(
                mess_name).ljust(35, chr(32)) + ' = ' + str(mess_id) + '\n\n'
        _str_protocols += 'require "' + tool.lua_class_name(mess_name) + '"\n'

    _str_msg = _str_msg_head + _str_msg[:-1]
    with open(file_name, 'w+') as fd:
        fd.write(_str_msg)

    with open(file_protocols, 'w+') as fd:
        fd.write(_str_protocols)
Exemple #4
0
 def _set_class_name(self):
     self._str_msg_name = tool.lua_proto_name_msg(self._mess_name)
     self._str_class_name = tool.lua_class_name(self._mess_name)
Exemple #5
0
	def _set_class_name(self):
		self._str_msg_name 	= tool.lua_proto_name_msg(self._mess_name)
		self._str_class_name= tool.lua_class_name(self._mess_name)