This commit is contained in:
2020-08-05 21:12:20 +08:00
parent d1cff958e4
commit 63a8d53bce
13 changed files with 787 additions and 785 deletions

View File

@@ -21,11 +21,12 @@ NetProto.setSever = function(_host, _port)
socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
end
NetProto.isDebug = false
---@type Dist.SpringWebsocket.Client
local socket = Client4Stomp.self
local appid = 2020158
local appsecret = "ea042bc86428ca968756a6e47b10742d"
local isDebug = true
local ErrCode = {
success = 1000,
invalidToken = 2019
@@ -94,7 +95,7 @@ local dispatch = function(content, params)
end
local dispatchHttp = function(content, params)
if isDebug then
if NetProto.isDebug then
print(content)
end
local map = json.decode(content)
@@ -168,7 +169,7 @@ NetProto.sendGet = function(cmd, map, callback, failedCallback, orgs, _baseUrl)
failedCallback = failedCallback
}
url = Uri.EscapeUriString(url)
if isDebug then
if NetProto.isDebug then
print(url)
end
WWWEx.get(url, NetProto.httpHeader, CLAssetType.text, dispatchHttp, onFailedSend, params, true, 1)
@@ -353,7 +354,7 @@ end
---@param frame Dist.SpringWebsocket.StompFrame
NetProto.OnReceiveStompMsg = function(frame)
-- if isDebug then
-- if NetProto.isDebug then
-- print(frame.Code, frame.Content)
-- end
if frame.Code == StompStatus.OPENSERVER then
@@ -394,7 +395,7 @@ NetProto.OnReceiveStompMsg = function(frame)
end
end
if isDebug then
if NetProto.isDebug then
printw(cmd, frame.Content)
end
if cmd then
@@ -461,7 +462,7 @@ NetProto.sendSocket = function(content, callback, timeOutSec)
end
NetProto.doSendMsg = function(contentStr)
if isDebug then
if NetProto.isDebug then
print("send=", contentStr)
end
socket:Send("/tr_socket", {atytopic = "socket.server.operation"}, contentStr)

View File

@@ -49,6 +49,7 @@ function CLLPStart.setLuasAtBegainning()
Prefs.getUserName(),
function(iswhite)
if iswhite then
NetProto.isDebug = true
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
ReporterMessageReceiver.self.gameObject:SetActive(true)
end