Commit 890e3f836f487fbec3410730d5c586eec007a67b
Merge branch 'develop' into qa
Showing
1 changed file
with
4 additions
and
6 deletions
Show diff stats
src/actions/HangAction.lua
... | ... | @@ -120,6 +120,7 @@ function _M.checkRpc(agent, data) |
120 | 120 | return true |
121 | 121 | end |
122 | 122 | |
123 | +local _BattleKey = nil | |
123 | 124 | function _M.startBattleRpc(agent, data) |
124 | 125 | local role = agent.role |
125 | 126 | local msg = MsgPack.unpack(data) |
... | ... | @@ -141,10 +142,8 @@ function _M.startBattleRpc(agent, data) |
141 | 142 | return 3 |
142 | 143 | end |
143 | 144 | |
144 | - local key = tostring(math.random()) | |
145 | - hangInfo.key = key | |
146 | - local nowTime = skynet.timex() | |
147 | - role:updateProperty({field = "hangInfo", value = hangInfo}) | |
145 | + _BattleKey = tostring(math.random()) | |
146 | + | |
148 | 147 | role:checkTaskEnter("HangBattle", {id = carbonId}) |
149 | 148 | SendPacket(actionCodes.Hang_startBattleRpc, MsgPack.pack({key = key})) |
150 | 149 | return true |
... | ... | @@ -154,7 +153,7 @@ function _M.endBattleRpc(agent, data) |
154 | 153 | local role = agent.role |
155 | 154 | local msg = MsgPack.unpack(data) |
156 | 155 | local hangInfo = role:getProperty("hangInfo") |
157 | - if not msg.key or msg.key ~= hangInfo.key then | |
156 | + if not msg.key or msg.key ~= _BattleKey then | |
158 | 157 | return 1 |
159 | 158 | end |
160 | 159 | local carbonId = msg.carbonId |
... | ... | @@ -190,7 +189,6 @@ function _M.endBattleRpc(agent, data) |
190 | 189 | |
191 | 190 | role:checkTaskEnter("HangPass", {id = carbonId}) |
192 | 191 | end |
193 | - hangInfo.key = nil | |
194 | 192 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
195 | 193 | |
196 | 194 | role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId}) | ... | ... |