新结算页面
parent
728a07e106
commit
9f240c2ae2
|
|
@ -67,7 +67,7 @@ function NetClient.new(host, game, protocol)
|
|||
-- self.responseMap = {}
|
||||
self.onevent = event("onevent",false)
|
||||
self.onconnect = event("onconnect",false)
|
||||
---- print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol)
|
||||
--print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol)
|
||||
|
||||
self.c__netClient = LuaNetClient(host,game,self,self.protocol)
|
||||
self.c__netClient:SetCallBackListener(R.c__ondata)
|
||||
|
|
@ -83,7 +83,6 @@ function R.connect(self)
|
|||
end
|
||||
self.c__netClient:Connect()
|
||||
end
|
||||
|
||||
local TYPE_STRING = "string"
|
||||
local TYPE_FUNC = "function"
|
||||
local TYPE_TABLE = "table"
|
||||
|
|
@ -92,7 +91,7 @@ local NULL_JSON = "{}"
|
|||
--- send
|
||||
function R.send(self,cmd, data, callback)
|
||||
if(debug_print) then
|
||||
-- print("send host:" .. self.host)
|
||||
print("send host:"..self.host)
|
||||
end
|
||||
if self.c__netClient == nil then
|
||||
return
|
||||
|
|
@ -108,6 +107,7 @@ function R.send(self, cmd, data, callback)
|
|||
self.c__netClient:Send(cmd,str,callback)
|
||||
end
|
||||
|
||||
|
||||
---c#网络层回调函数
|
||||
function R.c__ondata(self,cmd,result,data,func)
|
||||
local _response = nil
|
||||
|
|
@ -151,6 +151,7 @@ function R.getAveragePingTime(self)
|
|||
return self.c__netClient.AveragePingTime
|
||||
end
|
||||
|
||||
|
||||
---c#网络层回调函数
|
||||
function R.c__onevent(self,cmd,data)
|
||||
local new_response = {}
|
||||
|
|
@ -158,6 +159,7 @@ function R.c__onevent(self, cmd, data)
|
|||
new_response.Command = cmd
|
||||
new_response.Data = _response
|
||||
self.onevent(new_response)
|
||||
|
||||
end
|
||||
|
||||
function R.clearActionQueue(self)
|
||||
|
|
@ -170,7 +172,7 @@ end
|
|||
---c#网络层回调函数
|
||||
function R.c__onconnect(self,code)
|
||||
if(debug_print) then
|
||||
-- print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||
print("codeccccccccccccccccccccccccccccccccccccccc"..code)
|
||||
end
|
||||
self.onconnect(code)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ function Queue:Enqueue(element)
|
|||
self.queue[self.rear] = element
|
||||
else
|
||||
local temp = (self.rear + 1) % self.capacity
|
||||
---- print("1111111111111111111====>>>>")
|
||||
---- print(temp)
|
||||
--print("1111111111111111111====>>>>")
|
||||
--print(temp)
|
||||
if temp == self.head then
|
||||
error("Error: capacity is full.")
|
||||
ViewUtil.ErrorTip(10001,"Error: capacity is full.")
|
||||
|
|
@ -33,6 +33,7 @@ function Queue:Enqueue(element)
|
|||
self.queue[self.rear] = element
|
||||
self.size_ = self.size_ + 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Queue:Dequeue()
|
||||
|
|
@ -83,6 +84,6 @@ function Queue:dump()
|
|||
end
|
||||
str = str..","..self.queue[r].."}"
|
||||
if(debug_print) then
|
||||
-- print(str)
|
||||
print(str)
|
||||
end
|
||||
end
|
||||
|
|
@ -9,7 +9,6 @@ function bit.init32()
|
|||
bit.data32[i]=2^(32-i)
|
||||
end
|
||||
end
|
||||
|
||||
bit.init32()
|
||||
|
||||
function bit:d2b(arg) --bit:d2b
|
||||
|
|
@ -63,6 +62,7 @@ function bit:_and(a, b) --bit:_and
|
|||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
|
||||
end
|
||||
|
||||
function bit:_or(a,b) --bit:_or
|
||||
|
|
@ -126,10 +126,11 @@ function bit:_lshift(a, n) --bit:_lshift
|
|||
return self:b2d(r)
|
||||
end
|
||||
|
||||
|
||||
function bit:print(ta)
|
||||
local sr=""
|
||||
for i=1,32 do
|
||||
sr=sr..ta[i]
|
||||
end
|
||||
-- print(sr)
|
||||
print(sr)
|
||||
end
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
|
||||
string._htmlspecialchars_set = {}
|
||||
string._htmlspecialchars_set["&"] = "&"
|
||||
string._htmlspecialchars_set["\""] = """
|
||||
|
|
@ -8,7 +10,7 @@ string._htmlspecialchars_set[">"] = ">"
|
|||
--[[--
|
||||
将特殊字符转为 HTML 转义符
|
||||
~~~ lua
|
||||
-- print(string.htmlspecialchars("<ABC>"))
|
||||
print(string.htmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -24,7 +26,7 @@ end
|
|||
--[[--
|
||||
将 HTML 转义符还原为特殊字符,功能与 string.htmlspecialchars() 正好相反
|
||||
~~~ lua
|
||||
-- print(string.restorehtmlspecialchars("<ABC>"))
|
||||
print(string.restorehtmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -40,7 +42,7 @@ end
|
|||
--[[--
|
||||
将字符串中的 \n 换行符转换为 HTML 标记
|
||||
~~~ lua
|
||||
-- print(string.nl2br("Hello\nWorld"))
|
||||
print(string.nl2br("Hello\nWorld"))
|
||||
-- 输出
|
||||
-- Hello<br />World
|
||||
~~~
|
||||
|
|
@ -54,7 +56,7 @@ end
|
|||
--[[--
|
||||
将字符串中的特殊字符和 \n 换行符转换为 HTML 转移符和标记
|
||||
~~~ lua
|
||||
-- print(string.nl2br("<Hello>\nWorld"))
|
||||
print(string.nl2br("<Hello>\nWorld"))
|
||||
-- 输出
|
||||
-- <Hello><br />World
|
||||
~~~
|
||||
|
|
@ -101,7 +103,7 @@ end
|
|||
去除输入字符串头部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = " ABC"
|
||||
-- print(string.ltrim(input))
|
||||
print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串前面的两个空格被去掉了
|
||||
~~~
|
||||
空白字符包括:
|
||||
|
|
@ -121,7 +123,7 @@ end
|
|||
去除输入字符串尾部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = "ABC "
|
||||
-- print(string.ltrim(input))
|
||||
print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串最后的两个空格被去掉了
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -147,7 +149,7 @@ end
|
|||
将字符串的第一个字符转为大写,返回结果
|
||||
~~~ lua
|
||||
local input = "hello"
|
||||
-- print(string.ucfirst(input))
|
||||
print(string.ucfirst(input))
|
||||
-- 输出 Hello
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -165,7 +167,7 @@ end
|
|||
将字符串转换为符合 URL 传递要求的格式,并返回转换结果
|
||||
~~~ lua
|
||||
local input = "hello world"
|
||||
-- print(string.urlencode(input))
|
||||
print(string.urlencode(input))
|
||||
-- 输出
|
||||
-- hello%20world
|
||||
~~~
|
||||
|
|
@ -186,7 +188,7 @@ end
|
|||
将 URL 中的特殊字符还原,并返回结果
|
||||
~~~ lua
|
||||
local input = "hello%20world"
|
||||
-- print(string.urldecode(input))
|
||||
print(string.urldecode(input))
|
||||
-- 输出
|
||||
-- hello world
|
||||
~~~
|
||||
|
|
@ -205,7 +207,7 @@ end
|
|||
计算 UTF8 字符串的长度,每一个中文算一个字符
|
||||
~~~ lua
|
||||
local input = "你好World"
|
||||
-- print(string.utf8len(input))
|
||||
print(string.utf8len(input))
|
||||
-- 输出 7
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -276,7 +278,7 @@ end
|
|||
--[[--
|
||||
将数值格式化为包含千分位分隔符的字符串
|
||||
~~~ lua
|
||||
-- print(string.formatnumberthousands(1924235))
|
||||
print(string.formatnumberthousands(1924235))
|
||||
-- 输出 1,924,235
|
||||
~~~
|
||||
@param number num 数值
|
||||
|
|
@ -292,6 +294,7 @@ function string.formatnumberthousands(num)
|
|||
return formatted
|
||||
end
|
||||
|
||||
|
||||
function string.concat( ... )
|
||||
local str = {}
|
||||
local tem = {...}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ OnInit、DoHideAnimation、DoShowAnimation、OnShown、OnHide。
|
|||
例子:
|
||||
MyWinClass = fgui.window_class()
|
||||
function MyWinClass:ctor()
|
||||
-- print('MyWinClass-ctor')
|
||||
print('MyWinClass-ctor')
|
||||
self.contentPane = UIPackage.CreateObject("Basics", "WindowA")
|
||||
end
|
||||
function MyWinClass:OnShown()
|
||||
-- print('MyWinClass-onShown')
|
||||
print('MyWinClass-onShown')
|
||||
end
|
||||
local win = MyWinClass.New()
|
||||
win:Show()
|
||||
|
|
@ -92,12 +92,12 @@ MyButton = fgui.extension_class(GButton)
|
|||
fgui.register_extension("ui://包名/我的按钮", MyButton)
|
||||
|
||||
function MyButton:ctor() --当组件构建完成时此方法被调用
|
||||
-- print(self:GetChild("n1"))
|
||||
print(self:GetChild("n1"))
|
||||
end
|
||||
|
||||
--添加自定义的方法和字段
|
||||
function MyButton:Test()
|
||||
-- print('test')
|
||||
print('test')
|
||||
end
|
||||
|
||||
local get = tolua.initget(MyButton)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function ControllerManager.Init()
|
|||
|
||||
local hostIp = GetGameInfo("login_url")
|
||||
if(debug_print) then
|
||||
-- print("hostIp:::" .. hostIp)
|
||||
print("hostIp:::"..hostIp)
|
||||
end
|
||||
ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web)
|
||||
--ControllerManager.GroupClient = nil--NetClient.new("http://192.168.0.1:8081/", "web_group", ConnectionProtocol.Web)
|
||||
|
|
@ -76,7 +76,6 @@ function ControllerManager.SetGameNetClient(client)
|
|||
end
|
||||
|
||||
function ControllerManager.OnConnect(code)
|
||||
-- print("=======================================ControllerManager", code)
|
||||
if (code ~= SocketCode.Connect) then
|
||||
ControllerManager.SetGameNetClient(nil)
|
||||
if code ~= SocketCode.DisconnectByServer then
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ end
|
|||
function TableBG.GetTableBG(game_id)
|
||||
local id = -1
|
||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
||||
-- -- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
-- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
if json_data ~= nil then
|
||||
local config_data = json.decode(json_data)
|
||||
id = GetBG(config_data, game_id)
|
||||
|
|
|
|||
|
|
@ -303,9 +303,6 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
}
|
||||
end
|
||||
local roomList = self._group.rooms
|
||||
-- print("=========================playList,rooms")
|
||||
pt(playList)
|
||||
pt(roomList)
|
||||
local roomCtr = ControllerManager.GetController(RoomController)
|
||||
list_room.itemRenderer = function(index, obj)
|
||||
if index < #roomList then
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ local function __NetTip(txt_msg)
|
|||
end
|
||||
|
||||
local function __OnGameConnectAction(state)
|
||||
---- print("state:"..state)
|
||||
--print("state:"..state)
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
if state == SocketCode.Connect then
|
||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||
|
|
@ -150,14 +150,14 @@ function ViewManager.ChangeView(id, game_id, callback)
|
|||
end
|
||||
|
||||
function ViewManager.OnApplicationPause()
|
||||
-- -- print("game pause")
|
||||
-- print("game pause")
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationPause()
|
||||
end
|
||||
end
|
||||
|
||||
function ViewManager.OnApplicationActive()
|
||||
-- -- print("game active")
|
||||
-- print("game active")
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationActive()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -392,7 +392,6 @@ local function createJson()
|
|||
function json.null()
|
||||
return json.null -- so json.null() will also return null ;-)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal, PRIVATE functions.
|
||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
||||
|
|
@ -818,7 +817,6 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
|
|
@ -842,7 +840,6 @@ function luaIdePrintErr(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -980,7 +977,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
return tostring(v)
|
||||
end
|
||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
||||
-- print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
local function _dump(value, desciption, indent, nest, keylen)
|
||||
desciption = desciption or "<var>"
|
||||
local spc = ""
|
||||
|
|
@ -1029,7 +1026,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
end
|
||||
_dump(value, desciption, "- ", 1)
|
||||
for i, line in ipairs(result) do
|
||||
-- print(line)
|
||||
print(line)
|
||||
end
|
||||
end
|
||||
--@endregion
|
||||
|
|
@ -1038,7 +1035,9 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1168,7 +1167,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
if (jit) then
|
||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||
-- print(msg)
|
||||
print(msg)
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
|
|
@ -1188,7 +1187,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
LuaDebugger.reLoadFileBody = netData.data
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
debugger_sendMsg(
|
||||
breakInfoSocket,
|
||||
|
|
@ -1333,17 +1332,18 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
if (status and msg) then
|
||||
callBack()
|
||||
end
|
||||
end
|
||||
|
||||
--执行lua字符串
|
||||
debugger_exeLuaString = function()
|
||||
|
||||
local function loadScript()
|
||||
|
||||
local script = LuaDebugger.loadScriptBody.script
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
local currentTabble = {_G = _G}
|
||||
|
|
@ -1374,17 +1374,18 @@ debugger_exeLuaString = function()
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
|
||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
end
|
||||
)
|
||||
LuaDebugger.loadScriptBody.script = nil
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
|
@ -1409,10 +1410,12 @@ local function debugger_getTablekey(key, keyType, value)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
|
|
@ -1487,7 +1490,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error, "============================")
|
||||
print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1498,6 +1501,7 @@ local function debugger_setVarValue(server, data)
|
|||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
|
|
@ -1527,6 +1531,7 @@ local function debugger_setVarValue(server, data)
|
|||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1544,7 +1549,7 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("设置变量", error)
|
||||
print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
|
|
@ -1555,20 +1560,20 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("执行代码", error)
|
||||
print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("重新加载文件", error)
|
||||
print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -1622,7 +1627,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
-- print(error, "====>")
|
||||
print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1889,6 +1894,7 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1938,6 +1944,7 @@ local function debugger_getBreakVar(body, server)
|
|||
if (value) then
|
||||
local valueType = type(value)
|
||||
if (valueType == "table" or valueType == "userdata") then
|
||||
|
||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||
else
|
||||
if (valueType == "function") then
|
||||
|
|
@ -1972,9 +1979,9 @@ local function debugger_getBreakVar(body, server)
|
|||
xpcall(
|
||||
exe,
|
||||
function(error)
|
||||
-- -- print("获取变量错误 错误消息-----------------")
|
||||
-- -- print(error)
|
||||
-- -- print(debug.traceback("", 2))
|
||||
-- print("获取变量错误 错误消息-----------------")
|
||||
-- print(error)
|
||||
-- print(debug.traceback("", 2))
|
||||
debugger_sendMsg(
|
||||
server,
|
||||
LuaDebugger.event.C2S_ReqVar,
|
||||
|
|
@ -2029,6 +2036,7 @@ local function debugger_loop(server)
|
|||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2037,7 +2045,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2148,6 +2156,7 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
|
@ -2156,7 +2165,9 @@ debug_hook = function(event, line)
|
|||
if(event == "line") then
|
||||
local isCheck = false
|
||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||
|
||||
for bk, linesInfo in pairs(breakInfo) do
|
||||
|
||||
if(linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
|
|
@ -2198,7 +2209,7 @@ debug_hook = function(event, line)
|
|||
return
|
||||
end
|
||||
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
||||
-- -- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||
-- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||
local file = nil
|
||||
if (event == "call") then
|
||||
-- end
|
||||
|
|
@ -2206,7 +2217,7 @@ debug_hook = function(event, line)
|
|||
if (not LuaDebugger.Run) then
|
||||
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
||||
end
|
||||
-- -- print("stepIn",LuaDebugger.StepNextLevel)
|
||||
-- print("stepIn",LuaDebugger.StepNextLevel)
|
||||
|
||||
local stepInfo = getinfo(2, "S")
|
||||
local source = stepInfo.source
|
||||
|
|
@ -2248,6 +2259,7 @@ debug_hook = function(event, line)
|
|||
local breakInfo = LuaDebugger.breakInfos[file]
|
||||
local breakData = nil
|
||||
if (breakInfo) then
|
||||
|
||||
local ischeck = false
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
|
|
@ -2384,8 +2396,8 @@ local function start()
|
|||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
local socket = createSocket()
|
||||
-- print(controller_host)
|
||||
-- print(controller_port)
|
||||
print(controller_host)
|
||||
print(controller_port)
|
||||
|
||||
local server = socket.connect(controller_host, controller_port)
|
||||
debug_server = server
|
||||
|
|
@ -2415,15 +2427,15 @@ local function start()
|
|||
debug.sethook(debug_hook, "lrc")
|
||||
end,
|
||||
function(error)
|
||||
-- print("error:", error)
|
||||
print("error:", error)
|
||||
end
|
||||
)
|
||||
if (jit) then
|
||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||
-- print("error======================================================")
|
||||
print("error======================================================")
|
||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||
|
||||
-- print(msg)
|
||||
print(msg)
|
||||
end
|
||||
end
|
||||
_resume(coro_debugger, server)
|
||||
|
|
@ -2432,16 +2444,16 @@ local function start()
|
|||
end
|
||||
function StartDebug(host, port)
|
||||
if (not host) then
|
||||
-- print("error host nil")
|
||||
print("error host nil")
|
||||
end
|
||||
if (not port) then
|
||||
-- print("error prot nil")
|
||||
print("error prot nil")
|
||||
end
|
||||
if (type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
print("error host not string")
|
||||
end
|
||||
if (type(port) ~= "number") then
|
||||
-- print("error host not number")
|
||||
print("error host not number")
|
||||
end
|
||||
controller_host = host
|
||||
controller_port = port
|
||||
|
|
@ -2449,7 +2461,7 @@ function StartDebug(host, port)
|
|||
start,
|
||||
function(error)
|
||||
-- body
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
|
|
@ -2599,4 +2611,7 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -366,7 +366,6 @@ local function createJson()
|
|||
function json.null()
|
||||
return json.null -- so json.null() will also return null ;-)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal, PRIVATE functions.
|
||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
||||
|
|
@ -789,7 +788,6 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
|
|
@ -813,7 +811,6 @@ function luaIdePrintErr(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -951,7 +948,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
return tostring(v)
|
||||
end
|
||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
||||
-- print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
local function _dump(value, desciption, indent, nest, keylen)
|
||||
desciption = desciption or "<var>"
|
||||
local spc = ""
|
||||
|
|
@ -1000,7 +997,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
end
|
||||
_dump(value, desciption, "- ", 1)
|
||||
for i, line in ipairs(result) do
|
||||
-- print(line)
|
||||
print(line)
|
||||
end
|
||||
end
|
||||
--@endregion
|
||||
|
|
@ -1009,7 +1006,9 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject ) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1021,6 +1020,7 @@ local function debugger_valueToString(v)
|
|||
else
|
||||
value = tostring(v)
|
||||
end
|
||||
|
||||
end,function()
|
||||
value = vtype
|
||||
end)
|
||||
|
|
@ -1142,9 +1142,9 @@ local debugger_setBreak = nil
|
|||
local function debugger_receiveDebugBreakInfo()
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
else
|
||||
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
|
|
@ -1309,17 +1309,18 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
if (status and msg) then
|
||||
callBack()
|
||||
end
|
||||
end
|
||||
|
||||
--执行lua字符串
|
||||
debugger_exeLuaString = function()
|
||||
|
||||
local function loadScript()
|
||||
|
||||
local script = LuaDebugger.loadScriptBody.script
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
local currentTabble = {_G = _G}
|
||||
|
|
@ -1350,17 +1351,18 @@ debugger_exeLuaString = function()
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
|
||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
end
|
||||
)
|
||||
LuaDebugger.loadScriptBody.script = nil
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
|
@ -1385,10 +1387,12 @@ local function debugger_getTablekey(key, keyType, value)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
|
|
@ -1463,7 +1467,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error, "============================")
|
||||
print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1474,6 +1478,7 @@ local function debugger_setVarValue(server, data)
|
|||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
|
|
@ -1503,6 +1508,7 @@ local function debugger_setVarValue(server, data)
|
|||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1520,7 +1526,7 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("设置变量", error)
|
||||
print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
|
|
@ -1531,20 +1537,20 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("执行代码", error)
|
||||
print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("重新加载文件", error)
|
||||
print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -1598,7 +1604,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
-- print(error, "====>")
|
||||
print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1739,6 +1745,7 @@ end
|
|||
return
|
||||
]]
|
||||
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
||||
|
||||
for i, mtable in ipairs(metatables) do
|
||||
if (metatable == mtable) then
|
||||
return vinfos
|
||||
|
|
@ -1794,6 +1801,7 @@ local function debugger_getmetatable(value, metatable, vinfos, server, variables
|
|||
else
|
||||
return vinfos
|
||||
end
|
||||
|
||||
end
|
||||
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
||||
if (valueType == "userdata") then
|
||||
|
|
@ -1866,6 +1874,7 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1915,6 +1924,7 @@ local function debugger_getBreakVar(body, server)
|
|||
if (value) then
|
||||
local valueType = type(value)
|
||||
if (valueType == "table" or valueType == "userdata") then
|
||||
|
||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||
else
|
||||
if (valueType == "function") then
|
||||
|
|
@ -1953,9 +1963,9 @@ local function debugger_getBreakVar(body, server)
|
|||
xpcall(
|
||||
exe,
|
||||
function(error)
|
||||
-- -- print("获取变量错误 错误消息-----------------")
|
||||
-- -- print(error)
|
||||
-- -- print(debug.traceback("", 2))
|
||||
-- print("获取变量错误 错误消息-----------------")
|
||||
-- print(error)
|
||||
-- print(debug.traceback("", 2))
|
||||
debugger_sendMsg(
|
||||
server,
|
||||
LuaDebugger.event.C2S_ReqVar,
|
||||
|
|
@ -1981,6 +1991,7 @@ local function ResetDebugInfo()
|
|||
LuaDebugger.StepIn = false
|
||||
LuaDebugger.StepNext = false
|
||||
LuaDebugger.StepOut = false
|
||||
|
||||
end
|
||||
local function debugger_loop(server)
|
||||
server = debug_server
|
||||
|
|
@ -2009,6 +2020,7 @@ local function debugger_loop(server)
|
|||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2017,7 +2029,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2130,6 +2142,7 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
|
@ -2138,7 +2151,9 @@ debug_hook = function(event, line)
|
|||
if(event == "line") then
|
||||
local isCheck = false
|
||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||
|
||||
for bk, linesInfo in pairs(breakInfo) do
|
||||
|
||||
if(linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
|
|
@ -2152,12 +2167,14 @@ debug_hook = function(event, line)
|
|||
if(not isCheck) then
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local file = nil
|
||||
if(event == "line") then
|
||||
|
||||
local funs = nil
|
||||
local funlength =0
|
||||
if(LuaDebugger.currentDebuggerData) then
|
||||
|
|
@ -2176,6 +2193,7 @@ debug_hook = function(event, line)
|
|||
local breakData = nil
|
||||
local ischeck = false
|
||||
if(breakInfo) then
|
||||
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
if(lines and lines[line]) then
|
||||
|
|
@ -2186,6 +2204,7 @@ debug_hook = function(event, line)
|
|||
end
|
||||
local isHit = false
|
||||
if(ischeck) then
|
||||
|
||||
--并且在断点中
|
||||
local info = stepInfo
|
||||
local source = string.lower( info.source )
|
||||
|
|
@ -2195,6 +2214,7 @@ debug_hook = function(event, line)
|
|||
local hitCounts = {}
|
||||
local debugHitCounts = nil
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
|
||||
local lines = lineInfo.lines
|
||||
local pathNames = lineInfo.pathNames
|
||||
debugHitCounts = lineInfo.hitCounts
|
||||
|
|
@ -2237,6 +2257,7 @@ debug_hook = function(event, line)
|
|||
local hitPathNamesLength = #hitPathNames
|
||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||
if(hitFieName ~= "") then
|
||||
|
||||
local hitCount = breakData.hitCondition
|
||||
local clientHitCount = debugHitCounts[breakData.line]
|
||||
clientHitCount = clientHitCount + 1
|
||||
|
|
@ -2249,6 +2270,7 @@ debug_hook = function(event, line)
|
|||
elseif(clientHitCount >= hitCount) then
|
||||
isHit = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2261,7 +2283,7 @@ debug_hook = function(event, line)
|
|||
else
|
||||
if(funs[2] == tempFunc) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- -- print("StepIn 挂起")
|
||||
-- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2275,7 +2297,7 @@ debug_hook = function(event, line)
|
|||
return
|
||||
end
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- -- print("StepIn 挂起")
|
||||
-- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2295,6 +2317,7 @@ debug_hook = function(event, line)
|
|||
end
|
||||
end
|
||||
else
|
||||
|
||||
isNext =true
|
||||
end
|
||||
if(isNext) then
|
||||
|
|
@ -2313,6 +2336,8 @@ debug_hook = function(event, line)
|
|||
|
||||
--断点判断
|
||||
if(isHit) then
|
||||
|
||||
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||
|
|
@ -2346,9 +2371,10 @@ local function debugger_xpcall()
|
|||
end
|
||||
--调试开始
|
||||
local function start()
|
||||
|
||||
local socket = createSocket()
|
||||
-- print(controller_host)
|
||||
-- print(controller_port)
|
||||
print(controller_host)
|
||||
print(controller_port)
|
||||
|
||||
local fullName,dirName,fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
|
|
@ -2373,41 +2399,46 @@ local function start()
|
|||
xpcall(function()
|
||||
sethook(debug_hook, "lrc")
|
||||
end, function(error)
|
||||
-- print("error:", error)
|
||||
print("error:", error)
|
||||
end)
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||
print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||
else
|
||||
-- print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||
print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||
end
|
||||
|
||||
end
|
||||
_resume(coro_debugger, server)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StartDebug(host, port)
|
||||
|
||||
|
||||
if(not host) then
|
||||
-- print("error host nil")
|
||||
print("error host nil")
|
||||
end
|
||||
if(not port) then
|
||||
-- print("error prot nil")
|
||||
print("error prot nil")
|
||||
end
|
||||
if(type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
print("error host not string")
|
||||
end
|
||||
if(type(port) ~= "number") then
|
||||
-- print("error host not number")
|
||||
print("error host not number")
|
||||
end
|
||||
controller_host = host
|
||||
controller_port = port
|
||||
xpcall(start, function(error)
|
||||
-- body
|
||||
-- print(error)
|
||||
print(error)
|
||||
end)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
end
|
||||
|
||||
|
||||
|
||||
--base64
|
||||
|
||||
local string = string
|
||||
|
|
@ -2552,4 +2583,7 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -153,32 +153,32 @@ function ShareScreenShot(n, callback)
|
|||
end
|
||||
|
||||
function shareQRCodePicture(url,secene)
|
||||
---- print(debug.traceback())
|
||||
-- print(url)
|
||||
-- print(secene)
|
||||
--print(debug.traceback())
|
||||
print(url)
|
||||
print(secene)
|
||||
local json_data = {}
|
||||
json_data["title"] = "湘北联赛"
|
||||
local mediaObject = {}
|
||||
local filename = "qrcode" .. DataManager.SelfUser.account_id
|
||||
-- print(Application.persistentDataPath)
|
||||
print(Application.persistentDataPath)
|
||||
mediaObject["path"] = Application.persistentDataPath
|
||||
mediaObject["filename"] = filename
|
||||
mediaObject["type"] = 1
|
||||
json_data["mediaObject"] = mediaObject
|
||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||
json_data["scene"] = secene
|
||||
-- print("json_data==================")
|
||||
print("json_data==================")
|
||||
local json_str = json.encode(json_data)
|
||||
pt(json_str)
|
||||
local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250)
|
||||
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png",typeof(UnityEngine.Texture2D))
|
||||
filename = filename ..".jpg"
|
||||
-- print("text2==========")
|
||||
-- print(tex2)
|
||||
-- print("text1==========")
|
||||
-- print(tex1)
|
||||
-- print("filename==========")
|
||||
-- print(filename)
|
||||
print("text2==========")
|
||||
print(tex2)
|
||||
print("text1==========")
|
||||
print(tex1)
|
||||
print("filename==========")
|
||||
print(filename)
|
||||
QRCodePicture.CombanitePicture(tex1,tex2,393,1334-802-250,filename)
|
||||
|
||||
GameApplication.Instance:ShareLink(1, json_str, nil)
|
||||
|
|
@ -202,8 +202,6 @@ function LoadGameBg(url, main_view)
|
|||
local win_mode = main_view:GetChild("win_mode")
|
||||
win_mode:RemoveChildren(0, -1, true)
|
||||
local tex_bg = ResourcesManager.LoadObjectByGroup(url..".png",typeof(UnityEngine.Texture), url)
|
||||
-- print("===========================mainbg")
|
||||
-- print(url..".png",typeof(UnityEngine.Texture), url)
|
||||
local bg = GImage()
|
||||
bg.texture = FairyGUI.NTexture(tex_bg)
|
||||
bg.width = win_mode.width
|
||||
|
|
@ -365,6 +363,6 @@ end
|
|||
|
||||
function printlog(...)
|
||||
if debug_print then
|
||||
-- print(...)
|
||||
print(...)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -392,7 +392,6 @@ local function createJson()
|
|||
function json.null()
|
||||
return json.null -- so json.null() will also return null ;-)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal, PRIVATE functions.
|
||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
||||
|
|
@ -818,7 +817,6 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
|
|
@ -842,7 +840,6 @@ function luaIdePrintErr(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -980,7 +977,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
return tostring(v)
|
||||
end
|
||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
||||
-- print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
local function _dump(value, desciption, indent, nest, keylen)
|
||||
desciption = desciption or "<var>"
|
||||
local spc = ""
|
||||
|
|
@ -1029,7 +1026,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
end
|
||||
_dump(value, desciption, "- ", 1)
|
||||
for i, line in ipairs(result) do
|
||||
-- print(line)
|
||||
print(line)
|
||||
end
|
||||
end
|
||||
--@endregion
|
||||
|
|
@ -1038,7 +1035,9 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1168,7 +1167,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
if (jit) then
|
||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||
-- print(msg)
|
||||
print(msg)
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
|
|
@ -1188,7 +1187,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
LuaDebugger.reLoadFileBody = netData.data
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
debugger_sendMsg(
|
||||
breakInfoSocket,
|
||||
|
|
@ -1333,17 +1332,18 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
if (status and msg) then
|
||||
callBack()
|
||||
end
|
||||
end
|
||||
|
||||
--执行lua字符串
|
||||
debugger_exeLuaString = function()
|
||||
|
||||
local function loadScript()
|
||||
|
||||
local script = LuaDebugger.loadScriptBody.script
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
local currentTabble = {_G = _G}
|
||||
|
|
@ -1374,17 +1374,18 @@ debugger_exeLuaString = function()
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
|
||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
end
|
||||
)
|
||||
LuaDebugger.loadScriptBody.script = nil
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
|
@ -1409,10 +1410,12 @@ local function debugger_getTablekey(key, keyType, value)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
|
|
@ -1487,7 +1490,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error, "============================")
|
||||
print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1498,6 +1501,7 @@ local function debugger_setVarValue(server, data)
|
|||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
|
|
@ -1527,6 +1531,7 @@ local function debugger_setVarValue(server, data)
|
|||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1544,7 +1549,7 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("设置变量", error)
|
||||
print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
|
|
@ -1555,20 +1560,20 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("执行代码", error)
|
||||
print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("重新加载文件", error)
|
||||
print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -1622,7 +1627,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
-- print(error, "====>")
|
||||
print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1889,6 +1894,7 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1938,6 +1944,7 @@ local function debugger_getBreakVar(body, server)
|
|||
if (value) then
|
||||
local valueType = type(value)
|
||||
if (valueType == "table" or valueType == "userdata") then
|
||||
|
||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||
else
|
||||
if (valueType == "function") then
|
||||
|
|
@ -1972,9 +1979,9 @@ local function debugger_getBreakVar(body, server)
|
|||
xpcall(
|
||||
exe,
|
||||
function(error)
|
||||
-- -- print("获取变量错误 错误消息-----------------")
|
||||
-- -- print(error)
|
||||
-- -- print(debug.traceback("", 2))
|
||||
-- print("获取变量错误 错误消息-----------------")
|
||||
-- print(error)
|
||||
-- print(debug.traceback("", 2))
|
||||
debugger_sendMsg(
|
||||
server,
|
||||
LuaDebugger.event.C2S_ReqVar,
|
||||
|
|
@ -2029,6 +2036,7 @@ local function debugger_loop(server)
|
|||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2037,7 +2045,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2148,6 +2156,7 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
|
@ -2156,7 +2165,9 @@ debug_hook = function(event, line)
|
|||
if(event == "line") then
|
||||
local isCheck = false
|
||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||
|
||||
for bk, linesInfo in pairs(breakInfo) do
|
||||
|
||||
if(linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
|
|
@ -2198,7 +2209,7 @@ debug_hook = function(event, line)
|
|||
return
|
||||
end
|
||||
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
||||
-- -- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||
-- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||
local file = nil
|
||||
if (event == "call") then
|
||||
-- end
|
||||
|
|
@ -2206,7 +2217,7 @@ debug_hook = function(event, line)
|
|||
if (not LuaDebugger.Run) then
|
||||
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
||||
end
|
||||
-- -- print("stepIn",LuaDebugger.StepNextLevel)
|
||||
-- print("stepIn",LuaDebugger.StepNextLevel)
|
||||
|
||||
local stepInfo = getinfo(2, "S")
|
||||
local source = stepInfo.source
|
||||
|
|
@ -2248,6 +2259,7 @@ debug_hook = function(event, line)
|
|||
local breakInfo = LuaDebugger.breakInfos[file]
|
||||
local breakData = nil
|
||||
if (breakInfo) then
|
||||
|
||||
local ischeck = false
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
|
|
@ -2384,8 +2396,8 @@ local function start()
|
|||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
local socket = createSocket()
|
||||
-- print(controller_host)
|
||||
-- print(controller_port)
|
||||
print(controller_host)
|
||||
print(controller_port)
|
||||
|
||||
local server = socket.connect(controller_host, controller_port)
|
||||
debug_server = server
|
||||
|
|
@ -2415,15 +2427,15 @@ local function start()
|
|||
debug.sethook(debug_hook, "lrc")
|
||||
end,
|
||||
function(error)
|
||||
-- print("error:", error)
|
||||
print("error:", error)
|
||||
end
|
||||
)
|
||||
if (jit) then
|
||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||
-- print("error======================================================")
|
||||
print("error======================================================")
|
||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||
|
||||
-- print(msg)
|
||||
print(msg)
|
||||
end
|
||||
end
|
||||
_resume(coro_debugger, server)
|
||||
|
|
@ -2432,16 +2444,16 @@ local function start()
|
|||
end
|
||||
function StartDebug(host, port)
|
||||
if (not host) then
|
||||
-- print("error host nil")
|
||||
print("error host nil")
|
||||
end
|
||||
if (not port) then
|
||||
-- print("error prot nil")
|
||||
print("error prot nil")
|
||||
end
|
||||
if (type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
print("error host not string")
|
||||
end
|
||||
if (type(port) ~= "number") then
|
||||
-- print("error host not number")
|
||||
print("error host not number")
|
||||
end
|
||||
controller_host = host
|
||||
controller_port = port
|
||||
|
|
@ -2449,7 +2461,7 @@ function StartDebug(host, port)
|
|||
start,
|
||||
function(error)
|
||||
-- body
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
|
|
@ -2599,4 +2611,7 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -366,7 +366,6 @@ local function createJson()
|
|||
function json.null()
|
||||
return json.null -- so json.null() will also return null ;-)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Internal, PRIVATE functions.
|
||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
||||
|
|
@ -789,7 +788,6 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
|
|
@ -813,7 +811,6 @@ function luaIdePrintErr(...)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -951,7 +948,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
return tostring(v)
|
||||
end
|
||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
||||
-- print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
print("dump from: " .. debugger_strTrim(traceback[3]))
|
||||
local function _dump(value, desciption, indent, nest, keylen)
|
||||
desciption = desciption or "<var>"
|
||||
local spc = ""
|
||||
|
|
@ -1000,7 +997,7 @@ local function debugger_dump(value, desciption, nesting)
|
|||
end
|
||||
_dump(value, desciption, "- ", 1)
|
||||
for i, line in ipairs(result) do
|
||||
-- print(line)
|
||||
print(line)
|
||||
end
|
||||
end
|
||||
--@endregion
|
||||
|
|
@ -1009,7 +1006,9 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject ) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1021,6 +1020,7 @@ local function debugger_valueToString(v)
|
|||
else
|
||||
value = tostring(v)
|
||||
end
|
||||
|
||||
end,function()
|
||||
value = vtype
|
||||
end)
|
||||
|
|
@ -1142,9 +1142,9 @@ local debugger_setBreak = nil
|
|||
local function debugger_receiveDebugBreakInfo()
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
else
|
||||
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
|
|
@ -1309,17 +1309,18 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
if (status and msg) then
|
||||
callBack()
|
||||
end
|
||||
end
|
||||
|
||||
--执行lua字符串
|
||||
debugger_exeLuaString = function()
|
||||
|
||||
local function loadScript()
|
||||
|
||||
local script = LuaDebugger.loadScriptBody.script
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
local currentTabble = {_G = _G}
|
||||
|
|
@ -1350,17 +1351,18 @@ debugger_exeLuaString = function()
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
|
||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
end
|
||||
)
|
||||
LuaDebugger.loadScriptBody.script = nil
|
||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
|
@ -1385,10 +1387,12 @@ local function debugger_getTablekey(key, keyType, value)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
|
|
@ -1463,7 +1467,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
-- print(error, "============================")
|
||||
print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1474,6 +1478,7 @@ local function debugger_setVarValue(server, data)
|
|||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
|
|
@ -1503,6 +1508,7 @@ local function debugger_setVarValue(server, data)
|
|||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1520,7 +1526,7 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("设置变量", error)
|
||||
print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
|
|
@ -1531,20 +1537,20 @@ checkSetVar =
|
|||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("执行代码", error)
|
||||
print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
LuaDebugger.isReLoadFile = false
|
||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||
LuaDebugger.reLoadFileBody.script = nil
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
-- print("重新加载文件", error)
|
||||
print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -1598,7 +1604,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
-- print(error, "====>")
|
||||
print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1739,6 +1745,7 @@ end
|
|||
return
|
||||
]]
|
||||
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
||||
|
||||
for i, mtable in ipairs(metatables) do
|
||||
if (metatable == mtable) then
|
||||
return vinfos
|
||||
|
|
@ -1794,6 +1801,7 @@ local function debugger_getmetatable(value, metatable, vinfos, server, variables
|
|||
else
|
||||
return vinfos
|
||||
end
|
||||
|
||||
end
|
||||
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
||||
if (valueType == "userdata") then
|
||||
|
|
@ -1866,6 +1874,7 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1915,6 +1924,7 @@ local function debugger_getBreakVar(body, server)
|
|||
if (value) then
|
||||
local valueType = type(value)
|
||||
if (valueType == "table" or valueType == "userdata") then
|
||||
|
||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||
else
|
||||
if (valueType == "function") then
|
||||
|
|
@ -1953,9 +1963,9 @@ local function debugger_getBreakVar(body, server)
|
|||
xpcall(
|
||||
exe,
|
||||
function(error)
|
||||
-- -- print("获取变量错误 错误消息-----------------")
|
||||
-- -- print(error)
|
||||
-- -- print(debug.traceback("", 2))
|
||||
-- print("获取变量错误 错误消息-----------------")
|
||||
-- print(error)
|
||||
-- print(debug.traceback("", 2))
|
||||
debugger_sendMsg(
|
||||
server,
|
||||
LuaDebugger.event.C2S_ReqVar,
|
||||
|
|
@ -1981,6 +1991,7 @@ local function ResetDebugInfo()
|
|||
LuaDebugger.StepIn = false
|
||||
LuaDebugger.StepNext = false
|
||||
LuaDebugger.StepOut = false
|
||||
|
||||
end
|
||||
local function debugger_loop(server)
|
||||
server = debug_server
|
||||
|
|
@ -2009,6 +2020,7 @@ local function debugger_loop(server)
|
|||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2017,7 +2029,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
-- print(error)
|
||||
print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2130,6 +2142,7 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
|
@ -2138,7 +2151,9 @@ debug_hook = function(event, line)
|
|||
if(event == "line") then
|
||||
local isCheck = false
|
||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||
|
||||
for bk, linesInfo in pairs(breakInfo) do
|
||||
|
||||
if(linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
|
|
@ -2152,12 +2167,14 @@ debug_hook = function(event, line)
|
|||
if(not isCheck) then
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local file = nil
|
||||
if(event == "line") then
|
||||
|
||||
local funs = nil
|
||||
local funlength =0
|
||||
if(LuaDebugger.currentDebuggerData) then
|
||||
|
|
@ -2176,6 +2193,7 @@ debug_hook = function(event, line)
|
|||
local breakData = nil
|
||||
local ischeck = false
|
||||
if(breakInfo) then
|
||||
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
if(lines and lines[line]) then
|
||||
|
|
@ -2186,6 +2204,7 @@ debug_hook = function(event, line)
|
|||
end
|
||||
local isHit = false
|
||||
if(ischeck) then
|
||||
|
||||
--并且在断点中
|
||||
local info = stepInfo
|
||||
local source = string.lower( info.source )
|
||||
|
|
@ -2195,6 +2214,7 @@ debug_hook = function(event, line)
|
|||
local hitCounts = {}
|
||||
local debugHitCounts = nil
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
|
||||
local lines = lineInfo.lines
|
||||
local pathNames = lineInfo.pathNames
|
||||
debugHitCounts = lineInfo.hitCounts
|
||||
|
|
@ -2237,6 +2257,7 @@ debug_hook = function(event, line)
|
|||
local hitPathNamesLength = #hitPathNames
|
||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||
if(hitFieName ~= "") then
|
||||
|
||||
local hitCount = breakData.hitCondition
|
||||
local clientHitCount = debugHitCounts[breakData.line]
|
||||
clientHitCount = clientHitCount + 1
|
||||
|
|
@ -2249,6 +2270,7 @@ debug_hook = function(event, line)
|
|||
elseif(clientHitCount >= hitCount) then
|
||||
isHit = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2261,7 +2283,7 @@ debug_hook = function(event, line)
|
|||
else
|
||||
if(funs[2] == tempFunc) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- -- print("StepIn 挂起")
|
||||
-- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2275,7 +2297,7 @@ debug_hook = function(event, line)
|
|||
return
|
||||
end
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- -- print("StepIn 挂起")
|
||||
-- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2295,6 +2317,7 @@ debug_hook = function(event, line)
|
|||
end
|
||||
end
|
||||
else
|
||||
|
||||
isNext =true
|
||||
end
|
||||
if(isNext) then
|
||||
|
|
@ -2313,6 +2336,8 @@ debug_hook = function(event, line)
|
|||
|
||||
--断点判断
|
||||
if(isHit) then
|
||||
|
||||
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||
|
|
@ -2346,9 +2371,10 @@ local function debugger_xpcall()
|
|||
end
|
||||
--调试开始
|
||||
local function start()
|
||||
|
||||
local socket = createSocket()
|
||||
-- print(controller_host)
|
||||
-- print(controller_port)
|
||||
print(controller_host)
|
||||
print(controller_port)
|
||||
|
||||
local fullName,dirName,fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
|
|
@ -2373,41 +2399,46 @@ local function start()
|
|||
xpcall(function()
|
||||
sethook(debug_hook, "lrc")
|
||||
end, function(error)
|
||||
-- print("error:", error)
|
||||
print("error:", error)
|
||||
end)
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||
print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||
else
|
||||
-- print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||
print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||
end
|
||||
|
||||
end
|
||||
_resume(coro_debugger, server)
|
||||
end
|
||||
end
|
||||
end
|
||||
function StartDebug(host, port)
|
||||
|
||||
|
||||
if(not host) then
|
||||
-- print("error host nil")
|
||||
print("error host nil")
|
||||
end
|
||||
if(not port) then
|
||||
-- print("error prot nil")
|
||||
print("error prot nil")
|
||||
end
|
||||
if(type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
print("error host not string")
|
||||
end
|
||||
if(type(port) ~= "number") then
|
||||
-- print("error host not number")
|
||||
print("error host not number")
|
||||
end
|
||||
controller_host = host
|
||||
controller_port = port
|
||||
xpcall(start, function(error)
|
||||
-- body
|
||||
-- print(error)
|
||||
print(error)
|
||||
end)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
end
|
||||
|
||||
|
||||
|
||||
--base64
|
||||
|
||||
local string = string
|
||||
|
|
@ -2552,4 +2583,7 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -9,567 +9,218 @@ function EXClearingView.new(blur_view)
|
|||
setmetatable(M, { __index = ResultView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._full = true
|
||||
ResultView.init(self, "ui://Main_Majiang/clearing")
|
||||
ResultView.init(self, "ui://Main_Majiang/clearing_jiangxi")
|
||||
|
||||
self._currenIndex = 0
|
||||
self._blur_view = blur_view
|
||||
self._close_zone = false
|
||||
self:InitMaPai()
|
||||
-- self:InitMaPai()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function M:InitMaPai()
|
||||
self.maPaiCtr = self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
-- function M:InitMaPai()
|
||||
-- self.maPaiCtr = self._view:GetController("mapai")
|
||||
-- self.maPaiCtr.selectedIndex = 0
|
||||
|
||||
self.maPaiList = {}
|
||||
-- self.maPaiList = {}
|
||||
|
||||
for i = 1, 8 do
|
||||
local tempMP = self._view:GetChild("niao" .. i)
|
||||
table.insert(self.maPaiList, tempMP)
|
||||
end
|
||||
end
|
||||
|
||||
function M:IsMapaiShow(niao, isShow)
|
||||
if niao then
|
||||
niao.visible = isShow
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiValue(niao, value)
|
||||
if niao then
|
||||
niao.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. value
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiColor(niao, num)
|
||||
niao:GetController("color").selectedIndex = num
|
||||
end
|
||||
|
||||
function M:HideAllMapai()
|
||||
for i = 1, #self.maPaiList do
|
||||
self:IsMapaiShow(self.maPaiList[i], false)
|
||||
self:SetMaPaiColor(self.maPaiList[i], 0)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowSelectMaPai(niaoList)
|
||||
if niaoList and #niaoList > 0 then
|
||||
self.maPaiCtr.selectedIndex = 1
|
||||
self:HideAllMapai()
|
||||
for i = 1, #niaoList do
|
||||
self:IsMapaiShow(self.maPaiList[i], true)
|
||||
self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
|
||||
if niaoList[i].score > 0 then
|
||||
self:SetMaPaiColor(self.maPaiList[i], 2)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:CalculatePaixingInfo(result)
|
||||
self.WinList = {}
|
||||
if result.info_list and #result.info_list > 0 then
|
||||
for i = 1, #result.info_list do
|
||||
if result.info_list[i].win_list and #result.info_list[i].win_list > 0 then
|
||||
table.insert(self.WinList, result.info_list[i].win_list)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printlog("牌型列表====>>>")
|
||||
pt(self.WinList)
|
||||
end
|
||||
|
||||
function M:SetPaixingxiangqing(num)
|
||||
for i = 1, #self.PaiXingXiangQingCtrList do
|
||||
if self.PaiXingXiangQingCtrList[i] then
|
||||
self.PaiXingXiangQingCtrList[i].selectedIndex = num
|
||||
end
|
||||
end
|
||||
end
|
||||
-- for i = 1, 8 do
|
||||
-- local tempMP = self._view:GetChild("niao" .. i)
|
||||
-- table.insert(self.maPaiList, tempMP)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function M:InitData(over, room, result, total_result, callback)
|
||||
self._callback = callback
|
||||
local showClearMainBtn = self._view:GetChild("btn_showClearMain")
|
||||
local nextRoundBtn = self._view:GetChild("btn_nextRound")
|
||||
local nextRoundBtn2 = self._view:GetChild("Btn_NextRound2")
|
||||
local endRound = self._view:GetChild("Btn_EndRound")
|
||||
local _overCtr = self._view:GetController("over")
|
||||
local btn_confirm = self._view:GetChild("btn_confirm")
|
||||
local btn_result = self._view:GetChild("btn_showResult")
|
||||
local btn_close = self._view:GetChild("big_result"):GetChild("btn_close")
|
||||
local _btnCtr = self._view:GetController("button")
|
||||
local _sdkCtr = self._view:GetController("sdk")
|
||||
local ctr_type = self._view:GetController("type")
|
||||
local mainCtr = self._view:GetController("main")
|
||||
local playerNum = self._view:GetController("playerNum")
|
||||
|
||||
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round,
|
||||
room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
|
||||
self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes2(), "\r", "")
|
||||
local peopleNum = room.room_config.people_num
|
||||
|
||||
if result then
|
||||
self:ShowSelectMaPai(result.niao)
|
||||
self:CalculatePaixingInfo(result)
|
||||
end
|
||||
playerNum.selectedIndex = peopleNum - 2
|
||||
|
||||
self.PaiXingXiangQingCtrList = {}
|
||||
|
||||
local paixingxiangqing = self._view:GetChild("btn_detal")
|
||||
local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible = false
|
||||
paixingxiangqing.visible = true
|
||||
paixingxiangqing.onClick:Add(function()
|
||||
paixingxiangqing.visible = false
|
||||
fanhuipaixing.visible = true
|
||||
self:SetPaixingxiangqing(1)
|
||||
end)
|
||||
fanhuipaixing.onClick:Add(function()
|
||||
paixingxiangqing.visible = true
|
||||
fanhuipaixing.visible = false
|
||||
self:SetPaixingxiangqing(0)
|
||||
showClearMainBtn.onClick:Set(function()
|
||||
mainCtr.selectedIndex = 1
|
||||
end)
|
||||
|
||||
|
||||
if over ~= 2 then
|
||||
if result.liuju then
|
||||
ctr_type.selectedIndex = 3
|
||||
else
|
||||
local info_list = result.info_list
|
||||
for i = 1, #info_list do
|
||||
local is_win = info_list[i].is_win
|
||||
if is_win then
|
||||
if info_list[i].seat == room.self_player.seat then
|
||||
ctr_type.selectedIndex = 1
|
||||
else
|
||||
ctr_type.selectedIndex = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if over == 0 then
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_confirm.onClick:Add(function()
|
||||
nextRoundBtn.onClick:Set(function()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:PlayerReady()
|
||||
self:DestroyWithCallback()
|
||||
end)
|
||||
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
||||
elseif over == 1 then
|
||||
_btnCtr.selectedIndex = 1
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_result.onClick:Add(function()
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
_overCtr.selectedIndex = 1
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 0
|
||||
if self._qsinfo_view then
|
||||
self._qsinfo_view:Dispose()
|
||||
end
|
||||
end)
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
|
||||
nextRoundBtn2.onClick:Set(function()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:PlayerReady()
|
||||
self:DestroyWithCallback()
|
||||
end)
|
||||
|
||||
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
|
||||
end
|
||||
endRound.onClick:Set(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Family)
|
||||
end)
|
||||
|
||||
if over == 0 then
|
||||
_overCtr.selectedIndex = 0
|
||||
self:fillResult0(room, peopleNum, result)
|
||||
else
|
||||
_overCtr.selectedIndex = 1
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
|
||||
self:AddClearItem(room, nil, total_result.info_list, over)
|
||||
self:fillResult1(room, peopleNum, total_result)
|
||||
end
|
||||
end
|
||||
|
||||
function M:AddClearItem(room, data, total_data, over, niao, active_player)
|
||||
local n = over + 1
|
||||
local list_view1 = self._view:GetChild("player_list_1")
|
||||
local list_view2 = self._view:GetChild("player_list_2")
|
||||
function M:fillResult0(room, peopleNum, result)
|
||||
local config = ExtendManager.GetExtendConfig(room.game_id)
|
||||
local mode = config:GetGameInfo()
|
||||
local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config))
|
||||
self._view:GetChild("Label_GamePlay").title = string.format("第%s/%s局,%s", room.curren_round,
|
||||
room.room_config.round, gamePlay)
|
||||
for i = 1, peopleNum do
|
||||
local playerInfoComp = self._view:GetChild(string.format("Comp_Player%d", i))
|
||||
|
||||
if 0 == over or 1 == over then
|
||||
table.sort(data, function(a, b) return a.seat < b.seat end)
|
||||
list_view1:RemoveChildrenToPool()
|
||||
local allCardsList = playerInfoComp:GetChild("list_allCards")
|
||||
local huCardBtn = playerInfoComp:GetChild("Btn_Card_Hu")
|
||||
local jiangMaList = playerInfoComp:GetChild("list_JiangMa")
|
||||
local ziMoCtr = playerInfoComp:GetController("isZiMo")
|
||||
local dianPaoCtr = playerInfoComp:GetController("isPao")
|
||||
local isMeCtr = playerInfoComp:GetController("IsMe")
|
||||
|
||||
for i = 1, #data do
|
||||
local item = list_view1:AddItemFromPool()
|
||||
self:FillItemData(room, data[i], item, active_player, niao)
|
||||
end
|
||||
if #data == 3 then
|
||||
list_view1.lineGap = 54
|
||||
elseif #data == 2 then
|
||||
list_view1.lineGap = 108
|
||||
end
|
||||
if 1 == over then
|
||||
self:FillItemData2(room, total_data, list_view2)
|
||||
end
|
||||
elseif 2 == over then
|
||||
self:FillItemData2(room, total_data, list_view2)
|
||||
end
|
||||
end
|
||||
local infoList = result.info_list[i]
|
||||
local playInfo = room:GetPlayerBySeat(infoList.seat)
|
||||
local fzCardInfo = playInfo.fz_list
|
||||
local fzInfoNum = #fzCardInfo
|
||||
local handInfoNum = #infoList.hand_card
|
||||
|
||||
function M:FillItemData(room, data, item, active_player, niao)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
local p = room:GetPlayerBySeat(data["seat"])
|
||||
item:GetChild("playerName").text = p.self_user.nick_name
|
||||
item:GetChild("lab_hp").text = "" --抓马
|
||||
local user = room:GetPlayerBySeat(data["seat"]).self_user
|
||||
local head = item:GetChild('head'):GetChild('n4')
|
||||
ImageLoad.Load(user.head_url, head)
|
||||
self:fillHead(playInfo.self_user.head_url, playerInfoComp)
|
||||
|
||||
-- 手牌
|
||||
local hand_cards = data["hand_card"]
|
||||
table.sort(hand_cards, ViewUtil.HandCardSort)
|
||||
local hand_list_view = item:GetChild("hand_card_list")
|
||||
hand_list_view:RemoveChildrenToPool()
|
||||
for i = 1, #hand_cards do
|
||||
local card = hand_list_view:AddItemFromPool()
|
||||
card.icon = "ui://Main_Majiang/202_" .. hand_cards[i]
|
||||
end
|
||||
hand_list_view.width = 52 * #hand_cards
|
||||
playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name
|
||||
playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and
|
||||
string.format("+%d", infoList.jing_score) or infoList.jing_score
|
||||
playerInfoComp:GetChild("Text_Gang").text = infoList.gang_score >= 0 and
|
||||
string.format("+%d", infoList.gang_score) or infoList.gang_score
|
||||
playerInfoComp:GetChild("Text_Hu").text = infoList.hu_score >= 0 and string.format("+%d", infoList.hu_score) or
|
||||
infoList.hu_score
|
||||
playerInfoComp:GetChild("Text_Tatal").text = infoList.round_score >= 0 and
|
||||
string.format("+%d", infoList.round_score) or infoList.round_score
|
||||
|
||||
local fz_card = p.fz_list
|
||||
local fz_card_list = item:GetChild("fz_card_list")
|
||||
fz_card_list.width = 157 * #fz_card * 0.8
|
||||
fz_card_list:RemoveChildrenToPool()
|
||||
|
||||
for i = 1, #fz_card do
|
||||
if fz_card[i].type == FZType.Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
|
||||
for j = 1, fzInfoNum do
|
||||
if fzCardInfo[j].type == FZType.Peng then
|
||||
local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_FZ_3")
|
||||
for l = 1, 3 do
|
||||
local card = item:GetChild(string.format("Btn_Card%d", l))
|
||||
card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].card)
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Chi then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].opcard[j]
|
||||
elseif fzCardInfo[j].type == FZType.Chi then
|
||||
local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_FZ_3")
|
||||
for l = 1, 3 do
|
||||
local card = item:GetChild(string.format("Btn_Card%d", l))
|
||||
card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].opcard
|
||||
[l])
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4")
|
||||
for j = 1, 4 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
if fz_card[i].type == FZType.Gang_An and j == 4 then
|
||||
elseif fzCardInfo[j].type == FZType.Gang or fzCardInfo[j].type == FZType.Gang_An or fzCardInfo[j].type == FZType.Gang_Peng then
|
||||
local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_FZ_4")
|
||||
for l = 1, 4 do
|
||||
local card = item:GetChild(string.format("Btn_Card%d", l))
|
||||
if fzCardInfo[j].type == FZType.Gang_An and j == 4 then
|
||||
card.icon = "ui://Main_Majiang/202_00"
|
||||
else
|
||||
card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
|
||||
card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].card)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local huadd = data["hu_score"]
|
||||
local gangadd = data["gang_score"]
|
||||
local jingadd = data["jing_score"]
|
||||
local total = data["round_score"]
|
||||
local geng_zhuan = data["geng_zhuan"]
|
||||
local sp = " "
|
||||
local str = "胡:" .. huadd .. "分"
|
||||
if gangadd then
|
||||
str = str .. sp .. "杠:" .. gangadd .. "分"
|
||||
local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard")
|
||||
local handCardList = handCardItem:GetChild("list")
|
||||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
|
||||
end
|
||||
if jingadd then
|
||||
str = str .. sp .. "博精:" .. jingadd .. "分"
|
||||
handCardList.numItems = handInfoNum
|
||||
allCardsList.width = 172 * fzInfoNum + 60 + (handInfoNum - 1) * 56 + 36 * (fzInfoNum)
|
||||
|
||||
if infoList.seat == room.self_player.seat then
|
||||
isMeCtr.selectedIndex = 1
|
||||
end
|
||||
|
||||
if infoList.is_win then
|
||||
local winInfo = ""
|
||||
for j = 1, #infoList.win_list do
|
||||
winInfo = string.format("%s,%s", winInfo, Hu_Type_Name[infoList.win_list[j].type])
|
||||
end
|
||||
winInfo = string.sub(winInfo, 2, -1)
|
||||
playerInfoComp:GetChild("text_huShow").text = winInfo
|
||||
|
||||
if room.isZiMoHu then
|
||||
ziMoCtr.selectedIndex = 1
|
||||
end
|
||||
|
||||
huCardBtn.icon = string.format("ui://Main_Majiang/202_%d", infoList.win_card)
|
||||
huCardBtn.visible = true
|
||||
|
||||
|
||||
item:GetChild("score1").text = str
|
||||
-- local total_score = data["total_score"]
|
||||
if total >= 0 then
|
||||
item:GetChild("score2").text = "+" .. total
|
||||
item:GetChild("score2").grayed = false
|
||||
jiangMaList.visible = false
|
||||
else
|
||||
item:GetChild("score2").text = total
|
||||
item:GetChild("score2").grayed = true
|
||||
playerInfoComp:GetChild("text_huShow").text = ""
|
||||
if not room.isZiMoHu and playInfo.self_user.account_id == result.active_player then
|
||||
dianPaoCtr.selectedIndex = 1
|
||||
end
|
||||
|
||||
|
||||
--计算牌型
|
||||
local totalPeson = DataManager.CurrenRoom.room_config.people_num - 1
|
||||
local win_list = data["win_list"]
|
||||
local is_win = data["is_win"] or false
|
||||
local str1 = ""
|
||||
sp = "、"
|
||||
if is_win then
|
||||
if win_list then
|
||||
if DataManager.CurrenRoom.isZiMoHu then
|
||||
str1 = "自摸"
|
||||
else
|
||||
str1 = "接炮"
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local huName = Hu_Type_Name[win_list[i].type]
|
||||
if huName then
|
||||
str1 = str1 .. sp .. huName .. "x" .. win_list[i].score
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " +" .. huadd .. "分"
|
||||
end
|
||||
else
|
||||
printlog("输家============")
|
||||
if DataManager.CurrenRoom.isZiMoHu then
|
||||
printlog("自摸处理============")
|
||||
--str1=""
|
||||
if #self.WinList == 1 then
|
||||
for i = 1, #self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
local huName = Hu_Type_Name[self.WinList[i][j].type]
|
||||
if huName then
|
||||
if j == 1 then
|
||||
str1 = str1 .. huName .. "x" .. self.WinList[i][j].score
|
||||
else
|
||||
str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
else
|
||||
printlog("服务端自摸计算异常===>>>")
|
||||
end
|
||||
else
|
||||
printlog("非自摸处理====>>>")
|
||||
--点炮 一炮多响
|
||||
local yipaoduoxiang = false
|
||||
if #self.WinList > 1 then
|
||||
yipaoduoxiang = true
|
||||
end
|
||||
|
||||
if yipaoduoxiang then
|
||||
printlog("一炮多响====>>>")
|
||||
str = "点炮"
|
||||
local allTypeList = {}
|
||||
local isHas = false
|
||||
for i = 1, #self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
isHas = IsHasDictionary(self.WinList[i][j].type, allTypeList)
|
||||
if isHas == false then
|
||||
table.insert(allTypeList, self.WinList[i][j].type)
|
||||
huCardBtn.visible = false
|
||||
jiangMaList.visible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #allTypeList > 0 then
|
||||
for i = 1, #allTypeList do
|
||||
local huName = Hu_Type_Name[allTypeList[i]]
|
||||
if huName then
|
||||
str1 = str1 .. huName .. "、"
|
||||
function M:fillResult1(room, peopleNum, total_result)
|
||||
local gameNameAndRoomIDText = self._view:GetChild("Text_GameNameAndRoomID")
|
||||
local familyIDText = self._view:GetChild("Text_FamilyID")
|
||||
for i, v in pairs(room.self_player.self_user.games) do
|
||||
if v.game_id == room.game_id then
|
||||
gameNameAndRoomIDText.text = string.format("%s 房号:%s", v.name, room.room_id)
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
if #gameNameAndRoomIDText.text <= 0 then
|
||||
gameNameAndRoomIDText.text = string.format("房号:%s", room.room_id)
|
||||
end
|
||||
else
|
||||
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
|
||||
str1 = "点炮"
|
||||
if #self.WinList == 1 then
|
||||
for i = 1, # self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
local huName = Hu_Type_Name[self.WinList[i][j].type]
|
||||
if huName then
|
||||
str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
|
||||
end
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
else
|
||||
printlog("服务端自摸计算异常===>>>")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
printlog("牌型计算==>>>", str1)
|
||||
|
||||
if data["ming_gang_num"] > 0 then
|
||||
str1 = str1 .. " 明杠x" .. data["ming_gang_num"]
|
||||
end
|
||||
|
||||
if data["an_gang_num"] > 0 then
|
||||
str1 = str1 .. " 暗杠x" .. data["an_gang_num"]
|
||||
end
|
||||
|
||||
if data["dian_gang_num"] > 0 then
|
||||
str1 = str1 .. " 点杠x" .. data["dian_gang_num"]
|
||||
end
|
||||
|
||||
if gangadd ~= 0 then
|
||||
if gangadd > 0 then
|
||||
str1 = str1 .. " +" .. gangadd .. "分"
|
||||
else
|
||||
str1 = str1 .. " " .. gangadd .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
if data["ma_geng_gong"] and data["ma_geng_gong"] ~= 0 then
|
||||
if data["ma_geng_gong"] > 0 then
|
||||
str1 = str1 .. " 马跟杠:+" .. data["ma_geng_gong"] .. "分"
|
||||
else
|
||||
str1 = str1 .. " 马跟杠:" .. data["ma_geng_gong"] .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
if geng_zhuan and geng_zhuan ~= 0 then
|
||||
if geng_zhuan > 0 then
|
||||
str1 = str1 .. " 跟庄:+" .. geng_zhuan .. "分"
|
||||
else
|
||||
str1 = str1 .. " 跟庄:" .. geng_zhuan .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
item:GetChild("score3").text = str1
|
||||
item:GetChild("score4").text = str1
|
||||
local paixingCtr = item:GetController("detail")
|
||||
table.insert(self.PaiXingXiangQingCtrList, paixingCtr)
|
||||
-------------------------
|
||||
|
||||
local hp_nonnegative = room:checkHpNonnegative()
|
||||
item:GetController("nonnegative").selectedIndex = hp_nonnegative and 1 or 0
|
||||
if hp_nonnegative then
|
||||
local hp_info = data.hp_info
|
||||
local ctr_hp_limit = item:GetController("hp_limit")
|
||||
local hp = d2ad(hp_info.round_actual_hp)
|
||||
if hp >= 0 then hp = "+" .. tostring(hp) end
|
||||
item:GetChild("tex_hp").text = hp
|
||||
ctr_hp_limit.selectedIndex = hp_info.upper_limit and 1 or 0
|
||||
end
|
||||
|
||||
|
||||
item:GetController("win").selectedIndex = is_win and 0 or 1
|
||||
if p.self_user.account_id == active_player and is_win == false and total < 0 then
|
||||
item:GetController("win").selectedIndex = 2
|
||||
end
|
||||
|
||||
if is_win then
|
||||
item:GetController("bg").selectedIndex = 1
|
||||
else
|
||||
item:GetController("bg").selectedIndex = 0
|
||||
end
|
||||
local win_card = item:GetChild("win_card")
|
||||
win_card.icon = "ui://Main_Majiang/202_" .. data["win_card"]
|
||||
|
||||
if niao and #niao > 0 then
|
||||
local currentNiaoList = self:CalculateNiao(niao, data["seat"])
|
||||
if currentNiaoList and #currentNiaoList > 0 then
|
||||
local lst_niao = item:GetChild("list_niao")
|
||||
lst_niao:RemoveChildrenToPool()
|
||||
for i = 1, #currentNiaoList do
|
||||
if currentNiaoList[i].score > 0 then
|
||||
local card_niao = lst_niao:AddItemFromPool()
|
||||
card_niao.icon = "ui://Main_Majiang/202_" .. currentNiaoList[i].card
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
if p.seat == room.banker_seat then
|
||||
item:GetController("bank").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
||||
function M:CalculateNiao(niaoList, seat)
|
||||
local tempNiao = {}
|
||||
for i = 1, #niaoList do
|
||||
if niaoList[i].seat == seat then
|
||||
table.insert(tempNiao, niaoList[i])
|
||||
end
|
||||
end
|
||||
return tempNiao
|
||||
end
|
||||
|
||||
function M:FillItemData2(room, data, list)
|
||||
-- 赋值result_info,聊天室分享需要
|
||||
local player_list = {}
|
||||
for i = 1, #data do
|
||||
player_list[i] = {}
|
||||
local user = room:GetPlayerBySeat(data[i].seat).self_user
|
||||
player_list[i].id = user.account_id
|
||||
player_list[i].hp_info = data[i].hp_info
|
||||
player_list[i].score = data[i].total_score
|
||||
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
|
||||
player_list[i].nick = user.nick_name
|
||||
player_list[i].head_url = user.head_url
|
||||
|
||||
local settle_log = data[i].settle_log
|
||||
player_list[i].param = {}
|
||||
player_list[i].param[1] = {}
|
||||
player_list[i].param[1].key = "自摸次数:"
|
||||
player_list[i].param[1].value = tostring(data[i].settle_log.zimo)
|
||||
player_list[i].param[2] = {}
|
||||
player_list[i].param[2].key = "接炮次数:"
|
||||
player_list[i].param[2].value = tostring(data[i].settle_log.jie_pao)
|
||||
player_list[i].param[3] = {}
|
||||
player_list[i].param[3].key = "点炮次数:"
|
||||
player_list[i].param[3].value = tostring(data[i].settle_log.dian_pao)
|
||||
player_list[i].param[4] = {}
|
||||
player_list[i].param[4].key = "暗杠次数:"
|
||||
player_list[i].param[4].value = tostring(data[i].settle_log.an_kong)
|
||||
player_list[i].param[5] = {}
|
||||
player_list[i].param[5].key = "明杠次数:"
|
||||
player_list[i].param[5].value = tostring(data[i].settle_log.ming_kong)
|
||||
end
|
||||
|
||||
local round = room.room_config.round
|
||||
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
|
||||
local big_result = self._view:GetChild("big_result")
|
||||
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()),
|
||||
room.room_id, room.curren_round, room.room_config.round)
|
||||
local lst_p = big_result:GetChild("player_list")
|
||||
if #player_list == 3 then
|
||||
lst_p.columnGap = 108
|
||||
elseif #player_list == 2 then
|
||||
lst_p.columnGap = 208
|
||||
end
|
||||
|
||||
self:InitBigResult(room, 30)
|
||||
local show_detail = room.hpOnOff == 1
|
||||
for i = 1, lst_p.numChildren do
|
||||
local com_p = lst_p:GetChildAt(i - 1)
|
||||
com_p:GetController("jsicon").selectedIndex = i - 1
|
||||
local list_param = com_p:GetChild("list_param")
|
||||
for j = 1, list_param.numChildren do
|
||||
local tem = list_param:GetChildAt(j - 1)
|
||||
tem:GetChild("txt_value").textFormat.size = 30
|
||||
end
|
||||
if show_detail then
|
||||
local score = 0
|
||||
if com_p:GetController("pn").selectedIndex == 0 then
|
||||
score = com_p:GetChild("txt_navigate").text
|
||||
else
|
||||
score = com_p:GetChild("txt_positive").text
|
||||
end
|
||||
score = score / room.score_times
|
||||
com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times)
|
||||
end
|
||||
end
|
||||
|
||||
if room.group_id ~= 0 then
|
||||
big_result:GetController("group").selectedIndex = 1
|
||||
familyIDText.text = string.format("俱乐部:%s", room.group_id)
|
||||
else
|
||||
familyIDText.visible = false
|
||||
end
|
||||
self._view:GetChild("Text_RoundNum").text = string.format("局数:%s/%s", room.curren_round, room.room_config.round)
|
||||
self._view:GetChild("Text_Time").text = os.date("%Y-%m-%d %H:%M:%S", os.time())
|
||||
|
||||
for i = 1, peopleNum do
|
||||
local resultInfoComp = self._view:GetChild(string.format("Comp_ResultInfo%d", i))
|
||||
local totalInfoList = total_result.info_list[i]
|
||||
local playInfo = room:GetPlayerBySeat(totalInfoList.seat)
|
||||
|
||||
self:fillHead(playInfo.self_user.head_url, resultInfoComp)
|
||||
|
||||
resultInfoComp:GetChild('Text_Name').text = playInfo.self_user.nick_name
|
||||
resultInfoComp:GetChild('Text_ID').text = string.format("ID:%s", playInfo.self_user.account_id)
|
||||
resultInfoComp:GetChild('Text_TotalScore').text = totalInfoList.total_score >= 0 and
|
||||
string.format("+%s", totalInfoList.total_score) or totalInfoList.total_score
|
||||
resultInfoComp:GetChild('Text_ZiMo').text = string.format("自摸 %d次", totalInfoList.settle_log.zimo or 0)
|
||||
resultInfoComp:GetChild('Text_JiePao').text = string.format("接炮 %d次", totalInfoList.settle_log.jiepao or 0)
|
||||
resultInfoComp:GetChild('Text_FangPao').text = string.format("放炮 %d次", totalInfoList.settle_log.fangpao or 0)
|
||||
resultInfoComp:GetChild('Text_AnGang').text = string.format("暗杠 %d次", totalInfoList.settle_log.an_kong or 0)
|
||||
resultInfoComp:GetChild('Text_MingGang').text = string.format("明杠 %d次",
|
||||
totalInfoList.settle_log.ming_kong or 0)
|
||||
resultInfoComp:GetChild('Text_FangGang').text = string.format("放杠 %d次",
|
||||
totalInfoList.settle_log.fanggang or 0)
|
||||
|
||||
resultInfoComp:GetController("win").selectedIndex = totalInfoList.total_score >= 0 and 1 or 0
|
||||
end
|
||||
DataManager.CurrenRoom = nil
|
||||
end
|
||||
|
||||
function M:LoadHead(p, room)
|
||||
local btn_head = self._view:GetChild("btn_head")
|
||||
for i = 1, #room.player_list do
|
||||
local player = room.player_list[i]
|
||||
if p.seat == player.seat and player.self_user.head_url ~= "" then
|
||||
ImageLoad.Load(player.self_user.head_url, btn_head.icon)
|
||||
end
|
||||
end
|
||||
function M:fillHead(url, view)
|
||||
ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject)
|
||||
end
|
||||
|
||||
local prefix
|
||||
|
|
|
|||
|
|
@ -1,605 +0,0 @@
|
|||
require("Game.View.ResultView")
|
||||
local Hu_Type_Name = import(".CS_Win_Type")
|
||||
|
||||
local EXClearingView = {}
|
||||
|
||||
local M = EXClearingView
|
||||
|
||||
function EXClearingView.new(blur_view)
|
||||
setmetatable(M, { __index = ResultView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._full = true
|
||||
ResultView.init(self, "ui://Main_Majiang/clearing_jiangxi")
|
||||
|
||||
self._currenIndex = 0
|
||||
self._blur_view = blur_view
|
||||
self._close_zone = false
|
||||
self:InitMaPai()
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function M:InitMaPai()
|
||||
self.maPaiCtr = self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
|
||||
self.maPaiList = {}
|
||||
|
||||
for i = 1, 8 do
|
||||
local tempMP = self._view:GetChild("niao" .. i)
|
||||
table.insert(self.maPaiList, tempMP)
|
||||
end
|
||||
end
|
||||
|
||||
function M:IsMapaiShow(niao, isShow)
|
||||
if niao then
|
||||
niao.visible = isShow
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiValue(niao, value)
|
||||
if niao then
|
||||
niao.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. value
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiColor(niao, num)
|
||||
niao:GetController("color").selectedIndex = num
|
||||
end
|
||||
|
||||
function M:HideAllMapai()
|
||||
for i = 1, #self.maPaiList do
|
||||
self:IsMapaiShow(self.maPaiList[i], false)
|
||||
self:SetMaPaiColor(self.maPaiList[i], 0)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowSelectMaPai(niaoList)
|
||||
if niaoList and #niaoList > 0 then
|
||||
self.maPaiCtr.selectedIndex = 1
|
||||
self:HideAllMapai()
|
||||
for i = 1, #niaoList do
|
||||
self:IsMapaiShow(self.maPaiList[i], true)
|
||||
self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
|
||||
if niaoList[i].score > 0 then
|
||||
self:SetMaPaiColor(self.maPaiList[i], 2)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:CalculatePaixingInfo(result)
|
||||
self.WinList = {}
|
||||
if result.info_list and #result.info_list > 0 then
|
||||
for i = 1, #result.info_list do
|
||||
if result.info_list[i].win_list and #result.info_list[i].win_list > 0 then
|
||||
table.insert(self.WinList, result.info_list[i].win_list)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printlog("牌型列表====>>>")
|
||||
pt(self.WinList)
|
||||
end
|
||||
|
||||
function M:SetPaixingxiangqing(num)
|
||||
for i = 1, #self.PaiXingXiangQingCtrList do
|
||||
if self.PaiXingXiangQingCtrList[i] then
|
||||
self.PaiXingXiangQingCtrList[i].selectedIndex = num
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:InitData(over, room, result, total_result, callback)
|
||||
self._callback = callback
|
||||
local _overCtr = self._view:GetController("over")
|
||||
local btn_confirm = self._view:GetChild("btn_confirm")
|
||||
local btn_result = self._view:GetChild("btn_showResult")
|
||||
local btn_close = self._view:GetChild("big_result"):GetChild("btn_close")
|
||||
local _btnCtr = self._view:GetController("button")
|
||||
local _sdkCtr = self._view:GetController("sdk")
|
||||
local ctr_type = self._view:GetController("type")
|
||||
|
||||
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round,
|
||||
room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
|
||||
self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes2(), "\r", "")
|
||||
|
||||
if result then
|
||||
self:ShowSelectMaPai(result.niao)
|
||||
self:CalculatePaixingInfo(result)
|
||||
end
|
||||
|
||||
self.PaiXingXiangQingCtrList = {}
|
||||
|
||||
local paixingxiangqing = self._view:GetChild("btn_detal")
|
||||
local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible = false
|
||||
paixingxiangqing.visible = true
|
||||
paixingxiangqing.onClick:Add(function()
|
||||
paixingxiangqing.visible = false
|
||||
fanhuipaixing.visible = true
|
||||
self:SetPaixingxiangqing(1)
|
||||
end)
|
||||
fanhuipaixing.onClick:Add(function()
|
||||
paixingxiangqing.visible = true
|
||||
fanhuipaixing.visible = false
|
||||
self:SetPaixingxiangqing(0)
|
||||
end)
|
||||
|
||||
|
||||
if over ~= 2 then
|
||||
if result.liuju then
|
||||
ctr_type.selectedIndex = 3
|
||||
else
|
||||
local info_list = result.info_list
|
||||
for i = 1, #info_list do
|
||||
local is_win = info_list[i].is_win
|
||||
if is_win then
|
||||
if info_list[i].seat == room.self_player.seat then
|
||||
ctr_type.selectedIndex = 1
|
||||
else
|
||||
ctr_type.selectedIndex = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if over == 0 then
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_confirm.onClick:Add(function()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:PlayerReady()
|
||||
self:DestroyWithCallback()
|
||||
end)
|
||||
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
||||
elseif over == 1 then
|
||||
_btnCtr.selectedIndex = 1
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_result.onClick:Add(function()
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
_overCtr.selectedIndex = 1
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 0
|
||||
if self._qsinfo_view then
|
||||
self._qsinfo_view:Dispose()
|
||||
end
|
||||
end)
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
|
||||
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
|
||||
end
|
||||
else
|
||||
_overCtr.selectedIndex = 1
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
|
||||
self:AddClearItem(room, nil, total_result.info_list, over)
|
||||
end
|
||||
-----------------------lingmeng----------------------------
|
||||
local showClearMainBtn = self._view:GetChild("btn_showClearMain")
|
||||
local nextRoundBtn = self._view:GetChild("btn_nextRound")
|
||||
local MainCtr = self._view:GetController("main")
|
||||
|
||||
showClearMainBtn.onClick:Set(function()
|
||||
MainCtr.selectedIndex = 1
|
||||
end)
|
||||
|
||||
nextRoundBtn.onClick:Set(function()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:PlayerReady()
|
||||
self:DestroyWithCallback()
|
||||
end)
|
||||
-----------------------------------------------------------
|
||||
end
|
||||
|
||||
function M:AddClearItem(room, data, total_data, over, niao, active_player)
|
||||
local n = over + 1
|
||||
local list_view1 = self._view:GetChild("player_list_1")
|
||||
local list_view2 = self._view:GetChild("player_list_2")
|
||||
|
||||
if 0 == over or 1 == over then
|
||||
table.sort(data, function(a, b) return a.seat < b.seat end)
|
||||
list_view1:RemoveChildrenToPool()
|
||||
|
||||
for i = 1, #data do
|
||||
local item = list_view1:AddItemFromPool()
|
||||
self:FillItemData(room, data[i], item, active_player, niao)
|
||||
end
|
||||
if #data == 3 then
|
||||
list_view1.lineGap = 54
|
||||
elseif #data == 2 then
|
||||
list_view1.lineGap = 108
|
||||
end
|
||||
if 1 == over then
|
||||
self:FillItemData2(room, total_data, list_view2)
|
||||
end
|
||||
elseif 2 == over then
|
||||
self:FillItemData2(room, total_data, list_view2)
|
||||
end
|
||||
end
|
||||
|
||||
function M:FillItemData(room, data, item, active_player, niao)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
local p = room:GetPlayerBySeat(data["seat"])
|
||||
item:GetChild("playerName").text = p.self_user.nick_name
|
||||
item:GetChild("lab_hp").text = "" --抓马
|
||||
local user = room:GetPlayerBySeat(data["seat"]).self_user
|
||||
local head = item:GetChild('head'):GetChild('n4')
|
||||
ImageLoad.Load(user.head_url, head)
|
||||
|
||||
-- 手牌
|
||||
local hand_cards = data["hand_card"]
|
||||
table.sort(hand_cards, ViewUtil.HandCardSort)
|
||||
local hand_list_view = item:GetChild("hand_card_list")
|
||||
hand_list_view:RemoveChildrenToPool()
|
||||
for i = 1, #hand_cards do
|
||||
local card = hand_list_view:AddItemFromPool()
|
||||
card.icon = "ui://Main_Majiang/202_" .. hand_cards[i]
|
||||
end
|
||||
hand_list_view.width = 52 * #hand_cards
|
||||
|
||||
local fz_card = p.fz_list
|
||||
local fz_card_list = item:GetChild("fz_card_list")
|
||||
fz_card_list.width = 157 * #fz_card * 0.8
|
||||
fz_card_list:RemoveChildrenToPool()
|
||||
|
||||
for i = 1, #fz_card do
|
||||
if fz_card[i].type == FZType.Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Chi then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].opcard[j]
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4")
|
||||
for j = 1, 4 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
if fz_card[i].type == FZType.Gang_An and j == 4 then
|
||||
card.icon = "ui://Main_Majiang/202_00"
|
||||
else
|
||||
card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local huadd = data["hu_score"]
|
||||
local gangadd = data["gang_score"]
|
||||
local jingadd = data["jing_score"]
|
||||
local total = data["round_score"]
|
||||
local geng_zhuan = data["geng_zhuan"]
|
||||
local sp = " "
|
||||
local str = "胡:" .. huadd .. "分"
|
||||
if gangadd then
|
||||
str = str .. sp .. "杠:" .. gangadd .. "分"
|
||||
end
|
||||
if jingadd then
|
||||
str = str .. sp .. "博精:" .. jingadd .. "分"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
item:GetChild("score1").text = str
|
||||
-- local total_score = data["total_score"]
|
||||
if total >= 0 then
|
||||
item:GetChild("score2").text = "+" .. total
|
||||
item:GetChild("score2").grayed = false
|
||||
else
|
||||
item:GetChild("score2").text = total
|
||||
item:GetChild("score2").grayed = true
|
||||
end
|
||||
|
||||
|
||||
--计算牌型
|
||||
local totalPeson = DataManager.CurrenRoom.room_config.people_num - 1
|
||||
local win_list = data["win_list"]
|
||||
local is_win = data["is_win"] or false
|
||||
local str1 = ""
|
||||
sp = "、"
|
||||
if is_win then
|
||||
if win_list then
|
||||
if DataManager.CurrenRoom.isZiMoHu then
|
||||
str1 = "自摸"
|
||||
else
|
||||
str1 = "接炮"
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local huName = Hu_Type_Name[win_list[i].type]
|
||||
if huName then
|
||||
str1 = str1 .. sp .. huName .. "x" .. win_list[i].score
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " +" .. huadd .. "分"
|
||||
end
|
||||
else
|
||||
printlog("输家============")
|
||||
if DataManager.CurrenRoom.isZiMoHu then
|
||||
printlog("自摸处理============")
|
||||
--str1=""
|
||||
if #self.WinList == 1 then
|
||||
for i = 1, #self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
local huName = Hu_Type_Name[self.WinList[i][j].type]
|
||||
if huName then
|
||||
if j == 1 then
|
||||
str1 = str1 .. huName .. "x" .. self.WinList[i][j].score
|
||||
else
|
||||
str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
else
|
||||
printlog("服务端自摸计算异常===>>>")
|
||||
end
|
||||
else
|
||||
printlog("非自摸处理====>>>")
|
||||
--点炮 一炮多响
|
||||
local yipaoduoxiang = false
|
||||
if #self.WinList > 1 then
|
||||
yipaoduoxiang = true
|
||||
end
|
||||
|
||||
if yipaoduoxiang then
|
||||
printlog("一炮多响====>>>")
|
||||
str = "点炮"
|
||||
local allTypeList = {}
|
||||
local isHas = false
|
||||
for i = 1, #self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
isHas = IsHasDictionary(self.WinList[i][j].type, allTypeList)
|
||||
if isHas == false then
|
||||
table.insert(allTypeList, self.WinList[i][j].type)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #allTypeList > 0 then
|
||||
for i = 1, #allTypeList do
|
||||
local huName = Hu_Type_Name[allTypeList[i]]
|
||||
if huName then
|
||||
str1 = str1 .. huName .. "、"
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
end
|
||||
else
|
||||
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
|
||||
str1 = "点炮"
|
||||
if #self.WinList == 1 then
|
||||
for i = 1, # self.WinList do
|
||||
for j = 1, #self.WinList[i] do
|
||||
local huName = Hu_Type_Name[self.WinList[i][j].type]
|
||||
if huName then
|
||||
str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
|
||||
end
|
||||
end
|
||||
end
|
||||
str1 = str1 .. " " .. huadd .. "分"
|
||||
else
|
||||
printlog("服务端自摸计算异常===>>>")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
printlog("牌型计算==>>>", str1)
|
||||
|
||||
if data["ming_gang_num"] > 0 then
|
||||
str1 = str1 .. " 明杠x" .. data["ming_gang_num"]
|
||||
end
|
||||
|
||||
if data["an_gang_num"] > 0 then
|
||||
str1 = str1 .. " 暗杠x" .. data["an_gang_num"]
|
||||
end
|
||||
|
||||
if data["dian_gang_num"] > 0 then
|
||||
str1 = str1 .. " 点杠x" .. data["dian_gang_num"]
|
||||
end
|
||||
|
||||
if gangadd ~= 0 then
|
||||
if gangadd > 0 then
|
||||
str1 = str1 .. " +" .. gangadd .. "分"
|
||||
else
|
||||
str1 = str1 .. " " .. gangadd .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
if data["ma_geng_gong"] and data["ma_geng_gong"] ~= 0 then
|
||||
if data["ma_geng_gong"] > 0 then
|
||||
str1 = str1 .. " 马跟杠:+" .. data["ma_geng_gong"] .. "分"
|
||||
else
|
||||
str1 = str1 .. " 马跟杠:" .. data["ma_geng_gong"] .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
if geng_zhuan and geng_zhuan ~= 0 then
|
||||
if geng_zhuan > 0 then
|
||||
str1 = str1 .. " 跟庄:+" .. geng_zhuan .. "分"
|
||||
else
|
||||
str1 = str1 .. " 跟庄:" .. geng_zhuan .. "分"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
item:GetChild("score3").text = str1
|
||||
item:GetChild("score4").text = str1
|
||||
local paixingCtr = item:GetController("detail")
|
||||
table.insert(self.PaiXingXiangQingCtrList, paixingCtr)
|
||||
-------------------------
|
||||
|
||||
local hp_nonnegative = room:checkHpNonnegative()
|
||||
item:GetController("nonnegative").selectedIndex = hp_nonnegative and 1 or 0
|
||||
if hp_nonnegative then
|
||||
local hp_info = data.hp_info
|
||||
local ctr_hp_limit = item:GetController("hp_limit")
|
||||
local hp = d2ad(hp_info.round_actual_hp)
|
||||
if hp >= 0 then hp = "+" .. tostring(hp) end
|
||||
item:GetChild("tex_hp").text = hp
|
||||
ctr_hp_limit.selectedIndex = hp_info.upper_limit and 1 or 0
|
||||
end
|
||||
|
||||
|
||||
item:GetController("win").selectedIndex = is_win and 0 or 1
|
||||
if p.self_user.account_id == active_player and is_win == false and total < 0 then
|
||||
item:GetController("win").selectedIndex = 2
|
||||
end
|
||||
|
||||
if is_win then
|
||||
item:GetController("bg").selectedIndex = 1
|
||||
else
|
||||
item:GetController("bg").selectedIndex = 0
|
||||
end
|
||||
local win_card = item:GetChild("win_card")
|
||||
win_card.icon = "ui://Main_Majiang/202_" .. data["win_card"]
|
||||
|
||||
if niao and #niao > 0 then
|
||||
local currentNiaoList = self:CalculateNiao(niao, data["seat"])
|
||||
if currentNiaoList and #currentNiaoList > 0 then
|
||||
local lst_niao = item:GetChild("list_niao")
|
||||
lst_niao:RemoveChildrenToPool()
|
||||
for i = 1, #currentNiaoList do
|
||||
if currentNiaoList[i].score > 0 then
|
||||
local card_niao = lst_niao:AddItemFromPool()
|
||||
card_niao.icon = "ui://Main_Majiang/202_" .. currentNiaoList[i].card
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
if p.seat == room.banker_seat then
|
||||
item:GetController("bank").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
||||
function M:CalculateNiao(niaoList, seat)
|
||||
local tempNiao = {}
|
||||
for i = 1, #niaoList do
|
||||
if niaoList[i].seat == seat then
|
||||
table.insert(tempNiao, niaoList[i])
|
||||
end
|
||||
end
|
||||
return tempNiao
|
||||
end
|
||||
|
||||
function M:FillItemData2(room, data, list)
|
||||
-- 赋值result_info,聊天室分享需要
|
||||
local player_list = {}
|
||||
for i = 1, #data do
|
||||
player_list[i] = {}
|
||||
local user = room:GetPlayerBySeat(data[i].seat).self_user
|
||||
player_list[i].id = user.account_id
|
||||
player_list[i].hp_info = data[i].hp_info
|
||||
player_list[i].score = data[i].total_score
|
||||
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
|
||||
player_list[i].nick = user.nick_name
|
||||
player_list[i].head_url = user.head_url
|
||||
|
||||
local settle_log = data[i].settle_log
|
||||
player_list[i].param = {}
|
||||
player_list[i].param[1] = {}
|
||||
player_list[i].param[1].key = "自摸次数:"
|
||||
player_list[i].param[1].value = tostring(data[i].settle_log.zimo)
|
||||
player_list[i].param[2] = {}
|
||||
player_list[i].param[2].key = "接炮次数:"
|
||||
player_list[i].param[2].value = tostring(data[i].settle_log.jie_pao)
|
||||
player_list[i].param[3] = {}
|
||||
player_list[i].param[3].key = "点炮次数:"
|
||||
player_list[i].param[3].value = tostring(data[i].settle_log.dian_pao)
|
||||
player_list[i].param[4] = {}
|
||||
player_list[i].param[4].key = "暗杠次数:"
|
||||
player_list[i].param[4].value = tostring(data[i].settle_log.an_kong)
|
||||
player_list[i].param[5] = {}
|
||||
player_list[i].param[5].key = "明杠次数:"
|
||||
player_list[i].param[5].value = tostring(data[i].settle_log.ming_kong)
|
||||
end
|
||||
|
||||
local round = room.room_config.round
|
||||
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
|
||||
local big_result = self._view:GetChild("big_result")
|
||||
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()),
|
||||
room.room_id, room.curren_round, room.room_config.round)
|
||||
local lst_p = big_result:GetChild("player_list")
|
||||
if #player_list == 3 then
|
||||
lst_p.columnGap = 108
|
||||
elseif #player_list == 2 then
|
||||
lst_p.columnGap = 208
|
||||
end
|
||||
|
||||
self:InitBigResult(room, 30)
|
||||
local show_detail = room.hpOnOff == 1
|
||||
for i = 1, lst_p.numChildren do
|
||||
local com_p = lst_p:GetChildAt(i - 1)
|
||||
com_p:GetController("jsicon").selectedIndex = i - 1
|
||||
local list_param = com_p:GetChild("list_param")
|
||||
for j = 1, list_param.numChildren do
|
||||
local tem = list_param:GetChildAt(j - 1)
|
||||
tem:GetChild("txt_value").textFormat.size = 30
|
||||
end
|
||||
if show_detail then
|
||||
local score = 0
|
||||
if com_p:GetController("pn").selectedIndex == 0 then
|
||||
score = com_p:GetChild("txt_navigate").text
|
||||
else
|
||||
score = com_p:GetChild("txt_positive").text
|
||||
end
|
||||
score = score / room.score_times
|
||||
com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times)
|
||||
end
|
||||
end
|
||||
|
||||
if room.group_id ~= 0 then
|
||||
big_result:GetController("group").selectedIndex = 1
|
||||
end
|
||||
DataManager.CurrenRoom = nil
|
||||
end
|
||||
|
||||
function M:LoadHead(p, room)
|
||||
local btn_head = self._view:GetChild("btn_head")
|
||||
for i = 1, #room.player_list do
|
||||
local player = room.player_list[i]
|
||||
if p.seat == player.seat and player.self_user.head_url ~= "" then
|
||||
ImageLoad.Load(player.self_user.head_url, btn_head.icon)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local prefix
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
prefix = get_majiang_prefix(10)
|
||||
-- end
|
||||
return prefix
|
||||
end
|
||||
|
||||
function M:DestroyWithCallback()
|
||||
if self._callback then
|
||||
self._callback()
|
||||
end
|
||||
self:Destroy()
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -306,7 +306,7 @@ end
|
|||
|
||||
function M:OneventResult1(evt_data)
|
||||
local over = evt_data.type
|
||||
printlog("OneventResult1")
|
||||
print("OneventResult1")
|
||||
pt(evt_data)
|
||||
--0:小结算 1:小大结算 2:大结算
|
||||
self._room._reload_flag = false
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ end
|
|||
|
||||
function M:LoadConfigToDetail(data)
|
||||
local configData = json.decode(data)
|
||||
local returnString = string.format("人数%s人%s%s,%s", configData.maxPlayers,
|
||||
configData.zimo and ",只能自摸" or ",自摸可点炮",
|
||||
configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
|
||||
local returnString = string.format("人数%s人,%s,%s,%s", configData.maxPlayers,
|
||||
configData.zimo and "只能自摸" or "自摸可点炮",
|
||||
configData.tuoguan and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
|
||||
configData.jingbibo and "有精必博" or "有精可胡")
|
||||
return returnString
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local MJMainView = require("main.majiang.MJMainView")
|
||||
local EXClearingView = import(".EXClearingView_JiangXi")
|
||||
local EXClearingView = import(".EXClearingView")
|
||||
local TX_GameEvent = import(".GameEvent")
|
||||
local HuTipView = import("main.majiang.HuTipView")
|
||||
local SettingView = import(".EXSettingView")
|
||||
|
|
@ -473,7 +473,7 @@ function M:EventInit()
|
|||
-- info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
if num >= 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
else
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ local function run_test(testname, func, input, should_work, output)
|
|||
if status ~= nil then
|
||||
name = name .. statusmap[status]
|
||||
end
|
||||
-- print(("[%s] %s"):format(name, serialise_value(value, false)))
|
||||
print(("[%s] %s"):format(name, serialise_value(value, false)))
|
||||
end
|
||||
|
||||
local result = { pcall(func, unpack(input)) }
|
||||
|
|
@ -200,7 +200,7 @@ local function run_test(testname, func, input, should_work, output)
|
|||
test_count_total = test_count_total + 1
|
||||
|
||||
local teststatus = { [true] = "PASS", [false] = "FAIL" }
|
||||
-- print(("==> Test [%d] %s: %s"):format(test_count_total, testname,
|
||||
print(("==> Test [%d] %s: %s"):format(test_count_total, testname,
|
||||
teststatus[correct]))
|
||||
|
||||
status_line("Input", nil, input)
|
||||
|
|
@ -208,7 +208,7 @@ local function run_test(testname, func, input, should_work, output)
|
|||
status_line("Expected", should_work, output)
|
||||
end
|
||||
status_line("Received", success, result)
|
||||
-- print()
|
||||
print()
|
||||
|
||||
return correct, result
|
||||
end
|
||||
|
|
@ -216,11 +216,11 @@ end
|
|||
local function run_test_group(tests)
|
||||
local function run_helper(name, func, input)
|
||||
if type(name) == "string" and #name > 0 then
|
||||
-- print("==> " .. name)
|
||||
print("==> " .. name)
|
||||
end
|
||||
-- Not a protected call, these functions should never generate errors.
|
||||
func(unpack(input or {}))
|
||||
-- print()
|
||||
print()
|
||||
end
|
||||
|
||||
for _, v in ipairs(tests) do
|
||||
|
|
|
|||
|
|
@ -146,15 +146,15 @@ function _event:Dump()
|
|||
|
||||
for _, v in ilist(self.list) do
|
||||
if v.obj then
|
||||
-- print("update function:", v.func, "object name:", v.obj.name)
|
||||
print("update function:", v.func, "object name:", v.obj.name)
|
||||
else
|
||||
-- print("update function: ", v.func)
|
||||
print("update function: ", v.func)
|
||||
end
|
||||
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
-- print("all function is:", count)
|
||||
print("all function is:", count)
|
||||
end
|
||||
|
||||
_event.__call = function(self, ...)
|
||||
|
|
@ -165,7 +165,6 @@ _event.__call = function(self, ...)
|
|||
for i, f in ilist(_list) do
|
||||
self.current = i
|
||||
local flag, msg = f(...)
|
||||
|
||||
if not flag then
|
||||
_list:remove(i)
|
||||
self.lock = false
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
--
|
||||
-- Example usage:
|
||||
--
|
||||
-- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; -- print(x)'
|
||||
-- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)'
|
||||
-- luajit -jbc=- foo.lua
|
||||
-- luajit -jbc=foo.list foo.lua
|
||||
--
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
--
|
||||
-- local bc = require("jit.bc")
|
||||
--
|
||||
-- local function foo() -- print("hello") end
|
||||
-- local function foo() print("hello") end
|
||||
--
|
||||
-- bc.dump(foo) --> -- BYTECODE -- [...]
|
||||
-- -- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello"
|
||||
-- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello"
|
||||
--
|
||||
-- local out = {
|
||||
-- -- Do something with each line:
|
||||
|
|
@ -55,14 +55,10 @@ local stdout, stderr = io.stdout, io.stderr
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
local function ctlsub(c)
|
||||
if c == "\n" then
|
||||
return "\\n"
|
||||
elseif c == "\r" then
|
||||
return "\\r"
|
||||
elseif c == "\t" then
|
||||
return "\\t"
|
||||
else
|
||||
return format("\\%03d", byte(c))
|
||||
if c == "\n" then return "\\n"
|
||||
elseif c == "\r" then return "\\r"
|
||||
elseif c == "\t" then return "\\t"
|
||||
else return format("\\%03d", byte(c))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -191,3 +187,4 @@ return {
|
|||
off = bclistoff,
|
||||
start = bcliston -- For -j command line option.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
--
|
||||
-- Example usage:
|
||||
--
|
||||
-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; -- print(x)"
|
||||
-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)"
|
||||
-- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R
|
||||
-- luajit -jdump=is myapp.lua | less -R
|
||||
-- luajit -jdump=-b myapp.lua
|
||||
|
|
@ -28,15 +28,15 @@
|
|||
--
|
||||
-- The following dump features are available (* marks the default):
|
||||
--
|
||||
-- * t -- print a line for each started, ended or aborted trace (see also -jv).
|
||||
-- * t Print a line for each started, ended or aborted trace (see also -jv).
|
||||
-- * b Dump the traced bytecode.
|
||||
-- * i Dump the IR (intermediate representation).
|
||||
-- r Augment the IR with register/stack slots.
|
||||
-- s Dump the snapshot map.
|
||||
-- * m Dump the generated machine code.
|
||||
-- x -- print each taken trace exit.
|
||||
-- X -- print each taken trace exit and the contents of all registers.
|
||||
-- a -- print the IR of aborted traces, too.
|
||||
-- x Print each taken trace exit.
|
||||
-- X Print each taken trace exit and the contents of all registers.
|
||||
-- a Print the IR of aborted traces, too.
|
||||
--
|
||||
-- The output format can be set with the following characters:
|
||||
--
|
||||
|
|
@ -222,11 +222,8 @@ local function colorize_ansi(s, t)
|
|||
end
|
||||
|
||||
local irtype_ansi = setmetatable({},
|
||||
{
|
||||
__index = function(tab, t)
|
||||
local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s;
|
||||
end
|
||||
})
|
||||
{ __index = function(tab, t)
|
||||
local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })
|
||||
|
||||
local html_escape = { ["<"] = "<", [">"] = ">", ["&"] = "&", }
|
||||
|
||||
|
|
@ -236,11 +233,8 @@ local function colorize_html(s, t)
|
|||
end
|
||||
|
||||
local irtype_html = setmetatable({},
|
||||
{
|
||||
__index = function(tab, t)
|
||||
local s = colorize_html(irtype_text[t], t); tab[t] = s; return s;
|
||||
end
|
||||
})
|
||||
{ __index = function(tab, t)
|
||||
local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })
|
||||
|
||||
local header_html = [[
|
||||
<style type="text/css">
|
||||
|
|
@ -267,8 +261,7 @@ local colorize, irtype
|
|||
|
||||
-- Lookup tables to convert some literals into names.
|
||||
local litname = {
|
||||
["SLOAD "] = setmetatable({}, {
|
||||
__index = function(t, mode)
|
||||
["SLOAD "] = setmetatable({}, { __index = function(t, mode)
|
||||
local s = ""
|
||||
if band(mode, 1) ~= 0 then s = s.."P" end
|
||||
if band(mode, 2) ~= 0 then s = s.."F" end
|
||||
|
|
@ -278,11 +271,9 @@ local litname = {
|
|||
if band(mode, 32) ~= 0 then s = s.."I" end
|
||||
t[mode] = s
|
||||
return s
|
||||
end
|
||||
}),
|
||||
end}),
|
||||
["XLOAD "] = { [0] = "", "R", "V", "RV", "U", "RU", "VU", "RVU", },
|
||||
["CONV "] = setmetatable({}, {
|
||||
__index = function(t, mode)
|
||||
["CONV "] = setmetatable({}, { __index = function(t, mode)
|
||||
local s = irtype[band(mode, 31)]
|
||||
s = irtype[band(shr(mode, 5), 31)].."."..s
|
||||
if band(mode, 0x800) ~= 0 then s = s.." sext" end
|
||||
|
|
@ -290,8 +281,7 @@ local litname = {
|
|||
if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end
|
||||
t[mode] = s
|
||||
return s
|
||||
end
|
||||
}),
|
||||
end}),
|
||||
["FLOAD "] = vmdef.irfield,
|
||||
["FREF "] = vmdef.irfield,
|
||||
["FPMATH"] = vmdef.irfpm,
|
||||
|
|
@ -300,14 +290,10 @@ local litname = {
|
|||
}
|
||||
|
||||
local function ctlsub(c)
|
||||
if c == "\n" then
|
||||
return "\\n"
|
||||
elseif c == "\r" then
|
||||
return "\\r"
|
||||
elseif c == "\t" then
|
||||
return "\\t"
|
||||
else
|
||||
return format("\\%03d", byte(c))
|
||||
if c == "\n" then return "\\n"
|
||||
elseif c == "\r" then return "\\r"
|
||||
elseif c == "\t" then return "\\t"
|
||||
else return format("\\%03d", byte(c))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -563,11 +549,8 @@ end
|
|||
-- Dump trace states.
|
||||
local function dump_trace(what, tr, func, pc, otr, oex)
|
||||
if what == "stop" or (what == "abort" and dumpmode.a) then
|
||||
if dumpmode.i then
|
||||
dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop")
|
||||
elseif dumpmode.s then
|
||||
dump_snap(tr)
|
||||
end
|
||||
if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop")
|
||||
elseif dumpmode.s then dump_snap(tr) end
|
||||
if dumpmode.m then dump_mcode(tr) end
|
||||
end
|
||||
if what == "start" then
|
||||
|
|
@ -675,9 +658,7 @@ local function dumpon(opt, outfile)
|
|||
local term = os.getenv("TERM")
|
||||
local colormode = (term and term:match("color") or os.getenv("COLORTERM")) and "A" or "T"
|
||||
if opt then
|
||||
opt = gsub(opt, "[TAH]", function(mode)
|
||||
colormode = mode; return "";
|
||||
end)
|
||||
opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
|
||||
end
|
||||
|
||||
local m = { t=true, b=true, i=true, m=true, }
|
||||
|
|
@ -728,3 +709,4 @@ return {
|
|||
off = dumpoff,
|
||||
start = dumpon -- For -j command line option.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,26 +104,26 @@ local function dump_trace(what, tr, func, pc, otr, oex)
|
|||
if what == "abort" then
|
||||
local loc = fmtfunc(func, pc)
|
||||
if loc ~= startloc then
|
||||
-- print(format("[TRACE --- %s%s -- %s at %s]\n", startex, startloc, fmterr(otr, oex), loc))
|
||||
print(format("[TRACE --- %s%s -- %s at %s]\n", startex, startloc, fmterr(otr, oex), loc))
|
||||
else
|
||||
-- print(format("[TRACE --- %s%s -- %s]\n", startex, startloc, fmterr(otr, oex)))
|
||||
print(format("[TRACE --- %s%s -- %s]\n", startex, startloc, fmterr(otr, oex)))
|
||||
end
|
||||
elseif what == "stop" then
|
||||
local info = traceinfo(tr)
|
||||
local link, ltype = info.link, info.linktype
|
||||
if ltype == "interpreter" then
|
||||
-- print(format("[TRACE %3s %s%s -- fallback to interpreter]\n", tr, startex, startloc))
|
||||
print(format("[TRACE %3s %s%s -- fallback to interpreter]\n", tr, startex, startloc))
|
||||
elseif ltype == "stitch" then
|
||||
-- print(format("[TRACE %3s %s%s %s %s]\n", tr, startex, startloc, ltype, fmtfunc(func, pc)))
|
||||
print(format("[TRACE %3s %s%s %s %s]\n", tr, startex, startloc, ltype, fmtfunc(func, pc)))
|
||||
elseif link == tr or link == 0 then
|
||||
-- print(format("[TRACE %3s %s%s %s]\n", tr, startex, startloc, ltype))
|
||||
print(format("[TRACE %3s %s%s %s]\n", tr, startex, startloc, ltype))
|
||||
elseif ltype == "root" then
|
||||
-- print(format("[TRACE %3s %s%s -> %d]\n", tr, startex, startloc, link))
|
||||
print(format("[TRACE %3s %s%s -> %d]\n", tr, startex, startloc, link))
|
||||
else
|
||||
-- print(format("[TRACE %3s %s%s -> %d %s]\n", tr, startex, startloc, link, ltype))
|
||||
print(format("[TRACE %3s %s%s -> %d %s]\n", tr, startex, startloc, link, ltype))
|
||||
end
|
||||
else
|
||||
-- print(format("[TRACE %s]\n", what))
|
||||
print(format("[TRACE %s]\n", what))
|
||||
end
|
||||
out:flush()
|
||||
end
|
||||
|
|
@ -160,3 +160,4 @@ return {
|
|||
off = dumpoff,
|
||||
start = dumpon -- For -j command line option.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
return {
|
||||
|
||||
bcnames =
|
||||
"ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF ISTYPEISNUM MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TGETR TSETV TSETS TSETB TSETM TSETR CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW",
|
||||
bcnames = "ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF ISTYPEISNUM MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TGETR TSETV TSETS TSETB TSETM TSETR CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW",
|
||||
|
||||
irnames =
|
||||
"LT GE LE GT ULT UGE ULE UGT EQ NE ABC RETF NOP BASE PVAL GCSTEPHIOP LOOP USE PHI RENAMEPROF KPRI KINT KGC KPTR KKPTR KNULL KNUM KINT64KSLOT BNOT BSWAP BAND BOR BXOR BSHL BSHR BSAR BROL BROR ADD SUB MUL DIV MOD POW NEG ABS ATAN2 LDEXP MIN MAX FPMATHADDOV SUBOV MULOV AREF HREFK HREF NEWREFUREFO UREFC FREF STRREFLREF ALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW XSNEW TNEW TDUP CNEW CNEWI BUFHDRBUFPUTBUFSTRTBAR OBAR XBAR CONV TOBIT TOSTR STRTO CALLN CALLA CALLL CALLS CALLXSCARG ",
|
||||
irnames = "LT GE LE GT ULT UGE ULE UGT EQ NE ABC RETF NOP BASE PVAL GCSTEPHIOP LOOP USE PHI RENAMEPROF KPRI KINT KGC KPTR KKPTR KNULL KNUM KINT64KSLOT BNOT BSWAP BAND BOR BXOR BSHL BSHR BSAR BROL BROR ADD SUB MUL DIV MOD POW NEG ABS ATAN2 LDEXP MIN MAX FPMATHADDOV SUBOV MULOV AREF HREFK HREF NEWREFUREFO UREFC FREF STRREFLREF ALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW XSNEW TNEW TDUP CNEW CNEWI BUFHDRBUFPUTBUFSTRTBAR OBAR XBAR CONV TOBIT TOSTR STRTO CALLN CALLA CALLL CALLS CALLXSCARG ",
|
||||
|
||||
irfpm = { [0]="floor", "ceil", "trunc", "sqrt", "exp", "exp2", "log", "log2", "log10", "sin", "cos", "tan", "other", },
|
||||
|
||||
|
|
@ -361,3 +359,4 @@ return {
|
|||
},
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
-- ...
|
||||
-- zone("A*")
|
||||
-- ...
|
||||
-- -- print(zone:get()) --> "A*"
|
||||
-- print(zone:get()) --> "A*"
|
||||
-- ...
|
||||
-- zone()
|
||||
-- ...
|
||||
-- -- print(zone:get()) --> "AI"
|
||||
-- print(zone:get()) --> "AI"
|
||||
-- ...
|
||||
-- zone()
|
||||
--
|
||||
|
|
@ -42,3 +42,4 @@ return setmetatable({
|
|||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ updatelocale()
|
|||
|
||||
|
||||
|
||||
local I = m.P(function(s, i)
|
||||
print(i, s:sub(1, i - 1)); return i
|
||||
end)
|
||||
local I = m.P(function (s,i) print(i, s:sub(1, i-1)); return i end)
|
||||
|
||||
|
||||
local function getdef (id, defs)
|
||||
|
|
@ -156,20 +154,19 @@ local function firstdef(n, r) return adddef({ n }, n, r) end
|
|||
local function NT (n, b)
|
||||
if not b then
|
||||
error("rule '"..n.."' used outside a grammar")
|
||||
else
|
||||
return mm.V(n)
|
||||
else return mm.V(n)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local exp = m.P{ "Exp",
|
||||
Exp = S * ( m.V"Grammar"
|
||||
+ m.Cf(m.V "Seq" * ("/" * S * m.V "Seq") ^ 0, mt.__add)),
|
||||
+ m.Cf(m.V"Seq" * ("/" * S * m.V"Seq")^0, mt.__add) );
|
||||
Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^0 , mt.__mul)
|
||||
* (#seq_follow + patt_error),
|
||||
* (#seq_follow + patt_error);
|
||||
Prefix = "&" * S * m.V"Prefix" / mt.__len
|
||||
+ "!" * S * m.V"Prefix" / mt.__unm
|
||||
+ m.V "Suffix",
|
||||
+ m.V"Suffix";
|
||||
Suffix = m.Cf(m.V"Primary" * S *
|
||||
( ( m.P"+" * m.Cc(1, mt.__pow)
|
||||
+ m.P"*" * m.Cc(0, mt.__pow)
|
||||
|
|
@ -183,7 +180,7 @@ local exp = m.P { "Exp",
|
|||
)
|
||||
+ "=>" * S * m.Cg(Def / getdef * m.Cc(m.Cmt))
|
||||
) * S
|
||||
) ^ 0, function(a, b, f) return f(a, b) end),
|
||||
)^0, function (a,b,f) return f(a,b) end );
|
||||
Primary = "(" * m.V"Exp" * ")"
|
||||
+ String / mm.P
|
||||
+ Class
|
||||
|
|
@ -196,8 +193,8 @@ local exp = m.P { "Exp",
|
|||
+ "{|" * m.V"Exp" * "|}" / mm.Ct
|
||||
+ "{" * m.V"Exp" * "}" / mm.C
|
||||
+ m.P"." * m.Cc(any)
|
||||
+ (name * -arrow + "<" * name * ">") * m.Cb("G") / NT,
|
||||
Definition = name * arrow * m.V "Exp",
|
||||
+ (name * -arrow + "<" * name * ">") * m.Cb("G") / NT;
|
||||
Definition = name * arrow * m.V"Exp";
|
||||
Grammar = m.Cg(m.Cc(true), "G") *
|
||||
m.Cf(m.V"Definition" / firstdef * m.Cg(m.V"Definition")^0,
|
||||
adddef) / mm.P
|
||||
|
|
@ -230,10 +227,8 @@ local function find(s, p, i)
|
|||
fmem[p] = cp
|
||||
end
|
||||
local i, e = cp:match(s, i or 1)
|
||||
if i then
|
||||
return i, e - 1
|
||||
else
|
||||
return i
|
||||
if i then return i, e - 1
|
||||
else return i
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ local function _StructPackDecoder(wire_type, value_size, format)
|
|||
local result = struct_unpack(format, buffer, pos)
|
||||
return result, new_pos
|
||||
end
|
||||
|
||||
return _SimpleDecoder(wire_type, InnerDecode)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -299,16 +299,13 @@ local function _AttachFieldHelpers(message_meta, field_descriptor)
|
|||
local is_repeated = (field_descriptor.label == FieldDescriptor.LABEL_REPEATED)
|
||||
local is_packed = (field_descriptor.has_options and field_descriptor.GetOptions().packed)
|
||||
|
||||
rawset(field_descriptor, "_encoder",
|
||||
TYPE_TO_ENCODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))
|
||||
rawset(field_descriptor, "_sizer",
|
||||
TYPE_TO_SIZER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))
|
||||
rawset(field_descriptor, "_encoder", TYPE_TO_ENCODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))
|
||||
rawset(field_descriptor, "_sizer", TYPE_TO_SIZER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))
|
||||
rawset(field_descriptor, "_default_constructor", _DefaultValueConstructorForField(field_descriptor))
|
||||
|
||||
local AddDecoder = function(wiretype, is_packed)
|
||||
local tag_bytes = encoder.TagBytes(field_descriptor.number, wiretype)
|
||||
message_meta._decoders_by_tag[tag_bytes] = TYPE_TO_DECODER[field_descriptor.type](field_descriptor.number,
|
||||
is_repeated, is_packed, field_descriptor, field_descriptor._default_constructor)
|
||||
message_meta._decoders_by_tag[tag_bytes] = TYPE_TO_DECODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed, field_descriptor, field_descriptor._default_constructor)
|
||||
end
|
||||
|
||||
AddDecoder(FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type], False)
|
||||
|
|
@ -439,8 +436,7 @@ local _ED_meta = {
|
|||
local _extended_message = rawget(self, "_extended_message")
|
||||
if (extension_handle.label == FieldDescriptor.LABEL_REPEATED or
|
||||
extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE) then
|
||||
error('Cannot assign to extension "' ..
|
||||
extension_handle.full_name .. '" because it is a repeated or composite type.')
|
||||
error('Cannot assign to extension "'.. extension_handle.full_name .. '" because it is a repeated or composite type.')
|
||||
end
|
||||
|
||||
local type_checker = GetTypeChecker(extension_handle.cpp_type, extension_handle.type)
|
||||
|
|
@ -509,7 +505,6 @@ end
|
|||
function sortFunc(a, b)
|
||||
return a.index < b.index
|
||||
end
|
||||
|
||||
function pairsByKeys (t, f)
|
||||
local a = {}
|
||||
for n in pairs(t) do table.insert(a, n) end
|
||||
|
|
@ -517,10 +512,8 @@ function pairsByKeys(t, f)
|
|||
local i = 0 -- iterator variable
|
||||
local iter = function () -- iterator function
|
||||
i = i + 1
|
||||
if a[i] == nil then
|
||||
return nil
|
||||
else
|
||||
return a[i], t[a[i]]
|
||||
if a[i] == nil then return nil
|
||||
else return a[i], t[a[i]]
|
||||
end
|
||||
end
|
||||
return iter
|
||||
|
|
@ -964,3 +957,4 @@ local function Message(descriptor)
|
|||
end
|
||||
|
||||
_M.Message = Message
|
||||
|
||||
|
|
|
|||
|
|
@ -76,3 +76,4 @@ function msg_format(msg)
|
|||
msg_format_indent(write, msg, 0)
|
||||
return table.concat(out)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ if jit then
|
|||
jit.opt.start(3)
|
||||
end
|
||||
|
||||
-- print("ver"..jit.version_num.." jit: ", jit.status())
|
||||
-- print(string.format("os: %s, arch: %s", jit.os, jit.arch))
|
||||
print("ver"..jit.version_num.." jit: ", jit.status())
|
||||
print(string.format("os: %s, arch: %s", jit.os, jit.arch))
|
||||
end
|
||||
|
||||
if DebugServerIp then
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 965 KiB After Width: | Height: | Size: 483 KiB |
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
|
|
@ -0,0 +1,92 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ffe28b30c5a6cf24298b352cb37c18b2
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ guid: 326fa64ee0dd8b94aa86fa1978e56fa5
|
|||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
|
||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
||||
assetBundleVariant:
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue