diff --git a/GGELUA/Release64/lua/HPS/PackClient.lua b/GGELUA/Release64/lua/HPS/PackClient.lua index 7d49be8..8d6ea54 100644 --- a/GGELUA/Release64/lua/HPS/PackClient.lua +++ b/GGELUA/Release64/lua/HPS/PackClient.lua @@ -1,10 +1,10 @@ --[[ @Author : GGELUA @Date : 2021-02-11 11:49:09 - @LastEditTime : 2021-04-25 14:36:39 + @LastEditTime : 2021-05-03 20:23:00 --]] -local PushClient = package.loaded.PushClient or require("HPS/PushClient") +local PushClient = require("HPS/PushClient") local PackClient = class("PackClient",PushClient) PackClient._hp = false PackClient._接收事件 = false diff --git a/GGELUA/Release64/lua/HPS/PackServer.lua b/GGELUA/Release64/lua/HPS/PackServer.lua index e06095e..4880dca 100644 --- a/GGELUA/Release64/lua/HPS/PackServer.lua +++ b/GGELUA/Release64/lua/HPS/PackServer.lua @@ -1,10 +1,10 @@ --[[ @Author : GGELUA @Date : 2021-02-11 11:49:09 - @LastEditTime : 2021-05-02 11:21:25 + @LastEditTime : 2021-05-03 20:23:10 --]] -local Socket = package.loaded.Socket or require("HPS/Socket") +local Socket = require("HPS.Socket") local PackServer = class("PackServer",Socket) PackServer._hp = false PackServer._准备事件 = false diff --git a/GGELUA/Release64/lua/HPS/RPCClient.lua b/GGELUA/Release64/lua/HPS/RPCClient.lua index 96904f7..969817e 100644 --- a/GGELUA/Release64/lua/HPS/RPCClient.lua +++ b/GGELUA/Release64/lua/HPS/RPCClient.lua @@ -1,7 +1,7 @@ --[[ @Author : baidwwy @Date : 2021-02-11 11:49:09 - @LastEditTime : 2021-04-25 14:34:50 + @LastEditTime : 2021-05-03 20:26:53 --]] local adler32 = require("zlib").adler32 @@ -14,13 +14,18 @@ local c_yield = coroutine.yield local c_resume = coroutine.resume local c_create = coroutine.create local t_unpack = table.unpack -local PackClient = package.loaded.PackClient or require("HPS/PackClient") +local next = next +local PackClient = require("HPS.PackClient") local RPCClient = class("RPCClient",PackClient) local _REG = setmetatable({}, {__mode="k"}) local _CBK = setmetatable({}, {__mode="k"}) -function RPCClient:RPCClient() +function RPCClient:RPCClient(mcall) + if mcall and 引擎 then + self._mcall = {} + 引擎:注册事件(self) + end PackClient.PackClient(self)--初始化父类 local reg = {} _REG[self] = reg--private 注册表 @@ -36,6 +41,15 @@ function RPCClient:RPCClient() }) end +function RPCClient:更新事件() + if next(self._mcall) then + for i,v in ipairs(self._mcall) do + self:_接收事件(nil,v) + end + self._mcall = {} + end +end + function RPCClient:__index(k)--调用方法 local co,main = c_runing() local funp = type(k)=='string' and adler32(k) or k @@ -65,6 +79,10 @@ function RPCClient:_接收事件(id,data) self:接收事件(id,data) return end + if self._mcall and id then + table.insert(self._mcall,data) + return + end local t = m_unpack(data) if type(t)=='table' then local funp,cop = t[1],t[2] diff --git a/GGELUA/Release64/lua/HPS/RPCServer.lua b/GGELUA/Release64/lua/HPS/RPCServer.lua index 72a8418..eca680c 100644 --- a/GGELUA/Release64/lua/HPS/RPCServer.lua +++ b/GGELUA/Release64/lua/HPS/RPCServer.lua @@ -1,7 +1,7 @@ --[[ @Author : baidwwy @Date : 2021-02-11 11:49:09 - @LastEditTime : 2021-04-25 14:35:04 + @LastEditTime : 2021-05-03 20:22:33 --]] local adler32 = require("zlib").adler32 @@ -14,7 +14,8 @@ local c_yield = coroutine.yield local c_resume = coroutine.resume local c_create = coroutine.create local t_unpack = table.unpack -local PackServer = package.loaded.PackServer or require("HPS/PackServer") + +local PackServer = require("HPS.PackServer") local RPCServer = class("RPCServer",PackServer) local _REG = setmetatable({}, {__mode="k"})--接收函数