diff --git a/protocol/src/main/resources/lua-one/ProtocolBaseTemplate.lua b/protocol/src/main/resources/lua-one/ProtocolBaseTemplate.lua deleted file mode 100644 index ab54c492..00000000 --- a/protocol/src/main/resources/lua-one/ProtocolBaseTemplate.lua +++ /dev/null @@ -1,11 +0,0 @@ -function Protocols.{}:protocolId() - return {} -end - -function Protocols.{}:protocolName() - return "{}" -end - -function Protocols.{}:__tostring() - return table.serializeTableToJson(self) -end \ No newline at end of file diff --git a/protocol/src/main/resources/lua-one/ProtocolManagerTemplate.lua b/protocol/src/main/resources/lua-one/ProtocolManagerTemplate.lua deleted file mode 100644 index 0c173653..00000000 --- a/protocol/src/main/resources/lua-one/ProtocolManagerTemplate.lua +++ /dev/null @@ -1,41 +0,0 @@ -local protocols = {} - -local ProtocolManager = {} - --- table扩展方法,map的大小 -function table.mapSize(map) - local size = 0 - for _,_ in pairs(map) do - size = size + 1 - end - return size -end - -function ProtocolManager.getProtocol(protocolId) - local protocol = protocols[protocolId] - if protocol == nil then - error("[protocolId:" + protocolId + "]协议不存在") - end - return protocol -end - -function ProtocolManager.write(buffer, packet) - local protocolId = packet:protocolId() - -- 写入协议号 - buffer:writeShort(protocolId) - -- 写入包体 - ProtocolManager.getProtocol(protocolId):write(buffer, packet) -end - -function ProtocolManager.read(buffer) - local protocolId = buffer:readShort() - return ProtocolManager.getProtocol(protocolId):read(buffer) -end - -function initProtocol() - {} - {} -end - -ProtocolManager.initProtocol = initProtocol -return ProtocolManager diff --git a/protocol/src/main/resources/lua-one/ProtocolReaderTemplate.lua b/protocol/src/main/resources/lua-one/ProtocolReaderTemplate.lua deleted file mode 100644 index 1c82e934..00000000 --- a/protocol/src/main/resources/lua-one/ProtocolReaderTemplate.lua +++ /dev/null @@ -1,13 +0,0 @@ -function Protocols.{}:read(buffer) - local length = buffer:readInt() - if length == 0 then - return nil - end - local beforeReadIndex = buffer:getReadOffset() - local packet = Protocols.{}:new() - {} - if length > 0 then - buffer:setReadOffset(beforeReadIndex + length) - end - return packet -end \ No newline at end of file diff --git a/protocol/src/main/resources/lua-one/ProtocolTemplate.lua b/protocol/src/main/resources/lua-one/ProtocolTemplate.lua deleted file mode 100644 index 941f9ad7..00000000 --- a/protocol/src/main/resources/lua-one/ProtocolTemplate.lua +++ /dev/null @@ -1,10 +0,0 @@ -{} -local {} = {} -function {}:new() - local obj = { - {} - } - setmetatable(obj, self) - self.__index = self - return obj -end \ No newline at end of file diff --git a/protocol/src/main/resources/lua-one/ProtocolWriterTemplate.lua b/protocol/src/main/resources/lua-one/ProtocolWriterTemplate.lua deleted file mode 100644 index d4347420..00000000 --- a/protocol/src/main/resources/lua-one/ProtocolWriterTemplate.lua +++ /dev/null @@ -1,7 +0,0 @@ -function Protocols.{}:write(buffer, packet) - if packet == nil then - buffer:writeInt(0) - return - end - {} -end \ No newline at end of file