全部放大
parent
944b9ed164
commit
9e830c82b5
|
|
@ -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)
|
||||
|
|
@ -92,7 +92,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
|
||||
|
|
@ -170,7 +170,7 @@ end
|
|||
---c#网络层回调函数
|
||||
function R.c__onconnect(self, code)
|
||||
if (debug_print) then
|
||||
print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||
-- print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||
end
|
||||
self.onconnect(code)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Queue = {}
|
|||
|
||||
function Queue.new(capacity)
|
||||
local self = {}
|
||||
setmetatable(self,{__index = Queue})
|
||||
setmetatable(self, { __index = Queue })
|
||||
self.capacity = capacity
|
||||
self.queue = {}
|
||||
self.size_ = 0
|
||||
|
|
@ -20,11 +20,11 @@ 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.")
|
||||
ViewUtil.ErrorTip(10001, "Error: capacity is full.")
|
||||
return
|
||||
else
|
||||
self.rear = temp
|
||||
|
|
@ -33,12 +33,11 @@ function Queue:Enqueue(element)
|
|||
self.queue[self.rear] = element
|
||||
self.size_ = self.size_ + 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Queue:Dequeue()
|
||||
if self:IsEmpty() then
|
||||
ViewUtil.ErrorTip(10002,"Error: The Queue is empty.")
|
||||
ViewUtil.ErrorTip(10002, "Error: The Queue is empty.")
|
||||
error("Error: The Queue is empty.")
|
||||
return
|
||||
end
|
||||
|
|
@ -74,16 +73,16 @@ function Queue:dump()
|
|||
local first_flag = true
|
||||
while h ~= r do
|
||||
if first_flag == true then
|
||||
str = "{"..self.queue[h]
|
||||
str = "{" .. self.queue[h]
|
||||
h = (h + 1) % self.capacity
|
||||
first_flag = false
|
||||
else
|
||||
str = str..","..self.queue[h]
|
||||
str = str .. "," .. self.queue[h]
|
||||
h = (h + 1) % self.capacity
|
||||
end
|
||||
end
|
||||
str = str..","..self.queue[r].."}"
|
||||
if(debug_print) then
|
||||
print(str)
|
||||
str = str .. "," .. self.queue[r] .. "}"
|
||||
if (debug_print) then
|
||||
-- print(str)
|
||||
end
|
||||
end
|
||||
|
|
@ -5,132 +5,131 @@
|
|||
bit = bit or {}
|
||||
function bit.init32()
|
||||
bit.data32 = {}
|
||||
for i=1,32 do
|
||||
bit.data32[i]=2^(32-i)
|
||||
for i = 1, 32 do
|
||||
bit.data32[i] = 2 ^ (32 - i)
|
||||
end
|
||||
end
|
||||
|
||||
bit.init32()
|
||||
|
||||
function bit:d2b(arg) --bit:d2b
|
||||
local tr={}
|
||||
for i=1,32 do
|
||||
local tr = {}
|
||||
for i = 1, 32 do
|
||||
if arg >= self.data32[i] then
|
||||
tr[i]=1
|
||||
arg=arg-self.data32[i]
|
||||
tr[i] = 1
|
||||
arg = arg - self.data32[i]
|
||||
else
|
||||
tr[i]=0
|
||||
tr[i] = 0
|
||||
end
|
||||
end
|
||||
return tr
|
||||
end
|
||||
|
||||
function bit:b2d(arg) --bit:b2d
|
||||
local nr=0
|
||||
for i=1,32 do
|
||||
if arg[i] ==1 then
|
||||
nr=nr+2^(32-i)
|
||||
local nr = 0
|
||||
for i = 1, 32 do
|
||||
if arg[i] == 1 then
|
||||
nr = nr + 2 ^ (32 - i)
|
||||
end
|
||||
end
|
||||
return nr
|
||||
end
|
||||
|
||||
function bit:_xor(a,b) --bit:xor
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_xor(a, b) --bit:xor
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==op2[i] then
|
||||
r[i]=0
|
||||
for i = 1, 32 do
|
||||
if op1[i] == op2[i] then
|
||||
r[i] = 0
|
||||
else
|
||||
r[i]=1
|
||||
r[i] = 1
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_and(a,b) --bit:_and
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_and(a, b) --bit:_and
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 and op2[i]==1 then
|
||||
r[i]=1
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 and op2[i] == 1 then
|
||||
r[i] = 1
|
||||
else
|
||||
r[i]=0
|
||||
r[i] = 0
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
|
||||
end
|
||||
|
||||
function bit:_or(a,b) --bit:_or
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_or(a, b) --bit:_or
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 or op2[i]==1 then
|
||||
r[i]=1
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 or op2[i] == 1 then
|
||||
r[i] = 1
|
||||
else
|
||||
r[i]=0
|
||||
r[i] = 0
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_not(a) --bit:_not
|
||||
local op1=self:d2b(a)
|
||||
local r={}
|
||||
local op1 = self:d2b(a)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 then
|
||||
r[i]=0
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 then
|
||||
r[i] = 0
|
||||
else
|
||||
r[i]=1
|
||||
r[i] = 1
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_rshift(a,n) --bit:_rshift
|
||||
local op1=self:d2b(a)
|
||||
local r=self:d2b(0)
|
||||
function bit:_rshift(a, n) --bit:_rshift
|
||||
local op1 = self:d2b(a)
|
||||
local r = self:d2b(0)
|
||||
|
||||
if n < 32 and n > 0 then
|
||||
for i=1,n do
|
||||
for i=31,1,-1 do
|
||||
op1[i+1]=op1[i]
|
||||
for i = 1, n do
|
||||
for i = 31, 1, -1 do
|
||||
op1[i + 1] = op1[i]
|
||||
end
|
||||
op1[1]=0
|
||||
op1[1] = 0
|
||||
end
|
||||
r=op1
|
||||
r = op1
|
||||
end
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_lshift(a,n) --bit:_lshift
|
||||
local op1=self:d2b(a)
|
||||
local r=self:d2b(0)
|
||||
function bit:_lshift(a, n) --bit:_lshift
|
||||
local op1 = self:d2b(a)
|
||||
local r = self:d2b(0)
|
||||
|
||||
if n < 32 and n > 0 then
|
||||
for i=1,n do
|
||||
for i=1,31 do
|
||||
op1[i]=op1[i+1]
|
||||
for i = 1, n do
|
||||
for i = 1, 31 do
|
||||
op1[i] = op1[i + 1]
|
||||
end
|
||||
op1[32]=0
|
||||
op1[32] = 0
|
||||
end
|
||||
r=op1
|
||||
r = op1
|
||||
end
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
|
||||
function bit:print(ta)
|
||||
local sr=""
|
||||
for i=1,32 do
|
||||
sr=sr..ta[i]
|
||||
local sr = ""
|
||||
for i = 1, 32 do
|
||||
sr = sr .. ta[i]
|
||||
end
|
||||
print(sr)
|
||||
-- print(sr)
|
||||
end
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
string._htmlspecialchars_set = {}
|
||||
string._htmlspecialchars_set["&"] = "&"
|
||||
string._htmlspecialchars_set["\""] = """
|
||||
|
|
@ -10,7 +8,7 @@ string._htmlspecialchars_set[">"] = ">"
|
|||
--[[--
|
||||
将特殊字符转为 HTML 转义符
|
||||
~~~ lua
|
||||
print(string.htmlspecialchars("<ABC>"))
|
||||
-- print(string.htmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -26,7 +24,7 @@ end
|
|||
--[[--
|
||||
将 HTML 转义符还原为特殊字符,功能与 string.htmlspecialchars() 正好相反
|
||||
~~~ lua
|
||||
print(string.restorehtmlspecialchars("<ABC>"))
|
||||
-- print(string.restorehtmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -42,7 +40,7 @@ end
|
|||
--[[--
|
||||
将字符串中的 \n 换行符转换为 HTML 标记
|
||||
~~~ lua
|
||||
print(string.nl2br("Hello\nWorld"))
|
||||
-- print(string.nl2br("Hello\nWorld"))
|
||||
-- 输出
|
||||
-- Hello<br />World
|
||||
~~~
|
||||
|
|
@ -56,7 +54,7 @@ end
|
|||
--[[--
|
||||
将字符串中的特殊字符和 \n 换行符转换为 HTML 转移符和标记
|
||||
~~~ lua
|
||||
print(string.nl2br("<Hello>\nWorld"))
|
||||
-- print(string.nl2br("<Hello>\nWorld"))
|
||||
-- 输出
|
||||
-- <Hello><br />World
|
||||
~~~
|
||||
|
|
@ -88,10 +86,10 @@ local res = string.split(input, "-+-")
|
|||
function string.split(input, delimiter)
|
||||
input = tostring(input)
|
||||
delimiter = tostring(delimiter)
|
||||
if (delimiter=='') then return false end
|
||||
local pos,arr = 0, {}
|
||||
if (delimiter == '') then return false end
|
||||
local pos, arr = 0, {}
|
||||
-- for each divider found
|
||||
for st,sp in function() return string.find(input, delimiter, pos, true) end do
|
||||
for st, sp in function() return string.find(input, delimiter, pos, true) end do
|
||||
table.insert(arr, string.sub(input, pos, st - 1))
|
||||
pos = sp + 1
|
||||
end
|
||||
|
|
@ -103,7 +101,7 @@ end
|
|||
去除输入字符串头部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = " ABC"
|
||||
print(string.ltrim(input))
|
||||
-- print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串前面的两个空格被去掉了
|
||||
~~~
|
||||
空白字符包括:
|
||||
|
|
@ -123,7 +121,7 @@ end
|
|||
去除输入字符串尾部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = "ABC "
|
||||
print(string.ltrim(input))
|
||||
-- print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串最后的两个空格被去掉了
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -149,7 +147,7 @@ end
|
|||
将字符串的第一个字符转为大写,返回结果
|
||||
~~~ lua
|
||||
local input = "hello"
|
||||
print(string.ucfirst(input))
|
||||
-- print(string.ucfirst(input))
|
||||
-- 输出 Hello
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -167,7 +165,7 @@ end
|
|||
将字符串转换为符合 URL 传递要求的格式,并返回转换结果
|
||||
~~~ lua
|
||||
local input = "hello world"
|
||||
print(string.urlencode(input))
|
||||
-- print(string.urlencode(input))
|
||||
-- 输出
|
||||
-- hello%20world
|
||||
~~~
|
||||
|
|
@ -188,7 +186,7 @@ end
|
|||
将 URL 中的特殊字符还原,并返回结果
|
||||
~~~ lua
|
||||
local input = "hello%20world"
|
||||
print(string.urldecode(input))
|
||||
-- print(string.urldecode(input))
|
||||
-- 输出
|
||||
-- hello world
|
||||
~~~
|
||||
|
|
@ -197,9 +195,9 @@ print(string.urldecode(input))
|
|||
@see string.urlencode
|
||||
]]
|
||||
function string.urldecode(input)
|
||||
input = string.gsub (input, "+", " ")
|
||||
input = string.gsub (input, "%%(%x%x)", function(h) return string.char(checknumber(h,16)) end)
|
||||
input = string.gsub (input, "\r\n", "\n")
|
||||
input = string.gsub(input, "+", " ")
|
||||
input = string.gsub(input, "%%(%x%x)", function(h) return string.char(checknumber(h, 16)) end)
|
||||
input = string.gsub(input, "\r\n", "\n")
|
||||
return input
|
||||
end
|
||||
|
||||
|
|
@ -207,7 +205,7 @@ end
|
|||
计算 UTF8 字符串的长度,每一个中文算一个字符
|
||||
~~~ lua
|
||||
local input = "你好World"
|
||||
print(string.utf8len(input))
|
||||
-- print(string.utf8len(input))
|
||||
-- 输出 7
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -219,7 +217,7 @@ function string.utf8len(input)
|
|||
local len = string.len(input)
|
||||
local left = len
|
||||
local cnt = 0
|
||||
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}
|
||||
local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
|
||||
while left ~= 0 do
|
||||
local tmp = string.byte(input, -left)
|
||||
local i = #arr
|
||||
|
|
@ -251,7 +249,7 @@ function string.utf8sub(input, index, endIndex)
|
|||
local left = len
|
||||
local cnt = 0
|
||||
local head, tail = 0, 0
|
||||
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}
|
||||
local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
|
||||
while left ~= 0 do
|
||||
if cnt + 1 == index then
|
||||
head = len - left + 1
|
||||
|
|
@ -278,7 +276,7 @@ end
|
|||
--[[--
|
||||
将数值格式化为包含千分位分隔符的字符串
|
||||
~~~ lua
|
||||
print(string.formatnumberthousands(1924235))
|
||||
-- print(string.formatnumberthousands(1924235))
|
||||
-- 输出 1,924,235
|
||||
~~~
|
||||
@param number num 数值
|
||||
|
|
@ -294,12 +292,11 @@ function string.formatnumberthousands(num)
|
|||
return formatted
|
||||
end
|
||||
|
||||
|
||||
function string.concat( ... )
|
||||
function string.concat(...)
|
||||
local str = {}
|
||||
local tem = {...}
|
||||
for _,v in ipairs(tem) do
|
||||
local tem = { ... }
|
||||
for _, v in ipairs(tem) do
|
||||
str[#str + 1] = v
|
||||
end
|
||||
return table.concat(str , "")
|
||||
return table.concat(str, "")
|
||||
end
|
||||
|
|
@ -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()
|
||||
|
|
@ -74,7 +74,7 @@ function fgui.window_class(base)
|
|||
tolua.setpeer(ins, t)
|
||||
ins:SetLuaPeer(t)
|
||||
if t.ctor then
|
||||
t.ctor(ins,...)
|
||||
t.ctor(ins, ...)
|
||||
end
|
||||
|
||||
return ins
|
||||
|
|
@ -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)
|
||||
|
|
@ -133,7 +133,7 @@ function fgui.extension_class(base)
|
|||
o.Extend = function(ins)
|
||||
local t = {}
|
||||
setmetatable(t, o)
|
||||
tolua.setpeer(ins,t)
|
||||
tolua.setpeer(ins, t)
|
||||
return t
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ GameEvent = {
|
|||
OnUpdateInfo = 'OnUpdateInfo',
|
||||
|
||||
--打开托管
|
||||
TupGuanOpen='TupGuanOpen',
|
||||
TupGuanOpen = 'TupGuanOpen',
|
||||
--关闭托管
|
||||
TupGuanClose='TupGuanClose',
|
||||
TupGuanClose = 'TupGuanClose',
|
||||
|
||||
--麻将修改牌大小
|
||||
MJModifySzie='MJModifySzie',
|
||||
MJModifySzie = 'MJModifySzie',
|
||||
}
|
||||
|
||||
--- Base GameController
|
||||
|
|
@ -40,7 +40,7 @@ GameController = {
|
|||
|
||||
local M = GameController
|
||||
|
||||
setmetatable(M, {__index = IController})
|
||||
setmetatable(M, { __index = IController })
|
||||
|
||||
function M:init(name)
|
||||
self._name = name
|
||||
|
|
@ -48,7 +48,7 @@ function M:init(name)
|
|||
self._cacheEvent = Queue.new(1000)
|
||||
self._eventmap = {}
|
||||
self._dispatcher = {}
|
||||
self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT]=self.ResetConnect
|
||||
self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT] = self.ResetConnect
|
||||
|
||||
self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter
|
||||
self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState
|
||||
|
|
@ -71,8 +71,6 @@ function M:init(name)
|
|||
self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips
|
||||
|
||||
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
||||
|
||||
|
||||
end
|
||||
|
||||
function DispatchEvent(_dispatcher, evt_name, ...)
|
||||
|
|
@ -86,9 +84,8 @@ function M:AddEventListener(evt_name, func)
|
|||
self._dispatcher[evt_name] = func
|
||||
end
|
||||
|
||||
|
||||
function M:ResetConnect()
|
||||
-- print("断线重连================")
|
||||
-- -- print("断线重连================")
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
end
|
||||
|
|
@ -101,6 +98,7 @@ function M:PlayerReady()
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
print("====================================1发送准备")
|
||||
_client:send(Protocol.GAME_READY)
|
||||
end
|
||||
|
||||
|
|
@ -163,9 +161,9 @@ function M:AskDismissRoom()
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
_client:send(Protocol.GAME_ASK_DISMISS_ROOM,nil,function (res)
|
||||
_client:send(Protocol.GAME_ASK_DISMISS_ROOM, nil, function(res)
|
||||
if res.ReturnCode == 84 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"解散失败")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "解散失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -178,7 +176,7 @@ function M:DismissRoomVote(agree)
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
-- print(agree)
|
||||
-- -- print(agree)
|
||||
local _data = {}
|
||||
_data['result'] = agree
|
||||
_client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data)
|
||||
|
|
@ -261,7 +259,7 @@ end
|
|||
|
||||
-- 玩家进
|
||||
function M:OnEventPlayerEnter(evt_data)
|
||||
--print("进入房间++++++++++++++++++++++++++++++++++++++")
|
||||
---- print("进入房间++++++++++++++++++++++++++++++++++++++")
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local p = self._room:NewPlayer()
|
||||
|
|
@ -286,7 +284,6 @@ function M:OnEventPlayerEnter(evt_data)
|
|||
p.line_state = 1
|
||||
DataManager.CurrenRoom:AddPlayer(p)
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p)
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -325,15 +322,14 @@ function M:OnEventPlayerReady(evt_data)
|
|||
local pid = evt_data['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
p.ready = true
|
||||
if evt_data.start~=nil then
|
||||
if evt_data.start==1 then
|
||||
p.isSendCardState=true
|
||||
if evt_data.start ~= nil then
|
||||
if evt_data.start == 1 then
|
||||
p.isSendCardState = true
|
||||
else
|
||||
p.isSendCardState=false
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
else
|
||||
p.isSendCardState=false
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||
|
|
@ -341,22 +337,20 @@ function M:OnEventPlayerReady(evt_data)
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEventPlayerXiPaiReady(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local pid = evt_data['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
p.ready = true
|
||||
if evt_data.start~=nil then
|
||||
if evt_data.start==1 then
|
||||
p.isSendCardState=true
|
||||
if evt_data.start ~= nil then
|
||||
if evt_data.start == 1 then
|
||||
p.isSendCardState = true
|
||||
else
|
||||
p.isSendCardState=false
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
else
|
||||
p.isSendCardState=false
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||
|
|
@ -364,8 +358,6 @@ function M:OnEventPlayerXiPaiReady(evt_data)
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 聊天事件
|
||||
function M:OnEventInteraction(evt_data)
|
||||
if self._room.ban_chat1 == false or self._room.ban_chat2 == false then
|
||||
|
|
@ -396,7 +388,6 @@ function M:OnEventUpdateGPS(evt_data)
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
-- 被踢出房间事件
|
||||
function M:OnEventKicked()
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
|
|
@ -544,7 +535,7 @@ end
|
|||
|
||||
function M:OnEnter()
|
||||
if (debug_print) then
|
||||
print(self._name .. '进入Game控制器')
|
||||
-- print(self._name .. '进入Game控制器')
|
||||
end
|
||||
self._room = DataManager.CurrenRoom
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
|
|
@ -555,14 +546,14 @@ end
|
|||
|
||||
function M:OnExit()
|
||||
if (debug_print) then
|
||||
print(self._name .. ' 离开Game控制器')
|
||||
-- print(self._name .. ' 离开Game控制器')
|
||||
end
|
||||
ControllerManager.SetGameNetClient(nil)
|
||||
self._cacheEvent:Clear()
|
||||
end
|
||||
|
||||
function M:__OnNetEvent(msg)
|
||||
--print("Game消息ID===>>"..msg.Command)
|
||||
---- print("Game消息ID===>>"..msg.Command)
|
||||
local func = self._eventmap[msg.Command]
|
||||
if (func ~= nil) then
|
||||
func(self, msg.Data)
|
||||
|
|
@ -586,36 +577,30 @@ function M:ReturnToRoom()
|
|||
end,
|
||||
self.tmpGroupID
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:OnEvtOpenTupGTips(msg)
|
||||
--print("显示托管倒计时=====================")
|
||||
---- print("显示托管倒计时=====================")
|
||||
pt(msg)
|
||||
local pid = msg['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
local t=msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,true, t)
|
||||
local t = msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, true, t)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEvtCloseTupGTips(msg)
|
||||
--print("关闭托管倒计时=================")
|
||||
---- print("关闭托管倒计时=================")
|
||||
--pt(msg)
|
||||
local pid = msg['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
local t=msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,false, t)
|
||||
local t = msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t)
|
||||
end
|
||||
|
||||
|
||||
function M:DispatchEventTuoGuan(p,isShow,t)
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,isShow, t)
|
||||
function M:DispatchEventTuoGuan(p, isShow, t)
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:OnEvtOpenGameHuTuoGtips(isAuto)
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
if not _client then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ function M:connect(host, groupId, callback)
|
|||
self._mgr_client:destroy()
|
||||
self._mgr_client = nil
|
||||
end
|
||||
print("666666666666666666666666666 ", host)
|
||||
-- print("666666666666666666666666666 ", host)
|
||||
local _mgr_client = NetClient.new(self.host, "mgr_group")
|
||||
self._mgr_client = _mgr_client
|
||||
_mgr_client:connect()
|
||||
|
|
@ -186,7 +186,7 @@ end
|
|||
|
||||
-- 更新玩法
|
||||
function M:OnEvtUpdatePlay(evt_data)
|
||||
--print("更新玩法=============》》》")
|
||||
---- print("更新玩法=============》》》")
|
||||
--pt(evt_data)
|
||||
local pid = evt_data.pid
|
||||
local group = DataManager.groups:get(self.groupId)
|
||||
|
|
@ -354,7 +354,7 @@ function M:OnExit()
|
|||
end
|
||||
|
||||
function M:__OnNetEvent(msg)
|
||||
--print("消息ID===>>"..msg.Command)
|
||||
---- print("消息ID===>>"..msg.Command)
|
||||
local func = self._eventmap[msg.Command]
|
||||
if (func ~= nil) then func(self, msg.Data) end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
LoddyController = {}
|
||||
|
||||
local M = {}
|
||||
|
||||
--- Create a new LoddyController
|
||||
function LoddyController.new()
|
||||
setmetatable(M, {__index = IController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.baseType = LoddyController
|
||||
self.class = "Loddy"
|
||||
self.recordList = {}
|
||||
|
|
@ -14,11 +13,11 @@ function LoddyController.new()
|
|||
end
|
||||
|
||||
function M.OnEnter(self)
|
||||
--print(vardump(self,"loddy controller enter"))
|
||||
---- print(vardump(self,"loddy controller enter"))
|
||||
end
|
||||
|
||||
function M.OnExit(self)
|
||||
--print(vardump(self,"loddy controller exit"))
|
||||
---- print(vardump(self,"loddy controller exit"))
|
||||
end
|
||||
|
||||
local function __FillRoomData(s2croom)
|
||||
|
|
@ -27,7 +26,7 @@ local function __FillRoomData(s2croom)
|
|||
extend:FillRoomData(s2croom)
|
||||
end
|
||||
|
||||
local function __ConntectGameServer(cmd,room, host, _data,callback)
|
||||
local function __ConntectGameServer(cmd, room, host, _data, callback)
|
||||
-- local _data = {}
|
||||
_data["session"] = room.session
|
||||
local _game_client = NetClient.new(host, "game")
|
||||
|
|
@ -35,7 +34,7 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
|||
ControllerManager.SetGameNetClient(_game_client)
|
||||
_game_client.onconnect:Add(function(code)
|
||||
if (code == SocketCode.Connect) then
|
||||
_game_client:send(cmd, _data, function (response)
|
||||
_game_client:send(cmd, _data, function(response)
|
||||
if (response.ReturnCode == 0) then
|
||||
_game_client.onconnect:Clear()
|
||||
_game_client.onconnect:Add(ControllerManager.OnConnect)
|
||||
|
|
@ -44,17 +43,16 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
|||
end
|
||||
_game_client:destroy()
|
||||
if ControllerManager.GameNetClinet == _game_client then
|
||||
ControllerManager.GameNetClinet =nil
|
||||
ControllerManager.GameNetClinet = nil
|
||||
end
|
||||
callback(response)
|
||||
end)
|
||||
|
||||
else
|
||||
if ControllerManager.GameNetClinet == _game_client then
|
||||
ControllerManager.GameNetClinet =nil
|
||||
ControllerManager.GameNetClinet = nil
|
||||
end
|
||||
_game_client:destroy()
|
||||
callback({ReturnCode = 101})
|
||||
callback({ ReturnCode = 101 })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -68,15 +66,15 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
data.config_data = _data
|
||||
-- local runtime = os.clock()
|
||||
_client:send(Protocol.WEB_CREATE_ROOM, data, function(res)
|
||||
if ( res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
|
||||
self:JoinRoom("000000",callback)
|
||||
if (res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
|
||||
self:JoinRoom("000000", callback)
|
||||
return
|
||||
end
|
||||
if (res.ReturnCode == 0) then
|
||||
local json = res.Data
|
||||
local game_info = json["game_info"]
|
||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
res.ReturnCode = -2
|
||||
callback(res)
|
||||
end)
|
||||
|
|
@ -104,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||
|
||||
-- game_net =
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data, function (response)
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(response)
|
||||
if (response.ReturnCode == 0) then
|
||||
-- game_net:clearEvent()
|
||||
local _s2croom = response.Data
|
||||
|
|
@ -118,7 +116,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
ControllerManager.ChangeController(GameController)
|
||||
-- print("create room:"..(os.clock()-runtime))
|
||||
-- -- print("create room:"..(os.clock()-runtime))
|
||||
callback(response)
|
||||
return
|
||||
end
|
||||
|
|
@ -132,7 +130,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
end
|
||||
|
||||
local join_room_frame = 0
|
||||
function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
||||
function M:PublicJoinRoom(cmd, room_id, callback, group_id, group_layer)
|
||||
-- 同一帧不重复调用
|
||||
local last_frame = join_room_frame
|
||||
join_room_frame = Time.frameCount
|
||||
|
|
@ -147,12 +145,12 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
_data["floor"] = group_layer
|
||||
_data["platform"] = GetPlatform()
|
||||
local _client = ControllerManager.WebClient;
|
||||
_client:send(cmd, _data, function( res)
|
||||
_client:send(cmd, _data, function(res)
|
||||
if (res.ReturnCode == 0) then
|
||||
local json = res.Data
|
||||
local game_info = json["game_info"]
|
||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
res.ReturnCode = -2
|
||||
callback(res)
|
||||
end)
|
||||
|
|
@ -182,10 +180,10 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
end
|
||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||
-- local game_net = nil
|
||||
--print(vardump(room))
|
||||
---- print(vardump(room))
|
||||
-- game_net =
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1)
|
||||
if (res1.ReturnCode ~= 0 ) then
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
|
||||
if (res1.ReturnCode ~= 0) then
|
||||
if (callback) then callback(res1) end
|
||||
else
|
||||
local _s2croom = res1.Data
|
||||
|
|
@ -211,11 +209,10 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:JoinRoom(room_id,callback,group_id,group_layer)
|
||||
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM,room_id,callback,group_id,group_layer)
|
||||
function M:JoinRoom(room_id, callback, group_id, group_layer)
|
||||
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM, room_id, callback, group_id, group_layer)
|
||||
end
|
||||
|
||||
|
||||
function M:ResetJionRoom(callback)
|
||||
local _game = ControllerManager.GetController(GameController)
|
||||
local o_room = DataManager.CurrenRoom
|
||||
|
|
@ -241,14 +238,14 @@ function M:ResetJionRoom(callback)
|
|||
room.create_time = o_room.create_time
|
||||
room:SetReloadStatus(true)
|
||||
DataManager.CurrenRoom = room
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1)
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
|
||||
room:SetReloadStatus(false)
|
||||
if (res1.ReturnCode ~= 0 ) then
|
||||
if (res1.ReturnCode ~= 0) then
|
||||
if (callback) then callback(res1) end
|
||||
else
|
||||
printlog("ResetJionRoom==>>>")
|
||||
pt(res1)
|
||||
ControllerManager.enterPlayerData=res1.Data.tableInfo.playerData
|
||||
ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
|
||||
local _s2croom = res1.Data
|
||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
|
|
@ -260,7 +257,7 @@ end
|
|||
|
||||
function M:UpdatePlayerInfo(callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_UPDATE_INFO, nil, function (res)
|
||||
_client:send(Protocol.WEB_UPDATE_INFO, nil, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
DataManager.SelfUser.diamo = res.Data.diamo
|
||||
DataManager.SelfUser.invited = res.Data.invitation
|
||||
|
|
@ -272,12 +269,12 @@ function M:UpdatePlayerInfo(callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:UpdateNotice(id,callback)
|
||||
function M:UpdateNotice(id, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local _data = {}
|
||||
_data.id = id
|
||||
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function (res)
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
||||
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function(res)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 and #res.Data.notice_list > 0 then
|
||||
callback(true, res.Data)
|
||||
|
|
@ -298,10 +295,10 @@ function M:RequestRecordList(callback, roomid)
|
|||
proto = Protocol.WEB_GET_MILITARY_BY_ROOMID
|
||||
_data.roomId = roomid
|
||||
end
|
||||
_client:send(proto, _data, function (res)
|
||||
_client:send(proto, _data, function(res)
|
||||
self.recordList = nil
|
||||
-- print(vardump(res))
|
||||
if (res.ReturnCode == 0 or res.ReturnCode == 19 ) then
|
||||
-- -- print(vardump(res))
|
||||
if (res.ReturnCode == 0 or res.ReturnCode == 19) then
|
||||
--self:RequestRankList(callback)
|
||||
self.recordList = {}
|
||||
if res.ReturnCode == 19 then return end
|
||||
|
|
@ -335,8 +332,8 @@ function M:RequestRecordList(callback, roomid)
|
|||
end
|
||||
local round_count = record_list_item["round"]
|
||||
|
||||
for j = 1,round_count do
|
||||
local round_score_str = record_list_item["round_"..j]
|
||||
for j = 1, round_count do
|
||||
local round_score_str = record_list_item["round_" .. j]
|
||||
local m_round_game = MGameTimes.new()
|
||||
if round_score_str then
|
||||
local round_score_item = json.decode(round_score_str)
|
||||
|
|
@ -359,16 +356,15 @@ function M:RequestRecordList(callback, roomid)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:RequestPlayBack(_data,callback,game_info)
|
||||
function M:RequestPlayBack(_data, callback, game_info)
|
||||
if game_info and ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
self:RequestPlayBack(_data,callback)
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
self:RequestPlayBack(_data, callback)
|
||||
end)
|
||||
return
|
||||
else
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_GET_PLAY_BACK , _data , function (res)
|
||||
_client:send(Protocol.WEB_GET_PLAY_BACK, _data, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local data = json.decode(res.Data.playback)
|
||||
local cmdList = data.cmdList
|
||||
|
|
@ -381,28 +377,24 @@ function M:RequestPlayBack(_data,callback,game_info)
|
|||
if not room.self_player then
|
||||
room.self_player = room:GetPlayerBySeat(1)
|
||||
end
|
||||
callback(res.ReturnCode,data)
|
||||
callback(res.ReturnCode, data)
|
||||
else
|
||||
callback(res.ReturnCode,nil)
|
||||
callback(res.ReturnCode, nil)
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--获取手机验证码
|
||||
function M:GetPhoneCode(phone,callback)
|
||||
function M:GetPhoneCode(phone, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local _data = {}
|
||||
_data["phone"]=phone
|
||||
_data["phone"] = phone
|
||||
_client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res)
|
||||
callback(res)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:GetUserInfo(callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_GET_USER_INFO, nil, function(res)
|
||||
|
|
@ -419,7 +411,7 @@ function M:GetUserInfo(callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:UpdateUserInfo(_data,callback)
|
||||
function M:UpdateUserInfo(_data, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res)
|
||||
callback(res)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ local function __Login(cmd, _data, callBack)
|
|||
end
|
||||
|
||||
_client:setSession(data["session_id"] .. "," .. data["token"])
|
||||
print("11111111111111111111111111111111")
|
||||
-- print("11111111111111111111111111111111")
|
||||
pt(data)
|
||||
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web)
|
||||
ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"]))
|
||||
|
|
@ -129,11 +129,11 @@ function M:QuickLogin(session_id, callback)
|
|||
end
|
||||
|
||||
function M.OnEnter(self)
|
||||
--print("login controller enter")
|
||||
---- print("login controller enter")
|
||||
end
|
||||
|
||||
function M.OnExit(self)
|
||||
--print("login controller exit")
|
||||
---- print("login controller exit")
|
||||
end
|
||||
|
||||
--字符串类json格式转化为表
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
NewGroupController = {}
|
||||
|
||||
local M = {}
|
||||
|
|
@ -7,14 +6,13 @@ local GroupMgrController = import(".GroupMgrController")
|
|||
|
||||
--- Create a new NewGroupController
|
||||
function NewGroupController.new()
|
||||
setmetatable(M, {__index = IController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.baseType = NewGroupController
|
||||
self.class = "NewGroup"
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--获取圈列表
|
||||
function M:FG_GroupList(callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -27,7 +25,7 @@ function M:FG_GroupList(callback)
|
|||
local r_groups = res.Data.groups
|
||||
local l_groups = DataManager.groups
|
||||
l_groups:clear()
|
||||
for i=1,#r_groups do
|
||||
for i = 1, #r_groups do
|
||||
local tem = r_groups[i]
|
||||
local group = GroupData.new()
|
||||
group.id = tem.id
|
||||
|
|
@ -54,7 +52,7 @@ end
|
|||
function M:FG_CreateGroup(name, pay_type, type, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.name= name
|
||||
data.name = name
|
||||
data.pay_type = pay_type
|
||||
data.type = type
|
||||
_client:send(Protocol.WEB_FG_CREATE_GROUP, data, function(res)
|
||||
|
|
@ -78,7 +76,7 @@ function M:FG_CreateGroup(name, pay_type, type, callback)
|
|||
end
|
||||
|
||||
--删除圈
|
||||
function M:FG_RemoveGroup(id,callback)
|
||||
function M:FG_RemoveGroup(id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -106,7 +104,7 @@ function M:FG_ExitGroup(group_id, callback)
|
|||
end
|
||||
|
||||
--加入圈
|
||||
function M:FG_JoinGroup(id,callback)
|
||||
function M:FG_JoinGroup(id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -116,7 +114,7 @@ function M:FG_JoinGroup(id,callback)
|
|||
end
|
||||
|
||||
--置顶圈
|
||||
function M:FG_TopGroup(group_id,top,callback)
|
||||
function M:FG_TopGroup(group_id, top, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -131,7 +129,8 @@ function M:FG_TopGroup(group_id,top,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_UpdateGroupInfo(id, name, notice, ban, dissolve_opt, kick_opt, apply, ban_chat1, ban_chat2, option, showNum, callback)
|
||||
function M:FG_UpdateGroupInfo(id, name, notice, ban, dissolve_opt, kick_opt, apply, ban_chat1, ban_chat2, option, showNum,
|
||||
callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -151,7 +150,7 @@ function M:FG_UpdateGroupInfo(id, name, notice, ban, dissolve_opt, kick_opt, app
|
|||
end
|
||||
|
||||
--圈邀请列表
|
||||
function M:FG_GroupJoins(id,callback)
|
||||
function M:FG_GroupJoins(id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -161,7 +160,7 @@ function M:FG_GroupJoins(id,callback)
|
|||
end
|
||||
|
||||
--圈审核玩家加入
|
||||
function M:FG_GroupVerifyJoin(id,tagId,allow,callback)
|
||||
function M:FG_GroupVerifyJoin(id, tagId, allow, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -181,24 +180,22 @@ function M:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, callback
|
|||
data.num = num
|
||||
data.minus_only = minus_only
|
||||
data.type = sort_type
|
||||
--print(debug.traceback())
|
||||
---- print(debug.traceback())
|
||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
||||
--print("查询圈子玩家列表============")
|
||||
---- print("查询圈子玩家列表============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local group = DataManager.groups:get(group_id)
|
||||
local members = res.Data.members
|
||||
for i=1,#members do
|
||||
for i = 1, #members do
|
||||
local m = members[i]
|
||||
group:addMember(m)
|
||||
end
|
||||
end
|
||||
callback(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:FG_GroupMembers11(group_id, limit, num, minus_only, sort_type, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
|
|
@ -207,26 +204,25 @@ function M:FG_GroupMembers11(group_id, limit, num, minus_only, sort_type, callba
|
|||
data.num = num
|
||||
data.minus_only = minus_only
|
||||
data.type = sort_type
|
||||
self.currentGroupMembersData=data
|
||||
self.currentGroupMembersCallBack=callback
|
||||
--print(debug.traceback())
|
||||
self.currentGroupMembersData = data
|
||||
self.currentGroupMembersCallBack = callback
|
||||
---- print(debug.traceback())
|
||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
||||
--print("查询圈子玩家列表============")
|
||||
---- print("查询圈子玩家列表============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local group = DataManager.groups:get(group_id)
|
||||
local members = res.Data.members
|
||||
for i=1,#members do
|
||||
for i = 1, #members do
|
||||
local m = members[i]
|
||||
group:addMember(m)
|
||||
end
|
||||
end
|
||||
callback(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
function M:FG_GroupMembers12(group_id, limit, num,type,online, callback)
|
||||
function M:FG_GroupMembers12(group_id, limit, num, type, online, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -236,26 +232,25 @@ function M:FG_GroupMembers12(group_id, limit, num,type,online, callback)
|
|||
data.type = type
|
||||
--data.minus_only = minus_only
|
||||
--data.type = sort_type
|
||||
self.currentGroupMembersData=data
|
||||
self.currentGroupMembersCallBack=callback
|
||||
--print(debug.traceback())
|
||||
self.currentGroupMembersData = data
|
||||
self.currentGroupMembersCallBack = callback
|
||||
---- print(debug.traceback())
|
||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, data, function(res)
|
||||
--print("查询圈子玩家列表============")
|
||||
---- print("查询圈子玩家列表============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local group = DataManager.groups:get(group_id)
|
||||
local members = res.Data.members
|
||||
for i=1,#members do
|
||||
for i = 1, #members do
|
||||
local m = members[i]
|
||||
group:addMember(m)
|
||||
end
|
||||
end
|
||||
callback(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
function M:FG_GroupTiChu(group_id,limit, num,callback)
|
||||
function M:FG_GroupTiChu(group_id, limit, num, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -269,30 +264,27 @@ function M:FG_GroupTiChu(group_id,limit, num,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:SendGetGroupMembersInfo()
|
||||
local _client = ControllerManager.GroupClient
|
||||
if self.currentGroupMembersData and self.currentGroupMembersCallBack then
|
||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, self.currentGroupMembersData, function(res)
|
||||
--print("查询圈子玩家列表============")
|
||||
---- print("查询圈子玩家列表============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local group = DataManager.groups:get(self.currentGroupMembersData.id)
|
||||
local members = res.Data.members
|
||||
for i=1,#members do
|
||||
for i = 1, #members do
|
||||
local m = members[i]
|
||||
group:addMember(m)
|
||||
end
|
||||
end
|
||||
self.currentGroupMembersCallBack(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- 查询成员
|
||||
function M:FG_FindMember(group_id, member_id, callback, tag_name,tag_type)
|
||||
function M:FG_FindMember(group_id, member_id, callback, tag_name, tag_type)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -300,7 +292,7 @@ function M:FG_FindMember(group_id, member_id, callback, tag_name,tag_type)
|
|||
data.tagName = tag_name
|
||||
data.tagType = tag_type
|
||||
_client:send(Protocol.WEB_FG_FIND_MEMBER, data, function(res)
|
||||
--print("查询圈子单个玩家列表============")
|
||||
---- print("查询圈子单个玩家列表============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local group = DataManager.groups:get(group_id)
|
||||
|
|
@ -315,8 +307,6 @@ function M:FG_FindMember(group_id, member_id, callback, tag_name,tag_type)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 强制提取
|
||||
function M:FG_TakeHp1(group_id, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -325,7 +315,7 @@ function M:FG_TakeHp1(group_id, tagId, callback)
|
|||
data.tagId = tagId
|
||||
|
||||
_client:send(Protocol.WEB_FG_TAKE_HP, data, function(res)
|
||||
--print("查询圈子单个玩家列表============")
|
||||
---- print("查询圈子单个玩家列表============")
|
||||
--pt(res)
|
||||
callback(res)
|
||||
end)
|
||||
|
|
@ -356,7 +346,7 @@ function M:FG_MovePartner(group_id, member_id, partner_id, callback)
|
|||
end
|
||||
|
||||
-- 获取合伙人列表(合伙人管理)
|
||||
function M:FG_GetPartnerList(group_id, simple_all, limit, num ,callback,tagId)
|
||||
function M:FG_GetPartnerList(group_id, simple_all, limit, num, callback, tagId)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -387,8 +377,7 @@ function M:FG_QueryPartnerList(group_id, query_id, query_nick, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetMemberStat(group_id,query_id,partner_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetMemberStat(group_id, query_id, partner_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -406,9 +395,7 @@ function M:FG_GetMemberStat(group_id,query_id,partner_id,limit,num,time_type,beg
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:FG_GetPartnerStat(group_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetPartnerStat(group_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -424,8 +411,7 @@ function M:FG_GetPartnerStat(group_id,limit,num,time_type,begin_time,end_time,ca
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetZuanShiStat(group_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetZuanShiStat(group_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -442,7 +428,7 @@ function M:FG_GetZuanShiStat(group_id,limit,num,time_type,begin_time,end_time,ca
|
|||
end
|
||||
|
||||
-- WEB_FG_FIND_PARTNER_STAT
|
||||
function M:FG_FindPartnerStat(group_id,member_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_FindPartnerStat(group_id, member_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -460,7 +446,7 @@ function M:FG_FindPartnerStat(group_id,member_id,limit,num,time_type,begin_time,
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_FindZuanShiStat(group_id,member_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_FindZuanShiStat(group_id, member_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -481,7 +467,8 @@ end
|
|||
--find_partner_stat_member
|
||||
|
||||
-- WEB_FG_FIND_PARTNER_STAT
|
||||
function M:FG_FindPartnerStatMember(group_id,uid,root_uid,member_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_FindPartnerStatMember(group_id, uid, root_uid, member_id, limit, num, time_type, begin_time, end_time,
|
||||
callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -501,7 +488,8 @@ function M:FG_FindPartnerStatMember(group_id,uid,root_uid,member_id,limit,num,ti
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_FindPartnerZuanShiMember(group_id,uid,root_uid,member_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_FindPartnerZuanShiMember(group_id, uid, root_uid, member_id, limit, num, time_type, begin_time, end_time,
|
||||
callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -521,8 +509,7 @@ function M:FG_FindPartnerZuanShiMember(group_id,uid,root_uid,member_id,limit,num
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetXingYunStat(group_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetXingYunStat(group_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -538,7 +525,7 @@ function M:FG_GetXingYunStat(group_id,limit,num,time_type,begin_time,end_time,ca
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetMembersCount(group_id,callback)
|
||||
function M:FG_GetMembersCount(group_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -548,8 +535,7 @@ function M:FG_GetMembersCount(group_id,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetPartnerStatMember(group_id,uid,root_uid,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetPartnerStatMember(group_id, uid, root_uid, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
|
||||
|
|
@ -569,7 +555,7 @@ function M:FG_GetPartnerStatMember(group_id,uid,root_uid,limit,num,time_type,beg
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetDirectMemberStat(group_id,uid,root_uid,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_GetDirectMemberStat(group_id, uid, root_uid, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -587,8 +573,7 @@ function M:FG_GetDirectMemberStat(group_id,uid,root_uid,limit,num,time_type,begi
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetPartnerZuanShiMember(group_id,uid,root_uid,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetPartnerZuanShiMember(group_id, uid, root_uid, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
|
||||
|
|
@ -608,7 +593,7 @@ function M:FG_GetPartnerZuanShiMember(group_id,uid,root_uid,limit,num,time_type,
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetDirectZuanShiStat(group_id,uid,root_uid,limit,num,time_type,begin_time,end_time,callback)
|
||||
function M:FG_GetDirectZuanShiStat(group_id, uid, root_uid, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -626,8 +611,7 @@ function M:FG_GetDirectZuanShiStat(group_id,uid,root_uid,limit,num,time_type,beg
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_GetPartnerStatPlay(group_id,uid,parent_id,limit,num,time_type,begin_time,end_time,callback)
|
||||
|
||||
function M:FG_GetPartnerStatPlay(group_id, uid, parent_id, limit, num, time_type, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
|
||||
|
|
@ -648,7 +632,6 @@ function M:FG_GetPartnerStatPlay(group_id,uid,parent_id,limit,num,time_type,begi
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取合伙人成员列表
|
||||
function M:FG_GetPartnerMembers(group_id, partner_id, limit, num, quary_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -737,7 +720,7 @@ function M:FG_GetHpLogDetail(group_id, id, roomid, time, callback)
|
|||
end
|
||||
|
||||
--获取所有玩法
|
||||
function M:FG_GetAllplays(groupid,uid,callback)
|
||||
function M:FG_GetAllplays(groupid, uid, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = groupid
|
||||
|
|
@ -748,7 +731,7 @@ function M:FG_GetAllplays(groupid,uid,callback)
|
|||
end
|
||||
|
||||
--设置屏蔽玩法
|
||||
function M:FG_SetBanPlayid(groupId,pid,ban,uid,callback)
|
||||
function M:FG_SetBanPlayid(groupId, pid, ban, uid, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.groupid = groupId
|
||||
|
|
@ -772,10 +755,8 @@ function M:FG_GetRewards(group_id, pid, lev, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 设置推广奖励值
|
||||
function M:FG_SetRewards(group_id, tag, lev, partner_id, all, val, single,callback)
|
||||
function M:FG_SetRewards(group_id, tag, lev, partner_id, all, val, single, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -790,7 +771,7 @@ function M:FG_SetRewards(group_id, tag, lev, partner_id, all, val, single,callb
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_SetXIPAI(group_id, tag, lev, partner_id, all, val, single,callback)
|
||||
function M:FG_SetXIPAI(group_id, tag, lev, partner_id, all, val, single, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -805,7 +786,7 @@ function M:FG_SetXIPAI(group_id, tag, lev, partner_id, all, val, single,callbac
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_SetANCHOU(group_id, tag, lev, partner_id, all, val, single,callback)
|
||||
function M:FG_SetANCHOU(group_id, tag, lev, partner_id, all, val, single, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -820,7 +801,6 @@ function M:FG_SetANCHOU(group_id, tag, lev, partner_id, all, val, single,callba
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取奖励日志
|
||||
function M:FG_GetRewardsLog(group_id, limit, num, begin_time, end_time, tag, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -850,7 +830,7 @@ function M:FG_GetRewardStatistic(group_id, pid, begin_time, end_time, callback)
|
|||
end
|
||||
|
||||
-- 排行
|
||||
function M:FG_GetMemberRank(group_id, pid, limit, num, begin_time, end_time, type,callback)
|
||||
function M:FG_GetMemberRank(group_id, pid, limit, num, begin_time, end_time, type, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -903,7 +883,7 @@ function M:FG_GetGameStat(group_id, callback)
|
|||
end
|
||||
|
||||
-- 获取消费统计
|
||||
function M:FG_GetConsumeStat(group_id,begin_time, end_time, callback)
|
||||
function M:FG_GetConsumeStat(group_id, begin_time, end_time, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -943,7 +923,8 @@ function M:FG_GetGroupRecord(group_id, platform, qid, limit, num, callback)
|
|||
end
|
||||
|
||||
-- 获取战绩
|
||||
function M:FG_GetGroupRecordSpe(group_id, platform, qid, includeMembers, limit, num, begin_time, end_time, time_type, callback)
|
||||
function M:FG_GetGroupRecordSpe(group_id, platform, qid, includeMembers, limit, num, begin_time, end_time, time_type,
|
||||
callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -979,7 +960,6 @@ function M:FG_GetGroupPersonRecord(group_id, platform, qid, time_type, begin_tim
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 根据房间号查询战绩
|
||||
function M:FG_GetRecordByRoomid(group_id, roomid, platform, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -993,7 +973,7 @@ function M:FG_GetRecordByRoomid(group_id, roomid, platform, callback)
|
|||
end
|
||||
|
||||
-- 获取能量包数据
|
||||
function M:FG_GetTakeInfo(group_id, tagId,callback)
|
||||
function M:FG_GetTakeInfo(group_id, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -1003,9 +983,8 @@ function M:FG_GetTakeInfo(group_id, tagId,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取银行信息
|
||||
function M:FG_GetBankInfo(group_id, tagId,callback)
|
||||
function M:FG_GetBankInfo(group_id, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -1015,37 +994,30 @@ function M:FG_GetBankInfo(group_id, tagId,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:FG_TakeBankInfo(group_id, gethp,tagId,callback)
|
||||
function M:FG_TakeBankInfo(group_id, gethp, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
data.hp=gethp
|
||||
data.hp = gethp
|
||||
data.tagId = tagId
|
||||
_client:send(Protocol.TAKE_BANK_HP, data, function(res)
|
||||
callback(res)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:FG_SAVEBankInfo(group_id, gethp,tagId,callback)
|
||||
function M:FG_SAVEBankInfo(group_id, gethp, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
data.hp=gethp
|
||||
data.hp = gethp
|
||||
data.tagId = tagId
|
||||
_client:send(Protocol.SAVE_BANK_HP, data, function(res)
|
||||
callback(res)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- 提取体力值
|
||||
function M:FG_TakeHp(group_id, num, tagId,callback)
|
||||
function M:FG_TakeHp(group_id, num, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -1057,7 +1029,7 @@ function M:FG_TakeHp(group_id, num, tagId,callback)
|
|||
end
|
||||
|
||||
-- 获取提取记录
|
||||
function M:FG_GetTakeLog(group_id, limit, num, begin_time, end_time, tagId,callback)
|
||||
function M:FG_GetTakeLog(group_id, limit, num, begin_time, end_time, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -1071,9 +1043,8 @@ function M:FG_GetTakeLog(group_id, limit, num, begin_time, end_time, tagId,callb
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取提取记录
|
||||
function M:FG_GetBankLog(group_id, limit, num, begin_time, end_time, tagId,callback)
|
||||
function M:FG_GetBankLog(group_id, limit, num, begin_time, end_time, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = group_id
|
||||
|
|
@ -1087,7 +1058,6 @@ function M:FG_GetBankLog(group_id, limit, num, begin_time, end_time, tagId,callb
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取能量包统计
|
||||
function M:FG_GetFagPackInfo(group_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
|
|
@ -1099,7 +1069,7 @@ function M:FG_GetFagPackInfo(group_id, callback)
|
|||
end
|
||||
|
||||
--圈删除玩家
|
||||
function M:FG_GroupRemoveMember(id,tagId,callback)
|
||||
function M:FG_GroupRemoveMember(id, tagId, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local data = {}
|
||||
data.id = id
|
||||
|
|
@ -1112,6 +1082,7 @@ function M:FG_GroupRemoveMember(id,tagId,callback)
|
|||
callback(res)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:FG_GroupSetVip(group_id, member_id, isvip, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
|
|
@ -1129,11 +1100,12 @@ function M:FG_GroupSetVip(group_id, member_id, isvip, callback)
|
|||
callback(res)
|
||||
end)
|
||||
end
|
||||
function M:FG_EnterGroup(group_id,callback)
|
||||
|
||||
function M:FG_EnterGroup(group_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
printlog("FG_EnterGroup===>>>",_data.id)
|
||||
printlog("FG_EnterGroup===>>>", _data.id)
|
||||
_client:send(Protocol.WEB_ENTER_GROUP, _data, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
-- 获取玩法列表
|
||||
|
|
@ -1143,7 +1115,7 @@ function M:FG_EnterGroup(group_id,callback)
|
|||
group.hide_action = res.Data.hide_action
|
||||
|
||||
self.mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
||||
self.mgr_ctr:connect(res.Data.host,group_id,function(res1)
|
||||
self.mgr_ctr:connect(res.Data.host, group_id, function(res1)
|
||||
if res1.ReturnCode == 0 then
|
||||
callback(res)
|
||||
else
|
||||
|
|
@ -1153,7 +1125,6 @@ function M:FG_EnterGroup(group_id,callback)
|
|||
else
|
||||
callback(res)
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -1164,7 +1135,7 @@ function M:FG_ExitGroupMgr()
|
|||
end
|
||||
|
||||
--指定圈删除房间
|
||||
function M:FG_RemoveRoom(group_id,roomid,callback)
|
||||
function M:FG_RemoveRoom(group_id, roomid, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
@ -1221,27 +1192,24 @@ function M:FG_BanMember(group_id, member_id, ban, opType, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 获取成员调度
|
||||
function M:FG_GetBanMemberHB(group_id, member_id,callback)
|
||||
function M:FG_GetBanMemberHB(group_id, member_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
_data.tagId = member_id
|
||||
_client:send(Protocol.GROUP_GET_BLACK_MEMBER, _data, function(res)
|
||||
callback(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 设置成员调度
|
||||
function M:FG_BanMemberHB(group_id, member_id,opt,ban_rate,black_max_value,callback)
|
||||
function M:FG_BanMemberHB(group_id, member_id, opt, ban_rate, black_max_value, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
_data.tagId = member_id
|
||||
_data.ban =opt
|
||||
_data.ban = opt
|
||||
_data.opType = 2
|
||||
_data.ban_rate = ban_rate
|
||||
_data.ban_max_value = black_max_value
|
||||
|
|
@ -1251,15 +1219,13 @@ function M:FG_BanMemberHB(group_id, member_id,opt,ban_rate,black_max_value,callb
|
|||
local group = DataManager.groups:get(group_id)
|
||||
local member = group:getMember(member_id)
|
||||
if member then
|
||||
member.group_black=opt
|
||||
member.group_black = opt
|
||||
end
|
||||
end
|
||||
callback(res)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 设置禁止同桌
|
||||
function M:FG_SetBanTable(group_id, member_id, list, del_list, callback)
|
||||
if #list == 0 then table.insert(list, 0) end
|
||||
|
|
@ -1285,8 +1251,7 @@ function M:FG_GetBanTable(group_id, member_id, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:GetAddMember(group_id,member_id,callback)
|
||||
function M:GetAddMember(group_id, member_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
@ -1296,9 +1261,8 @@ function M:GetAddMember(group_id,member_id,callback)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
--添加成员
|
||||
function M:FG_AddMember(group_id,member_id,callback)
|
||||
function M:FG_AddMember(group_id, member_id, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
@ -1309,7 +1273,7 @@ function M:FG_AddMember(group_id,member_id,callback)
|
|||
end
|
||||
|
||||
-- 改变体力值
|
||||
function M:FG_ChangeFag(group_id,member_id,fag,callback )
|
||||
function M:FG_ChangeFag(group_id, member_id, fag, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
@ -1421,7 +1385,7 @@ function M:FG_SetPartnerThreshold(group_id, uid, score, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_StopService(group_id,ban,callback)
|
||||
function M:FG_StopService(group_id, ban, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
@ -1447,7 +1411,7 @@ function M:FG_AddPlay(group_id, game_id, config_data, name, hpData, hpOnOff, gty
|
|||
end)
|
||||
end
|
||||
|
||||
function M:FG_DelPlay(group_id,pid,callback)
|
||||
function M:FG_DelPlay(group_id, pid, callback)
|
||||
local _client = ControllerManager.GroupClient
|
||||
local _data = {}
|
||||
_data.id = group_id
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
ControllerManager.ChangeController(GameController)
|
||||
-- print("create room:"..(os.clock()-runtime))
|
||||
-- -- print("create room:"..(os.clock()-runtime))
|
||||
callback(response)
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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,7 @@ function ControllerManager.SetGameNetClient(client)
|
|||
end
|
||||
|
||||
function ControllerManager.OnConnect(code)
|
||||
print("=======================================ControllerManager", code)
|
||||
-- print("=======================================ControllerManager", code)
|
||||
if (code ~= SocketCode.Connect) then
|
||||
ControllerManager.SetGameNetClient(nil)
|
||||
if code ~= SocketCode.DisconnectByServer then
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ local TableBG = {}
|
|||
|
||||
local M = TableBG
|
||||
local bg_config = {
|
||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
||||
{id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01"},
|
||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
||||
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||
{ id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
|
||||
{ id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01" },
|
||||
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||
}
|
||||
|
||||
function TableBG.GetBGConfig(config)
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ local function __ShowTip(_version_view, text, callback)
|
|||
end
|
||||
|
||||
local function __update_check(data, onback, _version_view)
|
||||
print("===================updateCheck")
|
||||
-- print("===================updateCheck")
|
||||
local tex_tip = _version_view:GetChild("tex_info")
|
||||
for k, game_data in ipairs(data) do
|
||||
local asset_path = game_data["bundle"]:gsub("\r\n", "")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ local _isInit = false
|
|||
|
||||
local function __new_config(data)
|
||||
local ec = reimport(data.bundle .. ".ExtendConfig")
|
||||
print("初始化ExtendManager===>>>" .. data.bundle)
|
||||
-- print("初始化ExtendManager===>>>" .. data.bundle)
|
||||
--pt(data)
|
||||
local config = ec.new()
|
||||
ec.game_data = data
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ local WindowMap = {
|
|||
|
||||
}
|
||||
|
||||
local WindowQueue= {
|
||||
local WindowQueue = {
|
||||
|
||||
}
|
||||
|
||||
local M = BaseWindow
|
||||
|
||||
function BaseWindow.new(url,blur_view)
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function BaseWindow.new(url, blur_view)
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "BaseWindow"
|
||||
-- self._blur_view = blur_view
|
||||
self:init(url)
|
||||
|
|
@ -68,7 +68,7 @@ function M:init(url)
|
|||
printlog(self._view)
|
||||
-- self._view.fairyBatching = true
|
||||
local btn_close = self._view:GetChild("btn_close")
|
||||
if(btn_close) then
|
||||
if (btn_close) then
|
||||
btn_close.onClick:Set(function()
|
||||
self:CloseEvent()
|
||||
end)
|
||||
|
|
@ -83,7 +83,7 @@ function M:init(url)
|
|||
win_mode.touchable = false
|
||||
self:CloseEvent()
|
||||
end)
|
||||
printlog("======================================",self._full)
|
||||
printlog("======================================", self._full)
|
||||
if self._full then
|
||||
local offset = get_offset(self._full_offset)
|
||||
if self._anim_pop == 0 then
|
||||
|
|
@ -120,7 +120,7 @@ end
|
|||
|
||||
-- 显示窗口
|
||||
function M:Show()
|
||||
print("===========================================entershow",M.class)
|
||||
-- print("===========================================entershow",M.class)
|
||||
local contentPane = self._root_view:GetChild("contentPane")
|
||||
if self._anim_pop == 1 then
|
||||
contentPane:GetTransition("left_pop"):Play()
|
||||
|
|
@ -140,7 +140,7 @@ function M:Show()
|
|||
local _inQueue = false
|
||||
|
||||
if self._new_hide then
|
||||
for i=1,#WindowQueue do
|
||||
for i = 1, #WindowQueue do
|
||||
local win = WindowQueue[i]
|
||||
if win == self then
|
||||
_inQueue = true
|
||||
|
|
@ -168,9 +168,9 @@ function M:Close()
|
|||
-- BlurView(self._blur_view,false)
|
||||
-- end
|
||||
if self._queue then
|
||||
for i,v in ipairs(WindowQueue) do
|
||||
for i, v in ipairs(WindowQueue) do
|
||||
if v == self then
|
||||
table.remove(WindowQueue,i)
|
||||
table.remove(WindowQueue, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -194,9 +194,9 @@ function M:Destroy()
|
|||
if not _destroy_all then
|
||||
self:Close()
|
||||
if self._put_map then
|
||||
for i,v in ipairs(WindowMap) do
|
||||
for i, v in ipairs(WindowMap) do
|
||||
if v == self then
|
||||
table.remove(WindowMap,i)
|
||||
table.remove(WindowMap, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -245,7 +245,7 @@ end
|
|||
function BaseWindow.DestroyAll()
|
||||
_destroy_all = true
|
||||
local list = WindowMap
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local win = list[i]
|
||||
win:Destroy()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ function M:init(url)
|
|||
list_playName.onClickItem:Add(function()
|
||||
self.showView.visible = false
|
||||
local index = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
|
||||
local playDetail = view:GetChild(string.format("Label_Detail_%d",index))
|
||||
local playDetail = view:GetChild(string.format("Label_Detail_%d", index))
|
||||
local playView
|
||||
if not playDetail then
|
||||
playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d",index))
|
||||
playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d", index))
|
||||
if playDetail then
|
||||
playView = view:AddChild(playDetail)
|
||||
playView.name = string.format("Label_Detail_%d",index)
|
||||
playView.name = string.format("Label_Detail_%d", index)
|
||||
end
|
||||
end
|
||||
if not playDetail then
|
||||
|
|
@ -80,17 +80,17 @@ function M:init(url)
|
|||
end
|
||||
|
||||
function M:CreatePlay()
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在创建房间...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在创建房间...")
|
||||
local loddyCtr = ControllerManager.GetController(LoddyController)
|
||||
local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex+1].playeId
|
||||
local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
|
||||
local config = ExtendManager.GetExtendConfig(gameId)
|
||||
print("==============================config")
|
||||
-- print("==============================config")
|
||||
pt(config)
|
||||
local mode = config:GetGameInfo()
|
||||
print("==============================mode")
|
||||
-- print("==============================mode")
|
||||
pt(mode)
|
||||
local _data = mode:SelectedConfigData()
|
||||
print("==============================_data")
|
||||
-- print("==============================_data")
|
||||
pt(_data)
|
||||
-- loddyCtr:CreateRoom(gameId,_data, function (res)
|
||||
-- self:__OnCreateRoomAction(res)
|
||||
|
|
@ -111,7 +111,7 @@ function M:initePlayInfo()
|
|||
local games = DataManager.SelfUser.games
|
||||
for i = 1, #games do
|
||||
if PlayInfo[1].playListInfo[games[i].game_id] then
|
||||
table.insert(PlayInfo[1].playList,PlayInfo[1].playListInfo[games[i].game_id])
|
||||
table.insert(PlayInfo[1].playList, PlayInfo[1].playListInfo[games[i].game_id])
|
||||
end
|
||||
end
|
||||
pt(PlayInfo)
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
|||
list_familyNumber:SetVirtual()
|
||||
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
||||
local members = res.Data.members
|
||||
print("==========================res.Data.members")
|
||||
-- print("==========================res.Data.members")
|
||||
pt(res.Data.members)
|
||||
ViewUtil:CloseModalWait()
|
||||
if res.ReturnCode ~= 0 then
|
||||
|
|
@ -303,7 +303,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
}
|
||||
end
|
||||
local roomList = self._group.rooms
|
||||
print("=========================playList,rooms")
|
||||
-- print("=========================playList,rooms")
|
||||
pt(playList)
|
||||
pt(roomList)
|
||||
local roomCtr = ControllerManager.GetController(RoomController)
|
||||
|
|
@ -405,7 +405,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
end)
|
||||
end
|
||||
local all_num = #playList + #roomList
|
||||
print("=================================================list_room", list_room, list_room.numItems, all_num)
|
||||
-- print("=================================================list_room", list_room, list_room.numItems, all_num)
|
||||
pt(list_room)
|
||||
list_room.numItems = all_num
|
||||
list_gamePlay.numItems = #playList + 1
|
||||
|
|
@ -418,7 +418,7 @@ function M:ConnetFamily(index, groups, isCreate)
|
|||
local list_family = self._view:GetChild('list_family')
|
||||
list_family:SetVirtual()
|
||||
self._group = DataManager.groups:get(groups[index].id)
|
||||
print("===================================self._group")
|
||||
-- print("===================================self._group")
|
||||
pt(self._group)
|
||||
self._roomNum = self._group.room_num
|
||||
|
||||
|
|
@ -533,7 +533,7 @@ function M:OnUpdate()
|
|||
self._group.update_room = false
|
||||
self._fristRoom = true
|
||||
end
|
||||
print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||
-- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ function M:OnCreateRoom(mode_data)
|
|||
local mode = mode_data.data
|
||||
--点击建房按钮后保存当前游戏的config
|
||||
local _data = mode:SelectedConfigData()
|
||||
--print("OnCreateRoom================")
|
||||
---- print("OnCreateRoom================")
|
||||
--pt(_data)
|
||||
if not _data["stamina"] then _data["stamina"] = 0 end
|
||||
local user_id = DataManager.SelfUser.account_id
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
--进入房间View对象
|
||||
|
||||
|
||||
|
|
@ -9,8 +8,8 @@ local KEY_DEL = "del"
|
|||
local KEY_CLEAR = "reset"
|
||||
|
||||
function JoinRoomView.new()
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "JoinRoomView"
|
||||
self._currenIndex = 0
|
||||
self._close_destroy = true
|
||||
|
|
@ -19,35 +18,35 @@ function JoinRoomView.new()
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
self.tex_num = self._view:GetChild("show_text")
|
||||
self:ClearNumTex()
|
||||
|
||||
for i = 0 , 9 do
|
||||
local obj = self._view:GetChild("btn_num_"..i)
|
||||
obj.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
for i = 0, 9 do
|
||||
local obj = self._view:GetChild("btn_num_" .. i)
|
||||
obj.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
i = i + 1
|
||||
end
|
||||
local btn_reset = self._view:GetChild("btn_reset")
|
||||
btn_reset.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
btn_reset.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
local btn_del = self._view:GetChild("btn_del")
|
||||
btn_del.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
btn_del.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
end
|
||||
|
||||
function M:OnNumButtonAction(context)
|
||||
local typer = string.sub(context.sender.name ,5)
|
||||
local typer = string.sub(context.sender.name, 5)
|
||||
printlog("==========================OnNumButtonAction==============================")
|
||||
printlog(typer)
|
||||
if typer == KEY_DEL then
|
||||
if (self._currenIndex > 0) then
|
||||
self._currenIndex = self._currenIndex - 1
|
||||
printlog("==================test=================")
|
||||
print("ok")
|
||||
-- print("ok")
|
||||
printlog(#self._texnum_str)
|
||||
printlog(self._currenIndex)
|
||||
printlog("==================test=================")
|
||||
self._texnum_str = string.sub(self._texnum_str,0,self._currenIndex)
|
||||
self._texnum_str = string.sub(self._texnum_str, 0, self._currenIndex)
|
||||
self.tex_num.text = self._texnum_str
|
||||
end
|
||||
elseif typer == KEY_CLEAR then
|
||||
|
|
@ -55,9 +54,9 @@ function M:OnNumButtonAction(context)
|
|||
else
|
||||
if (self._currenIndex < 6) then
|
||||
self._currenIndex = self._currenIndex + 1
|
||||
self._texnum_str = self._texnum_str .. string.sub(typer,-1)
|
||||
self._texnum_str = self._texnum_str .. string.sub(typer, -1)
|
||||
self.tex_num.text = self._texnum_str
|
||||
if(self._currenIndex == 6) then
|
||||
if (self._currenIndex == 6) then
|
||||
self:JoinRoom(self._texnum_str)
|
||||
end
|
||||
end
|
||||
|
|
@ -65,19 +64,19 @@ function M:OnNumButtonAction(context)
|
|||
end
|
||||
|
||||
function M:JoinRoom(str)
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在加入房间...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在加入房间...")
|
||||
local boddyCtr = ControllerManager.GetController(LoddyController)
|
||||
boddyCtr:JoinRoom(str, function (response)
|
||||
boddyCtr:JoinRoom(str, function(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if response.ReturnCode == -2 then
|
||||
self:JoinRoom(str)
|
||||
return
|
||||
elseif response.ReturnCode ~=0 then
|
||||
ViewUtil.ErrorTip(response.ReturnCode,"进入房间失败")
|
||||
elseif response.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(response.ReturnCode, "进入房间失败")
|
||||
return
|
||||
end
|
||||
self:Destroy()
|
||||
ViewManager.ChangeView(ViewManager.View_Main,DataManager.CurrenRoom.game_id)
|
||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ function M:init(url)
|
|||
local view = self._view
|
||||
local user = self.user;
|
||||
|
||||
print("================phone=====================")
|
||||
-- print("================phone=====================")
|
||||
for k, v in pairs(user) do
|
||||
print(string.format("k:%s|v:%s", k, v))
|
||||
-- print(string.format("k:%s|v:%s", k, v))
|
||||
end
|
||||
|
||||
--show
|
||||
|
|
|
|||
|
|
@ -3,25 +3,25 @@
|
|||
local LobbyShopView = {}
|
||||
|
||||
local M = LobbyShopView
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
|
||||
local SHOP_LIST = {
|
||||
{
|
||||
num=2000,
|
||||
price=300
|
||||
num = 2000,
|
||||
price = 300
|
||||
},
|
||||
{
|
||||
num=1000,
|
||||
price=165
|
||||
num = 1000,
|
||||
price = 165
|
||||
},
|
||||
{
|
||||
num=300,
|
||||
price=50
|
||||
num = 300,
|
||||
price = 50
|
||||
},
|
||||
}
|
||||
|
||||
function LobbyShopView.new(Fct_UpdateDiamo)
|
||||
local self = setmetatable({}, {__index = M})
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'ShopView'
|
||||
self._close_destroy = true
|
||||
self:init('ui://Lobby/Shop')
|
||||
|
|
@ -37,28 +37,25 @@ function M:init(url)
|
|||
|
||||
for i = 1, #SHOP_LIST do
|
||||
local shopChild = UIPackage.CreateObjectFromURL('ui://Lobby/c_shop_child')
|
||||
shopChild:GetChild('num').text = string.format("%s 张",SHOP_LIST[i].num)
|
||||
shopChild:GetChild('num').text = string.format("%s 张", SHOP_LIST[i].num)
|
||||
local shopBuyBtn = shopChild:GetChild('btn_buy')
|
||||
shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s",SHOP_LIST[i].price)
|
||||
shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s", SHOP_LIST[i].price)
|
||||
shopBuyBtn.onClick:Set(function()
|
||||
local index = i;
|
||||
if false then
|
||||
--发送购买给后端
|
||||
else
|
||||
--假数据
|
||||
print("===================shop====================")
|
||||
print(SHOP_LIST[index].num)
|
||||
print(DataManager.SelfUser.diamo)
|
||||
-- print("===================shop====================")
|
||||
-- print(SHOP_LIST[index].num)
|
||||
-- print(DataManager.SelfUser.diamo)
|
||||
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num
|
||||
print(DataManager.SelfUser.diamo)
|
||||
-- print(DataManager.SelfUser.diamo)
|
||||
self.UpdateDiamo()
|
||||
end
|
||||
|
||||
end)
|
||||
shopList:AddChild(shopChild)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ local NoticeView = {}
|
|||
local M = NoticeView
|
||||
|
||||
function NoticeView.new(blur_view)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "NoticeView"
|
||||
-- self._blur_view = blur_view
|
||||
self:init("ui://Lobby/pop_notice")
|
||||
|
|
@ -12,7 +12,7 @@ function NoticeView.new(blur_view)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self._close_destroy = true
|
||||
self._close_zone = true
|
||||
end
|
||||
|
|
@ -40,7 +40,6 @@ function M:FillData(data)
|
|||
end
|
||||
list.selectedIndex = 0
|
||||
self:ShowIndex(1)
|
||||
|
||||
end
|
||||
|
||||
function M:ShowIndex(index)
|
||||
|
|
@ -56,9 +55,7 @@ function M:ShowIndex(index)
|
|||
|
||||
-- pic.text = "<img src=\""..notices[index].picture.."\"></img>"
|
||||
-- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>"
|
||||
-- print(pic.text)
|
||||
|
||||
|
||||
-- -- print(pic.text)
|
||||
end
|
||||
|
||||
function M:Destroy(flag)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ local PhonePasswordView = {}
|
|||
local M = PhonePasswordView
|
||||
|
||||
function PhonePasswordView.new(callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PhonePasswordView"
|
||||
self._callback = callback
|
||||
self._close_destroy = true
|
||||
|
|
@ -14,11 +14,11 @@ function PhonePasswordView.new(callback)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self.ctr_update = self._view:GetController("update")
|
||||
if DataManager.SelfUser.password then
|
||||
--self.ctr_update.selectedIndex = 1
|
||||
--print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id)
|
||||
---- print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id)
|
||||
--self._view:GetChild("tex_phone").text = DataManager.SelfUser.account_id--ViewUtil.phone_hide(DataManager.SelfUser.phone)
|
||||
end
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ function M:GetCode()
|
|||
return
|
||||
end
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
loddyctr:GetPhoneCode(phone,function( res)
|
||||
loddyctr:GetPhoneCode(phone, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
self._view:GetController("code").selectedIndex = 1
|
||||
self._left_time = 120
|
||||
|
|
@ -60,10 +60,10 @@ function M:OnUpdate()
|
|||
_left_time = _left_time - deltaTime
|
||||
_left_time = math.max(0, _left_time)
|
||||
local leftTime = math.floor(_left_time)
|
||||
self._view:GetChild("tex_time").text = tostring(leftTime).."后重新发送"
|
||||
self._view:GetChild("tex_time").text = tostring(leftTime) .. "后重新发送"
|
||||
self._left_time = _left_time
|
||||
else
|
||||
self._view:GetController("code").selectedIndex=0
|
||||
self._view:GetController("code").selectedIndex = 0
|
||||
UpdateBeat:Remove(self.OnUpdate, self)
|
||||
end
|
||||
end
|
||||
|
|
@ -75,10 +75,9 @@ end
|
|||
|
||||
--绑定
|
||||
function M:Bind()
|
||||
|
||||
local tex_passwd = self._view:GetChild("tex_passwd")
|
||||
local password = tex_passwd.text
|
||||
if string.len(password) <6 then
|
||||
if string.len(password) < 6 then
|
||||
ViewUtil.ShowTips("请输入5位以上的密码")
|
||||
return
|
||||
end
|
||||
|
|
@ -93,24 +92,23 @@ function M:Bind()
|
|||
-- _data.phone = DataManager.SelfUser.phone
|
||||
-- _data.code = code
|
||||
-- end
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在提交...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在提交...")
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
_data.password = password
|
||||
_data.type =3
|
||||
_data.type = 3
|
||||
|
||||
loddyctr:UpdateUserInfo(_data,function( res)
|
||||
loddyctr:UpdateUserInfo(_data, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (res.ReturnCode ==0) then
|
||||
if (res.ReturnCode == 0) then
|
||||
DataManager.SelfUser.password = "123"
|
||||
if self._callback then self._callback() end
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"提交失败")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提交失败")
|
||||
end
|
||||
self:Close()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:CheckInputCode()
|
||||
local code = self._view:GetChild("tex_code").text
|
||||
if not (string.len(code) == 6) then
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ RankView = {}
|
|||
|
||||
local M = RankView
|
||||
|
||||
function RankView.new( main_view,video )
|
||||
function RankView.new(main_view, video)
|
||||
UIPackage.AddPackage("base/rank/ui/Rank")
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "RankView"
|
||||
self._animation = false
|
||||
self._full = true
|
||||
|
|
@ -24,9 +24,8 @@ function RankView.new( main_view,video )
|
|||
return self
|
||||
end
|
||||
|
||||
function M:init( url )
|
||||
|
||||
BaseWindow.init(self,url)
|
||||
function M:init(url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
self._view:GetController("tab").selectedIndex = self._video and 1 or 0
|
||||
self._curren_tex = ""
|
||||
|
|
@ -37,18 +36,15 @@ function M:init( url )
|
|||
for i = 0, 9 do
|
||||
local btn = develop_panel:GetChild("btn_" .. i)
|
||||
btn.onClick:Add(function()
|
||||
|
||||
if self._curren_len < 6 then
|
||||
|
||||
self._curren_tex = self._curren_tex .. i
|
||||
self._curren_len = self._curren_len + 1
|
||||
self.tex_roomid.text = self._curren_tex
|
||||
|
||||
if self._curren_len == 6 then
|
||||
|
||||
ViewUtil.ShowModalWait(self._root_view)
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestRecordList(function (result)
|
||||
loddyCtr1:RequestRecordList(function(result)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
|
|
@ -79,8 +75,6 @@ function M:init( url )
|
|||
self._curren_len = 0
|
||||
self.tex_roomid.text = self._curren_tex
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function M:readData()
|
||||
|
|
@ -90,7 +84,7 @@ function M:readData()
|
|||
record_list_1:RemoveChildrenToPool()
|
||||
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestRecordList(function (result)
|
||||
loddyCtr1:RequestRecordList(function(result)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
|
|
@ -101,7 +95,6 @@ function M:readData()
|
|||
|
||||
|
||||
self:InitRecord1(loddyCtr1.recordList)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -118,21 +111,18 @@ end
|
|||
|
||||
local load_head_num = 0
|
||||
function M:InitRecord1(recordList, develop_tool)
|
||||
|
||||
--print("InitRecord1=========")
|
||||
---- print("InitRecord1=========")
|
||||
pt(recordList)
|
||||
local main_view = self._view
|
||||
-- 战绩 list
|
||||
local record_list_1, ctr_recored, ctr_no_record
|
||||
if develop_tool then
|
||||
|
||||
ctr_recored = main_view:GetController("developer")
|
||||
ctr_recored.selectedIndex = 1
|
||||
|
||||
record_list_1 = main_view:GetChild("lst_record")
|
||||
local btn_backto_search = main_view:GetChild("btn_backto_search")
|
||||
btn_backto_search.onClick:Set(function()
|
||||
|
||||
ctr_recored.selectedIndex = 0
|
||||
|
||||
self._curren_tex = ""
|
||||
|
|
@ -146,8 +136,7 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
end
|
||||
record_list_1:RemoveChildrenToPool()
|
||||
ctr_no_record.selectedIndex = #recordList == 0 and 1 or 0
|
||||
for i=1, #recordList do
|
||||
|
||||
for i = 1, #recordList do
|
||||
local record_list_item = recordList[i]
|
||||
local total_score_list = record_list_item.TotalScoreList
|
||||
local item = record_list_1:AddItemFromPool()
|
||||
|
|
@ -165,7 +154,7 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
local game_data = ExtendManager.GetGameData(game_id)
|
||||
local room_type_str = record_list_item.GameInfo.name
|
||||
local room_id_str = record_list_item.RoomId
|
||||
local time =tonumber(record_list_item.Time)
|
||||
local time = tonumber(record_list_item.Time)
|
||||
local room_time_str = os.date("%Y-%m-%d %H:%M", time)
|
||||
local item_score_list = record_list_item.GameTimes
|
||||
local play_back_id = record_list_item.PlayBackId
|
||||
|
|
@ -184,7 +173,7 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
-- 显示 每个玩家的 名字和 分数
|
||||
-- player_list 是聊天室数据
|
||||
local player_list = {}
|
||||
for j=1,#total_score_list do
|
||||
for j = 1, #total_score_list do
|
||||
local player_list_item = total_score_list[j]
|
||||
local player_item = player_item_list:AddItemFromPool()
|
||||
player_item:GetChild("n0").text = player_list_item.Name
|
||||
|
|
@ -199,7 +188,7 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
player_item:GetController("num_color").selectedIndex = 0
|
||||
end
|
||||
|
||||
player_score.text = score >= 0 and "+"..score or score
|
||||
player_score.text = score >= 0 and "+" .. score or score
|
||||
player_list[j] = {}
|
||||
player_list[j].id = player_list_item.Id
|
||||
player_list[j].score = score
|
||||
|
|
@ -207,9 +196,9 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
player_list[j].nick = player_list_item.Name
|
||||
end
|
||||
-- 点击事件
|
||||
item.onClick:Add(function ()
|
||||
|
||||
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str,item_score_list, game_id, develop_tool, record_list_item)
|
||||
item.onClick:Add(function()
|
||||
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str, item_score_list, game_id,
|
||||
develop_tool, record_list_item)
|
||||
end)
|
||||
-- 分享
|
||||
item:GetChild("btn_screenshot").onClick:Set(function()
|
||||
|
|
@ -240,14 +229,14 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
item:GetChild("score").text = score
|
||||
if score < 0 then item:GetController("di").selectedIndex = 1 end
|
||||
if p.Portrait and p.Portrait ~= "" then
|
||||
ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function( ... )
|
||||
ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function(...)
|
||||
load_head_num = load_head_num - 1
|
||||
end)
|
||||
else
|
||||
load_head_num = load_head_num - 1
|
||||
end
|
||||
end
|
||||
coroutine.start(function ( ... )
|
||||
coroutine.start(function(...)
|
||||
local left_time = 4
|
||||
while (true) do
|
||||
if load_head_num == 0 or left_time == 0 then
|
||||
|
|
@ -266,7 +255,8 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
end)
|
||||
item:GetChild("btn_link").onClick:Set(function()
|
||||
local group_id = record_list_item.group_id and tonumber(record_list_item.group_id) or 0
|
||||
ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id, player_list, self._root_view)
|
||||
ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id,
|
||||
player_list, self._root_view)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -285,7 +275,7 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
local hpType = record_item.GameInfo.hpType
|
||||
|
||||
record_list_2:RemoveChildrenToPool()
|
||||
for i=1,#item_score do
|
||||
for i = 1, #item_score do
|
||||
local item_player_info = item_score[i]
|
||||
local play_back_id = item_player_info.PlayBackId
|
||||
local player_score = item_player_info.PlayerList
|
||||
|
|
@ -307,8 +297,7 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
record_item_2:GetChild("Number").text = tostring(i)
|
||||
|
||||
player_item_list:RemoveChildrenToPool()
|
||||
for j=1,#player_score do
|
||||
|
||||
for j = 1, #player_score do
|
||||
local player_item = player_item_list:AddItemFromPool()
|
||||
player_item:GetChild("n0").text = player_score[j].Name
|
||||
local player_score_text = player_item:GetChild("n1")
|
||||
|
|
@ -321,14 +310,13 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
else
|
||||
player_item:GetController("num_color").selectedIndex = 0
|
||||
end
|
||||
player_score_text.text = score >= 0 and "+"..score or score
|
||||
|
||||
player_score_text.text = score >= 0 and "+" .. score or score
|
||||
end
|
||||
local btn_play_back = record_item_2:GetChild("btn_play_back")
|
||||
btn_play_back.onClick:Set(function()
|
||||
--print("点击进入回放=====")
|
||||
---- print("点击进入回放=====")
|
||||
if DataManager.SelfUser.playback[playback_id] ~= nil and DataManager.SelfUser.playback[playback_id][i] ~= nil then
|
||||
--print("1111111111111111")
|
||||
---- print("1111111111111111")
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
DataManager.CurrenRoom = room
|
||||
room.game_id = game_id
|
||||
|
|
@ -343,13 +331,13 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
main._totalRound = #item_score
|
||||
main:FillRoomData(DataManager.SelfUser.playback[playback_id][i])
|
||||
else
|
||||
--print("2222222222222")
|
||||
---- print("2222222222222")
|
||||
ViewUtil.ShowModalWait(self._view)
|
||||
local _data = {}
|
||||
_data["military_id"] = playback_id
|
||||
_data["round"] = tostring(i)
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestPlayBack(_data,function(code,data)
|
||||
loddyCtr1:RequestPlayBack(_data, function(code, data)
|
||||
ViewUtil.CloseModalWait()
|
||||
if code == 0 then
|
||||
if DataManager.SelfUser.playback[playback_id] ~= nil then
|
||||
|
|
@ -364,31 +352,30 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
main._currentId = playback_id
|
||||
main._currentRound = i
|
||||
main._totalRound = #item_score
|
||||
--print(main)
|
||||
---- print(main)
|
||||
main:FillRoomData(data)
|
||||
elseif code == 25 then
|
||||
ViewUtil.ErrorTip(code, "回放未找到!")
|
||||
btn_play_back.grayed = true
|
||||
end
|
||||
end, record_item.GameInfo)
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M:GenaratePlayBack(id, game_id, ...)
|
||||
local tem =nil
|
||||
local tem = nil
|
||||
local dview_class = nil
|
||||
if not dview_class then
|
||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||
dview_class = exconfig:GetView(id)
|
||||
--print(dview_class)
|
||||
---- print(dview_class)
|
||||
end
|
||||
if not dview_class then
|
||||
return
|
||||
end
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
tem = dview_class.new(...)
|
||||
tem.Id = id
|
||||
tem:Show()
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ local UserEditView = {}
|
|||
local M = UserEditView
|
||||
|
||||
function UserEditView.new(callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "UserEditView"
|
||||
self._callback = callback
|
||||
self._close_destroy = true
|
||||
|
|
@ -18,7 +18,7 @@ function UserEditView.new(callback)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local btn_head = self._view:GetChild("btn_head")
|
||||
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
|
|
@ -42,7 +42,7 @@ function M:init(url)
|
|||
btn_edit_portrait.onClick:Set(function()
|
||||
-- local edit_portrait_view = EditPortraitView.new(function()
|
||||
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
-- --print(DataManager.SelfUser.head_url)
|
||||
-- ---- print(DataManager.SelfUser.head_url)
|
||||
-- self._callback()
|
||||
-- end)
|
||||
-- edit_portrait_view:Show()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ LobbyView = {}
|
|||
local M = {}
|
||||
|
||||
function LobbyView.new()
|
||||
-- print("new lobbyView!!!!")
|
||||
-- -- print("new lobbyView!!!!")
|
||||
setmetatable(M, { __index = BaseView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "LobbyView"
|
||||
|
|
@ -38,7 +38,7 @@ function LobbyView.new()
|
|||
end
|
||||
|
||||
function M:InitView(url)
|
||||
-- print("init lobbyView!!!!")
|
||||
-- -- print("init lobbyView!!!!")
|
||||
BaseView.InitView(self, url)
|
||||
self._full_offset = false
|
||||
local view = self._view
|
||||
|
|
@ -338,7 +338,7 @@ function M:__show_service()
|
|||
end
|
||||
|
||||
function M:__GetMessage(data)
|
||||
-- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
||||
-- -- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
||||
if not data or not data.notice_list then
|
||||
self._mesList = ""
|
||||
else
|
||||
|
|
@ -364,7 +364,7 @@ function M:__PopMsg(index)
|
|||
end
|
||||
|
||||
function M:__moveMsg(index)
|
||||
-- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
-- -- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
if not self._tex_message then return end
|
||||
index, self._tex_message.text = self:__PopMsg(index)
|
||||
self._tex_message.x = self._message.width
|
||||
|
|
@ -392,8 +392,8 @@ end
|
|||
function M:__ShowShare()
|
||||
local pop_share = self._view:GetChild("pop_share")
|
||||
local shareUrl = GetGameInfo("invite_link") .. "?uid=" .. DataManager.SelfUser.account_id
|
||||
--print("shareUrl=================")
|
||||
--print(shareUrl)
|
||||
---- print("shareUrl=================")
|
||||
---- print(shareUrl)
|
||||
local btn_wx_session = pop_share:GetChild("btn_wx_session")
|
||||
btn_wx_session.onClick:Add(function()
|
||||
shareQRCodePicture(shareUrl, 0)
|
||||
|
|
@ -437,7 +437,7 @@ function M:Destroy()
|
|||
end
|
||||
|
||||
function M:Show()
|
||||
--print("on lobbyView show~~~~~~")
|
||||
---- print("on lobbyView show~~~~~~")
|
||||
BaseView.Show(self)
|
||||
ViewUtil.PlaySoundBg()
|
||||
UpdateBeat:Add(self.OnUpdate, self)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function M:init()
|
|||
|
||||
local view = self._view
|
||||
-- view:GetChild("tex_version").text = "Version:" .. GetGameInfoPlatform("version")
|
||||
-- print(GameApplication.Instance.accountTest and 1 or 0)
|
||||
-- -- print(GameApplication.Instance.accountTest and 1 or 0)
|
||||
view:GetController("test").selectedIndex = GameApplication.Instance.accountTest and 1 or 0
|
||||
self.agree = view:GetController("agree");
|
||||
-- Utils.LoadBg("loginbg", view)
|
||||
|
|
@ -70,7 +70,7 @@ function M:init()
|
|||
Utils.SaveLocalFile(key, json.encode(_data))
|
||||
end)
|
||||
if not s then
|
||||
print("Error:" .. e)
|
||||
-- print("Error:" .. e)
|
||||
end
|
||||
|
||||
DataManager.SelfUser.acc = utez
|
||||
|
|
@ -218,7 +218,7 @@ end
|
|||
function M:QuickLogin()
|
||||
if (not GameApplication.Instance.accountTest) then
|
||||
local session_id = PlayerPrefs.GetString("session_id")
|
||||
print("session_id:" .. session_id)
|
||||
-- print("session_id:" .. session_id)
|
||||
if session_id and string.len(session_id) > 3 then
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...")
|
||||
local loginCtr = ControllerManager.GetController(LoginController)
|
||||
|
|
@ -231,8 +231,8 @@ end
|
|||
|
||||
function M:LoginCallBack(result, data)
|
||||
self.isWXCallBackMark = true
|
||||
--print("微信登录返回================================================================")
|
||||
--print("result===>"..result)
|
||||
---- print("微信登录返回================================================================")
|
||||
---- print("result===>"..result)
|
||||
--pt(data)
|
||||
if (not result) or result ~= 0 then
|
||||
if result == 10 then
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ function M:SetTuoGuanState()
|
|||
end
|
||||
|
||||
function M:InitView(url, isHideIpAdds)
|
||||
--print("url===>>>")
|
||||
--print(url)
|
||||
--print(debug.traceback())
|
||||
---- print("url===>>>")
|
||||
---- print(url)
|
||||
---- print(debug.traceback())
|
||||
BaseView.InitView(self, url)
|
||||
--
|
||||
|
||||
|
|
@ -668,7 +668,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.TupGuanOpen,
|
||||
function(...)
|
||||
--print("刷新托管数据=====")
|
||||
---- print("刷新托管数据=====")
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
|
|
@ -802,17 +802,17 @@ function M:OnPlayerReady(...)
|
|||
if p.isSendCardState ~= nil and p.isSendCardState == true then
|
||||
p.isSendCardState = false
|
||||
ControllerManager.IsSendCard = false
|
||||
--print("进入设置计时器控制==========")
|
||||
---- print("进入设置计时器控制==========")
|
||||
coroutine.start(function()
|
||||
--print("计时器倒计时5s=============")
|
||||
---- print("计时器倒计时5s=============")
|
||||
coroutine.wait(5)
|
||||
--print("当前状态==============")
|
||||
--print(ControllerManager.IsSendCard)
|
||||
---- print("当前状态==============")
|
||||
---- print(ControllerManager.IsSendCard)
|
||||
if ControllerManager.IsSendCard == true then
|
||||
--print("以发送开牌======================")
|
||||
---- print("以发送开牌======================")
|
||||
return
|
||||
else
|
||||
--print("开始断线重连")
|
||||
---- print("开始断线重连")
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
end
|
||||
|
|
@ -1097,7 +1097,7 @@ end
|
|||
|
||||
--游戏激活
|
||||
function M:OnApplicationActive()
|
||||
--print("游戏激活================")
|
||||
---- print("游戏激活================")
|
||||
if os.time() - last_pause_time > 15 then
|
||||
last_pause_time = os.time()
|
||||
ControllerManager.WebClient:clearActionQueue()
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ GroupNumberInputView_Game = import(".MngView.GroupNumberInputView")
|
|||
local GroupInfoView = {}
|
||||
local M = GroupInfoView
|
||||
|
||||
local currentSelectPlay=0
|
||||
local currentSelectPlay = 0
|
||||
|
||||
function GroupInfoView.new(curGroup, fg_info)
|
||||
setmetatable(M, {__index = BaseView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'GroupInfoView'
|
||||
self.curGroup = curGroup
|
||||
curGroup.layer = 0
|
||||
|
|
@ -35,7 +35,7 @@ function GroupInfoView.new(curGroup, fg_info)
|
|||
self.lstgameVisible = false
|
||||
self.isShowRoomItem = (self.curGroup.lev == 1 or self.curGroup.lev == 2)
|
||||
DataManager.SelfUser.cur_group = self
|
||||
self.FillGameItemList={}
|
||||
self.FillGameItemList = {}
|
||||
self:InitView('ui://NewGroup/Main_GroupInfo')
|
||||
|
||||
return self
|
||||
|
|
@ -110,7 +110,7 @@ local function RoomWeight1(room)
|
|||
elseif #room.plist == 0 then
|
||||
weight = weight + 0
|
||||
elseif room.maxPlayers > #room.plist then
|
||||
weight = 0.5--weight + (10 - room.maxPlayers + #room.plist)
|
||||
weight = 0.5 --weight + (10 - room.maxPlayers + #room.plist)
|
||||
elseif room.maxPlayers == #room.plist then
|
||||
weight = weight + 1
|
||||
end
|
||||
|
|
@ -124,13 +124,13 @@ end
|
|||
-- 房间排序
|
||||
local function SortRooms(a, b)
|
||||
-- printlog("SortRooms====》》》》",currentSelectPlay)
|
||||
if currentSelectPlay==0 then
|
||||
if currentSelectPlay == 0 then
|
||||
local rwa = RoomWeight(a)
|
||||
local rwb = RoomWeight(b)
|
||||
if rwa ~= rwb then
|
||||
return rwa > rwb
|
||||
else
|
||||
return a.pid<b.pid
|
||||
return a.pid < b.pid
|
||||
end
|
||||
else
|
||||
local rwa = RoomWeight1(a)
|
||||
|
|
@ -138,7 +138,7 @@ local function SortRooms(a, b)
|
|||
if rwa ~= rwb then
|
||||
return rwa < rwb
|
||||
else
|
||||
return a.pid<b.pid
|
||||
return a.pid < b.pid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -165,7 +165,7 @@ local function __fillRoomItem(self, index, item, room)
|
|||
local room_item = self.roomItems[item]
|
||||
local play = self.curGroup:getPlay(room.pid)
|
||||
if not room_item then
|
||||
room_item = RoomItem.new(item, room.maxPlayers,self.isShowRoomItem)
|
||||
room_item = RoomItem.new(item, room.maxPlayers, self.isShowRoomItem)
|
||||
self.roomItems[item] = room_item
|
||||
end
|
||||
|
||||
|
|
@ -180,16 +180,16 @@ local function __fillRoomItem(self, index, item, room)
|
|||
|
||||
local str = ""
|
||||
if room.limitInRoom then
|
||||
str = str..room.limitInRoom/1000
|
||||
str = str .. room.limitInRoom / 1000
|
||||
end
|
||||
|
||||
if room.round==nil then
|
||||
room.round=0
|
||||
if room.round == nil then
|
||||
room.round = 0
|
||||
end
|
||||
|
||||
|
||||
--printlog("wwwwwwwwwww1111111111111111 ",room.round," ",room.times)
|
||||
room_item.tex_round.text = room.status >=-1 and string.format('%s/%s', room.round, room.times) or ""
|
||||
room_item.tex_round.text = room.status >= -1 and string.format('%s/%s', room.round, room.times) or ""
|
||||
local name = __getLayerName(self, room.pid)
|
||||
room_item.tex_gamename.text = name
|
||||
room_item.tex_limit.text = str
|
||||
|
|
@ -230,15 +230,14 @@ local function __fillRoomItem(self, index, item, room)
|
|||
local p = plist[i]
|
||||
if isHidden == 0 then
|
||||
p_head.tex_name.text = ViewUtil.stringEllipsis(p.nick)
|
||||
p_head.tex_id.text = "ID:"..p.aid
|
||||
p_head.tex_id.text = "ID:" .. p.aid
|
||||
ImageLoad.Load(p.portrait, btn_head._iconObject, self.class)
|
||||
|
||||
if p.hp then
|
||||
local str1="积分:"
|
||||
local hp=p.hp/1000
|
||||
p_head.text_score.text=str1..hp
|
||||
local str1 = "积分:"
|
||||
local hp = p.hp / 1000
|
||||
p_head.text_score.text = str1 .. hp
|
||||
end
|
||||
|
||||
else
|
||||
p_head.tex_name.text = "智能"
|
||||
p_head.tex_id.text = "防作弊"
|
||||
|
|
@ -272,7 +271,7 @@ local function __fillRoomItem(self, index, item, room)
|
|||
if room.default or self.curGroup.lev == 3 then
|
||||
-- 房间点击:假房间 匹配,真房间 加入
|
||||
if room.default or isHidden == 1 then
|
||||
self:__startGame(room.id,room.pid, true, isHidden)
|
||||
self:__startGame(room.id, room.pid, true, isHidden)
|
||||
else
|
||||
self:__joinRoom(roomid)
|
||||
end
|
||||
|
|
@ -291,7 +290,7 @@ local function __fillRoomItem(self, index, item, room)
|
|||
function()
|
||||
riv:Dispose()
|
||||
if room.default or isHidden == 1 then
|
||||
self:__startGame(room.id,room.pid, true, isHidden)
|
||||
self:__startGame(room.id, room.pid, true, isHidden)
|
||||
else
|
||||
self:__joinRoom(roomid)
|
||||
end
|
||||
|
|
@ -345,7 +344,6 @@ local function __fillRoomItem(self, index, item, room)
|
|||
self.fg_info[key] = room.pid
|
||||
local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
||||
Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -376,7 +374,7 @@ local function __fillRoomData(self)
|
|||
-- 单个玩法
|
||||
local rooms = self.curGroup:getPlay(currentPlayID).rooms
|
||||
local trooms = {}
|
||||
for i=1,#rooms do
|
||||
for i = 1, #rooms do
|
||||
local room = rooms[i]
|
||||
local play = self.curGroup:getPlay(room.pid)
|
||||
local isvip = 0
|
||||
|
|
@ -406,16 +404,13 @@ local function __fillRoomData(self)
|
|||
if isvip == self._showVipRooms then
|
||||
if isHidden == 1 then
|
||||
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
||||
table.insert( trooms,room )
|
||||
table.insert(trooms, room)
|
||||
end
|
||||
else
|
||||
table.insert( trooms,room )
|
||||
table.insert(trooms, room)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
self.curRooms = membe_clone(trooms)
|
||||
|
||||
|
|
@ -435,28 +430,26 @@ local function __fillRoomData(self)
|
|||
|
||||
------
|
||||
if isvip == self._showVipRooms then
|
||||
local hp=json.decode(play.hpData)
|
||||
local hp = json.decode(play.hpData)
|
||||
if hp and hp.maxRound then
|
||||
room.times=hp.maxRound
|
||||
room.times = hp.maxRound
|
||||
end
|
||||
|
||||
if hp and hp.limitInRoom then
|
||||
room.limitInRoom=hp.limitInRoom
|
||||
room.limitInRoom = hp.limitInRoom
|
||||
end
|
||||
|
||||
|
||||
table.insert( self.curRooms,room )
|
||||
|
||||
table.insert(self.curRooms, room)
|
||||
end
|
||||
-----
|
||||
end
|
||||
|
||||
else
|
||||
if currentGameID == 0 then
|
||||
--printlog("aaaaaaaaaaaaaaaaa222222222222222222222222222")
|
||||
local rooms = curGroup.rooms
|
||||
local trooms = {}
|
||||
for i=1,#rooms do
|
||||
for i = 1, #rooms do
|
||||
local room = rooms[i]
|
||||
local play = self.curGroup:getPlay(room.pid)
|
||||
local isvip = 0
|
||||
|
|
@ -485,15 +478,13 @@ local function __fillRoomData(self)
|
|||
if isvip == self._showVipRooms then
|
||||
if play.isHidden == 1 then
|
||||
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
||||
table.insert( trooms,room )
|
||||
table.insert(trooms, room)
|
||||
end
|
||||
else
|
||||
table.insert( trooms,room )
|
||||
table.insert(trooms, room)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
self.curRooms = membe_clone(trooms)
|
||||
|
||||
|
|
@ -514,20 +505,19 @@ local function __fillRoomData(self)
|
|||
play.isvip = isvip
|
||||
end
|
||||
if isvip == self._showVipRooms then
|
||||
local hp=json.decode(self.curGroup.playList[i].hpData)
|
||||
defaultRoom.limitInRoom=hp.limitInRoom
|
||||
local hp = json.decode(self.curGroup.playList[i].hpData)
|
||||
defaultRoom.limitInRoom = hp.limitInRoom
|
||||
if hp.maxRound then
|
||||
defaultRoom.times=hp.maxRound
|
||||
defaultRoom.times = hp.maxRound
|
||||
end
|
||||
local totalNum=1
|
||||
local totalNum = 1
|
||||
if hp.tex_times_room then
|
||||
totalNum=hp.tex_times_room/1000
|
||||
totalNum = hp.tex_times_room / 1000
|
||||
end
|
||||
|
||||
for i=1,totalNum do
|
||||
for i = 1, totalNum do
|
||||
self.curRooms[#self.curRooms + 1] = defaultRoom
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
@ -571,42 +561,40 @@ local function __fillRoomData(self)
|
|||
end
|
||||
end
|
||||
|
||||
local hp=json.decode(p_data.hpData)
|
||||
local hp = json.decode(p_data.hpData)
|
||||
if hp and hp.maxRound then
|
||||
self.curGroup.default_rooms[i].times=hp.maxRound
|
||||
self.curGroup.default_rooms[i].times = hp.maxRound
|
||||
end
|
||||
|
||||
if hp and hp.limitInRoom then
|
||||
self.curGroup.default_rooms[i].limitInRoom=hp.limitInRoom
|
||||
self.curGroup.default_rooms[i].limitInRoom = hp.limitInRoom
|
||||
end
|
||||
|
||||
local totalNum=1
|
||||
local totalNum = 1
|
||||
if hp and hp.tex_times_room then
|
||||
totalNum=hp.tex_times_room/1000
|
||||
totalNum = hp.tex_times_room / 1000
|
||||
end
|
||||
for j=1,totalNum do
|
||||
for j = 1, totalNum do
|
||||
self.curRooms[#self.curRooms + 1] = self.curGroup.default_rooms[i]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
currentSelectPlay=self:GetSelectedPlayID()
|
||||
table.sort(self.curRooms,SortRooms )
|
||||
currentSelectPlay = self:GetSelectedPlayID()
|
||||
table.sort(self.curRooms, SortRooms)
|
||||
list_offline = {}
|
||||
|
||||
if self.curGroup.lev < 3 then
|
||||
self.lst_room.numItems = #self.curRooms
|
||||
else
|
||||
if self.curGroup.show_num > 0 and #self.curRooms > self.curGroup.show_num then
|
||||
|
||||
local tr = {}
|
||||
|
||||
for j = 1, #self.curRooms do
|
||||
if #tr < self.curGroup.show_num or self.curRooms[j].default == true then
|
||||
table.insert(tr,self.curRooms[j])
|
||||
table.insert(tr, self.curRooms[j])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -650,7 +638,7 @@ end
|
|||
function M:InitRoomInfoView()
|
||||
local room = self.roominfo.room
|
||||
if not room.default then
|
||||
printlog("wwwwwwwwwww22222222222222222 ",room.round," ",room.times)
|
||||
printlog("wwwwwwwwwww22222222222222222 ", room.round, " ", room.times)
|
||||
self.roominfo.view:GetChild('tex_round').text = string.format('(%s/%s)', room.round, room.times)
|
||||
local lst_player = self.roominfo.view:GetChild('lst_player')
|
||||
lst_player:RemoveChildrenToPool()
|
||||
|
|
@ -694,7 +682,6 @@ local function __fillPlayItem(self, index, item)
|
|||
if (index == 0) then
|
||||
tex_game.text = __getLayerName(self, 0)
|
||||
else
|
||||
|
||||
pipeijoin.onClick:Add(
|
||||
function()
|
||||
local currentPlayID = self:GetSelectedPlayID()
|
||||
|
|
@ -717,7 +704,7 @@ local function __fillPlayItem(self, index, item)
|
|||
end
|
||||
end
|
||||
|
||||
self:__startGame("",currentPlayID, false)
|
||||
self:__startGame("", currentPlayID, false)
|
||||
end
|
||||
)
|
||||
tex_game.text = __getLayerName(self, self.playIdList[index])
|
||||
|
|
@ -726,7 +713,6 @@ end
|
|||
|
||||
local _iconMap = {}
|
||||
local function __fillExtendIcon(id, callback)
|
||||
|
||||
local File = System.IO.File
|
||||
local path = Application.persistentDataPath .. '/UserData/Icon'
|
||||
if not System.IO.Directory.Exists(path) then
|
||||
|
|
@ -760,7 +746,7 @@ local function __fillExtendIcon(id, callback)
|
|||
local texture = UnityEngine.Texture2D(128, 128)
|
||||
texture:LoadImage(bytes)
|
||||
local ntexture = FairyGUI.NTexture(texture)
|
||||
_iconMap[id] = {texture = texture, ntexture = ntexture}
|
||||
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
||||
callback(ntexture)
|
||||
end
|
||||
)
|
||||
|
|
@ -771,17 +757,17 @@ local function __fillExtendIcon(id, callback)
|
|||
local texture = UnityEngine.Texture2D(128, 128)
|
||||
texture:LoadImage(bytes)
|
||||
local ntexture = FairyGUI.NTexture(texture)
|
||||
_iconMap[id] = {texture = texture, ntexture = ntexture}
|
||||
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
||||
callback(ntexture)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function GetGameName(index)
|
||||
if index==0 then return "全 部" end
|
||||
if index == 0 then return "全 部" end
|
||||
local list = DataManager.SelfUser.games
|
||||
for k,v in ipairs(list) do
|
||||
if v.game_id==index then
|
||||
for k, v in ipairs(list) do
|
||||
if v.game_id == index then
|
||||
return v.name
|
||||
end
|
||||
end
|
||||
|
|
@ -791,41 +777,40 @@ end
|
|||
|
||||
-- 玩法名字显示
|
||||
local function __fillGameItem(self, index, item)
|
||||
local gameName=""
|
||||
local gameName = ""
|
||||
if (index == 0) then
|
||||
item.icon = 'ui://NewGroup/quyxtb'
|
||||
gameName=GetGameName(0)
|
||||
item:GetChild("n11").text=gameName
|
||||
if self.currentGameItemName==nil then
|
||||
gameName = GetGameName(0)
|
||||
item:GetChild("n11").text = gameName
|
||||
if self.currentGameItemName == nil then
|
||||
item.icon = 'ui://NewGroup/quyxtb-1'
|
||||
end
|
||||
else
|
||||
local gameId = self.gameIdList[index]
|
||||
local config = ExtendManager.GetExtendConfig(gameId)
|
||||
local mode = config:GetGameInfo()
|
||||
local iconName=mode:GetIconUrl1()
|
||||
local iconName = mode:GetIconUrl1()
|
||||
item.icon = iconName
|
||||
gameName=GetGameName(gameId)
|
||||
item:GetChild("n11").text=gameName
|
||||
gameName = GetGameName(gameId)
|
||||
item:GetChild("n11").text = gameName
|
||||
end
|
||||
|
||||
if item.icon==self.currentGameItemName then
|
||||
item.icon=self.currentGameItemName.."-1"
|
||||
item:GetChild("n11").text=gameName
|
||||
if item.icon == self.currentGameItemName then
|
||||
item.icon = self.currentGameItemName .. "-1"
|
||||
item:GetChild("n11").text = gameName
|
||||
end
|
||||
item:GetChild("n22").text=index+1
|
||||
|
||||
item:GetChild("n22").text = index + 1
|
||||
end
|
||||
|
||||
local function __analysePlayListData(self)
|
||||
self.playIdList = {}
|
||||
DataManager.SelfUser.PlayLocalList={}
|
||||
DataManager.SelfUser.PlayLocalList = {}
|
||||
|
||||
local playName="playfaconfig"..self.curGroup.id
|
||||
local playName = "playfaconfig" .. self.curGroup.id
|
||||
local json_data = Utils.LoadLocalFile(playName)
|
||||
if json_data then
|
||||
local data = json.decode(json_data)
|
||||
DataManager.SelfUser.PlayLocalList=data
|
||||
DataManager.SelfUser.PlayLocalList = data
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -846,7 +831,7 @@ local function __analysePlayListData(self)
|
|||
end
|
||||
p_data.isvip = isvip
|
||||
|
||||
local isHasPlayC=true
|
||||
local isHasPlayC = true
|
||||
--[[for k,v in pairs(DataManager.SelfUser.PlayLocalList) do
|
||||
if tonumber(k)==p_data.id then
|
||||
isHasPlayC=v
|
||||
|
|
@ -982,7 +967,7 @@ function M:InitView(url)
|
|||
|
||||
|
||||
|
||||
self._view:GetChild('tex_id').text = "ID:"..self.curGroup.id
|
||||
self._view:GetChild('tex_id').text = "ID:" .. self.curGroup.id
|
||||
|
||||
self._view:GetChild('tex_name').text = self.curGroup.name
|
||||
|
||||
|
|
@ -1024,9 +1009,9 @@ function M:InitView(url)
|
|||
self.lst_game.onClickItem:Add(
|
||||
function(pas)
|
||||
if self.currentSelectItem == pas.data then return end
|
||||
local name=pas.data.icon
|
||||
local name = pas.data.icon
|
||||
self.currentSelectItem = pas.data
|
||||
self.currentGameItemName=name
|
||||
self.currentGameItemName = name
|
||||
self.lst_layer.selectedIndex = 0
|
||||
self:__refreshPay()
|
||||
__analyseGameListData(self)
|
||||
|
|
@ -1060,8 +1045,8 @@ function M:InitView(url)
|
|||
|
||||
local btn_quanbu = self._view:GetChild('btn_quanbu')
|
||||
btn_quanbu.onClick:Set(
|
||||
function ()
|
||||
self.lst_layer.selectedIndex=0
|
||||
function()
|
||||
self.lst_layer.selectedIndex = 0
|
||||
self:__loadPlayData()
|
||||
end
|
||||
)
|
||||
|
|
@ -1097,7 +1082,7 @@ function M:InitView(url)
|
|||
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
||||
return
|
||||
end
|
||||
self:__startGame("",pid, false)
|
||||
self:__startGame("", pid, false)
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1105,7 +1090,6 @@ function M:InitView(url)
|
|||
local btn_start2 = self._view:GetChild('btn_start2')
|
||||
btn_start2.onClick:Set(
|
||||
function()
|
||||
|
||||
local currentPlayID = self:GetSelectedPlayID()
|
||||
if currentPlayID == 0 then
|
||||
if self.lst_layer.selectedIndex == 0 and self.lst_game.selectedIndex > 0 then
|
||||
|
|
@ -1126,21 +1110,20 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
self:__startGame("",currentPlayID, false)
|
||||
self:__startGame("", currentPlayID, false)
|
||||
end
|
||||
)
|
||||
|
||||
-- 选择玩法按钮
|
||||
local btn_choose = self._view:GetChild('btn_choose')
|
||||
btn_choose.onClick:Set(
|
||||
function ()
|
||||
function()
|
||||
self.lstgameVisible = not self.lstgameVisible
|
||||
if (self.lstgameVisible) then
|
||||
self.lst_game:TweenMove(Vector2.New(3,100), 0.3)
|
||||
self.lst_game:TweenMove(Vector2.New(3, 100), 0.3)
|
||||
else
|
||||
self.lst_game:TweenMove(Vector2.New(3,760), 0.3)
|
||||
self.lst_game:TweenMove(Vector2.New(3, 760), 0.3)
|
||||
end
|
||||
|
||||
end
|
||||
-- function()
|
||||
-- local sgv =
|
||||
|
|
@ -1229,7 +1212,7 @@ function M:InitView(url)
|
|||
self:__loadGroupData()
|
||||
self:__refreshManager()
|
||||
UpdateBeat:Add(self.__onUpdate, self)
|
||||
self._view.visible=false
|
||||
self._view.visible = false
|
||||
end
|
||||
|
||||
function M:__saveLastData()
|
||||
|
|
@ -1251,7 +1234,7 @@ function M:__loadLastData()
|
|||
table.insert(self.gameIdList, t.gameId)
|
||||
end
|
||||
table.insert(self.playIdList, t.id)
|
||||
local room = {maxPlayers = t.maxPlayers, status = 0, default = true, pid = t.id, color = t.deskId}
|
||||
local room = { maxPlayers = t.maxPlayers, status = 0, default = true, pid = t.id, color = t.deskId }
|
||||
table.insert(self.curRooms, room)
|
||||
self.playNames[t.id] = t.name
|
||||
end
|
||||
|
|
@ -1272,13 +1255,13 @@ function M:__onUpdate()
|
|||
if self._pipeiTime and self._pipeiTime > 0 then
|
||||
local deltaTime = Time.deltaTime
|
||||
self._pipeiTime = self._pipeiTime - deltaTime
|
||||
self._pipeiTime = math.max( self._pipeiTime,0 )
|
||||
self._pipeiTime = math.max(self._pipeiTime, 0)
|
||||
if self._pipeiTime == 0 then
|
||||
self._view:GetChild('node_matching'):GetChild('text_time').text = "当前排位时间较长,请耐心等待..."
|
||||
self._view:GetChild('node_matching'):GetController('quxiao').selectedIndex = 1
|
||||
else
|
||||
local time = math.floor(self._pipeiTime)
|
||||
self._view:GetChild('node_matching'):GetChild('text_time').text = "玩家排位中,".. time .."秒后可退出..."
|
||||
self._view:GetChild('node_matching'):GetChild('text_time').text = "玩家排位中," .. time .. "秒后可退出..."
|
||||
end
|
||||
end
|
||||
if self.__join_room then
|
||||
|
|
@ -1405,7 +1388,7 @@ function M:__joinRoom(room_id)
|
|||
)
|
||||
end
|
||||
|
||||
function M:__joinRoom_match(roomid,pid, is_null, isHidden, callback)
|
||||
function M:__joinRoom_match(roomid, pid, is_null, isHidden, callback)
|
||||
if isHidden == nil then
|
||||
isHidden = 0
|
||||
local play = self.curGroup:getPlay(pid)
|
||||
|
|
@ -1567,13 +1550,15 @@ function M:_evtUpdateMsg()
|
|||
self:_setHongDian(true)
|
||||
end
|
||||
end
|
||||
|
||||
function M:_setHongDian(isShow)
|
||||
--红点提示
|
||||
local member_tips = self._view:GetChild('member_tips')
|
||||
member_tips.visible = isShow
|
||||
end
|
||||
|
||||
function M:_evtInvited(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local data = arg[1]
|
||||
local imv =
|
||||
FGInvitedMsgView.new(
|
||||
|
|
@ -1589,7 +1574,6 @@ end
|
|||
|
||||
-- 更新牌友圈事件
|
||||
function M:_evtUpdateGroup(...)
|
||||
|
||||
-- local btn_remit = self._view:GetChild('btn_remit')
|
||||
-- local option = self.curGroup.option or 0
|
||||
|
||||
|
|
@ -1630,10 +1614,10 @@ function M:__refreshManager()
|
|||
local btn_partner = self._view:GetChild('btn_partner')
|
||||
btn_partner.onClick:Set(
|
||||
function()
|
||||
--print("成员..........................................")
|
||||
---- print("成员..........................................")
|
||||
if not self.mng_view3 then
|
||||
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
||||
self.mng_view3:SetCurrentGroupInfoViewIns(function ()
|
||||
self.mng_view3:SetCurrentGroupInfoViewIns(function()
|
||||
self:OnclickMember()
|
||||
end)
|
||||
end
|
||||
|
|
@ -1645,7 +1629,7 @@ function M:__refreshManager()
|
|||
|
||||
local btn_play = self._view:GetChild('btn_play')
|
||||
btn_play.onClick:Set(function()
|
||||
local gl_view =GroupMngGameListView.new(self.curGroup.id)
|
||||
local gl_view = GroupMngGameListView.new(self.curGroup.id)
|
||||
gl_view:Show()
|
||||
-- self:SetRoomListVisible(false)
|
||||
end)
|
||||
|
|
@ -1662,7 +1646,6 @@ function M:__refreshManager()
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
function M:OnclickMember()
|
||||
if not self.mng_view3 then
|
||||
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
||||
|
|
@ -1720,7 +1703,7 @@ function M:__loadGroupData()
|
|||
curGroup.update_room = false
|
||||
curGroup.update_info = false
|
||||
curGroup.update_joins = false
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在进入牌友圈,请稍等...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在进入牌友圈,请稍等...")
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_EnterGroup(
|
||||
curGroup.id,
|
||||
|
|
@ -1733,7 +1716,7 @@ function M:__loadGroupData()
|
|||
--self._view.visible=false
|
||||
--ViewUtil.ErrorTip(res.ReturnCode, "获取圈子数据失败")
|
||||
else
|
||||
self._view.visible=true
|
||||
self._view.visible = true
|
||||
self:Show()
|
||||
self:__saveLastData()
|
||||
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
||||
|
|
@ -1759,12 +1742,12 @@ function M:__loadGroupData()
|
|||
|
||||
local btn_vip = self._view:GetChild("btn_vip")
|
||||
if self.curGroup.isvip == 1 then
|
||||
local vip = self.fg_info[tostring(self.curGroup.id).."vip"] or 0
|
||||
local vip = self.fg_info[tostring(self.curGroup.id) .. "vip"] or 0
|
||||
self._showVipRooms = vip
|
||||
btn_vip:GetController("vip").selectedIndex = math.abs( self._showVipRooms - 1)
|
||||
btn_vip.onClick:Set(function ()
|
||||
btn_vip:GetController("vip").selectedIndex = math.abs(self._showVipRooms - 1)
|
||||
btn_vip.onClick:Set(function()
|
||||
btn_vip:GetController("vip").selectedIndex = self._showVipRooms
|
||||
self._showVipRooms = math.abs( self._showVipRooms - 1 )
|
||||
self._showVipRooms = math.abs(self._showVipRooms - 1)
|
||||
self:_evtUpdatePlay()
|
||||
local key = tostring(self.curGroup.id) .. "vip"
|
||||
self.fg_info[key] = self._showVipRooms
|
||||
|
|
@ -1853,15 +1836,16 @@ function M:__loadGroupData()
|
|||
local btn_bxx = self._view:GetChild('btn_bxx')
|
||||
btn_bxx.onClick:Set(
|
||||
function()
|
||||
local ctrNum=1
|
||||
local ctrNum = 1
|
||||
-- if self.curGroup.lev==3 and self.curGroup.partnerLev>0 or self.curGroup.lev==1 or self.curGroup.lev==2 then
|
||||
-- ctrNum=2
|
||||
-- end
|
||||
if self.curGroup.lev==1 then
|
||||
ctrNum=2
|
||||
if self.curGroup.lev == 1 then
|
||||
ctrNum = 2
|
||||
end
|
||||
ctrNum=2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,DataManager.SelfUser.account_id)
|
||||
ctrNum = 2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum,
|
||||
DataManager.SelfUser.account_id)
|
||||
gmv:SetCallback(
|
||||
function()
|
||||
btn_bxx.selected = false
|
||||
|
|
@ -1876,7 +1860,7 @@ function M:__loadGroupData()
|
|||
end
|
||||
|
||||
-- 匹配游戏
|
||||
function M:__startGame(roomid,pid, is_null,isHidden, callback)
|
||||
function M:__startGame(roomid, pid, is_null, isHidden, callback)
|
||||
ViewUtil.ShowModalWait(self._root_view, '正在加入游戏...', 'join_room')
|
||||
local _gameCtrl = ControllerManager.GetController(GameController)
|
||||
local _currentCtrl = ControllerManager.GetCurrenController()
|
||||
|
|
@ -1890,7 +1874,7 @@ function M:__startGame(roomid,pid, is_null,isHidden, callback)
|
|||
isHidden,
|
||||
function(code)
|
||||
if code == -2 then
|
||||
self:__startGame(roomid,pid, is_null, isHidden, callback)
|
||||
self:__startGame(roomid, pid, is_null, isHidden, callback)
|
||||
elseif code ~= 0 then
|
||||
ViewUtil.ErrorMsg(self._root_view, code, '进入房间失败')
|
||||
ViewUtil.CloseModalWait('join_room')
|
||||
|
|
@ -1980,15 +1964,16 @@ function M:showPipei(play)
|
|||
end
|
||||
self._pipeiTime = 20
|
||||
end
|
||||
|
||||
function M:hidePipei()
|
||||
--print("hidePipei=============")
|
||||
--print(self._view)
|
||||
--print(self._view:GetController('pipei'))
|
||||
---- print("hidePipei=============")
|
||||
---- print(self._view)
|
||||
---- print(self._view:GetController('pipei'))
|
||||
if self._view:GetController('pipei') then
|
||||
self._view:GetController('pipei').selectedIndex = 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:SetCallBack(callback)
|
||||
self._callback = nil
|
||||
self._callback = callback
|
||||
|
|
@ -2055,4 +2040,3 @@ function M:Destroy()
|
|||
end
|
||||
|
||||
return M
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ local GroupMainView = {}
|
|||
|
||||
local M = GroupMainView
|
||||
|
||||
function GroupMainView.new(main_view, root_view,par_veiw)
|
||||
--print(debug.traceback())
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function GroupMainView.new(main_view, root_view, par_veiw)
|
||||
---- print(debug.traceback())
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'GroupMainView'
|
||||
UIPackage.AddPackage('base/newgroup/ui/NewGroup')
|
||||
self._view = main_view
|
||||
|
|
@ -21,7 +21,7 @@ function GroupMainView.new(main_view, root_view,par_veiw)
|
|||
end
|
||||
|
||||
function M:InitView(url)
|
||||
--print(url)
|
||||
---- print(url)
|
||||
-- BlurView(self._view:GetChild("bg"),true)
|
||||
if DataManager.SelfUser.agent > 0 then
|
||||
self._view:GetController('agent').selectedIndex = 1
|
||||
|
|
@ -37,7 +37,7 @@ function M:InitView(url)
|
|||
cgv:Show()
|
||||
cgv:SetCallback(function(name, pay_type, fg_type)
|
||||
ViewUtil.ShowModalWait(cgv._root_view)
|
||||
fgCtr:FG_CreateGroup(name,pay_type,fg_type,function(res)
|
||||
fgCtr:FG_CreateGroup(name, pay_type, fg_type, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
|
|
@ -147,7 +147,6 @@ function M:DEnterGroup()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
local function SortGroups(a, b)
|
||||
local sort_a = 0
|
||||
local sort_b = 0
|
||||
|
|
@ -157,9 +156,9 @@ local function SortGroups(a, b)
|
|||
return sort_a > sort_b
|
||||
end
|
||||
|
||||
function M:__fill_item(item,group)
|
||||
function M:__fill_item(item, group)
|
||||
item:GetChild('tex_name').text = group.name
|
||||
item:GetChild('tex_id').text = "ID:".. group.id
|
||||
item:GetChild('tex_id').text = "ID:" .. group.id
|
||||
local p_num = group.total_member_num
|
||||
item:GetChild('tex_p_num').text = p_num > 99 and '99+' or p_num
|
||||
|
||||
|
|
@ -171,7 +170,7 @@ function M:__fill_item(item,group)
|
|||
end
|
||||
else
|
||||
if group.show_num > 0 and group.room_num > group.show_num then
|
||||
item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num--group.show_num
|
||||
item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num --group.show_num
|
||||
else
|
||||
item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num
|
||||
end
|
||||
|
|
@ -192,7 +191,7 @@ function M:FillData()
|
|||
local new_info = {}
|
||||
for i = 1, #groups do
|
||||
local key = tostring(groups[i].id)
|
||||
local key1 = tostring(groups[i].id).."vip"
|
||||
local key1 = tostring(groups[i].id) .. "vip"
|
||||
if not fg_info[key] then
|
||||
new_info[key] = 0
|
||||
if not fg_info_changed then
|
||||
|
|
@ -220,7 +219,7 @@ function M:FillData()
|
|||
else
|
||||
self.btn_joingroup:GetController("info").selectedIndex = 1
|
||||
ctr_empty_group.selectedIndex = 0
|
||||
self:__fill_item(self.btn_joingroup,groups[1])
|
||||
self:__fill_item(self.btn_joingroup, groups[1])
|
||||
end
|
||||
|
||||
local lst_group = self._view:GetChild('lst_group')
|
||||
|
|
@ -230,7 +229,7 @@ function M:FillData()
|
|||
|
||||
local item = lst_group:AddItemFromPool()
|
||||
item.data = group
|
||||
self:__fill_item(item,group)
|
||||
self:__fill_item(item, group)
|
||||
|
||||
local btn_top = item:GetChild('btn_top')
|
||||
local ctr_select = btn_top:GetController('select')
|
||||
|
|
@ -240,7 +239,7 @@ function M:FillData()
|
|||
context:StopPropagation()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
ViewUtil.ShowModalWait(self._root_view)
|
||||
fgCtr:FG_TopGroup(group.id,ctr_select.selectedIndex == 0,function(res)
|
||||
fgCtr:FG_TopGroup(group.id, ctr_select.selectedIndex == 0, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
|
|
@ -274,7 +273,7 @@ function M:EnterGroup(fg_id)
|
|||
--self._view.visible = false
|
||||
end
|
||||
|
||||
function M:Show(fg_id,callback)
|
||||
function M:Show(fg_id, callback)
|
||||
local fgCtr1 = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr1:FG_GroupList(function(res)
|
||||
if self._is_destroy then
|
||||
|
|
@ -294,7 +293,6 @@ function M:Show(fg_id,callback)
|
|||
callback(-1)
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ local GroupManagerView = {}
|
|||
local M = GroupManagerView
|
||||
|
||||
function GroupManagerView.new(blur_view, gid, btn_type, callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupManagerView"
|
||||
-- self._close_destroy = true
|
||||
self._put_map = false
|
||||
|
|
@ -26,7 +26,7 @@ end
|
|||
-- 获取界面配置
|
||||
local function getPageConfig(id)
|
||||
--pt(MngPageConfig.PageList)
|
||||
for i=1,#MngPageConfig.PageList do
|
||||
for i = 1, #MngPageConfig.PageList do
|
||||
local tem = MngPageConfig.PageList[i]
|
||||
if tem.id == id then
|
||||
return tem
|
||||
|
|
@ -35,7 +35,7 @@ local function getPageConfig(id)
|
|||
end
|
||||
|
||||
function M:init(url, btn_type)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self.titleTxt = self._view:GetChild("n79")
|
||||
-- if btn_type == 2 then
|
||||
-- self._view:GetChild("n0"):GetChild("icon").url = "ui://m7iejg46p41ohx8"
|
||||
|
|
@ -57,7 +57,7 @@ function M:init(url, btn_type)
|
|||
|
||||
-- 初始化标题列表
|
||||
for i = 1, #self.page_config do
|
||||
-- print("page_config:"..self.page_config[i])
|
||||
-- -- print("page_config:"..self.page_config[i])
|
||||
local page = getPageConfig(self.page_config[i])
|
||||
--如果界面无show_key,或圈子中对应的key为true才显示界面
|
||||
if not page.show_key or (page.show_key and group[page.show_key]) then
|
||||
|
|
@ -105,7 +105,7 @@ function M:init(url, btn_type)
|
|||
local offset = get_offset(self._full_offset)
|
||||
gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset
|
||||
gmsv._view.height = GRoot.inst.height
|
||||
gmsv._view.x = 0--offset
|
||||
gmsv._view.x = 0 --offset
|
||||
|
||||
-- first_page_config = getPageConfig(self.page_config[2])
|
||||
-- gmsv = first_page_config.view.new(self.group_id, self._root_view)
|
||||
|
|
@ -138,20 +138,19 @@ function M:init(url, btn_type)
|
|||
local index = self.ctr_index.selectedIndex
|
||||
local page_info = getPageConfig(self.page_config[index + 1])
|
||||
if not self._view_map[index + 1] then
|
||||
|
||||
local tem = page_info.view.new(self.group_id, self._root_view)
|
||||
|
||||
-- anchor:AddRelation(self._root_view, RelationType.Size,true)
|
||||
--tem._view:Center(true)
|
||||
|
||||
--print("222222222222222",anchor._view)
|
||||
---- print("222222222222222",anchor._view)
|
||||
anchor:AddChild(tem._view)
|
||||
-- tem._view.parent = anchor
|
||||
|
||||
local offset = get_offset(self._full_offset)
|
||||
tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset
|
||||
tem._view.height = GRoot.inst.height
|
||||
tem._view.x = 0--offset
|
||||
tem._view.x = 0 --offset
|
||||
--tem._view:AddRelation(self._root_view, RelationType.Size)
|
||||
-- tem._view:MakeFullScreen()
|
||||
|
||||
|
|
@ -176,12 +175,10 @@ function M:init(url, btn_type)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack)
|
||||
self.groupInfoViewCallBack=groupInfoViewCallBack
|
||||
self.groupInfoViewCallBack = groupInfoViewCallBack
|
||||
end
|
||||
|
||||
|
||||
-- 获取指定ID的页面
|
||||
function M:GetPageByID(id)
|
||||
for i, v in pairs(self._view_map) do
|
||||
|
|
@ -221,7 +218,7 @@ end
|
|||
-- quick_access_id 是快速访问标志,打开对应id的页面
|
||||
function M:Show(quick_access_id)
|
||||
local index = self.ctr_index.selectedIndex
|
||||
printlog("index+1index+1index+1index+1 ",index+1)
|
||||
printlog("index+1index+1index+1index+1 ", index + 1)
|
||||
if not quick_access_id then
|
||||
local page_info = getPageConfig(self.page_config[index + 1])
|
||||
if page_info.refresh then self._view_map[index + 1]:initData() end
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ function M:FillFagData()
|
|||
|
||||
local tex_name = self._view:GetChild("tex_name")
|
||||
local name = tex_name.text
|
||||
print("jefe:")
|
||||
-- print("jefe:")
|
||||
pt(self.hpData)
|
||||
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
|
|
@ -469,7 +469,7 @@ function M:FillFagData()
|
|||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
--print("======新增玩法=============")
|
||||
---- print("======新增玩法=============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local play = {}
|
||||
|
|
@ -510,7 +510,7 @@ function M:FillFagData()
|
|||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
--print("======修改玩法=============")
|
||||
---- print("======修改玩法=============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local play = {}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ local GroupMemberFagLogView = {}
|
|||
local M = GroupMemberFagLogView
|
||||
|
||||
function GroupMemberFagLogView.new(group_id, member, not_manager)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupMemberFagLogView"
|
||||
self._close_destroy = true
|
||||
-- self._blur_view = blur_view
|
||||
|
|
@ -25,7 +25,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local btn_close = self._view:GetChild("btn_close")
|
||||
btn_close.onClick:Set(function()
|
||||
|
|
@ -51,8 +51,7 @@ function M:init(url)
|
|||
self:OnRenderItem(index, obj)
|
||||
end
|
||||
self.lst_fag.scrollPane.onPullUpRelease:Set(function()
|
||||
self:GetData(self.lst_fag.numItems+self.m_index)
|
||||
|
||||
self:GetData(self.lst_fag.numItems + self.m_index)
|
||||
end)
|
||||
if not self.not_manager then
|
||||
self._view:GetController("manager").selectedIndex = 1
|
||||
|
|
@ -75,7 +74,8 @@ function M:init(url)
|
|||
end
|
||||
end)
|
||||
|
||||
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"), -308, 0)
|
||||
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"),
|
||||
-308, 0)
|
||||
self.begin_time, self.end_time = self.time_panel:GetDate()
|
||||
|
||||
self._view:GetChild("btn_search").onClick:Set(function()
|
||||
|
|
@ -93,7 +93,7 @@ function M:GetFilter()
|
|||
local filter = 0
|
||||
for i = 1, 8 do
|
||||
local tem = math.pow(2, i - 1)
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||
if btn_filter and btn_filter.selected then
|
||||
filter = filter + tem
|
||||
|
|
@ -150,7 +150,8 @@ function M:GetData(index)
|
|||
if filter == 0 then return end
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time, function(res)
|
||||
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time,
|
||||
function(res)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
|
|
@ -160,7 +161,7 @@ function M:GetData(index)
|
|||
else
|
||||
local data = res.Data.hp_logs
|
||||
if #data == 0 then return end
|
||||
-- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
-- -- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
-- pt(data)
|
||||
-- pt(self.member)
|
||||
for i = 1, #data do
|
||||
|
|
@ -177,18 +178,18 @@ function M:GuoLv(data)
|
|||
if self.member.lev == 1 then
|
||||
local m_data_other = {}
|
||||
local m_data_my = {}
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
if self.member.uid ~= data[i].mgr_id then
|
||||
table.insert(m_data_other,data[i])
|
||||
table.insert(m_data_other, data[i])
|
||||
else
|
||||
table.insert(m_data_my,data[i])
|
||||
table.insert(m_data_my, data[i])
|
||||
end
|
||||
end
|
||||
-- printlog("比较计算=========m_data_my>>>",#m_data_my)
|
||||
-- printlog("比较计算=========m_data_other>>>",#m_data_other)
|
||||
|
||||
|
||||
if #m_data_my>0 and #m_data_other==0 then
|
||||
if #m_data_my > 0 and #m_data_other == 0 then
|
||||
for i = 1, #m_data_my do
|
||||
self.hp_log[#self.hp_log + 1] = m_data_my[i]
|
||||
end
|
||||
|
|
@ -203,9 +204,9 @@ function M:GuoLv(data)
|
|||
local m_data_other = {}
|
||||
local m_data_my = {}
|
||||
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
if self.member.uid ~= data[i].mgr_id then
|
||||
table.insert(m_data_other,data[i])
|
||||
table.insert(m_data_other, data[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -217,13 +218,12 @@ function M:GuoLv(data)
|
|||
end
|
||||
self.m_index = #data - #m_data_other + self.m_index
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function fillItem(data, obj)
|
||||
local num = d2ad(data.hp)
|
||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
|
||||
obj:GetChild("tex_reason").text = __getReason(data)
|
||||
end
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ function M:OnRenderItem(index, obj)
|
|||
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
|
||||
obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
|
||||
obj:GetChild("tex_reason").text = __getReason(data)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
|
||||
local btn_head = obj:GetChild("btn_head")
|
||||
btn_head.icon = "ui://Common/Head0"
|
||||
ImageLoad.Load(self.member.portrait, btn_head._iconObject)
|
||||
|
|
@ -261,7 +261,7 @@ function M:OnRenderItem(index, obj)
|
|||
local item = lst:AddItemFromPool()
|
||||
fillItem(data.detail[i], item)
|
||||
end
|
||||
obj.height =95 * (#data.detail+1)
|
||||
obj.height = 95 * (#data.detail + 1)
|
||||
self.lst_fag:RefreshVirtualList()
|
||||
self.lst_fag:ScrollToView(index)
|
||||
else
|
||||
|
|
@ -281,7 +281,7 @@ function M:OnRenderItem(index, obj)
|
|||
local item = lst:AddItemFromPool()
|
||||
fillItem(data.detail[i], item)
|
||||
end
|
||||
obj.height =95 * (#data.detail+1)
|
||||
obj.height = 95 * (#data.detail + 1)
|
||||
self.lst_fag:RefreshVirtualList()
|
||||
self.lst_fag:ScrollToView(index)
|
||||
end
|
||||
|
|
@ -311,7 +311,7 @@ end
|
|||
-- 填充日统计对象
|
||||
function M:OnRenderDailyItem(index, obj)
|
||||
local data = self.daily_count[#self.daily_count - index]
|
||||
obj:GetChild("tex_date").text = os.date("%Y-%m-%d",data.time)
|
||||
obj:GetChild("tex_date").text = os.date("%Y-%m-%d", data.time)
|
||||
local num = d2ad(data.num)
|
||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupSetPermissionView = import(".GroupSetPermissionView")
|
|||
local GroupBanSameTableView = import(".GroupBanSameTableView")
|
||||
local MngPermission = import(".MngPermission")
|
||||
local GroupSetTagView = import("../GroupSetTagView")
|
||||
local GroupSetMemberInfoDiaoduView=import('.GroupSetMemberInfoDiaoduView')
|
||||
local GroupSetMemberInfoDiaoduView = import('.GroupSetMemberInfoDiaoduView')
|
||||
local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView")
|
||||
|
||||
-- 牌友圈成员体力值记录
|
||||
|
|
@ -12,13 +12,13 @@ local GroupMemberOperateView = {}
|
|||
|
||||
local M = GroupMemberOperateView
|
||||
|
||||
function GroupMemberOperateView.new(group_id, member, callBack,callBack1)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function GroupMemberOperateView.new(group_id, member, callBack, callBack1)
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupMemberOperateView"
|
||||
self._close_destroy = true
|
||||
-- self._blur_view = blur_view
|
||||
--print("GroupMemberOperateView==============")
|
||||
---- print("GroupMemberOperateView==============")
|
||||
--pt(member)
|
||||
self.member = member
|
||||
self.group_id = group_id
|
||||
|
|
@ -30,11 +30,11 @@ end
|
|||
|
||||
-- 管理员权限
|
||||
local MngPermissionList = {
|
||||
DeleteMember = 1,-- 删除成员
|
||||
AddMember = 2,--添加成员
|
||||
SetFag = 3,--设置体力值
|
||||
BanPlaying = 4,--禁止游戏
|
||||
BanSameTable = 5--禁止同桌
|
||||
DeleteMember = 1, -- 删除成员
|
||||
AddMember = 2, --添加成员
|
||||
SetFag = 3, --设置体力值
|
||||
BanPlaying = 4, --禁止游戏
|
||||
BanSameTable = 5 --禁止同桌
|
||||
}
|
||||
|
||||
local function CheckPermission(lev, permission)
|
||||
|
|
@ -46,11 +46,11 @@ local function CheckPermission(lev, permission)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local member = self.member
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
--print("DataManager.groups:get(self.group_id)")
|
||||
---- print("DataManager.groups:get(self.group_id)")
|
||||
--pt(group)
|
||||
local perm_array = MngPermission.getPermData(group.permission)
|
||||
|
||||
|
|
@ -105,7 +105,6 @@ function M:init(url)
|
|||
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
self._view:GetChild("btn_deploy").onClick:Set(function()
|
||||
|
||||
local gniv = GroupNumberInputView.new(nil, function(num)
|
||||
ViewUtil.ShowModalWait()
|
||||
local parent_id = tonumber(num)
|
||||
|
|
@ -128,7 +127,7 @@ function M:init(url)
|
|||
ctr_superior.selectedIndex = 1
|
||||
ViewUtil.ShowBannerOnScreenCenter("调配玩家成功")
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"调配玩家失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "调配玩家失败")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -138,7 +137,7 @@ function M:init(url)
|
|||
end)
|
||||
local vipbtn = self._view:GetChild("btn_vip")
|
||||
if vipbtn ~= nil then
|
||||
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id ) then
|
||||
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id) then
|
||||
vipbtn.visible = true
|
||||
vipbtn.selected = member.isvip == 1 and true or false
|
||||
vipbtn.onClick:Set(function()
|
||||
|
|
@ -153,7 +152,7 @@ function M:init(url)
|
|||
self.callBack()
|
||||
else
|
||||
vipbtn.selected = not vipbtn.selected
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置vip失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置vip失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -167,7 +166,7 @@ function M:init(url)
|
|||
lst_mng:RemoveChildrenToPool()
|
||||
-- 删除按钮
|
||||
local option = group.option or 0
|
||||
if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option,1) == 1) or group.lev < member.lev then
|
||||
if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option, 1) == 1) or group.lev < member.lev then
|
||||
local btn_del = lst_mng:AddItemFromPool()
|
||||
btn_del.icon = "ui://NewGroup/mng_del"
|
||||
btn_del.onClick:Set(function()
|
||||
|
|
@ -187,12 +186,11 @@ function M:init(url)
|
|||
ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家")
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"删除成员失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "删除成员失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
_curren_msg:Show()
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -224,7 +222,7 @@ function M:init(url)
|
|||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
self.callBack()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"禁止娱乐失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "禁止娱乐失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -232,8 +230,8 @@ function M:init(url)
|
|||
end)
|
||||
end
|
||||
|
||||
--print("group.type=====================")
|
||||
--print(group.type)
|
||||
---- print("group.type=====================")
|
||||
---- print(group.type)
|
||||
--pt(group)
|
||||
if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
local btn_ban = lst_mng:AddItemFromPool()
|
||||
|
|
@ -263,7 +261,7 @@ function M:init(url)
|
|||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
self.callBack()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -286,14 +284,14 @@ function M:init(url)
|
|||
local btv = GroupBanSameTableView.new(self.blur_view, self.group_id, member.uid, res.Data)
|
||||
btv:Show()
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"获取禁止同桌列表失败!")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取禁止同桌列表失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
if group.lev == 1 and member.lev > 1 and member.partnerLev >0 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
if group.lev == 1 and member.lev > 1 and member.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
--if false then
|
||||
local btn_set_mng = lst_mng:AddItemFromPool()
|
||||
btn_set_mng.icon = "ui://NewGroup/zhengzu"
|
||||
|
|
@ -304,16 +302,13 @@ function M:init(url)
|
|||
ViewUtil.CloseModalWait()
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local diaoduView=GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
||||
diaoduView:SetCurrentState(res.Data.group_black+1,res.Data)
|
||||
local diaoduView = GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
||||
diaoduView:SetCurrentState(res.Data.group_black + 1, res.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"获取整组调度失败!")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取整组调度失败!")
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -344,7 +339,7 @@ function M:init(url)
|
|||
end
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置副群主失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置副群主失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -376,7 +371,7 @@ function M:init(url)
|
|||
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置合伙人失败失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置合伙人失败失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -454,7 +449,7 @@ function M:init(url)
|
|||
local btn_banplays = lst_mng:AddItemFromPool()
|
||||
btn_banplays.icon = "ui://NewGroup/mng_ban_plays"
|
||||
btn_banplays.onClick:Set(function()
|
||||
local banplays = GroupPartnerBanPlaysView.new(self.group_id,member.uid)
|
||||
local banplays = GroupPartnerBanPlaysView.new(self.group_id, member.uid)
|
||||
banplays:Show()
|
||||
end)
|
||||
end
|
||||
|
|
@ -463,8 +458,8 @@ function M:init(url)
|
|||
local btn_qiangzhi = lst_mng:AddItemFromPool()
|
||||
btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi"
|
||||
btn_qiangzhi.onClick:Set(function()
|
||||
local msg_tip = MsgWindow.new(self._root_view,"确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
||||
msg_tip.onOk:Add(function( ... )
|
||||
local msg_tip = MsgWindow.new(self._root_view, "确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
||||
msg_tip.onOk:Add(function(...)
|
||||
ViewUtil.ShowModalWait()
|
||||
fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
|
|
@ -499,10 +494,9 @@ function M:MovePartner(parent_id, member, obj)
|
|||
obj:GetController("show_superior").selectedIndex = 1
|
||||
ViewUtil.ShowBannerOnScreenCenter("转移成功")
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"转移失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "转移失败")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
|
@ -65,7 +65,7 @@ function M:OnRenderItem(index, obj)
|
|||
local hpStr
|
||||
local hpData = json.decode(play.hpData)
|
||||
if play.hpOnOff == 1 then
|
||||
-- print(vardump(play))
|
||||
-- -- print(vardump(play))
|
||||
local str_reward_type = play.rewardType == 1 and "赢家返点" or (play.rewardType == 2 and "人头返点")
|
||||
local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点"
|
||||
local str_hp_type = hpData.type == 1 and "固定抽水" or "浮动抽水"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
|
|||
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
||||
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||
|
||||
|
||||
local MngPermission = import('.MngPermission')
|
||||
|
|
@ -62,15 +62,15 @@ function M:FillView()
|
|||
end
|
||||
self.lst_member.scrollPane.onPullUpRelease:Set(
|
||||
function()
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
||||
self:GetMemberData(self.lst_member.numItems)
|
||||
end
|
||||
)
|
||||
|
||||
--local n50=self._view:GetChild('n50')
|
||||
--print(n50)
|
||||
---- print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
--print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
---- print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
-- 搜索玩家
|
||||
local ctr_search = self._view:GetController('search')
|
||||
self._view:GetChild('btn_search').onClick:Set(
|
||||
|
|
@ -151,7 +151,7 @@ function M:FillView()
|
|||
pt(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
||||
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
self:ClearNumTex()
|
||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||
else
|
||||
|
|
@ -174,9 +174,6 @@ function M:FillView()
|
|||
self:initData()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 快速访问
|
||||
|
|
@ -187,8 +184,8 @@ end
|
|||
|
||||
-- 获取成员数据
|
||||
function M:GetMemberData(index)
|
||||
--print("11111111111111111111")
|
||||
--print(debug.traceback())
|
||||
---- print("11111111111111111111")
|
||||
---- print(debug.traceback())
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
if index == 0 then
|
||||
group:clearMember()
|
||||
|
|
@ -287,11 +284,11 @@ function M:FillItem(obj, member, refresh)
|
|||
|
||||
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
||||
if member.parentId==0 then
|
||||
obj:GetChild('tex_shangjiID').text=""
|
||||
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||
if member.parentId == 0 then
|
||||
obj:GetChild('tex_shangjiID').text = ""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
||||
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
|
|||
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
||||
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||
local GroupStatMember = import('.GroupStatMember')
|
||||
local GroupMngFagPackView = import('../GroupMngFagPackView')
|
||||
|
||||
|
|
@ -64,14 +64,13 @@ function M:FillView()
|
|||
local rtype = self._view:GetChild("n132")
|
||||
rtype.visible = false
|
||||
|
||||
rtype.onChanged:Set(function ()
|
||||
rtype.onChanged:Set(function()
|
||||
if tostring(self.online) == rtype.value then
|
||||
return
|
||||
end
|
||||
self.online = tonumber(rtype.value)
|
||||
self:GetMemberData(0)
|
||||
--printlog("aaaaaaaa222222222222222222222222222222")
|
||||
|
||||
end)
|
||||
|
||||
-- 初始化成员列表
|
||||
|
|
@ -88,9 +87,9 @@ function M:FillView()
|
|||
)
|
||||
|
||||
--local n50=self._view:GetChild('n50')
|
||||
--print(n50)
|
||||
---- print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
--print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
---- print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
-- 搜索玩家
|
||||
local ctr_search = self._view:GetController('search')
|
||||
self._view:GetChild('btn_search').onClick:Set(
|
||||
|
|
@ -171,7 +170,7 @@ function M:FillView()
|
|||
pt(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
||||
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
self:ClearNumTex()
|
||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||
else
|
||||
|
|
@ -200,13 +199,10 @@ function M:FillView()
|
|||
--self._view:GetChild("n50").selected = true
|
||||
ctr_page.onChanged:Set(
|
||||
function()
|
||||
|
||||
self.stype = ctr_page.selectedIndex + 1
|
||||
self:initData()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 快速访问
|
||||
|
|
@ -217,8 +213,8 @@ end
|
|||
|
||||
-- 获取成员数据
|
||||
function M:GetMemberData(index)
|
||||
--print("11111111111111111111")
|
||||
--print(debug.traceback())
|
||||
---- print("11111111111111111111")
|
||||
---- print(debug.traceback())
|
||||
-- local iClear = false
|
||||
-- local rtype = self._view:GetChild("n132").value
|
||||
-- if tostring(self.online) ~= rtype then
|
||||
|
|
@ -324,8 +320,8 @@ function M:FillItem(obj, member, refresh)
|
|||
-- else
|
||||
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
|
||||
-- end
|
||||
--print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time))
|
||||
obj:GetChild('tex_last_login').text = "最近登录:"..os.date('%Y/%m/%d', member.last_time)
|
||||
---- print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time))
|
||||
obj:GetChild('tex_last_login').text = "最近登录:" .. os.date('%Y/%m/%d', member.last_time)
|
||||
else
|
||||
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
|
||||
end
|
||||
|
|
@ -336,11 +332,11 @@ function M:FillItem(obj, member, refresh)
|
|||
obj:GetChild('tex_ruhui').text = os.date('%Y/%m/%d %H:%M:%S', member.join_time)
|
||||
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
||||
if member.parentId==0 then
|
||||
obj:GetChild('tex_shangjiID').text=""
|
||||
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||
if member.parentId == 0 then
|
||||
obj:GetChild('tex_shangjiID').text = ""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
||||
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -451,16 +447,17 @@ function M:FillItem(obj, member, refresh)
|
|||
)
|
||||
|
||||
local btnBxx = obj:GetChild('btn_bxx')
|
||||
btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and not (DataManager.SelfUser.account_id == member.uid)
|
||||
btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and
|
||||
not (DataManager.SelfUser.account_id == member.uid)
|
||||
--btnBxx.visible = not (DataManager.SelfUser.account_id == member.uid)
|
||||
obj:GetChild('btn_bxx').onClick:Set(
|
||||
function()
|
||||
local ctrNum=1
|
||||
local ctrNum = 1
|
||||
-- if not (member.lev == 3 and member.partnerLev == 0) then
|
||||
-- ctrNum = 2
|
||||
-- end
|
||||
ctrNum=2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,member.uid)
|
||||
ctrNum = 2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum, member.uid)
|
||||
gmv:SetCallback(
|
||||
function()
|
||||
btnBxx.selected = false
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ local M = PlayerInfoView
|
|||
|
||||
function M.new(view, main_view, isHideIpAdds)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = PlayerInfoView})
|
||||
setmetatable(self, { __index = PlayerInfoView })
|
||||
self._view = view
|
||||
self._main_view = main_view
|
||||
self._isHideIpAdds = isHideIpAdds
|
||||
self.isShowTGTimer=false
|
||||
self.currentTime=0
|
||||
self.totalTime=0
|
||||
self.isShowTGTimer = false
|
||||
self.currentTime = 0
|
||||
self.totalTime = 0
|
||||
--self.isShow = fasle
|
||||
self:init()
|
||||
return self
|
||||
|
|
@ -41,33 +41,33 @@ function M:init()
|
|||
self._tex_player_name = player_name_score:GetChild('tex_player_name')
|
||||
self._tex_player_id = player_name_score:GetChild('tex_player_id')
|
||||
self._tex_score = player_name_score:GetChild('tex_score')
|
||||
self._tex_score.visible=true
|
||||
self._tex_score.visible = true
|
||||
|
||||
self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
if self._tex_score1 then
|
||||
self._tex_score1.visible=true
|
||||
self._tex_score1.visible = true
|
||||
end
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
if self._tex_score2 then
|
||||
self._tex_score2.visible=true
|
||||
self._tex_score2.visible = true
|
||||
end
|
||||
|
||||
self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
|
||||
if self._tex_n4 then
|
||||
self._tex_n4.visible=true
|
||||
self._tex_n4.visible = true
|
||||
end
|
||||
self._tex_n5 = self._view:GetChild("info"):GetChild("n5")
|
||||
if self._tex_n5 then
|
||||
self._tex_n5.visible=true
|
||||
self._tex_n5.visible = true
|
||||
end
|
||||
|
||||
self.n3Bg=self._view:GetChild("info"):GetChild("n3")
|
||||
self.n3Bg = self._view:GetChild("info"):GetChild("n3")
|
||||
if self.n3Bg then
|
||||
--self.n3Bg:SetSize(138,55)
|
||||
end
|
||||
self.zhanjitext=self._view:GetChild("text_jifen")
|
||||
self.zhanjitext = self._view:GetChild("text_jifen")
|
||||
if self.zhanjitext then
|
||||
self.zhanjitext.text=0
|
||||
self.zhanjitext.text = 0
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -83,57 +83,53 @@ function M:init()
|
|||
self._ctr_mask_voice = view:GetController('mask_voice')
|
||||
self._ctr_dismiss_room = view:GetController('dismiss_room')
|
||||
|
||||
self.PlayerTGTips=view:GetChild('tuoguanTips')
|
||||
self.PlayerTGTips = view:GetChild('tuoguanTips')
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowTGTips(isShow,time)
|
||||
function M:IsShowTGTips(isShow, time)
|
||||
--printlog("isShowisShowisShow==== ",isShow," time ",time)
|
||||
if time==nil then time=0 end
|
||||
if time == nil then time = 0 end
|
||||
|
||||
self.isShowTGTimer = isShow
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
||||
end
|
||||
self.currentTime=0
|
||||
self.currentTime = 0
|
||||
if isShow then
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text="开启托管剩余时间"..time.."s"
|
||||
self.PlayerTGTips.text = "开启托管剩余时间" .. time .. "s"
|
||||
end
|
||||
self.totalTime=time
|
||||
self.totalTime = time
|
||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||
--UpdateBeat:Add(self.OnUpdate,self)
|
||||
-- printlog("aaaaaaaaa111111111111111111111111111111")
|
||||
--TimerManager.RemoveTimer(self.OnUpdate)
|
||||
TimerManager.AddTimer(self.OnUpdate,self)
|
||||
TimerManager.AddTimer(self.OnUpdate, self)
|
||||
--printlog(self)
|
||||
else
|
||||
-- printlog("移除IsShowTGTips",self.isShow)
|
||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
||||
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:OnUpdate()
|
||||
--printlog("OnUpdate=====================")
|
||||
if self.isShowTGTimer then
|
||||
self.currentTime=self.currentTime+Time.deltaTime
|
||||
if self.currentTime>=1 then
|
||||
self.currentTime=0
|
||||
self.totalTime=self.totalTime-1
|
||||
self.currentTime = self.currentTime + Time.deltaTime
|
||||
if self.currentTime >= 1 then
|
||||
self.currentTime = 0
|
||||
self.totalTime = self.totalTime - 1
|
||||
--printlog("当前计时器===>>>",self.totalTime)
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text="开启托管剩余时间"..self.totalTime.."s"
|
||||
self.PlayerTGTips.text = "开启托管剩余时间" .. self.totalTime .. "s"
|
||||
end
|
||||
|
||||
if self.totalTime<=0 then
|
||||
self.isShowTGTimer=false
|
||||
if self.totalTime <= 0 then
|
||||
self.isShowTGTimer = false
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
|
|
@ -144,7 +140,6 @@ function M:OnUpdate()
|
|||
self:muShiPlayerUpdate()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:FillData(player)
|
||||
|
|
@ -176,9 +171,9 @@ function M:FillData(player)
|
|||
--and player.self_user.account_id ~= room.self_player.self_user.account_id
|
||||
then
|
||||
if player.orgSeat and player.orgSeat > 0 then
|
||||
self._tex_player_name.text = "玩家"..player.orgSeat
|
||||
self._tex_player_name.text = "玩家" .. player.orgSeat
|
||||
else
|
||||
self._tex_player_name.text = "玩家"..player.seat
|
||||
self._tex_player_name.text = "玩家" .. player.seat
|
||||
player.orgSeat = membe_clone(player.seat)
|
||||
end
|
||||
if self._tex_player_id then
|
||||
|
|
@ -187,7 +182,7 @@ function M:FillData(player)
|
|||
else
|
||||
self._tex_player_name.text = player.self_user.nick_name
|
||||
if self._tex_player_id then
|
||||
self._tex_player_id.text = "ID:".. player.self_user.account_id
|
||||
self._tex_player_id.text = "ID:" .. player.self_user.account_id
|
||||
end
|
||||
end
|
||||
self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0
|
||||
|
|
@ -208,7 +203,7 @@ function M:UpdateScore(score)
|
|||
local room = DataManager.CurrenRoom
|
||||
if room:checkHpNonnegative() then
|
||||
if self._player.cur_hp then
|
||||
-- print(self._player.total_hp)
|
||||
-- -- print(self._player.total_hp)
|
||||
-- if self._player.total_hp then
|
||||
-- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp)
|
||||
-- else
|
||||
|
|
@ -339,9 +334,11 @@ function M:MarkTuoguan()
|
|||
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
|
||||
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
|
||||
end
|
||||
|
||||
function M:UnmarkTuoguan()
|
||||
self:RemoveMarkFromHead('mark_tuoguan')
|
||||
end
|
||||
|
||||
-- 动态的往头像上加载组件
|
||||
function M:AddMarkToHead(com, key)
|
||||
if key then
|
||||
|
|
@ -354,6 +351,7 @@ function M:AddMarkToHead(com, key)
|
|||
com.touchable = false
|
||||
com.xy = self:GetHeadCenter()
|
||||
end
|
||||
|
||||
-- 动态移除组件
|
||||
function M:RemoveMarkFromHead(key)
|
||||
if self[key] then
|
||||
|
|
@ -363,11 +361,10 @@ function M:RemoveMarkFromHead(key)
|
|||
end
|
||||
|
||||
function M:Destroy()
|
||||
self.isShowTGTimer=false
|
||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
||||
self.OnUpdate=nil
|
||||
self.muShiPlayerUpdate=nil
|
||||
self.isShowTGTimer = false
|
||||
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||
self.OnUpdate = nil
|
||||
self.muShiPlayerUpdate = nil
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ function M:FillData(player)
|
|||
end
|
||||
end
|
||||
|
||||
print("============================playinfoview")
|
||||
-- print("============================playinfoview")
|
||||
pt(player)
|
||||
|
||||
if isHidden
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ end
|
|||
function ViewUtil.HandCardSort2(a, b)
|
||||
a = tonumber(string.sub(a, 2))
|
||||
b = tonumber(string.sub(b, 2))
|
||||
--print(a)
|
||||
--print(b)
|
||||
---- print(a)
|
||||
---- print(b)
|
||||
return a < b
|
||||
end
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ function get_gps(callback)
|
|||
end)
|
||||
end)
|
||||
if not s then
|
||||
--print("Error" .. e)
|
||||
---- print("Error" .. e)
|
||||
end
|
||||
elseif Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then
|
||||
-- DataManager.SelfUser.location = Location.new(string.format("%s,%s", math.random(10,20), math.random(10,20)))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local debugger_reLoadFile =nil
|
||||
local debugger_reLoadFile = nil
|
||||
xpcall(function()
|
||||
debugger_reLoadFile = require("luaideReLoadFile")
|
||||
end,function()
|
||||
end, function()
|
||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||
end)
|
||||
local debugger_stackInfo = nil
|
||||
|
|
@ -392,6 +392,7 @@ 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'
|
||||
|
|
@ -449,8 +450,8 @@ local function createJson()
|
|||
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||
-- scanned.
|
||||
function decode_scanConstant(s, startPos)
|
||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
||||
local constNames = {"true", "false", "null"}
|
||||
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||
local constNames = { "true", "false", "null" }
|
||||
|
||||
for i, k in pairs(constNames) do
|
||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||
|
|
@ -776,17 +777,17 @@ function print(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 1}
|
||||
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
|
|
@ -800,46 +801,48 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 2}
|
||||
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 3}
|
||||
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -977,7 +980,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 = ""
|
||||
|
|
@ -1026,7 +1029,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
|
||||
|
|
@ -1035,9 +1038,7 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
return "userdata", vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1045,11 +1046,11 @@ local function debugger_valueToString(v)
|
|||
local value = vtype
|
||||
xpcall(function()
|
||||
value = tostring(v)
|
||||
end,function()
|
||||
end, function()
|
||||
value = vtype
|
||||
end)
|
||||
return value, vtype
|
||||
elseif (vtype == "number" or vtype == "string" ) then
|
||||
elseif (vtype == "number" or vtype == "string") then
|
||||
return v, vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
|
|
@ -1057,12 +1058,12 @@ local function debugger_valueToString(v)
|
|||
end
|
||||
local function debugger_setVarInfo(name, value)
|
||||
local valueStr, valueType = debugger_valueToString(value)
|
||||
local nameStr,nameType = debugger_valueToString(name)
|
||||
if(valueStr == nil) then
|
||||
local nameStr, nameType = debugger_valueToString(name)
|
||||
if (valueStr == nil) then
|
||||
valueStr = valueType
|
||||
end
|
||||
local valueInfo = {
|
||||
name =nameStr,
|
||||
name = nameStr,
|
||||
valueType = valueType,
|
||||
valueStr = ZZBase64.encode(valueStr)
|
||||
}
|
||||
|
|
@ -1100,7 +1101,7 @@ local function debugger_getvalue(f)
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
return {locals = locals, ups = ups}
|
||||
return { locals = locals, ups = ups }
|
||||
end
|
||||
--获取堆栈
|
||||
debugger_stackInfo =
|
||||
|
|
@ -1146,7 +1147,7 @@ debugger_stackInfo =
|
|||
end
|
||||
end
|
||||
|
||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
||||
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||
local data = {
|
||||
stack = stackInfo.stack,
|
||||
vars = stackInfo.vars,
|
||||
|
|
@ -1157,7 +1158,7 @@ debugger_stackInfo =
|
|||
}
|
||||
LuaDebugger.currentTempFunc = data.funcs[1]
|
||||
return data
|
||||
end
|
||||
end
|
||||
|
||||
--===========================点断信息==================================================
|
||||
--根据不同的游戏引擎进行定时获取断点信息
|
||||
|
|
@ -1167,12 +1168,12 @@ 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
|
||||
local msg, status = breakInfoSocket:receive()
|
||||
if(LuaDebugger.isLaunch and status == "closed") then
|
||||
if (LuaDebugger.isLaunch and status == "closed") then
|
||||
os.exit()
|
||||
end
|
||||
if (msg) then
|
||||
|
|
@ -1182,12 +1183,12 @@ local function debugger_receiveDebugBreakInfo()
|
|||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||
LuaDebugger.loadScriptBody = netData.data
|
||||
debugger_exeLuaString()
|
||||
debugger_sendMsg(breakInfoSocket,LuaDebugger.event.C2S_LoadLuaScript,LuaDebugger.loadScriptBody)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||
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,
|
||||
|
|
@ -1290,7 +1291,7 @@ debugger_setBreak =
|
|||
end
|
||||
LuaDebugger.isHook = false
|
||||
end
|
||||
end
|
||||
end
|
||||
local function debugger_checkFileIsBreak(fileName)
|
||||
return LuaDebugger.breakInfos[fileName]
|
||||
end
|
||||
|
|
@ -1322,7 +1323,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. condition)
|
||||
setfenv(fun, currentTabble)
|
||||
return fun()
|
||||
|
|
@ -1332,21 +1333,20 @@ 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}
|
||||
local currentTabble = { _G = _G }
|
||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||
frameId = frameId
|
||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||
|
|
@ -1359,7 +1359,7 @@ debugger_exeLuaString = function()
|
|||
for k, v in pairs(locals) do
|
||||
currentTabble[k] = v
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
|
||||
local fun = loadstring(script)
|
||||
setfenv(fun, currentTabble)
|
||||
|
|
@ -1374,50 +1374,47 @@ 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.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
||||
--根据key 值在 value 查找
|
||||
local function debugger_getTablekey(key,keyType,value)
|
||||
if(keyType == -1) then
|
||||
local function debugger_getTablekey(key, keyType, value)
|
||||
if (keyType == -1) then
|
||||
return key
|
||||
elseif(keyType == 1) then
|
||||
elseif (keyType == 1) then
|
||||
return tonumber(key)
|
||||
elseif(keyType == 2) then
|
||||
elseif (keyType == 2) then
|
||||
local valueKey = nil
|
||||
for k,v in pairs(value) do
|
||||
for k, v in pairs(value) do
|
||||
local nameType = type(k)
|
||||
if(nameType == "userdata" or nameType == "table") then
|
||||
if (nameType == "userdata" or nameType == "table") then
|
||||
if (not LuaDebugger.isFoxGloryProject) then
|
||||
valueKey = tostring(k)
|
||||
if(key == valueKey) then
|
||||
if (key == valueKey) then
|
||||
return k
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
--@region vars check
|
||||
local localValueChangeIndex = -1
|
||||
|
|
@ -1432,7 +1429,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(firstKeyName == name) then
|
||||
if (firstKeyName == name) then
|
||||
localValueChangeIndex = i
|
||||
oldValue = value
|
||||
end
|
||||
|
|
@ -1450,7 +1447,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
upValueFun = func
|
||||
oldValue = value
|
||||
upValueChangeIndex = i
|
||||
|
|
@ -1462,8 +1459,8 @@ local function debugger_setVarValue(server, data)
|
|||
end
|
||||
i = i + 1
|
||||
end
|
||||
--@endregion
|
||||
local vars = {locals = locals, ups = ups}
|
||||
--@endregion
|
||||
local vars = { locals = locals, ups = ups }
|
||||
|
||||
local function loadScript()
|
||||
local currentTabble = {}
|
||||
|
|
@ -1480,7 +1477,7 @@ local function debugger_setVarValue(server, data)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. data.value)
|
||||
setfenv(fun, currentTabble)
|
||||
newValue = fun()
|
||||
|
|
@ -1490,7 +1487,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
print(error, "============================")
|
||||
-- print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1499,39 +1496,37 @@ local function debugger_setVarValue(server, data)
|
|||
-- local 查找并替换
|
||||
local keyLength = #data.keys
|
||||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
if (keyLength == 1) then
|
||||
if (localValueChangeIndex ~= -1) then
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
elseif (upValueFun ~= nil) then
|
||||
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||
else
|
||||
--全局变量查找
|
||||
if(_G[firstKeyName]) then
|
||||
if (_G[firstKeyName]) then
|
||||
_G[firstKeyName] = newValue
|
||||
end
|
||||
end
|
||||
else
|
||||
if(not oldValue) then
|
||||
if(_G[firstKeyName]) then
|
||||
if (not oldValue) then
|
||||
if (_G[firstKeyName]) then
|
||||
oldValue = _G[firstKeyName]
|
||||
end
|
||||
end
|
||||
local tempValue = oldValue
|
||||
for i=2,keyLength-1 do
|
||||
if(tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
||||
for i = 2, keyLength - 1 do
|
||||
if (tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||
end
|
||||
end
|
||||
if(tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
||||
if (tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||
end
|
||||
end
|
||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1543,41 +1538,41 @@ checkSetVar =
|
|||
function()
|
||||
if (LuaDebugger.isSetVar) then
|
||||
LuaDebugger.isSetVar = false
|
||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("设置变量", error)
|
||||
-- print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
elseif (LuaDebugger.isLoadLuaScript) then
|
||||
LuaDebugger.isLoadLuaScript = false
|
||||
debugger_exeLuaString()
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("执行代码", error)
|
||||
-- print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
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
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("重新加载文件", error)
|
||||
-- print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -1627,7 +1622,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
print(error, "====>")
|
||||
-- print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1894,7 +1889,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1944,7 +1938,6 @@ 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
|
||||
|
|
@ -1979,9 +1972,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,
|
||||
|
|
@ -2018,7 +2011,7 @@ local function debugger_loop(server)
|
|||
while true do
|
||||
local line, status = server:receive()
|
||||
if (status == "closed") then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
|
|
@ -2030,13 +2023,12 @@ local function debugger_loop(server)
|
|||
local event = netData.event
|
||||
local body = netData.data
|
||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2045,7 +2037,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2156,29 +2148,26 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
if (not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.Run) then
|
||||
if(event == "line") then
|
||||
if (LuaDebugger.Run) then
|
||||
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
|
||||
if (linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if(isCheck) then
|
||||
if (isCheck) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if(not isCheck) then
|
||||
if (not isCheck) then
|
||||
return
|
||||
end
|
||||
else
|
||||
|
|
@ -2209,7 +2198,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
|
||||
|
|
@ -2217,7 +2206,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
|
||||
|
|
@ -2259,7 +2248,6 @@ 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
|
||||
|
|
@ -2299,13 +2287,13 @@ debug_hook = function(event, line)
|
|||
end
|
||||
pathNamesCount = pathNamesCount - 1
|
||||
hitPathNamesCount = hitPathNamesCount - 1
|
||||
checkCount = checkCount+1
|
||||
checkCount = checkCount + 1
|
||||
|
||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
if(checkCount>0) then
|
||||
if (checkCount > 0) then
|
||||
break;
|
||||
end
|
||||
else
|
||||
|
|
@ -2384,7 +2372,7 @@ end
|
|||
local function debugger_xpcall()
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
if(data.stack and data.stack[1]) then
|
||||
if (data.stack and data.stack[1]) then
|
||||
data.stack[1].isXpCall = true
|
||||
end
|
||||
--挂起等待调试器作出反应
|
||||
|
|
@ -2396,8 +2384,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
|
||||
|
|
@ -2427,15 +2415,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)
|
||||
|
|
@ -2444,16 +2432,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
|
||||
|
|
@ -2461,7 +2449,7 @@ function StartDebug(host, port)
|
|||
start,
|
||||
function(error)
|
||||
-- body
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
|
|
@ -2478,8 +2466,8 @@ ZZBase64.__code = {
|
|||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||
};
|
||||
ZZBase64.__decode = {}
|
||||
for k,v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
||||
for k, v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||
end
|
||||
|
||||
function ZZBase64.encode(text)
|
||||
|
|
@ -2489,14 +2477,14 @@ function ZZBase64.encode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
for i = 1, len, 3 do
|
||||
local a = string.byte(text, i )
|
||||
local a = string.byte(text, i)
|
||||
local b = string.byte(text, i + 1)
|
||||
local c = string.byte(text, i + 2)
|
||||
-- num = a<<16 + b<<8 + c
|
||||
local num = a * 65536 + b * 256 + c
|
||||
for j = 1, 4 do
|
||||
--tmp = num >> ((4 -j) * 6)
|
||||
local tmp = math.floor(num / (2 ^ ((4-j) * 6)))
|
||||
local tmp = math.floor(num / (2 ^ ((4 - j) * 6)))
|
||||
--curPos = tmp&0x3f
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2533,13 +2521,13 @@ function ZZBase64.__left2(res, index, text, len)
|
|||
res[index + 3] = "="
|
||||
end
|
||||
|
||||
function ZZBase64.__left1(res, index,text, len)
|
||||
function ZZBase64.__left1(res, index, text, len)
|
||||
local num = string.byte(text, len + 1)
|
||||
num = num * 16
|
||||
|
||||
local tmp = math.floor(num / 64)
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index ] = ZZBase64.__code[curPos]
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
||||
curPos = num % 64 + 1
|
||||
res[index + 1] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2562,11 +2550,11 @@ function ZZBase64.decode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
local decode = ZZBase64.__decode
|
||||
for i =1, len, 4 do
|
||||
local a = decode[string.byte(text,i )]
|
||||
local b = decode[string.byte(text,i + 1)]
|
||||
local c = decode[string.byte(text,i + 2)]
|
||||
local d = decode[string.byte(text,i + 3)]
|
||||
for i = 1, len, 4 do
|
||||
local a = decode[string.byte(text, i)]
|
||||
local b = decode[string.byte(text, i + 1)]
|
||||
local c = decode[string.byte(text, i + 2)]
|
||||
local d = decode[string.byte(text, i + 3)]
|
||||
|
||||
--num = a<<18 + b<<12 + c<<6 + d
|
||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||
|
|
@ -2575,7 +2563,7 @@ function ZZBase64.decode(text)
|
|||
num = math.floor(num / 256)
|
||||
local f = string.char(num % 256)
|
||||
num = math.floor(num / 256)
|
||||
res[index ] = string.char(num % 256)
|
||||
res[index] = string.char(num % 256)
|
||||
res[index + 1] = f
|
||||
res[index + 2] = e
|
||||
index = index + 3
|
||||
|
|
@ -2611,7 +2599,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local debugger_reLoadFile =nil
|
||||
local debugger_reLoadFile = nil
|
||||
xpcall(function()
|
||||
debugger_reLoadFile = require("luaideReLoadFile")
|
||||
end,function()
|
||||
end, function()
|
||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||
end)
|
||||
local sethook = debug.sethook
|
||||
|
|
@ -13,9 +13,9 @@ local checkSetVar = nil
|
|||
local loadstring_ = nil
|
||||
local debugger_sendMsg = nil
|
||||
if (loadstring) then
|
||||
loadstring_ = loadstring
|
||||
loadstring_ = loadstring
|
||||
else
|
||||
loadstring_ = load
|
||||
loadstring_ = load
|
||||
end
|
||||
local ZZBase64 = {}
|
||||
local LuaDebugTool_ = nil
|
||||
|
|
@ -366,6 +366,7 @@ 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'
|
||||
|
|
@ -423,8 +424,8 @@ local function createJson()
|
|||
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||
-- scanned.
|
||||
function decode_scanConstant(s, startPos)
|
||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
||||
local constNames = {"true", "false", "null"}
|
||||
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||
local constNames = { "true", "false", "null" }
|
||||
|
||||
for i, k in pairs(constNames) do
|
||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||
|
|
@ -694,7 +695,7 @@ local LuaDebugger = {
|
|||
runLineCount = 0,
|
||||
--分割字符串缓存
|
||||
splitFilePaths = {},
|
||||
version="0.9.3",
|
||||
version = "0.9.3",
|
||||
serVarLevel = 4
|
||||
}
|
||||
local debug_hook = nil
|
||||
|
|
@ -747,17 +748,17 @@ function print(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 1}
|
||||
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
|
|
@ -771,46 +772,48 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 2}
|
||||
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 3}
|
||||
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -948,7 +951,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 = ""
|
||||
|
|
@ -997,7 +1000,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
|
||||
|
|
@ -1005,27 +1008,24 @@ local function debugger_valueToString(v)
|
|||
local vtype = type(v)
|
||||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject ) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
return "userdata", vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
||||
local value = vtype
|
||||
xpcall(function()
|
||||
if(LuaDebugger.isFoxGloryProject) then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
value = vtype
|
||||
else
|
||||
value = tostring(v)
|
||||
end
|
||||
|
||||
end,function()
|
||||
end, function()
|
||||
value = vtype
|
||||
end)
|
||||
return value, vtype
|
||||
elseif (vtype == "number" or vtype == "string" ) then
|
||||
elseif (vtype == "number" or vtype == "string") then
|
||||
return v, vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
|
|
@ -1033,12 +1033,12 @@ local function debugger_valueToString(v)
|
|||
end
|
||||
local function debugger_setVarInfo(name, value)
|
||||
local valueStr, valueType = debugger_valueToString(value)
|
||||
local nameStr,nameType = debugger_valueToString(name)
|
||||
if(valueStr == nil) then
|
||||
local nameStr, nameType = debugger_valueToString(name)
|
||||
if (valueStr == nil) then
|
||||
valueStr = valueType
|
||||
end
|
||||
local valueInfo = {
|
||||
name =nameStr,
|
||||
name = nameStr,
|
||||
valueType = valueType,
|
||||
valueStr = ZZBase64.encode(valueStr)
|
||||
}
|
||||
|
|
@ -1076,7 +1076,7 @@ local function debugger_getvalue(f)
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
return {locals = locals, ups = ups}
|
||||
return { locals = locals, ups = ups }
|
||||
end
|
||||
--获取堆栈
|
||||
debugger_stackInfo =
|
||||
|
|
@ -1122,7 +1122,7 @@ debugger_stackInfo =
|
|||
end
|
||||
end
|
||||
|
||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
||||
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||
local data = {
|
||||
stack = stackInfo.stack,
|
||||
vars = stackInfo.vars,
|
||||
|
|
@ -1133,23 +1133,23 @@ debugger_stackInfo =
|
|||
}
|
||||
|
||||
return data
|
||||
end
|
||||
end
|
||||
--==============================工具方法 end======================================================
|
||||
--===========================点断信息==================================================
|
||||
--根据不同的游戏引擎进行定时获取断点信息
|
||||
--CCDirector:sharedDirector():getScheduler()
|
||||
local debugger_setBreak = nil
|
||||
local function debugger_receiveDebugBreakInfo()
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
if (not jit) then
|
||||
if (_VERSION) then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
else
|
||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
local msg, status = breakInfoSocket:receive()
|
||||
if(LuaDebugger.isLaunch == true and status == "closed") then
|
||||
if (LuaDebugger.isLaunch == true and status == "closed") then
|
||||
os.exit()
|
||||
end
|
||||
if (msg) then
|
||||
|
|
@ -1159,7 +1159,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||
LuaDebugger.loadScriptBody = netData.data
|
||||
debugger_exeLuaString()
|
||||
debugger_sendMsg(breakInfoSocket,LuaDebugger.event.C2S_LoadLuaScript,LuaDebugger.loadScriptBody)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||
LuaDebugger.reLoadFileBody = netData.data
|
||||
LuaDebugger.isReLoadFile = false
|
||||
|
|
@ -1267,7 +1267,7 @@ debugger_setBreak =
|
|||
end
|
||||
LuaDebugger.isHook = false
|
||||
end
|
||||
end
|
||||
end
|
||||
local function debugger_checkFileIsBreak(fileName)
|
||||
return LuaDebugger.breakInfos[fileName]
|
||||
end
|
||||
|
|
@ -1299,7 +1299,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. condition)
|
||||
setfenv(fun, currentTabble)
|
||||
return fun()
|
||||
|
|
@ -1309,21 +1309,20 @@ 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}
|
||||
local currentTabble = { _G = _G }
|
||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||
frameId = frameId
|
||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||
|
|
@ -1336,7 +1335,7 @@ debugger_exeLuaString = function()
|
|||
for k, v in pairs(locals) do
|
||||
currentTabble[k] = v
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
|
||||
local fun = loadstring(script)
|
||||
setfenv(fun, currentTabble)
|
||||
|
|
@ -1351,50 +1350,47 @@ 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.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
||||
--根据key 值在 value 查找
|
||||
local function debugger_getTablekey(key,keyType,value)
|
||||
if(keyType == -1) then
|
||||
local function debugger_getTablekey(key, keyType, value)
|
||||
if (keyType == -1) then
|
||||
return key
|
||||
elseif(keyType == 1) then
|
||||
elseif (keyType == 1) then
|
||||
return tonumber(key)
|
||||
elseif(keyType == 2) then
|
||||
elseif (keyType == 2) then
|
||||
local valueKey = nil
|
||||
for k,v in pairs(value) do
|
||||
for k, v in pairs(value) do
|
||||
local nameType = type(k)
|
||||
if(nameType == "userdata" or nameType == "table") then
|
||||
if (nameType == "userdata" or nameType == "table") then
|
||||
if (not LuaDebugger.isFoxGloryProject) then
|
||||
valueKey = tostring(k)
|
||||
if(key == valueKey) then
|
||||
if (key == valueKey) then
|
||||
return k
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
--@region vars check
|
||||
local localValueChangeIndex = -1
|
||||
|
|
@ -1409,7 +1405,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(firstKeyName == name) then
|
||||
if (firstKeyName == name) then
|
||||
localValueChangeIndex = i
|
||||
oldValue = value
|
||||
end
|
||||
|
|
@ -1427,7 +1423,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
upValueFun = func
|
||||
oldValue = value
|
||||
upValueChangeIndex = i
|
||||
|
|
@ -1439,8 +1435,8 @@ local function debugger_setVarValue(server, data)
|
|||
end
|
||||
i = i + 1
|
||||
end
|
||||
--@endregion
|
||||
local vars = {locals = locals, ups = ups}
|
||||
--@endregion
|
||||
local vars = { locals = locals, ups = ups }
|
||||
|
||||
local function loadScript()
|
||||
local currentTabble = {}
|
||||
|
|
@ -1457,7 +1453,7 @@ local function debugger_setVarValue(server, data)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. data.value)
|
||||
setfenv(fun, currentTabble)
|
||||
newValue = fun()
|
||||
|
|
@ -1467,7 +1463,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
print(error, "============================")
|
||||
-- print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1476,39 +1472,37 @@ local function debugger_setVarValue(server, data)
|
|||
-- local 查找并替换
|
||||
local keyLength = #data.keys
|
||||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
if (keyLength == 1) then
|
||||
if (localValueChangeIndex ~= -1) then
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
elseif (upValueFun ~= nil) then
|
||||
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||
else
|
||||
--全局变量查找
|
||||
if(_G[firstKeyName]) then
|
||||
if (_G[firstKeyName]) then
|
||||
_G[firstKeyName] = newValue
|
||||
end
|
||||
end
|
||||
else
|
||||
if(not oldValue) then
|
||||
if(_G[firstKeyName]) then
|
||||
if (not oldValue) then
|
||||
if (_G[firstKeyName]) then
|
||||
oldValue = _G[firstKeyName]
|
||||
end
|
||||
end
|
||||
local tempValue = oldValue
|
||||
for i=2,keyLength-1 do
|
||||
if(tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
||||
for i = 2, keyLength - 1 do
|
||||
if (tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||
end
|
||||
end
|
||||
if(tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
||||
if (tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||
end
|
||||
end
|
||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1520,41 +1514,41 @@ checkSetVar =
|
|||
function()
|
||||
if (LuaDebugger.isSetVar) then
|
||||
LuaDebugger.isSetVar = false
|
||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("设置变量", error)
|
||||
-- print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
elseif (LuaDebugger.isLoadLuaScript) then
|
||||
LuaDebugger.isLoadLuaScript = false
|
||||
debugger_exeLuaString()
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("执行代码", error)
|
||||
-- print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
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
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("重新加载文件", error)
|
||||
-- print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -1604,7 +1598,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
print(error, "====>")
|
||||
-- print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1745,7 +1739,6 @@ 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
|
||||
|
|
@ -1801,7 +1794,6 @@ 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
|
||||
|
|
@ -1874,7 +1866,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1924,11 +1915,10 @@ 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
|
||||
if(LuaDebugger.isFoxGloryProject) then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
value = "function"
|
||||
else
|
||||
value = tostring(value)
|
||||
|
|
@ -1963,9 +1953,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,
|
||||
|
|
@ -1991,7 +1981,6 @@ local function ResetDebugInfo()
|
|||
LuaDebugger.StepIn = false
|
||||
LuaDebugger.StepNext = false
|
||||
LuaDebugger.StepOut = false
|
||||
|
||||
end
|
||||
local function debugger_loop(server)
|
||||
server = debug_server
|
||||
|
|
@ -2002,7 +1991,7 @@ local function debugger_loop(server)
|
|||
while true do
|
||||
local line, status = server:receive()
|
||||
if (status == "closed") then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
|
|
@ -2014,13 +2003,12 @@ local function debugger_loop(server)
|
|||
local event = netData.event
|
||||
local body = netData.data
|
||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2029,7 +2017,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2041,7 +2029,7 @@ local function debugger_loop(server)
|
|||
LuaDebugger.currentDebuggerData = nil
|
||||
LuaDebugger.Run = true
|
||||
LuaDebugger.tempRunFlag = true
|
||||
LuaDebugger.currentLine= nil
|
||||
LuaDebugger.currentLine = nil
|
||||
local data = coroutine.yield()
|
||||
LuaDebugger.serVarLevel = 4
|
||||
LuaDebugger.currentDebuggerData = data
|
||||
|
|
@ -2142,42 +2130,37 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
if (not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.Run) then
|
||||
if(event == "line") then
|
||||
if (LuaDebugger.Run) then
|
||||
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
|
||||
if (linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if(isCheck) then
|
||||
if (isCheck) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if(not isCheck) then
|
||||
if (not isCheck) then
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local file = nil
|
||||
if(event == "line") then
|
||||
|
||||
if (event == "line") then
|
||||
local funs = nil
|
||||
local funlength =0
|
||||
if(LuaDebugger.currentDebuggerData) then
|
||||
local funlength = 0
|
||||
if (LuaDebugger.currentDebuggerData) then
|
||||
funs = LuaDebugger.currentDebuggerData.funcs
|
||||
funlength = #funs
|
||||
end
|
||||
|
|
@ -2185,47 +2168,44 @@ debug_hook = function(event, line)
|
|||
local tempFunc = stepInfo.func
|
||||
local source = stepInfo.source
|
||||
file = getSource(source);
|
||||
if(source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||
if(funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount+1
|
||||
if (source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||
if (funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount + 1
|
||||
end
|
||||
local breakInfo = LuaDebugger.breakInfos[file]
|
||||
local breakData = nil
|
||||
local ischeck = false
|
||||
if(breakInfo) then
|
||||
|
||||
if (breakInfo) then
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
if(lines and lines[line]) then
|
||||
if (lines and lines[line]) then
|
||||
ischeck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local isHit = false
|
||||
if(ischeck) then
|
||||
|
||||
if (ischeck) then
|
||||
--并且在断点中
|
||||
local info = stepInfo
|
||||
local source = string.lower( info.source )
|
||||
local fullName,dir,fileName = debugger_getFilePathInfo(source)
|
||||
local source = string.lower(info.source)
|
||||
local fullName, dir, fileName = debugger_getFilePathInfo(source)
|
||||
local hitPathNames = splitFilePath(fullName)
|
||||
|
||||
local hitCounts = {}
|
||||
local debugHitCounts = nil
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
|
||||
local lines = lineInfo.lines
|
||||
local pathNames = lineInfo.pathNames
|
||||
debugHitCounts = lineInfo.hitCounts
|
||||
if(lines and lines[line]) then
|
||||
if (lines and lines[line]) then
|
||||
breakData = lines[line]
|
||||
--判断路径
|
||||
hitCounts[k] = 0
|
||||
local hitPathNamesCount = #hitPathNames
|
||||
local pathNamesCount = #pathNames
|
||||
local checkCount = 0;
|
||||
while(true) do
|
||||
while (true) do
|
||||
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
||||
break
|
||||
else
|
||||
|
|
@ -2233,57 +2213,55 @@ debug_hook = function(event, line)
|
|||
end
|
||||
pathNamesCount = pathNamesCount - 1
|
||||
hitPathNamesCount = hitPathNamesCount - 1
|
||||
checkCount = checkCount+1
|
||||
if(pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
checkCount = checkCount + 1
|
||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
if(checkCount>0) then
|
||||
if (checkCount > 0) then
|
||||
break;
|
||||
end
|
||||
else
|
||||
breakData = nil
|
||||
end
|
||||
end
|
||||
if(breakData) then
|
||||
if (breakData) then
|
||||
local hitFieName = ""
|
||||
local maxCount = 0
|
||||
for k, v in pairs(hitCounts) do
|
||||
if(v > maxCount) then
|
||||
if (v > maxCount) then
|
||||
maxCount = v
|
||||
hitFieName = k;
|
||||
end
|
||||
end
|
||||
local hitPathNamesLength = #hitPathNames
|
||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||
if(hitFieName ~= "") then
|
||||
|
||||
if (hitFieName ~= "") then
|
||||
local hitCount = breakData.hitCondition
|
||||
local clientHitCount = debugHitCounts[breakData.line]
|
||||
clientHitCount = clientHitCount + 1
|
||||
debugHitCounts[breakData.line] = clientHitCount
|
||||
if(funs and funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
if (funs and funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
elseif(LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||
elseif (LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.tempRunFlag = nil
|
||||
elseif(clientHitCount >= hitCount) then
|
||||
elseif (clientHitCount >= hitCount) then
|
||||
isHit = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if(LuaDebugger.StepOut) then
|
||||
if(funlength == 1) then
|
||||
if (LuaDebugger.StepOut) then
|
||||
if (funlength == 1) then
|
||||
ResetDebugInfo();
|
||||
LuaDebugger.Run = true
|
||||
return
|
||||
else
|
||||
if(funs[2] == tempFunc) then
|
||||
if (funs[2] == tempFunc) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- print("StepIn 挂起")
|
||||
-- -- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2292,35 +2270,34 @@ debug_hook = function(event, line)
|
|||
end
|
||||
end
|
||||
|
||||
if(LuaDebugger.StepIn) then
|
||||
if(funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
if (LuaDebugger.StepIn) then
|
||||
if (funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
return
|
||||
end
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- print("StepIn 挂起")
|
||||
-- -- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.StepNext ) then
|
||||
if (LuaDebugger.StepNext) then
|
||||
local isNext = false
|
||||
if(funs) then
|
||||
for i,f in ipairs(funs) do
|
||||
if(tempFunc == f) then
|
||||
if(LuaDebugger.currentLine == line) then
|
||||
if (funs) then
|
||||
for i, f in ipairs(funs) do
|
||||
if (tempFunc == f) then
|
||||
if (LuaDebugger.currentLine == line) then
|
||||
return
|
||||
end
|
||||
isNext =true
|
||||
isNext = true
|
||||
break;
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
isNext =true
|
||||
isNext = true
|
||||
end
|
||||
if(isNext) then
|
||||
if (isNext) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
|
|
@ -2335,17 +2312,15 @@ debug_hook = function(event, line)
|
|||
|
||||
|
||||
--断点判断
|
||||
if(isHit) then
|
||||
|
||||
|
||||
if (isHit) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(3, sevent)
|
||||
--挂起等待调试器作出反应
|
||||
if(breakData and breakData.condition) then
|
||||
debugger_conditionStr(breakData.condition,data.vars,function()
|
||||
if (breakData and breakData.condition) then
|
||||
debugger_conditionStr(breakData.condition, data.vars, function()
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
end)
|
||||
|
|
@ -2362,7 +2337,7 @@ end
|
|||
local function debugger_xpcall()
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
if(data.stack and data.stack[1]) then
|
||||
if (data.stack and data.stack[1]) then
|
||||
data.stack[1].isXpCall = true
|
||||
end
|
||||
--挂起等待调试器作出反应
|
||||
|
|
@ -2371,12 +2346,11 @@ 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)
|
||||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
local server = socket.connect(controller_host, controller_port)
|
||||
debug_server = server;
|
||||
|
|
@ -2384,7 +2358,7 @@ local function start()
|
|||
--创建breakInfo socket
|
||||
socket = createSocket()
|
||||
breakInfoSocket = socket.connect(controller_host, controller_port)
|
||||
if(breakInfoSocket) then
|
||||
if (breakInfoSocket) then
|
||||
breakInfoSocket:settimeout(0)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
||||
name = "breakPointSocket"
|
||||
|
|
@ -2399,46 +2373,41 @@ 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 进行调试!")
|
||||
if (not jit) then
|
||||
if (_VERSION) then
|
||||
-- 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")
|
||||
if (not host) then
|
||||
-- print("error host nil")
|
||||
end
|
||||
if(not port) then
|
||||
print("error prot nil")
|
||||
if (not port) then
|
||||
-- print("error prot nil")
|
||||
end
|
||||
if(type(host) ~= "string") then
|
||||
print("error host not string")
|
||||
if (type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
end
|
||||
if(type(port) ~= "number") then
|
||||
print("error host not number")
|
||||
if (type(port) ~= "number") then
|
||||
-- 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
|
||||
|
|
@ -2448,10 +2417,10 @@ ZZBase64.__code = {
|
|||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||
};
|
||||
};
|
||||
ZZBase64.__decode = {}
|
||||
for k,v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
||||
for k, v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||
end
|
||||
|
||||
function ZZBase64.encode(text)
|
||||
|
|
@ -2461,14 +2430,14 @@ function ZZBase64.encode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
for i = 1, len, 3 do
|
||||
local a = string.byte(text, i )
|
||||
local a = string.byte(text, i)
|
||||
local b = string.byte(text, i + 1)
|
||||
local c = string.byte(text, i + 2)
|
||||
-- num = a<<16 + b<<8 + c
|
||||
local num = a * 65536 + b * 256 + c
|
||||
for j = 1, 4 do
|
||||
--tmp = num >> ((4 -j) * 6)
|
||||
local tmp = math.floor(num / (2 ^ ((4-j) * 6)))
|
||||
local tmp = math.floor(num / (2 ^ ((4 - j) * 6)))
|
||||
--curPos = tmp&0x3f
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2505,13 +2474,13 @@ function ZZBase64.__left2(res, index, text, len)
|
|||
res[index + 3] = "="
|
||||
end
|
||||
|
||||
function ZZBase64.__left1(res, index,text, len)
|
||||
function ZZBase64.__left1(res, index, text, len)
|
||||
local num = string.byte(text, len + 1)
|
||||
num = num * 16
|
||||
|
||||
local tmp = math.floor(num / 64)
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index ] = ZZBase64.__code[curPos]
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
||||
curPos = num % 64 + 1
|
||||
res[index + 1] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2534,11 +2503,11 @@ function ZZBase64.decode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
local decode = ZZBase64.__decode
|
||||
for i =1, len, 4 do
|
||||
local a = decode[string.byte(text,i )]
|
||||
local b = decode[string.byte(text,i + 1)]
|
||||
local c = decode[string.byte(text,i + 2)]
|
||||
local d = decode[string.byte(text,i + 3)]
|
||||
for i = 1, len, 4 do
|
||||
local a = decode[string.byte(text, i)]
|
||||
local b = decode[string.byte(text, i + 1)]
|
||||
local c = decode[string.byte(text, i + 2)]
|
||||
local d = decode[string.byte(text, i + 3)]
|
||||
|
||||
--num = a<<18 + b<<12 + c<<6 + d
|
||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||
|
|
@ -2547,7 +2516,7 @@ function ZZBase64.decode(text)
|
|||
num = math.floor(num / 256)
|
||||
local f = string.char(num % 256)
|
||||
num = math.floor(num / 256)
|
||||
res[index ] = string.char(num % 256)
|
||||
res[index] = string.char(num % 256)
|
||||
res[index + 1] = f
|
||||
res[index + 2] = e
|
||||
index = index + 3
|
||||
|
|
@ -2583,7 +2552,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
local breakSocketHandle,debugXpCall = require("LuaDebugjit")("localhost",7003)
|
||||
local breakSocketHandle, debugXpCall = require("LuaDebugjit")("localhost", 7003)
|
||||
local timer = Timer.New(function()
|
||||
breakSocketHandle() end, 1, -1, false)
|
||||
breakSocketHandle()
|
||||
end, 1, -1, false)
|
||||
timer:Start();
|
||||
|
||||
require "Core.init"
|
||||
json = require 'cjson'
|
||||
require'FairyGUI'
|
||||
require'Game.ControllerManager'
|
||||
require'Game.ViewManager'
|
||||
require'Game.DataManager'
|
||||
require 'FairyGUI'
|
||||
require 'Game.ControllerManager'
|
||||
require 'Game.ViewManager'
|
||||
require 'Game.DataManager'
|
||||
require "Game.ExtendManager"
|
||||
require "Game.ExtendHotupdate"
|
||||
require "TableData"
|
||||
|
|
@ -19,7 +20,7 @@ Utils = Game.Utils
|
|||
PlayerPrefs = UnityEngine.PlayerPrefs
|
||||
RuntimePlatform = UnityEngine.RuntimePlatform
|
||||
Application = UnityEngine.Application
|
||||
Screen=UnityEngine.Screen
|
||||
Screen = UnityEngine.Screen
|
||||
ResourcesManager = taurus.unity.ResourcesManager
|
||||
-- require 'tolua.reflection'
|
||||
-- tolua.loadassembly('Assembly-CSharp')
|
||||
|
|
@ -31,21 +32,22 @@ local _game_info
|
|||
local panel = nil
|
||||
|
||||
|
||||
oldGameVersion=2 --1 原始 2 老游戏新加功能
|
||||
oldGameVersion = 2 --1 原始 2 老游戏新加功能
|
||||
|
||||
--主入口函数。从这里开始lua逻辑
|
||||
function Main()
|
||||
--PlayerPrefs.DeleteKey('session_id')
|
||||
Application.targetFrameRate = 60
|
||||
FairyGUI.UIConfig.buttonSound =FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",typeof(UnityEngine.AudioClip)))
|
||||
FairyGUI.UIConfig.buttonSound = FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",
|
||||
typeof(UnityEngine.AudioClip)))
|
||||
FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S"
|
||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN","base/static/fonts/SIYUAN.TTF"),null)
|
||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
||||
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
||||
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
||||
--pt(_game_info)
|
||||
debug_print = false--GetGameInfo("debug_print")
|
||||
debug_print = false --GetGameInfo("debug_print")
|
||||
if Application.platform == RuntimePlatform.WindowsEditor then
|
||||
debug_print = true
|
||||
end
|
||||
|
|
@ -89,10 +91,8 @@ function Main()
|
|||
end
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function GetGameInfo(key)
|
||||
return _game_info[key]
|
||||
end
|
||||
|
|
@ -107,7 +107,7 @@ function GetGameInfoPlatform(key)
|
|||
return _platfrom[key]
|
||||
end
|
||||
|
||||
function BlurView(view,enabled)
|
||||
function BlurView(view, enabled)
|
||||
if enabled then
|
||||
local bf = FairyGUI.BlurFilter()
|
||||
bf.blurSize = 0.05
|
||||
|
|
@ -142,7 +142,7 @@ function ShareScreenShot(n, callback)
|
|||
json_data["mediaObject"] = mediaObject
|
||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||
json_data["scene"] = 0
|
||||
local json_str =json.encode(json_data)
|
||||
local json_str = json.encode(json_data)
|
||||
TakeScreenShot.Take(function()
|
||||
-- 1微信 2支付宝
|
||||
GameApplication.Instance:ShareLink(n or 1, json_str, nil)
|
||||
|
|
@ -152,44 +152,43 @@ function ShareScreenShot(n, callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function shareQRCodePicture(url,secene)
|
||||
--print(debug.traceback())
|
||||
print(url)
|
||||
print(secene)
|
||||
function shareQRCodePicture(url, 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)
|
||||
QRCodePicture.CombanitePicture(tex1,tex2,393,1334-802-250,filename)
|
||||
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)
|
||||
QRCodePicture.CombanitePicture(tex1, tex2, 393, 1334 - 802 - 250, filename)
|
||||
|
||||
GameApplication.Instance:ShareLink(1, json_str, nil)
|
||||
end
|
||||
|
||||
|
||||
function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name)
|
||||
|
||||
end
|
||||
|
||||
function UISetController(root,controller_name, gear_display, selectedIndex)
|
||||
function UISetController(root, controller_name, gear_display, selectedIndex)
|
||||
local ctr = root:GetController(controller_name)
|
||||
local gear = gear_display:GetGear(0)
|
||||
|
||||
|
|
@ -202,9 +201,9 @@ local bg_url = nil
|
|||
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 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
|
||||
|
|
@ -225,7 +224,7 @@ function AddPanel(child)
|
|||
panel:AddChild(child)
|
||||
end
|
||||
|
||||
function AddPanelAt(child,index)
|
||||
function AddPanelAt(child, index)
|
||||
child:MakeFullScreen()
|
||||
child:AddRelation(GRoot.inst, RelationType.Size)
|
||||
panel:AddChildAt(child, index)
|
||||
|
|
@ -261,118 +260,111 @@ function OnApplicationActive()
|
|||
ViewManager.OnApplicationActive()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function pt(...)
|
||||
if debug_print then
|
||||
local arg={...}
|
||||
local has=false
|
||||
for _,v in pairs(arg) do
|
||||
if v and type(v)=="table" then
|
||||
has=true
|
||||
local arg = { ... }
|
||||
local has = false
|
||||
for _, v in pairs(arg) do
|
||||
if v and type(v) == "table" then
|
||||
has = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not has then
|
||||
print(...)
|
||||
-- print(...)
|
||||
end
|
||||
|
||||
local content=""
|
||||
for _,v in pairs(arg) do
|
||||
if v=="table" then
|
||||
content=content..tostring(v).."\n"
|
||||
local content = ""
|
||||
for _, v in pairs(arg) do
|
||||
if v == "table" then
|
||||
content = content .. tostring(v) .. "\n"
|
||||
else
|
||||
content=content.."==>[T]:"..LuaPrint(v,limit),debug.traceback().."\n"
|
||||
content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n"
|
||||
end
|
||||
print(content)
|
||||
-- print(content)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function LuaPrint(lua_table,limit,indent,step)
|
||||
step=step or 0
|
||||
indent=indent or 0
|
||||
local content=""
|
||||
if limit~=nil then
|
||||
if step>limit then
|
||||
function LuaPrint(lua_table, limit, indent, step)
|
||||
step = step or 0
|
||||
indent = indent or 0
|
||||
local content = ""
|
||||
if limit ~= nil then
|
||||
if step > limit then
|
||||
return "..."
|
||||
end
|
||||
end
|
||||
if step>10 then
|
||||
return content.."..."
|
||||
if step > 10 then
|
||||
return content .. "..."
|
||||
end
|
||||
if lua_table==nil then
|
||||
if lua_table == nil then
|
||||
return "nil"
|
||||
end
|
||||
if type(lua_table)=="userdata" or type(lua_table)=="lightuserdata" or type(lua_table)=="thread" then
|
||||
if type(lua_table) == "userdata" or type(lua_table) == "lightuserdata" or type(lua_table) == "thread" then
|
||||
return tostring(lua_table)
|
||||
end
|
||||
|
||||
if type(lua_table)=="string" or type(lua_table)=="number" then
|
||||
return "[No-Table]:"..lua_table
|
||||
if type(lua_table) == "string" or type(lua_table) == "number" then
|
||||
return "[No-Table]:" .. lua_table
|
||||
end
|
||||
|
||||
for k,v in pairs(lua_table) do
|
||||
if k~="_class_type" then
|
||||
local szBuffer=""
|
||||
Typev=type(v)
|
||||
if Typev =="table" then
|
||||
szBuffer="{"
|
||||
for k, v in pairs(lua_table) do
|
||||
if k ~= "_class_type" then
|
||||
local szBuffer = ""
|
||||
Typev = type(v)
|
||||
if Typev == "table" then
|
||||
szBuffer = "{"
|
||||
end
|
||||
local szPrefix=string.rep(" ",indent)
|
||||
if Typev=="table" and v._fields then
|
||||
local kk,vv=next(v._fields)
|
||||
if type(vv)=="table" then
|
||||
content=content.."\n\t"..kk.name.."={"..LuaPrint(vv._fields,5,indent+1,step+1).."}"
|
||||
local szPrefix = string.rep(" ", indent)
|
||||
if Typev == "table" and v._fields then
|
||||
local kk, vv = next(v._fields)
|
||||
if type(vv) == "table" then
|
||||
content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) ..
|
||||
"}"
|
||||
else
|
||||
content=content.."\n\t"..kk.name.."="..vv
|
||||
content = content .. "\n\t" .. kk.name .. "=" .. vv
|
||||
end
|
||||
else
|
||||
if type(k)=="table" then
|
||||
if type(k) == "table" then
|
||||
if k.name then
|
||||
if type(v)~="table" then
|
||||
content=content.."\n"..k.name.."="..v
|
||||
if type(v) ~= "table" then
|
||||
content = content .. "\n" .. k.name .. "=" .. v
|
||||
else
|
||||
content=content.."\n"..k.name.." = list:"
|
||||
local tmp="\n"
|
||||
for ka,va in ipairs(v) do
|
||||
tmp=tmp.."#"..ka.."_"..tostring(va)
|
||||
content = content .. "\n" .. k.name .. " = list:"
|
||||
local tmp = "\n"
|
||||
for ka, va in ipairs(v) do
|
||||
tmp = tmp .. "#" .. ka .. "_" .. tostring(va)
|
||||
end
|
||||
content=content..tmp
|
||||
content = content .. tmp
|
||||
end
|
||||
end
|
||||
|
||||
elseif type(k)=="function" then
|
||||
content=content.."\n fun=function"
|
||||
elseif type(k) == "function" then
|
||||
content = content .. "\n fun=function"
|
||||
else
|
||||
formatting=szPrefix..tostring(k).." = "..szBuffer
|
||||
if Typev=="table" then
|
||||
content=content.."\n"..formatting
|
||||
content=content..LuaPrint(v,limit,indent+1,step+1)
|
||||
content=content.."\n"..szPrefix.."},"
|
||||
formatting = szPrefix .. tostring(k) .. " = " .. szBuffer
|
||||
if Typev == "table" then
|
||||
content = content .. "\n" .. formatting
|
||||
content = content .. LuaPrint(v, limit, indent + 1, step + 1)
|
||||
content = content .. "\n" .. szPrefix .. "},"
|
||||
else
|
||||
local szValue=""
|
||||
if Typev=="string" then
|
||||
szValue=string.format("%q",v)
|
||||
local szValue = ""
|
||||
if Typev == "string" then
|
||||
szValue = string.format("%q", v)
|
||||
else
|
||||
szValue=tostring(v)
|
||||
szValue = tostring(v)
|
||||
end
|
||||
content=content.."\n"..formatting..(szValue or "nil")..","
|
||||
content = content .. "\n" .. formatting .. (szValue or "nil") .. ","
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return content
|
||||
end
|
||||
|
||||
|
||||
function printlog(...)
|
||||
if debug_print then
|
||||
print(...)
|
||||
-- print(...)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
local debugger_reLoadFile =nil
|
||||
local debugger_reLoadFile = nil
|
||||
xpcall(function()
|
||||
debugger_reLoadFile = require("luaideReLoadFile")
|
||||
end,function()
|
||||
end, function()
|
||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||
end)
|
||||
local debugger_stackInfo = nil
|
||||
|
|
@ -392,6 +392,7 @@ 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'
|
||||
|
|
@ -449,8 +450,8 @@ local function createJson()
|
|||
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||
-- scanned.
|
||||
function decode_scanConstant(s, startPos)
|
||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
||||
local constNames = {"true", "false", "null"}
|
||||
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||
local constNames = { "true", "false", "null" }
|
||||
|
||||
for i, k in pairs(constNames) do
|
||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||
|
|
@ -776,17 +777,17 @@ function print(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 1}
|
||||
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
|
|
@ -800,46 +801,48 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 2}
|
||||
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 3}
|
||||
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -977,7 +980,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 = ""
|
||||
|
|
@ -1026,7 +1029,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
|
||||
|
|
@ -1035,9 +1038,7 @@ local function debugger_valueToString(v)
|
|||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
return "userdata", vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
|
|
@ -1045,11 +1046,11 @@ local function debugger_valueToString(v)
|
|||
local value = vtype
|
||||
xpcall(function()
|
||||
value = tostring(v)
|
||||
end,function()
|
||||
end, function()
|
||||
value = vtype
|
||||
end)
|
||||
return value, vtype
|
||||
elseif (vtype == "number" or vtype == "string" ) then
|
||||
elseif (vtype == "number" or vtype == "string") then
|
||||
return v, vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
|
|
@ -1057,12 +1058,12 @@ local function debugger_valueToString(v)
|
|||
end
|
||||
local function debugger_setVarInfo(name, value)
|
||||
local valueStr, valueType = debugger_valueToString(value)
|
||||
local nameStr,nameType = debugger_valueToString(name)
|
||||
if(valueStr == nil) then
|
||||
local nameStr, nameType = debugger_valueToString(name)
|
||||
if (valueStr == nil) then
|
||||
valueStr = valueType
|
||||
end
|
||||
local valueInfo = {
|
||||
name =nameStr,
|
||||
name = nameStr,
|
||||
valueType = valueType,
|
||||
valueStr = ZZBase64.encode(valueStr)
|
||||
}
|
||||
|
|
@ -1100,7 +1101,7 @@ local function debugger_getvalue(f)
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
return {locals = locals, ups = ups}
|
||||
return { locals = locals, ups = ups }
|
||||
end
|
||||
--获取堆栈
|
||||
debugger_stackInfo =
|
||||
|
|
@ -1146,7 +1147,7 @@ debugger_stackInfo =
|
|||
end
|
||||
end
|
||||
|
||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
||||
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||
local data = {
|
||||
stack = stackInfo.stack,
|
||||
vars = stackInfo.vars,
|
||||
|
|
@ -1157,7 +1158,7 @@ debugger_stackInfo =
|
|||
}
|
||||
LuaDebugger.currentTempFunc = data.funcs[1]
|
||||
return data
|
||||
end
|
||||
end
|
||||
|
||||
--===========================点断信息==================================================
|
||||
--根据不同的游戏引擎进行定时获取断点信息
|
||||
|
|
@ -1167,12 +1168,12 @@ 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
|
||||
local msg, status = breakInfoSocket:receive()
|
||||
if(LuaDebugger.isLaunch and status == "closed") then
|
||||
if (LuaDebugger.isLaunch and status == "closed") then
|
||||
os.exit()
|
||||
end
|
||||
if (msg) then
|
||||
|
|
@ -1182,12 +1183,12 @@ local function debugger_receiveDebugBreakInfo()
|
|||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||
LuaDebugger.loadScriptBody = netData.data
|
||||
debugger_exeLuaString()
|
||||
debugger_sendMsg(breakInfoSocket,LuaDebugger.event.C2S_LoadLuaScript,LuaDebugger.loadScriptBody)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||
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,
|
||||
|
|
@ -1290,7 +1291,7 @@ debugger_setBreak =
|
|||
end
|
||||
LuaDebugger.isHook = false
|
||||
end
|
||||
end
|
||||
end
|
||||
local function debugger_checkFileIsBreak(fileName)
|
||||
return LuaDebugger.breakInfos[fileName]
|
||||
end
|
||||
|
|
@ -1322,7 +1323,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. condition)
|
||||
setfenv(fun, currentTabble)
|
||||
return fun()
|
||||
|
|
@ -1332,21 +1333,20 @@ 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}
|
||||
local currentTabble = { _G = _G }
|
||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||
frameId = frameId
|
||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||
|
|
@ -1359,7 +1359,7 @@ debugger_exeLuaString = function()
|
|||
for k, v in pairs(locals) do
|
||||
currentTabble[k] = v
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
|
||||
local fun = loadstring(script)
|
||||
setfenv(fun, currentTabble)
|
||||
|
|
@ -1374,50 +1374,47 @@ 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.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
||||
--根据key 值在 value 查找
|
||||
local function debugger_getTablekey(key,keyType,value)
|
||||
if(keyType == -1) then
|
||||
local function debugger_getTablekey(key, keyType, value)
|
||||
if (keyType == -1) then
|
||||
return key
|
||||
elseif(keyType == 1) then
|
||||
elseif (keyType == 1) then
|
||||
return tonumber(key)
|
||||
elseif(keyType == 2) then
|
||||
elseif (keyType == 2) then
|
||||
local valueKey = nil
|
||||
for k,v in pairs(value) do
|
||||
for k, v in pairs(value) do
|
||||
local nameType = type(k)
|
||||
if(nameType == "userdata" or nameType == "table") then
|
||||
if (nameType == "userdata" or nameType == "table") then
|
||||
if (not LuaDebugger.isFoxGloryProject) then
|
||||
valueKey = tostring(k)
|
||||
if(key == valueKey) then
|
||||
if (key == valueKey) then
|
||||
return k
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
--@region vars check
|
||||
local localValueChangeIndex = -1
|
||||
|
|
@ -1432,7 +1429,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(firstKeyName == name) then
|
||||
if (firstKeyName == name) then
|
||||
localValueChangeIndex = i
|
||||
oldValue = value
|
||||
end
|
||||
|
|
@ -1450,7 +1447,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
upValueFun = func
|
||||
oldValue = value
|
||||
upValueChangeIndex = i
|
||||
|
|
@ -1462,8 +1459,8 @@ local function debugger_setVarValue(server, data)
|
|||
end
|
||||
i = i + 1
|
||||
end
|
||||
--@endregion
|
||||
local vars = {locals = locals, ups = ups}
|
||||
--@endregion
|
||||
local vars = { locals = locals, ups = ups }
|
||||
|
||||
local function loadScript()
|
||||
local currentTabble = {}
|
||||
|
|
@ -1480,7 +1477,7 @@ local function debugger_setVarValue(server, data)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. data.value)
|
||||
setfenv(fun, currentTabble)
|
||||
newValue = fun()
|
||||
|
|
@ -1490,7 +1487,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
print(error, "============================")
|
||||
-- print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1499,39 +1496,37 @@ local function debugger_setVarValue(server, data)
|
|||
-- local 查找并替换
|
||||
local keyLength = #data.keys
|
||||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
if (keyLength == 1) then
|
||||
if (localValueChangeIndex ~= -1) then
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
elseif (upValueFun ~= nil) then
|
||||
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||
else
|
||||
--全局变量查找
|
||||
if(_G[firstKeyName]) then
|
||||
if (_G[firstKeyName]) then
|
||||
_G[firstKeyName] = newValue
|
||||
end
|
||||
end
|
||||
else
|
||||
if(not oldValue) then
|
||||
if(_G[firstKeyName]) then
|
||||
if (not oldValue) then
|
||||
if (_G[firstKeyName]) then
|
||||
oldValue = _G[firstKeyName]
|
||||
end
|
||||
end
|
||||
local tempValue = oldValue
|
||||
for i=2,keyLength-1 do
|
||||
if(tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
||||
for i = 2, keyLength - 1 do
|
||||
if (tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||
end
|
||||
end
|
||||
if(tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
||||
if (tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||
end
|
||||
end
|
||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1543,41 +1538,41 @@ checkSetVar =
|
|||
function()
|
||||
if (LuaDebugger.isSetVar) then
|
||||
LuaDebugger.isSetVar = false
|
||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("设置变量", error)
|
||||
-- print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
elseif (LuaDebugger.isLoadLuaScript) then
|
||||
LuaDebugger.isLoadLuaScript = false
|
||||
debugger_exeLuaString()
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("执行代码", error)
|
||||
-- print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
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
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("重新加载文件", error)
|
||||
-- print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -1627,7 +1622,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
print(error, "====>")
|
||||
-- print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1894,7 +1889,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1944,7 +1938,6 @@ 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
|
||||
|
|
@ -1979,9 +1972,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,
|
||||
|
|
@ -2018,7 +2011,7 @@ local function debugger_loop(server)
|
|||
while true do
|
||||
local line, status = server:receive()
|
||||
if (status == "closed") then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
|
|
@ -2030,13 +2023,12 @@ local function debugger_loop(server)
|
|||
local event = netData.event
|
||||
local body = netData.data
|
||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2045,7 +2037,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2156,29 +2148,26 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
if (not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.Run) then
|
||||
if(event == "line") then
|
||||
if (LuaDebugger.Run) then
|
||||
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
|
||||
if (linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if(isCheck) then
|
||||
if (isCheck) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if(not isCheck) then
|
||||
if (not isCheck) then
|
||||
return
|
||||
end
|
||||
else
|
||||
|
|
@ -2209,7 +2198,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
|
||||
|
|
@ -2217,7 +2206,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
|
||||
|
|
@ -2259,7 +2248,6 @@ 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
|
||||
|
|
@ -2299,13 +2287,13 @@ debug_hook = function(event, line)
|
|||
end
|
||||
pathNamesCount = pathNamesCount - 1
|
||||
hitPathNamesCount = hitPathNamesCount - 1
|
||||
checkCount = checkCount+1
|
||||
checkCount = checkCount + 1
|
||||
|
||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
if(checkCount>0) then
|
||||
if (checkCount > 0) then
|
||||
break;
|
||||
end
|
||||
else
|
||||
|
|
@ -2384,7 +2372,7 @@ end
|
|||
local function debugger_xpcall()
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
if(data.stack and data.stack[1]) then
|
||||
if (data.stack and data.stack[1]) then
|
||||
data.stack[1].isXpCall = true
|
||||
end
|
||||
--挂起等待调试器作出反应
|
||||
|
|
@ -2396,8 +2384,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
|
||||
|
|
@ -2427,15 +2415,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)
|
||||
|
|
@ -2444,16 +2432,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
|
||||
|
|
@ -2461,7 +2449,7 @@ function StartDebug(host, port)
|
|||
start,
|
||||
function(error)
|
||||
-- body
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||
|
|
@ -2478,8 +2466,8 @@ ZZBase64.__code = {
|
|||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||
};
|
||||
ZZBase64.__decode = {}
|
||||
for k,v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
||||
for k, v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||
end
|
||||
|
||||
function ZZBase64.encode(text)
|
||||
|
|
@ -2489,14 +2477,14 @@ function ZZBase64.encode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
for i = 1, len, 3 do
|
||||
local a = string.byte(text, i )
|
||||
local a = string.byte(text, i)
|
||||
local b = string.byte(text, i + 1)
|
||||
local c = string.byte(text, i + 2)
|
||||
-- num = a<<16 + b<<8 + c
|
||||
local num = a * 65536 + b * 256 + c
|
||||
for j = 1, 4 do
|
||||
--tmp = num >> ((4 -j) * 6)
|
||||
local tmp = math.floor(num / (2 ^ ((4-j) * 6)))
|
||||
local tmp = math.floor(num / (2 ^ ((4 - j) * 6)))
|
||||
--curPos = tmp&0x3f
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2533,13 +2521,13 @@ function ZZBase64.__left2(res, index, text, len)
|
|||
res[index + 3] = "="
|
||||
end
|
||||
|
||||
function ZZBase64.__left1(res, index,text, len)
|
||||
function ZZBase64.__left1(res, index, text, len)
|
||||
local num = string.byte(text, len + 1)
|
||||
num = num * 16
|
||||
|
||||
local tmp = math.floor(num / 64)
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index ] = ZZBase64.__code[curPos]
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
||||
curPos = num % 64 + 1
|
||||
res[index + 1] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2562,11 +2550,11 @@ function ZZBase64.decode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
local decode = ZZBase64.__decode
|
||||
for i =1, len, 4 do
|
||||
local a = decode[string.byte(text,i )]
|
||||
local b = decode[string.byte(text,i + 1)]
|
||||
local c = decode[string.byte(text,i + 2)]
|
||||
local d = decode[string.byte(text,i + 3)]
|
||||
for i = 1, len, 4 do
|
||||
local a = decode[string.byte(text, i)]
|
||||
local b = decode[string.byte(text, i + 1)]
|
||||
local c = decode[string.byte(text, i + 2)]
|
||||
local d = decode[string.byte(text, i + 3)]
|
||||
|
||||
--num = a<<18 + b<<12 + c<<6 + d
|
||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||
|
|
@ -2575,7 +2563,7 @@ function ZZBase64.decode(text)
|
|||
num = math.floor(num / 256)
|
||||
local f = string.char(num % 256)
|
||||
num = math.floor(num / 256)
|
||||
res[index ] = string.char(num % 256)
|
||||
res[index] = string.char(num % 256)
|
||||
res[index + 1] = f
|
||||
res[index + 2] = e
|
||||
index = index + 3
|
||||
|
|
@ -2611,7 +2599,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local debugger_reLoadFile =nil
|
||||
local debugger_reLoadFile = nil
|
||||
xpcall(function()
|
||||
debugger_reLoadFile = require("luaideReLoadFile")
|
||||
end,function()
|
||||
end, function()
|
||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||
end)
|
||||
local sethook = debug.sethook
|
||||
|
|
@ -13,9 +13,9 @@ local checkSetVar = nil
|
|||
local loadstring_ = nil
|
||||
local debugger_sendMsg = nil
|
||||
if (loadstring) then
|
||||
loadstring_ = loadstring
|
||||
loadstring_ = loadstring
|
||||
else
|
||||
loadstring_ = load
|
||||
loadstring_ = load
|
||||
end
|
||||
local ZZBase64 = {}
|
||||
local LuaDebugTool_ = nil
|
||||
|
|
@ -366,6 +366,7 @@ 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'
|
||||
|
|
@ -423,8 +424,8 @@ local function createJson()
|
|||
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||
-- scanned.
|
||||
function decode_scanConstant(s, startPos)
|
||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
||||
local constNames = {"true", "false", "null"}
|
||||
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||
local constNames = { "true", "false", "null" }
|
||||
|
||||
for i, k in pairs(constNames) do
|
||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||
|
|
@ -694,7 +695,7 @@ local LuaDebugger = {
|
|||
runLineCount = 0,
|
||||
--分割字符串缓存
|
||||
splitFilePaths = {},
|
||||
version="0.9.3",
|
||||
version = "0.9.3",
|
||||
serVarLevel = 4
|
||||
}
|
||||
local debug_hook = nil
|
||||
|
|
@ -747,17 +748,17 @@ function print(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 1}
|
||||
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
|
|
@ -771,46 +772,48 @@ function luaIdePrintWarn(...)
|
|||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 2}
|
||||
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function luaIdePrintErr(...)
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||
debugger_print(...)
|
||||
end
|
||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||
if (debug_server) then
|
||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||
local str = ""
|
||||
if (#arg == 0) then
|
||||
arg = {"nil"}
|
||||
arg = { "nil" }
|
||||
end
|
||||
for k, v in pairs(arg) do
|
||||
str = str .. tostring(v) .. "\t"
|
||||
end
|
||||
local sendMsg = {
|
||||
event = LuaDebugger.event.C2S_LuaPrint,
|
||||
data = {msg = ZZBase64.encode(str), type = 3}
|
||||
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||
}
|
||||
local sendStr = json.encode(sendMsg)
|
||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 辅助方法
|
||||
|
|
@ -948,7 +951,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 = ""
|
||||
|
|
@ -997,7 +1000,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
|
||||
|
|
@ -1005,27 +1008,24 @@ local function debugger_valueToString(v)
|
|||
local vtype = type(v)
|
||||
local vstr = nil
|
||||
if (vtype == "userdata") then
|
||||
if (LuaDebugger.isFoxGloryProject ) then
|
||||
|
||||
return "userdata",vtype
|
||||
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
return "userdata", vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
end
|
||||
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
||||
local value = vtype
|
||||
xpcall(function()
|
||||
if(LuaDebugger.isFoxGloryProject) then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
value = vtype
|
||||
else
|
||||
value = tostring(v)
|
||||
end
|
||||
|
||||
end,function()
|
||||
end, function()
|
||||
value = vtype
|
||||
end)
|
||||
return value, vtype
|
||||
elseif (vtype == "number" or vtype == "string" ) then
|
||||
elseif (vtype == "number" or vtype == "string") then
|
||||
return v, vtype
|
||||
else
|
||||
return tostring(v), vtype
|
||||
|
|
@ -1033,12 +1033,12 @@ local function debugger_valueToString(v)
|
|||
end
|
||||
local function debugger_setVarInfo(name, value)
|
||||
local valueStr, valueType = debugger_valueToString(value)
|
||||
local nameStr,nameType = debugger_valueToString(name)
|
||||
if(valueStr == nil) then
|
||||
local nameStr, nameType = debugger_valueToString(name)
|
||||
if (valueStr == nil) then
|
||||
valueStr = valueType
|
||||
end
|
||||
local valueInfo = {
|
||||
name =nameStr,
|
||||
name = nameStr,
|
||||
valueType = valueType,
|
||||
valueStr = ZZBase64.encode(valueStr)
|
||||
}
|
||||
|
|
@ -1076,7 +1076,7 @@ local function debugger_getvalue(f)
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
return {locals = locals, ups = ups}
|
||||
return { locals = locals, ups = ups }
|
||||
end
|
||||
--获取堆栈
|
||||
debugger_stackInfo =
|
||||
|
|
@ -1122,7 +1122,7 @@ debugger_stackInfo =
|
|||
end
|
||||
end
|
||||
|
||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
||||
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||
local data = {
|
||||
stack = stackInfo.stack,
|
||||
vars = stackInfo.vars,
|
||||
|
|
@ -1133,23 +1133,23 @@ debugger_stackInfo =
|
|||
}
|
||||
|
||||
return data
|
||||
end
|
||||
end
|
||||
--==============================工具方法 end======================================================
|
||||
--===========================点断信息==================================================
|
||||
--根据不同的游戏引擎进行定时获取断点信息
|
||||
--CCDirector:sharedDirector():getScheduler()
|
||||
local debugger_setBreak = nil
|
||||
local function debugger_receiveDebugBreakInfo()
|
||||
if(not jit) then
|
||||
if(_VERSION)then
|
||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
if (not jit) then
|
||||
if (_VERSION) then
|
||||
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||
else
|
||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||
end
|
||||
end
|
||||
if (breakInfoSocket) then
|
||||
local msg, status = breakInfoSocket:receive()
|
||||
if(LuaDebugger.isLaunch == true and status == "closed") then
|
||||
if (LuaDebugger.isLaunch == true and status == "closed") then
|
||||
os.exit()
|
||||
end
|
||||
if (msg) then
|
||||
|
|
@ -1159,7 +1159,7 @@ local function debugger_receiveDebugBreakInfo()
|
|||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||
LuaDebugger.loadScriptBody = netData.data
|
||||
debugger_exeLuaString()
|
||||
debugger_sendMsg(breakInfoSocket,LuaDebugger.event.C2S_LoadLuaScript,LuaDebugger.loadScriptBody)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||
LuaDebugger.reLoadFileBody = netData.data
|
||||
LuaDebugger.isReLoadFile = false
|
||||
|
|
@ -1267,7 +1267,7 @@ debugger_setBreak =
|
|||
end
|
||||
LuaDebugger.isHook = false
|
||||
end
|
||||
end
|
||||
end
|
||||
local function debugger_checkFileIsBreak(fileName)
|
||||
return LuaDebugger.breakInfos[fileName]
|
||||
end
|
||||
|
|
@ -1299,7 +1299,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. condition)
|
||||
setfenv(fun, currentTabble)
|
||||
return fun()
|
||||
|
|
@ -1309,21 +1309,20 @@ 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}
|
||||
local currentTabble = { _G = _G }
|
||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||
frameId = frameId
|
||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||
|
|
@ -1336,7 +1335,7 @@ debugger_exeLuaString = function()
|
|||
for k, v in pairs(locals) do
|
||||
currentTabble[k] = v
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
|
||||
local fun = loadstring(script)
|
||||
setfenv(fun, currentTabble)
|
||||
|
|
@ -1351,50 +1350,47 @@ 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.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||
.C2S_HITBreakPoint)
|
||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||
end
|
||||
LuaDebugger.loadScriptBody.complete = true
|
||||
|
||||
end
|
||||
--@region 调试中修改变量值
|
||||
|
||||
|
||||
--根据key 值在 value 查找
|
||||
local function debugger_getTablekey(key,keyType,value)
|
||||
if(keyType == -1) then
|
||||
local function debugger_getTablekey(key, keyType, value)
|
||||
if (keyType == -1) then
|
||||
return key
|
||||
elseif(keyType == 1) then
|
||||
elseif (keyType == 1) then
|
||||
return tonumber(key)
|
||||
elseif(keyType == 2) then
|
||||
elseif (keyType == 2) then
|
||||
local valueKey = nil
|
||||
for k,v in pairs(value) do
|
||||
for k, v in pairs(value) do
|
||||
local nameType = type(k)
|
||||
if(nameType == "userdata" or nameType == "table") then
|
||||
if (nameType == "userdata" or nameType == "table") then
|
||||
if (not LuaDebugger.isFoxGloryProject) then
|
||||
valueKey = tostring(k)
|
||||
if(key == valueKey) then
|
||||
if (key == valueKey) then
|
||||
return k
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local function debugger_setVarValue(server, data)
|
||||
|
||||
local newValue = nil
|
||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
||||
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||
local firstKeyName = data.keys[1]
|
||||
--@region vars check
|
||||
local localValueChangeIndex = -1
|
||||
|
|
@ -1409,7 +1405,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(firstKeyName == name) then
|
||||
if (firstKeyName == name) then
|
||||
localValueChangeIndex = i
|
||||
oldValue = value
|
||||
end
|
||||
|
|
@ -1427,7 +1423,7 @@ local function debugger_setVarValue(server, data)
|
|||
if not name then
|
||||
break
|
||||
end
|
||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||
upValueFun = func
|
||||
oldValue = value
|
||||
upValueChangeIndex = i
|
||||
|
|
@ -1439,8 +1435,8 @@ local function debugger_setVarValue(server, data)
|
|||
end
|
||||
i = i + 1
|
||||
end
|
||||
--@endregion
|
||||
local vars = {locals = locals, ups = ups}
|
||||
--@endregion
|
||||
local vars = { locals = locals, ups = ups }
|
||||
|
||||
local function loadScript()
|
||||
local currentTabble = {}
|
||||
|
|
@ -1457,7 +1453,7 @@ local function debugger_setVarValue(server, data)
|
|||
currentTabble[k] = v
|
||||
end
|
||||
end
|
||||
setmetatable(currentTabble, {__index = _G})
|
||||
setmetatable(currentTabble, { __index = _G })
|
||||
local fun = loadstring("return " .. data.value)
|
||||
setfenv(fun, currentTabble)
|
||||
newValue = fun()
|
||||
|
|
@ -1467,7 +1463,7 @@ local function debugger_setVarValue(server, data)
|
|||
xpcall(
|
||||
loadScript,
|
||||
function(error)
|
||||
print(error, "============================")
|
||||
-- print(error, "============================")
|
||||
end
|
||||
)
|
||||
|
||||
|
|
@ -1476,39 +1472,37 @@ local function debugger_setVarValue(server, data)
|
|||
-- local 查找并替换
|
||||
local keyLength = #data.keys
|
||||
|
||||
if(keyLength == 1) then
|
||||
if(localValueChangeIndex ~= -1) then
|
||||
|
||||
if (keyLength == 1) then
|
||||
if (localValueChangeIndex ~= -1) then
|
||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||
elseif(upValueFun ~= nil) then
|
||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
||||
elseif (upValueFun ~= nil) then
|
||||
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||
else
|
||||
--全局变量查找
|
||||
if(_G[firstKeyName]) then
|
||||
if (_G[firstKeyName]) then
|
||||
_G[firstKeyName] = newValue
|
||||
end
|
||||
end
|
||||
else
|
||||
if(not oldValue) then
|
||||
if(_G[firstKeyName]) then
|
||||
if (not oldValue) then
|
||||
if (_G[firstKeyName]) then
|
||||
oldValue = _G[firstKeyName]
|
||||
end
|
||||
end
|
||||
local tempValue = oldValue
|
||||
for i=2,keyLength-1 do
|
||||
if(tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
||||
for i = 2, keyLength - 1 do
|
||||
if (tempValue) then
|
||||
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||
end
|
||||
end
|
||||
if(tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
||||
if (tempValue) then
|
||||
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||
end
|
||||
end
|
||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||
data.varInfo = varInfo
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
|
||||
end
|
||||
--@endregion
|
||||
|
||||
|
|
@ -1520,41 +1514,41 @@ checkSetVar =
|
|||
function()
|
||||
if (LuaDebugger.isSetVar) then
|
||||
LuaDebugger.isSetVar = false
|
||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("设置变量", error)
|
||||
-- print("设置变量", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isLoadLuaScript) then
|
||||
elseif (LuaDebugger.isLoadLuaScript) then
|
||||
LuaDebugger.isLoadLuaScript = false
|
||||
debugger_exeLuaString()
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("执行代码", error)
|
||||
-- print("执行代码", error)
|
||||
end
|
||||
)
|
||||
elseif(LuaDebugger.isReLoadFile) then
|
||||
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
|
||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||
xpcall(
|
||||
checkSetVar,
|
||||
function(error)
|
||||
print("重新加载文件", error)
|
||||
-- print("重新加载文件", error)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -1604,7 +1598,7 @@ local function debugger_getValueByScript(value, script)
|
|||
val = fun()
|
||||
end,
|
||||
function(error)
|
||||
print(error, "====>")
|
||||
-- print(error, "====>")
|
||||
val = nil
|
||||
end
|
||||
)
|
||||
|
|
@ -1745,7 +1739,6 @@ 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
|
||||
|
|
@ -1801,7 +1794,6 @@ 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
|
||||
|
|
@ -1874,7 +1866,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
|||
vinfos = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
m = getmetatable(value)
|
||||
|
|
@ -1924,11 +1915,10 @@ 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
|
||||
if(LuaDebugger.isFoxGloryProject) then
|
||||
if (LuaDebugger.isFoxGloryProject) then
|
||||
value = "function"
|
||||
else
|
||||
value = tostring(value)
|
||||
|
|
@ -1963,9 +1953,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,
|
||||
|
|
@ -1991,7 +1981,6 @@ local function ResetDebugInfo()
|
|||
LuaDebugger.StepIn = false
|
||||
LuaDebugger.StepNext = false
|
||||
LuaDebugger.StepOut = false
|
||||
|
||||
end
|
||||
local function debugger_loop(server)
|
||||
server = debug_server
|
||||
|
|
@ -2002,7 +1991,7 @@ local function debugger_loop(server)
|
|||
while true do
|
||||
local line, status = server:receive()
|
||||
if (status == "closed") then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
|
|
@ -2014,13 +2003,12 @@ local function debugger_loop(server)
|
|||
local event = netData.event
|
||||
local body = netData.data
|
||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||
if(LuaDebugger.isLaunch) then
|
||||
if (LuaDebugger.isLaunch) then
|
||||
os.exit()
|
||||
else
|
||||
debug.sethook()
|
||||
coroutine.yield()
|
||||
end
|
||||
|
||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||
--设置断点信息
|
||||
local function setB()
|
||||
|
|
@ -2029,7 +2017,7 @@ local function debugger_loop(server)
|
|||
xpcall(
|
||||
setB,
|
||||
function(error)
|
||||
print(error)
|
||||
-- print(error)
|
||||
end
|
||||
)
|
||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||
|
|
@ -2041,7 +2029,7 @@ local function debugger_loop(server)
|
|||
LuaDebugger.currentDebuggerData = nil
|
||||
LuaDebugger.Run = true
|
||||
LuaDebugger.tempRunFlag = true
|
||||
LuaDebugger.currentLine= nil
|
||||
LuaDebugger.currentLine = nil
|
||||
local data = coroutine.yield()
|
||||
LuaDebugger.serVarLevel = 4
|
||||
LuaDebugger.currentDebuggerData = data
|
||||
|
|
@ -2142,42 +2130,37 @@ local function debugger_loop(server)
|
|||
end
|
||||
coro_debugger = coroutine.create(debugger_loop)
|
||||
debug_hook = function(event, line)
|
||||
|
||||
if(not LuaDebugger.isHook) then
|
||||
if (not LuaDebugger.isHook) then
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.Run) then
|
||||
if(event == "line") then
|
||||
if (LuaDebugger.Run) then
|
||||
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
|
||||
if (linesInfo.lines and linesInfo.lines[line]) then
|
||||
isCheck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if(isCheck) then
|
||||
if (isCheck) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if(not isCheck) then
|
||||
if (not isCheck) then
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local file = nil
|
||||
if(event == "line") then
|
||||
|
||||
if (event == "line") then
|
||||
local funs = nil
|
||||
local funlength =0
|
||||
if(LuaDebugger.currentDebuggerData) then
|
||||
local funlength = 0
|
||||
if (LuaDebugger.currentDebuggerData) then
|
||||
funs = LuaDebugger.currentDebuggerData.funcs
|
||||
funlength = #funs
|
||||
end
|
||||
|
|
@ -2185,47 +2168,44 @@ debug_hook = function(event, line)
|
|||
local tempFunc = stepInfo.func
|
||||
local source = stepInfo.source
|
||||
file = getSource(source);
|
||||
if(source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||
if(funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount+1
|
||||
if (source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||
if (funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount + 1
|
||||
end
|
||||
local breakInfo = LuaDebugger.breakInfos[file]
|
||||
local breakData = nil
|
||||
local ischeck = false
|
||||
if(breakInfo) then
|
||||
|
||||
if (breakInfo) then
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
local lines = lineInfo.lines
|
||||
if(lines and lines[line]) then
|
||||
if (lines and lines[line]) then
|
||||
ischeck = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local isHit = false
|
||||
if(ischeck) then
|
||||
|
||||
if (ischeck) then
|
||||
--并且在断点中
|
||||
local info = stepInfo
|
||||
local source = string.lower( info.source )
|
||||
local fullName,dir,fileName = debugger_getFilePathInfo(source)
|
||||
local source = string.lower(info.source)
|
||||
local fullName, dir, fileName = debugger_getFilePathInfo(source)
|
||||
local hitPathNames = splitFilePath(fullName)
|
||||
|
||||
local hitCounts = {}
|
||||
local debugHitCounts = nil
|
||||
for k, lineInfo in pairs(breakInfo) do
|
||||
|
||||
local lines = lineInfo.lines
|
||||
local pathNames = lineInfo.pathNames
|
||||
debugHitCounts = lineInfo.hitCounts
|
||||
if(lines and lines[line]) then
|
||||
if (lines and lines[line]) then
|
||||
breakData = lines[line]
|
||||
--判断路径
|
||||
hitCounts[k] = 0
|
||||
local hitPathNamesCount = #hitPathNames
|
||||
local pathNamesCount = #pathNames
|
||||
local checkCount = 0;
|
||||
while(true) do
|
||||
while (true) do
|
||||
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
||||
break
|
||||
else
|
||||
|
|
@ -2233,57 +2213,55 @@ debug_hook = function(event, line)
|
|||
end
|
||||
pathNamesCount = pathNamesCount - 1
|
||||
hitPathNamesCount = hitPathNamesCount - 1
|
||||
checkCount = checkCount+1
|
||||
if(pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
checkCount = checkCount + 1
|
||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
if(checkCount>0) then
|
||||
if (checkCount > 0) then
|
||||
break;
|
||||
end
|
||||
else
|
||||
breakData = nil
|
||||
end
|
||||
end
|
||||
if(breakData) then
|
||||
if (breakData) then
|
||||
local hitFieName = ""
|
||||
local maxCount = 0
|
||||
for k, v in pairs(hitCounts) do
|
||||
if(v > maxCount) then
|
||||
if (v > maxCount) then
|
||||
maxCount = v
|
||||
hitFieName = k;
|
||||
end
|
||||
end
|
||||
local hitPathNamesLength = #hitPathNames
|
||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||
if(hitFieName ~= "") then
|
||||
|
||||
if (hitFieName ~= "") then
|
||||
local hitCount = breakData.hitCondition
|
||||
local clientHitCount = debugHitCounts[breakData.line]
|
||||
clientHitCount = clientHitCount + 1
|
||||
debugHitCounts[breakData.line] = clientHitCount
|
||||
if(funs and funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
if (funs and funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
elseif(LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||
elseif (LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.tempRunFlag = nil
|
||||
elseif(clientHitCount >= hitCount) then
|
||||
elseif (clientHitCount >= hitCount) then
|
||||
isHit = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if(LuaDebugger.StepOut) then
|
||||
if(funlength == 1) then
|
||||
if (LuaDebugger.StepOut) then
|
||||
if (funlength == 1) then
|
||||
ResetDebugInfo();
|
||||
LuaDebugger.Run = true
|
||||
return
|
||||
else
|
||||
if(funs[2] == tempFunc) then
|
||||
if (funs[2] == tempFunc) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- print("StepIn 挂起")
|
||||
-- -- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
|
|
@ -2292,35 +2270,34 @@ debug_hook = function(event, line)
|
|||
end
|
||||
end
|
||||
|
||||
if(LuaDebugger.StepIn) then
|
||||
if(funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
if (LuaDebugger.StepIn) then
|
||||
if (funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||
return
|
||||
end
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||
-- print("StepIn 挂起")
|
||||
-- -- print("StepIn 挂起")
|
||||
--挂起等待调试器作出反应
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
return
|
||||
end
|
||||
|
||||
if(LuaDebugger.StepNext ) then
|
||||
if (LuaDebugger.StepNext) then
|
||||
local isNext = false
|
||||
if(funs) then
|
||||
for i,f in ipairs(funs) do
|
||||
if(tempFunc == f) then
|
||||
if(LuaDebugger.currentLine == line) then
|
||||
if (funs) then
|
||||
for i, f in ipairs(funs) do
|
||||
if (tempFunc == f) then
|
||||
if (LuaDebugger.currentLine == line) then
|
||||
return
|
||||
end
|
||||
isNext =true
|
||||
isNext = true
|
||||
break;
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
isNext =true
|
||||
isNext = true
|
||||
end
|
||||
if(isNext) then
|
||||
if (isNext) then
|
||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
|
|
@ -2335,17 +2312,15 @@ debug_hook = function(event, line)
|
|||
|
||||
|
||||
--断点判断
|
||||
if(isHit) then
|
||||
|
||||
|
||||
if (isHit) then
|
||||
LuaDebugger.runLineCount = 0
|
||||
LuaDebugger.currentLine = line
|
||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(3, sevent)
|
||||
--挂起等待调试器作出反应
|
||||
if(breakData and breakData.condition) then
|
||||
debugger_conditionStr(breakData.condition,data.vars,function()
|
||||
if (breakData and breakData.condition) then
|
||||
debugger_conditionStr(breakData.condition, data.vars, function()
|
||||
_resume(coro_debugger, data)
|
||||
checkSetVar()
|
||||
end)
|
||||
|
|
@ -2362,7 +2337,7 @@ end
|
|||
local function debugger_xpcall()
|
||||
--调用 coro_debugger 并传入 参数
|
||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
||||
if(data.stack and data.stack[1]) then
|
||||
if (data.stack and data.stack[1]) then
|
||||
data.stack[1].isXpCall = true
|
||||
end
|
||||
--挂起等待调试器作出反应
|
||||
|
|
@ -2371,12 +2346,11 @@ 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)
|
||||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||
LuaDebugger.DebugLuaFie = fileName
|
||||
local server = socket.connect(controller_host, controller_port)
|
||||
debug_server = server;
|
||||
|
|
@ -2384,7 +2358,7 @@ local function start()
|
|||
--创建breakInfo socket
|
||||
socket = createSocket()
|
||||
breakInfoSocket = socket.connect(controller_host, controller_port)
|
||||
if(breakInfoSocket) then
|
||||
if (breakInfoSocket) then
|
||||
breakInfoSocket:settimeout(0)
|
||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
||||
name = "breakPointSocket"
|
||||
|
|
@ -2399,46 +2373,41 @@ 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 进行调试!")
|
||||
if (not jit) then
|
||||
if (_VERSION) then
|
||||
-- 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")
|
||||
if (not host) then
|
||||
-- print("error host nil")
|
||||
end
|
||||
if(not port) then
|
||||
print("error prot nil")
|
||||
if (not port) then
|
||||
-- print("error prot nil")
|
||||
end
|
||||
if(type(host) ~= "string") then
|
||||
print("error host not string")
|
||||
if (type(host) ~= "string") then
|
||||
-- print("error host not string")
|
||||
end
|
||||
if(type(port) ~= "number") then
|
||||
print("error host not number")
|
||||
if (type(port) ~= "number") then
|
||||
-- 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
|
||||
|
|
@ -2448,10 +2417,10 @@ ZZBase64.__code = {
|
|||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||
};
|
||||
};
|
||||
ZZBase64.__decode = {}
|
||||
for k,v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
||||
for k, v in pairs(ZZBase64.__code) do
|
||||
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||
end
|
||||
|
||||
function ZZBase64.encode(text)
|
||||
|
|
@ -2461,14 +2430,14 @@ function ZZBase64.encode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
for i = 1, len, 3 do
|
||||
local a = string.byte(text, i )
|
||||
local a = string.byte(text, i)
|
||||
local b = string.byte(text, i + 1)
|
||||
local c = string.byte(text, i + 2)
|
||||
-- num = a<<16 + b<<8 + c
|
||||
local num = a * 65536 + b * 256 + c
|
||||
for j = 1, 4 do
|
||||
--tmp = num >> ((4 -j) * 6)
|
||||
local tmp = math.floor(num / (2 ^ ((4-j) * 6)))
|
||||
local tmp = math.floor(num / (2 ^ ((4 - j) * 6)))
|
||||
--curPos = tmp&0x3f
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2505,13 +2474,13 @@ function ZZBase64.__left2(res, index, text, len)
|
|||
res[index + 3] = "="
|
||||
end
|
||||
|
||||
function ZZBase64.__left1(res, index,text, len)
|
||||
function ZZBase64.__left1(res, index, text, len)
|
||||
local num = string.byte(text, len + 1)
|
||||
num = num * 16
|
||||
|
||||
local tmp = math.floor(num / 64)
|
||||
local curPos = tmp % 64 + 1
|
||||
res[index ] = ZZBase64.__code[curPos]
|
||||
res[index] = ZZBase64.__code[curPos]
|
||||
|
||||
curPos = num % 64 + 1
|
||||
res[index + 1] = ZZBase64.__code[curPos]
|
||||
|
|
@ -2534,11 +2503,11 @@ function ZZBase64.decode(text)
|
|||
local res = {}
|
||||
local index = 1
|
||||
local decode = ZZBase64.__decode
|
||||
for i =1, len, 4 do
|
||||
local a = decode[string.byte(text,i )]
|
||||
local b = decode[string.byte(text,i + 1)]
|
||||
local c = decode[string.byte(text,i + 2)]
|
||||
local d = decode[string.byte(text,i + 3)]
|
||||
for i = 1, len, 4 do
|
||||
local a = decode[string.byte(text, i)]
|
||||
local b = decode[string.byte(text, i + 1)]
|
||||
local c = decode[string.byte(text, i + 2)]
|
||||
local d = decode[string.byte(text, i + 3)]
|
||||
|
||||
--num = a<<18 + b<<12 + c<<6 + d
|
||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||
|
|
@ -2547,7 +2516,7 @@ function ZZBase64.decode(text)
|
|||
num = math.floor(num / 256)
|
||||
local f = string.char(num % 256)
|
||||
num = math.floor(num / 256)
|
||||
res[index ] = string.char(num % 256)
|
||||
res[index] = string.char(num % 256)
|
||||
res[index + 1] = f
|
||||
res[index + 2] = e
|
||||
index = index + 3
|
||||
|
|
@ -2583,7 +2552,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
|||
res[index] = string.char(num)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return StartDebug
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "100Zhang_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/100zhang/ui/Extend_MJ_100Zhang")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人100张 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人100张 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
--print(beforeLaiziID)
|
||||
--print(currentLaizi1ID)
|
||||
--print(currentLaizi2ID)
|
||||
---- print(beforeLaiziID)
|
||||
---- print(currentLaizi1ID)
|
||||
---- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("100Zhang_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -319,16 +311,15 @@ function M:EventInit()
|
|||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("100Zhang_MJ", "extend/majiang/100zhang/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -444,7 +435,7 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -453,12 +444,12 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -476,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -605,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -700,7 +691,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -718,7 +709,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -6,8 +6,8 @@ local CS_ClearingView = {}
|
|||
local M = CS_ClearingView
|
||||
|
||||
function CS_ClearingView.new(blur_view)
|
||||
setmetatable(M, {__index = ResultView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = ResultView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._full = true
|
||||
ResultView.init(self, "ui://Main_Majiang/clearing")
|
||||
|
||||
|
|
@ -16,70 +16,63 @@ function CS_ClearingView.new(blur_view)
|
|||
self._close_zone = false
|
||||
self._close_destroy = true
|
||||
|
||||
self.xiPaiCtr=self._view:GetController("xipai")
|
||||
self.xiPaiCtr = self._view:GetController("xipai")
|
||||
|
||||
self:InitMaPai()
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function M:InitMaPai()
|
||||
self.maPaiCtr=self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr = self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
|
||||
self.maPaiList={}
|
||||
self.maPaiList = {}
|
||||
|
||||
for i=1,10 do
|
||||
local tempMP=self._view:GetChild("niao"..i)
|
||||
table.insert(self.maPaiList,tempMP)
|
||||
for i = 1, 10 do
|
||||
local tempMP = self._view:GetChild("niao" .. i)
|
||||
table.insert(self.maPaiList, tempMP)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:IsMapaiShow(niao,isShow)
|
||||
function M:IsMapaiShow(niao, isShow)
|
||||
if niao then
|
||||
niao.visible=isShow
|
||||
niao.visible = isShow
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetMaPaiValue(niao,value)
|
||||
function M:SetMaPaiValue(niao, value)
|
||||
if niao then
|
||||
niao.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..value
|
||||
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
|
||||
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)
|
||||
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
|
||||
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)
|
||||
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
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:InitData(over, room, result, total_result, callback)
|
||||
self._callback = callback
|
||||
local _overCtr = self._view:GetController("over")
|
||||
|
|
@ -89,23 +82,24 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
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_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:GetDes(), "\r", "")
|
||||
-- self._view:GetChild("tex_roomnum").text = room.room_id
|
||||
-- self._view:GetChild("tex_data").text = os.date("%Y-%m-%d %H:%M", os.time())
|
||||
-- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time())
|
||||
|
||||
local paixingxiangqing=self._view:GetChild("btn_detal")
|
||||
paixingxiangqing.visible=false
|
||||
local fanhuipaixing=self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible=false
|
||||
local paixingxiangqing = self._view:GetChild("btn_detal")
|
||||
paixingxiangqing.visible = false
|
||||
local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible = false
|
||||
|
||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig and round>1 then
|
||||
self.xiPaiCtr.selectedIndex=1
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig and round > 1 then
|
||||
self.xiPaiCtr.selectedIndex = 1
|
||||
else
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -115,13 +109,13 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
|
||||
|
||||
if over ~= 2 then
|
||||
local xipai=self._view:GetChild("btn_xipai")
|
||||
xipai.touchable=true
|
||||
local xipai = self._view:GetChild("btn_xipai")
|
||||
xipai.touchable = true
|
||||
xipai.onClick:Add(function()
|
||||
local xiPaiCallBack=function ()
|
||||
xipai.touchable=false
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
ViewUtil.ErrorTip(1000000,"申请洗牌成功")
|
||||
local xiPaiCallBack = function()
|
||||
xipai.touchable = false
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
ViewUtil.ErrorTip(1000000, "申请洗牌成功")
|
||||
end
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:SendXiPaiAction(xiPaiCallBack)
|
||||
|
|
@ -155,14 +149,14 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
end)
|
||||
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
||||
elseif over == 1 then
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
_btnCtr.selectedIndex = 1
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_result.onClick:Add(function()
|
||||
_overCtr.selectedIndex = 1
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 0
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
if self._qsinfo_view then
|
||||
self._qsinfo_view:Dispose()
|
||||
end
|
||||
|
|
@ -173,9 +167,9 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
|
||||
end
|
||||
else
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
_overCtr.selectedIndex = 1
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
|
|
@ -183,7 +177,7 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
end
|
||||
end
|
||||
|
||||
function M:AddClearItem(room, data, total_data,over, niao, active_player)
|
||||
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")
|
||||
|
|
@ -202,9 +196,9 @@ function M:AddClearItem(room, data, total_data,over, niao, active_player)
|
|||
end
|
||||
end
|
||||
end
|
||||
table.sort(data, function(a,b) return a.seat > b.seat end)
|
||||
table.sort(data, function(a, b) return a.seat > b.seat end)
|
||||
list_view1:RemoveChildrenToPool()
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
local item = list_view1:AddItemFromPool()
|
||||
self:FillItemData(room, data[i], item, active_player, niao)
|
||||
end
|
||||
|
|
@ -244,14 +238,14 @@ function M:FillItemData(room, data, item, active_player)
|
|||
end
|
||||
|
||||
local sp = " "
|
||||
local str = "胡:"..huadd.."分"
|
||||
str = str..sp.."扎鸟:"..birdadd.."分"
|
||||
str = str..sp.."起手胡:"..qsadd.."分"
|
||||
local str = "胡:" .. huadd .. "分"
|
||||
str = str .. sp .. "扎鸟:" .. birdadd .. "分"
|
||||
str = str .. sp .. "起手胡:" .. qsadd .. "分"
|
||||
-- if #qs_niao_list > 0 then
|
||||
-- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. ")"
|
||||
-- end
|
||||
if data["piao_niao_score"] then
|
||||
str = str..sp.."飘鸟:"..data["piao_niao_score"].."分"
|
||||
str = str .. sp .. "飘鸟:" .. data["piao_niao_score"] .. "分"
|
||||
end
|
||||
item:GetChild("score1").text = str
|
||||
local win_list = data["win_list"]
|
||||
|
|
@ -271,7 +265,7 @@ function M:FillItemData(room, data, item, active_player)
|
|||
end
|
||||
str2 = CS_Win_Type[win_list[i].type]
|
||||
end
|
||||
str1 = str1..str2..sp
|
||||
str1 = str1 .. str2 .. sp
|
||||
end
|
||||
item:GetChild("score3").text = str1
|
||||
end
|
||||
|
|
@ -284,9 +278,9 @@ function M:FillItemData(room, data, item, active_player)
|
|||
if data["is_win"] and active_player == p.self_user.account_id and remove_win_card then
|
||||
list_remove(hand_cards, data["win_card"])
|
||||
end
|
||||
for i=1,#hand_cards do
|
||||
for i = 1, #hand_cards do
|
||||
local card = hand_list_view:AddItemFromPool()
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..hand_cards[i]
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. hand_cards[i]
|
||||
end
|
||||
hand_list_view.width = 52 * #hand_cards
|
||||
|
||||
|
|
@ -294,27 +288,27 @@ function M:FillItemData(room, data, item, active_player)
|
|||
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
|
||||
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
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].card
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "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
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].opcard[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
|
||||
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/" .. self:GetPrefix() .. "202_"..fz_card[i].card
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].card
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -322,7 +316,7 @@ function M:FillItemData(room, data, item, active_player)
|
|||
|
||||
-- local total_score = data["total_score"]
|
||||
if total >= 0 then
|
||||
item:GetChild("score2").text = "+"..total
|
||||
item:GetChild("score2").text = "+" .. total
|
||||
item:GetChild("score2").grayed = false
|
||||
else
|
||||
item:GetChild("score2").text = total
|
||||
|
|
@ -342,13 +336,13 @@ function M:FillItemData(room, data, item, active_player)
|
|||
|
||||
local is_win = data["is_win"] or false
|
||||
item:GetController("win").selectedIndex = is_win and 0 or 1
|
||||
--print(p.self_user.account_id, active_player)
|
||||
---- print(p.self_user.account_id, active_player)
|
||||
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
|
||||
item:GetController("win").selectedIndex = 2
|
||||
end
|
||||
local win_card = item:GetChild("win_card")
|
||||
if is_win then
|
||||
win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..data["win_card"]
|
||||
win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. data["win_card"]
|
||||
end
|
||||
if data.niao then
|
||||
item:GetController("niao").selectedIndex = 1
|
||||
|
|
@ -384,22 +378,22 @@ function M:FillItemData2(room, data, list)
|
|||
|
||||
local settle_log = data[i].settle_log
|
||||
player_list[i].param = {}
|
||||
player_list[i].param[1]={}
|
||||
player_list[i].param[1] = {}
|
||||
player_list[i].param[1].key = "大胡自摸:"
|
||||
player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo)
|
||||
player_list[i].param[2]={}
|
||||
player_list[i].param[2] = {}
|
||||
player_list[i].param[2].key = "小胡自摸:"
|
||||
player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo)
|
||||
player_list[i].param[3]={}
|
||||
player_list[i].param[3] = {}
|
||||
player_list[i].param[3].key = "大胡接炮:"
|
||||
player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao)
|
||||
player_list[i].param[4]={}
|
||||
player_list[i].param[4] = {}
|
||||
player_list[i].param[4].key = "小胡接炮:"
|
||||
player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao)
|
||||
player_list[i].param[5]={}
|
||||
player_list[i].param[5] = {}
|
||||
player_list[i].param[5].key = "大胡点炮:"
|
||||
player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao)
|
||||
player_list[i].param[6]={}
|
||||
player_list[i].param[6] = {}
|
||||
player_list[i].param[6].key = "小胡点炮:"
|
||||
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
|
||||
end
|
||||
|
|
@ -408,7 +402,8 @@ function M:FillItemData2(room, data, list)
|
|||
-- self:SetGSListlineGap(-10)
|
||||
|
||||
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)
|
||||
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
|
||||
|
|
@ -472,7 +467,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
cards[card] = 1
|
||||
end
|
||||
end
|
||||
for k,v in pairs(cards) do
|
||||
for k, v in pairs(cards) do
|
||||
local card = k
|
||||
if card_map[card] then
|
||||
if card_map[card] < cards[card] then
|
||||
|
|
@ -484,7 +479,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
end
|
||||
end
|
||||
local all_cards = {}
|
||||
for j,v in pairs(card_map) do
|
||||
for j, v in pairs(card_map) do
|
||||
for k = 1, v do
|
||||
table.insert(all_cards, j)
|
||||
end
|
||||
|
|
@ -493,7 +488,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
for j = 1, #all_cards do
|
||||
local citem = lst_card:AddItemFromPool()
|
||||
citem.touchable = false
|
||||
citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..all_cards[j]
|
||||
citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. all_cards[j]
|
||||
end
|
||||
local cs_zhua_niao = room.room_config.niao_type == 2
|
||||
qsinfo:GetController("niao").selectedIndex = cs_zhua_niao and 1 or 0
|
||||
|
|
@ -517,7 +512,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
_touch_start_pos = self._view:GlobalToLocal(Vector2(context.inputEvent.x, context.inputEvent.y))
|
||||
end)
|
||||
btn_di.onTouchMove:Add(function(context)
|
||||
local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y))
|
||||
local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
local dist = Vector2(xy.x - _touch_start_pos.x, xy.y - _touch_start_pos.y)
|
||||
local posx = _view_start_pos.x + dist.x
|
||||
local posy = _view_start_pos.y + dist.y
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ local M = {}
|
|||
|
||||
--- Create a new CS_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "CS_MainView"
|
||||
self.asset_group = "ChangSha_MJ"
|
||||
self:init()
|
||||
|
|
@ -47,7 +47,7 @@ function M:InitView(url)
|
|||
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
||||
|
||||
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
|
||||
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ function M:InitView(url)
|
|||
self._hu_tip = HuTipView.new(self)
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
--print("CS_MainView")
|
||||
---- print("CS_MainView")
|
||||
if (room.playing or room.curren_round > 0) or room.status == 1 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
|
|
@ -111,8 +111,8 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(CS_GameEvent.SendCards,function( ... )
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
|
||||
local arg = { ... }
|
||||
self._tex_LeftCard.text = arg[1]
|
||||
local info = self._player_card_info[1]
|
||||
info._player.auto_out_card = false
|
||||
|
|
@ -454,7 +454,7 @@ function M:EventInit()
|
|||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self._state.selectedIndex = 1
|
||||
if oldGameVersion==1 then
|
||||
if oldGameVersion == 1 then
|
||||
self:__PiaoNiaoTip()
|
||||
else
|
||||
self:__PiaoNiaoTip1()
|
||||
|
|
@ -535,7 +535,7 @@ function M:OutCard(card)
|
|||
-- 防止同一帧内执行两次OutCard事件
|
||||
local last_discard_frame = discard_frame
|
||||
discard_frame = Time.frameCount
|
||||
--print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
|
||||
---- print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
|
||||
if discard_frame == last_discard_frame then
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
local outcard_list = self._mask_data["outcard_list"]
|
||||
local comp = handcard_list["comp"]
|
||||
local card = outcard_list["card"]
|
||||
--print("comp"..comp)
|
||||
-- print(vardump(_player.card_list))
|
||||
---- print("comp"..comp)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. "_3d"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -36,7 +36,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list, DataManager.CurrenRoom.room_config.no_jiang)
|
||||
local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list,
|
||||
DataManager.CurrenRoom.room_config.no_jiang)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -112,7 +113,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -162,8 +163,8 @@ function M:__OnDragEnd(context, offset)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- print(button.y - card.old_postion.y)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print(button.y - card.old_postion.y)
|
||||
-- if (button.y < -55 and _room.curren_outcard_seat == _room.self_player.seat) and self:CheckPlayerOnlineState() then
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
|
|
@ -184,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -198,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoShan_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaoshan/ui/Extend_MJ_ChaoShan")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮汕 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮汕 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoShan_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -319,16 +311,15 @@ function M:EventInit()
|
|||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -444,7 +435,7 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -453,12 +444,12 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -476,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -605,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -700,7 +691,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -718,7 +709,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoZhou_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaozhou/ui/Extend_MJ_ChaoZhou")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮州 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮州 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoZhou_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -319,26 +311,25 @@ function M:EventInit()
|
|||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -454,7 +445,7 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -463,12 +454,12 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -484,42 +475,39 @@ function M:__FangziTip(tip, weight)
|
|||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
|
||||
for i=1,count do
|
||||
if tip.tip_map_id[i].type==6 then
|
||||
tip_hu=true
|
||||
for i = 1, count do
|
||||
if tip.tip_map_id[i].type == 6 then
|
||||
tip_hu = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for k=1,#_tlist do
|
||||
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu==true then
|
||||
if td.type==6 then
|
||||
if tip_hu == true then
|
||||
if td.type == 6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if tip_hu==false then
|
||||
if tip_hu == false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
|
|
@ -539,20 +527,19 @@ function M:__FangziTip(tip, weight)
|
|||
end
|
||||
end)
|
||||
end
|
||||
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
|
|
@ -575,8 +562,6 @@ function M:__FangziTip(tip, weight)
|
|||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -676,7 +661,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -771,7 +756,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -789,7 +774,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoZhouGui_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaozhougui/ui/Extend_MJ_ChaoZhouGui")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoZhouGui_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -319,26 +311,25 @@ function M:EventInit()
|
|||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -454,7 +445,7 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -463,12 +454,12 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -484,42 +475,39 @@ function M:__FangziTip(tip, weight)
|
|||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
|
||||
for i=1,count do
|
||||
if tip.tip_map_id[i].type==6 then
|
||||
tip_hu=true
|
||||
for i = 1, count do
|
||||
if tip.tip_map_id[i].type == 6 then
|
||||
tip_hu = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for k=1,#_tlist do
|
||||
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu==true then
|
||||
if td.type==6 then
|
||||
if tip_hu == true then
|
||||
if td.type == 6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if tip_hu==false then
|
||||
if tip_hu == false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
|
|
@ -539,20 +527,19 @@ function M:__FangziTip(tip, weight)
|
|||
end
|
||||
end)
|
||||
end
|
||||
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
|
|
@ -575,8 +562,6 @@ function M:__FangziTip(tip, weight)
|
|||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -676,7 +661,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -771,7 +756,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -789,7 +774,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 33
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -101,12 +101,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -131,7 +131,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -98,12 +98,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -137,7 +137,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
table.insert(tingList, 412)
|
||||
end
|
||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -81,7 +83,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -134,7 +136,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -168,10 +171,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -121,7 +121,7 @@ function M:OnEventSendCards(evt_data)
|
|||
_room.jing = jing
|
||||
self._cacheEvent:Enqueue(function()
|
||||
_room.banker_seat = seat
|
||||
print("========================fuzhijing")
|
||||
-- print("========================fuzhijing")
|
||||
for i = 1, #_room.player_list do
|
||||
_room.player_list[i].hand_left_count = 13
|
||||
_room.player_list[i].fz_list = {}
|
||||
|
|
@ -275,7 +275,7 @@ function M:OnEventFzAction(evt_data)
|
|||
end
|
||||
|
||||
function M:OnEventHu(evt_data)
|
||||
print("===========================OnEventHu")
|
||||
-- print("===========================OnEventHu")
|
||||
local cards = evt_data["card"]
|
||||
local win_p = self._room:GetPlayerBySeat(evt_data["seat"])
|
||||
local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"])
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ function M:EventInit()
|
|||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
print("===================================com_name", com_name)
|
||||
-- print("===================================com_name", com_name)
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ function M:FillRoomData(s2croom)
|
|||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
print("=======================在此进入")
|
||||
-- print("=======================在此进入")
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
end
|
||||
|
|
@ -141,7 +141,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
print("==========================__OnClickHandCard")
|
||||
-- print("==========================__OnClickHandCard")
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
|
|
@ -168,7 +168,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ function M:FillRoomData(s2croom)
|
|||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
print("=======================================自动开始")
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
end
|
||||
|
|
@ -141,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "QiZhiBa_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/qizhiba/ui/Extend_MJ_QiZhiBa")
|
||||
MJMainView.InitView(self,"ui://Main_PokeMaJiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_PokeMaJiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人七支八 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人七支八 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3])>0 then
|
||||
self:SetShowLaiZiProcess(room.laiziInfo[3],room.laiziInfo[3],0,false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3]) > 0 then
|
||||
self:SetShowLaiZiProcess(room.laiziInfo[3], room.laiziInfo[3], 0, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_PokeMaJiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_PokeMaJiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID>0 then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID>0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID>0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,8 +143,8 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
|
||||
|
|
@ -159,12 +152,12 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -175,7 +168,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -189,11 +182,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_PokeMaJiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_PokeMaJiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -202,7 +195,7 @@ function M:EventInit()
|
|||
info:UpdateHandCard()
|
||||
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
||||
info:UpdateOutCardList(outcard, card, self._cursor)
|
||||
local cardAudio=string.sub(card,2)
|
||||
local cardAudio = string.sub(card, 2)
|
||||
self:PlaySound("QiZhiBa_MJ", p.self_user.sex, tostring(cardAudio))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
if seat == _room.self_player.seat then
|
||||
|
|
@ -211,7 +204,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -222,19 +215,19 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
arg={...}
|
||||
arg = { ... }
|
||||
local _tip = arg[1]
|
||||
self:__FangziTip(_tip)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -268,7 +261,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -291,11 +284,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("QiZhiBa_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("QiZhiBa_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -305,14 +298,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -321,16 +313,15 @@ function M:EventInit()
|
|||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -339,7 +330,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -405,7 +396,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -426,7 +417,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -445,9 +436,9 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
function M:OutCard(card)
|
||||
local isOut=IsHasDictionary(card,DataManager.CurrenRoom.laiziInfo)
|
||||
if isOut==false then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
local isOut = IsHasDictionary(card, DataManager.CurrenRoom.laiziInfo)
|
||||
if isOut == false then
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -456,13 +447,13 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
local cardAudio=string.sub(card,2)
|
||||
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex,tostring(cardAudio))
|
||||
local cardAudio = string.sub(card, 2)
|
||||
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex, tostring(cardAudio))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -483,19 +474,16 @@ function M:__FangziTip(tip, weight)
|
|||
local count = #_tlist
|
||||
table.sort(_tlist)
|
||||
local isHu = false
|
||||
for k=1,#_tlist do
|
||||
|
||||
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_PokeMaJiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_PokeMaJiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_PokeMaJiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
|
||||
|
|
@ -520,9 +508,6 @@ function M:__FangziTip(tip, weight)
|
|||
_chipeng_tip:Center()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function M:__TipAction(context)
|
||||
local data = context.sender.data
|
||||
local _gamectr = self._gamectr
|
||||
|
|
@ -544,14 +529,14 @@ function M:__TipAction(context)
|
|||
self._chipeng_tip = nil
|
||||
end
|
||||
|
||||
|
||||
function M:_ChiView(tiplist, callback)
|
||||
self._chipeng_tip.visible = false
|
||||
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
|
||||
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
||||
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
||||
local crossCtr = _pop_tip_choice:GetController("state")
|
||||
crossCtr.selectedIndex = #tiplist == 3 and 0 or (#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
||||
crossCtr.selectedIndex = #tiplist == 3 and 0 or
|
||||
(#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
||||
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
|
||||
_pop_tip_choice:Dispose()
|
||||
self._chipeng_tip.visible = true
|
||||
|
|
@ -564,7 +549,8 @@ function M:_ChiView(tiplist, callback)
|
|||
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
||||
if tiplist[i].weight ~= 1 then
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tiplist[i].card)
|
||||
end
|
||||
else
|
||||
local tem = {}
|
||||
|
|
@ -575,9 +561,12 @@ function M:_ChiView(tiplist, callback)
|
|||
table.sort(tem, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[1])
|
||||
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[2])
|
||||
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[3])
|
||||
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[1])
|
||||
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[2])
|
||||
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[3])
|
||||
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
||||
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
||||
end
|
||||
|
|
@ -585,14 +574,15 @@ function M:_ChiView(tiplist, callback)
|
|||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -619,20 +609,20 @@ function M:OnFangziAction(...)
|
|||
local fz_sound = ""
|
||||
if fz.type == FZType.Peng then
|
||||
fangzi = "碰"
|
||||
fz_sound = "peng"..math.random(1, 3)
|
||||
fz_sound = "peng" .. math.random(1, 3)
|
||||
elseif fz.type == FZType.Chi then
|
||||
fangzi = "吃"
|
||||
fz_sound = "chi"..math.random(1, 3)
|
||||
fz_sound = "chi" .. math.random(1, 3)
|
||||
else
|
||||
if fz.opengang then
|
||||
fangzi = "杠"
|
||||
fz_sound = "gang"..math.random(1, 2)
|
||||
fz_sound = "gang" .. math.random(1, 2)
|
||||
else
|
||||
fangzi = "补"
|
||||
fz_sound = "buzhang"
|
||||
end
|
||||
end
|
||||
self:PlaySound("QiZhiBa_MJ",player.self_user.sex,fz_sound)
|
||||
self:PlaySound("QiZhiBa_MJ", player.self_user.sex, fz_sound)
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
|
||||
|
|
@ -662,7 +652,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -680,7 +670,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -757,7 +747,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -775,7 +765,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = import(".main.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -71,19 +71,19 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCard3)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
if _tableInfo.laiziCard3>0 then
|
||||
local str=string.sub(_tableInfo.laiziCard3,2)
|
||||
for i=1,4 do
|
||||
table.insert(room.laiziInfo,tonumber(i..str))
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
if _tableInfo.laiziCard3 > 0 then
|
||||
local str = string.sub(_tableInfo.laiziCard3, 2)
|
||||
for i = 1, 4 do
|
||||
table.insert(room.laiziInfo, tonumber(i .. str))
|
||||
end
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCard3
|
||||
room.beforelaiziCardId = _tableInfo.laiziCard3
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
--pt(room.laiziInfo)
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -110,7 +110,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -120,13 +120,13 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
fz.allCard=op["opcard"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
fz.allCard = op["opcard"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -151,7 +151,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -160,7 +160,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -15,52 +15,46 @@ function M.new(view,mainView)
|
|||
return self
|
||||
end
|
||||
|
||||
function M:ShowHuTip(card_list,currentOnclickCard)
|
||||
function M:ShowHuTip(card_list, currentOnclickCard)
|
||||
if currentOnclickCard then
|
||||
if DataManager.CurrenRoom.self_player.CardTingList then
|
||||
local tempV=DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
||||
if tempV and #tempV>0 then
|
||||
local tempV = DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
||||
if tempV and #tempV > 0 then
|
||||
self._mainView._hu_tip:FillData(tempV)
|
||||
else
|
||||
self._mainView._hu_tip:HideHuTipsPanel()
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
|
||||
self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList)
|
||||
end--]]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -68,27 +62,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
self:ShowHuTip(card_list)
|
||||
if getcard then
|
||||
self._out_card = true
|
||||
if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList>0 then
|
||||
if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList > 0 then
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local isTing,curIndex=CheckDictionaryFromContent(_carViewList[i].card_item,DataManager.CurrenRoom.self_player.tingPaiList)
|
||||
local isTing, curIndex = CheckDictionaryFromContent(_carViewList[i].card_item,
|
||||
DataManager.CurrenRoom.self_player.tingPaiList)
|
||||
if isTing then
|
||||
--printlog("听牌提示===》》》",curIndex)
|
||||
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
|
||||
local value=#DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
||||
if tonumber(value)>1 then
|
||||
btn:GetController("mark_ting").selectedIndex=2
|
||||
local value = #DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
||||
if tonumber(value) > 1 then
|
||||
btn:GetController("mark_ting").selectedIndex = 2
|
||||
else
|
||||
btn:GetController("mark_ting").selectedIndex=1
|
||||
end
|
||||
|
||||
btn:GetController("mark_ting").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--DataManager.CurrenRoom.self_player.tingPaiList=nil
|
||||
|
||||
else
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
|
|
@ -98,18 +90,14 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -127,7 +115,7 @@ function M:__OnClickHandCard(context)
|
|||
|
||||
if self._out_card then
|
||||
printlog("点击开始出牌===>>>")
|
||||
self:ShowHuTip(card_list,button.data.card_item)
|
||||
self:ShowHuTip(card_list, button.data.card_item)
|
||||
end
|
||||
|
||||
-- 标记出牌
|
||||
|
|
@ -163,9 +151,9 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
local isOut=IsHasDictionary(card.card_item,DataManager.CurrenRoom.laiziInfo)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut==false) then
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
local isOut = IsHasDictionary(card.card_item, DataManager.CurrenRoom.laiziInfo)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut == false) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = button
|
||||
|
|
@ -184,6 +172,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -198,10 +187,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,15 +4,15 @@ local TableBG = require("Game.Data.TableBG")
|
|||
local MJSettingView = import(".MJSettingViewNew")
|
||||
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
||||
|
||||
local bg_config = {
|
||||
{id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01"},
|
||||
{id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02"},
|
||||
{id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03"}
|
||||
local bg_config = {
|
||||
{ id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01" },
|
||||
{ id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02" },
|
||||
{ id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03" }
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
setmetatable(M,{__index = MainView})
|
||||
setmetatable(M, { __index = MainView })
|
||||
|
||||
local default_bg = 1
|
||||
function M:InitView(url, use_custom_bg)
|
||||
|
|
@ -29,7 +29,7 @@ function M:InitView(url, use_custom_bg)
|
|||
|
||||
UIPackage.AddPackage("base/main_pokemajiang/ui/Main_PokeMaJiang")
|
||||
|
||||
MainView.InitView(self,url)
|
||||
MainView.InitView(self, url)
|
||||
local _view = self._view
|
||||
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj")
|
||||
if not use_custom_bg then
|
||||
|
|
@ -59,19 +59,18 @@ function M:InitView(url, use_custom_bg)
|
|||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||
|
||||
--print("2222222222222222222222")
|
||||
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||
---- print("2222222222222222222222")
|
||||
---- print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
||||
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
||||
--temp111:SetActive(false)
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function ()
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function()
|
||||
if self.dismiss_room_cd_time > 0 then
|
||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
|
@ -82,11 +81,11 @@ function M:InitView(url, use_custom_bg)
|
|||
local _player_card_info = self._player_card_info
|
||||
for i = 1, _room.room_config.people_num do
|
||||
local tem = _view:GetChild("player_card_info" .. i)
|
||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem,i)
|
||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
||||
end
|
||||
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_card_info[self:GetPos(p.seat)]
|
||||
info:SetPlayer(p)
|
||||
|
|
@ -95,20 +94,19 @@ function M:InitView(url, use_custom_bg)
|
|||
|
||||
local list = _room.player_list
|
||||
local readyNum = 0
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
if p.ready then readyNum = readyNum + 1 end
|
||||
end
|
||||
|
||||
for i=1,#_room.player_list do
|
||||
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
if self._room.card_type == 2 then
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
end
|
||||
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
|
||||
self._ctr_action = _view:GetController("action")
|
||||
|
|
@ -126,27 +124,24 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
function M:Change3d(flag)
|
||||
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
|
||||
local _cardbox = _view:GetChild("cardbox")
|
||||
|
||||
for i=1,#_room.player_list do
|
||||
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
if self._room.card_type == 2 then
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
end
|
||||
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
|
||||
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
||||
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
||||
if flag == true then
|
||||
|
||||
if _view:GetController("3d") ~= nil then
|
||||
_view:GetController("3d").selectedIndex = 1
|
||||
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
||||
|
|
@ -199,7 +194,7 @@ function M:NewSettingView()
|
|||
-- gear:Apply()
|
||||
-- settingView.Change3d = function() end
|
||||
|
||||
settingView:FillBgSection(function(url,index)
|
||||
settingView:FillBgSection(function(url, index)
|
||||
printlog("NewSettingView")
|
||||
LoadGameBg(url, self._root_view)
|
||||
end, self._room.game_id, 1, bg_config)
|
||||
|
|
@ -230,30 +225,29 @@ function M:GetIndex(seat)
|
|||
end
|
||||
|
||||
function M:GetPosString(seat)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "南","dir_2"
|
||||
return "南", "dir_2"
|
||||
elseif seat == 3 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
elseif seat == 4 then
|
||||
return "北","dir_4"
|
||||
return "北", "dir_4"
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "南","dir_2"
|
||||
return "南", "dir_2"
|
||||
elseif seat == 3 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -261,7 +255,7 @@ end
|
|||
function M:SetCardBoxPosition()
|
||||
local _room = self._room
|
||||
for i = 1, _room.room_config.people_num do
|
||||
local tex = self._view:GetChild("cardbox"):GetChild("direction"..i)
|
||||
local tex = self._view:GetChild("cardbox"):GetChild("direction" .. i)
|
||||
local index = _room.self_player.seat + i - 1
|
||||
index = index > 4 and index - 4 or index
|
||||
tex.text = self._gamectr:GetPosString(index)
|
||||
|
|
@ -287,16 +281,16 @@ function M:markOutCards(showTip, data)
|
|||
end
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
MainView.OnPlayerEnter(self,...)
|
||||
local arg = {...}
|
||||
MainView.OnPlayerEnter(self, ...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = self._player_card_info[self:GetPos(p.seat)]
|
||||
info:SetPlayer(p)
|
||||
info:FillData()
|
||||
end
|
||||
|
||||
function M:OnPlayerReady( ... )
|
||||
local arg = {...}
|
||||
function M:OnPlayerReady(...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
|
|
@ -316,12 +310,11 @@ function M:OnPlayerReady( ... )
|
|||
|
||||
if readyNum == _room.room_config.people_num then
|
||||
local _cardbox = _view:GetChild("cardbox")
|
||||
for i=1,#_room.player_list do
|
||||
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -376,7 +369,7 @@ function M:CountCardLeftNum(card)
|
|||
return count
|
||||
end
|
||||
|
||||
function M:OnPlayerLeave( ... )
|
||||
function M:OnPlayerLeave(...)
|
||||
MainView.OnPlayerLeave(self, ...)
|
||||
local _room = self._room
|
||||
if _room.banker_seat == _room.self_player.seat then
|
||||
|
|
@ -387,7 +380,7 @@ end
|
|||
function M:PlayerChangeLineState()
|
||||
local isOutCard = true
|
||||
local str = "玩家 "
|
||||
for _ , player in ipairs(self._room.player_list) do
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
if player.line_state == 0 then
|
||||
isOutCard = false
|
||||
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
||||
|
|
@ -407,11 +400,11 @@ function M:PlayerChangeLineState()
|
|||
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:RemoveCursor()
|
||||
|
|
@ -436,10 +429,10 @@ function M:PlayMJMusic(path)
|
|||
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
||||
end
|
||||
|
||||
function M:PlaySound(group,sex,path)
|
||||
function M:PlaySound(group, sex, path)
|
||||
local sex_path = ViewUtil.Sex_Chat[sex]
|
||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3",sex_path,path)
|
||||
ViewUtil.PlaySound(group,path1)
|
||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
|
||||
ViewUtil.PlaySound(group, path1)
|
||||
end
|
||||
|
||||
function M:GetPrefix()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ local M = PlayerCardInfoView
|
|||
--- Create a new PlayerCardInfoView
|
||||
function M.new(view, mainView)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = M})
|
||||
setmetatable(self, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
|
|
@ -126,10 +126,10 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local handcard_list = self._mask_data['handcard_list']
|
||||
local oder = handcard_list['oder']
|
||||
local _player = self._player
|
||||
-- print(vardump(self._player))
|
||||
-- -- print(vardump(self._player))
|
||||
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
-- print(vardump(_player.card_list))
|
||||
-- -- print(vardump(_player.card_list))
|
||||
if (not mp) then
|
||||
local comp_back = handcard_list['comp_back']
|
||||
if self._current_card_type == 2 then
|
||||
|
|
@ -161,8 +161,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local outcard_list = self._mask_data['outcard_list']
|
||||
local comp = handcard_list['comp']
|
||||
local card = outcard_list['card']
|
||||
--print("comp"..comp)
|
||||
-- print(vardump(_player.card_list))
|
||||
---- print("comp"..comp)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. '_3d'
|
||||
|
|
@ -296,8 +296,8 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
end
|
||||
end
|
||||
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col,0,true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row,0,true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, 0, true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, 0, true)
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
||||
|
|
@ -358,8 +358,8 @@ end
|
|||
|
||||
function M:UpdateFzList(fz, index, show_card)
|
||||
printlog("UpdateFzList=====》》》")
|
||||
printlog("index===",index)
|
||||
printlog("show_card===",show_card)
|
||||
printlog("index===", index)
|
||||
printlog("show_card===", show_card)
|
||||
local gn = 3
|
||||
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
||||
gn = 4
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function M:setHandCardPos(btn_card, i, getcard)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("======================onthisUpdateHandCard")
|
||||
-- print("======================onthisUpdateHandCard")
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
|
|
@ -154,7 +154,7 @@ function M:__OnDragEnd(context)
|
|||
local _room = DataManager.CurrenRoom
|
||||
if not _room or _room:GetReloadStatus() then return end
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ local MJTableBG = {}
|
|||
|
||||
local M = MJTableBG
|
||||
local mj_bg_config = {
|
||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
||||
{id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01"},
|
||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
||||
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||
{ id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
|
||||
{ id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01" },
|
||||
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||
}
|
||||
|
||||
local function GetBG(data, game_id)
|
||||
|
|
@ -52,7 +52,7 @@ function MJTableBG.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)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "TuiDaoHu_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/tuidaohu/ui/Extend_MJ_TuiDaoHu")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
|
|
@ -126,16 +119,16 @@ function M:InitPlayerInfoView()
|
|||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
|||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("TuiDaoHu_MJ",player.self_user.sex, hu_sound)
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
|||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
|
|
@ -322,12 +314,12 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -336,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -402,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -423,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -443,7 +435,7 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
|
|
@ -452,12 +444,12 @@ function M:OutCard(card)
|
|||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -475,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
|
|
@ -548,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -571,12 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -603,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -621,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -698,7 +691,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -716,7 +709,7 @@ function M:ReloadRoom(bskip)
|
|||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
|||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
|||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
|
|
@ -98,12 +98,12 @@ function M:FillRoomData(s2croom)
|
|||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -137,7 +137,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
--if #tingList > 0 then
|
||||
-- table.insert(tingList, 412)
|
||||
--end
|
||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -81,7 +83,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -134,7 +136,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -168,10 +171,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -12,8 +12,8 @@ local PlayerInfoView = import(".EXPlayerInfoView")
|
|||
local TableBG = import('Game.Data.TableBG')
|
||||
local M = {}
|
||||
function M.new()
|
||||
setmetatable(M, {__index = PKMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = PKMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ChunTian_MainView"
|
||||
self:init()
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
|
|
@ -22,19 +22,20 @@ end
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'},
|
||||
{id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2'},
|
||||
{id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3'}
|
||||
{ id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
|
||||
}
|
||||
|
||||
function M:InitView(url)
|
||||
local room = self._room
|
||||
UIPackage.AddPackage("extend/poker/chuntian/ui/Extend_Poker_ChunTian")
|
||||
printlog(room.room_config.people_num)
|
||||
PKMainView.InitView(self, "ui://Extend_Poker_ChunTian/ChunTian_Main_" .. room.room_config.people_num,nil,1,default_bg,bg_config,nil,"ui://Extend_Poker_ChunTian/SettingWindow1")
|
||||
PKMainView.InitView(self, "ui://Extend_Poker_ChunTian/ChunTian_Main_" .. room.room_config.people_num, nil, 1,
|
||||
default_bg, bg_config, nil, "ui://Extend_Poker_ChunTian/SettingWindow1")
|
||||
local _room = DataManager.CurrenRoom
|
||||
local user_id = DataManager.SelfUser.account_id
|
||||
local json_data = Utils.LoadLocalFile(user_id.._room.game_id.."pai")
|
||||
local json_data = Utils.LoadLocalFile(user_id .. _room.game_id .. "pai")
|
||||
if json_data == nil then
|
||||
local _gamectr = self._gamectr
|
||||
self._room.pai = 0
|
||||
|
|
@ -44,7 +45,7 @@ function M:InitView(url)
|
|||
self._room.pai = pai
|
||||
end
|
||||
|
||||
json_data = Utils.LoadLocalFile(user_id.._room.game_id.."cardsize")
|
||||
json_data = Utils.LoadLocalFile(user_id .. _room.game_id .. "cardsize")
|
||||
if json_data == nil then
|
||||
local _gamectr = self._gamectr
|
||||
self._room.cardsize = 1
|
||||
|
|
@ -63,7 +64,7 @@ function M:InitView(url)
|
|||
tem.visible = false
|
||||
end
|
||||
local list = self._room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info._view.visible = true
|
||||
|
|
@ -77,9 +78,8 @@ function M:InitView(url)
|
|||
end
|
||||
|
||||
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
|
||||
for i=1,#self._room.player_list do
|
||||
|
||||
if self._room.self_player.seat==self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then
|
||||
for i = 1, #self._room.player_list do
|
||||
if self._room.self_player.seat == self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then
|
||||
-- body
|
||||
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
||||
local _action = self._view:AddChild(ErrorMsgTip)
|
||||
|
|
@ -88,9 +88,9 @@ function M:InitView(url)
|
|||
local btn1 = _action:GetChild("btn_connect")
|
||||
local btn2 = _action:GetChild("btn_back")
|
||||
text.text = "您来晚了,座位有人,请重新进牌桌"
|
||||
btn1.visible=false
|
||||
btn1.visible = false
|
||||
btn2:Center()
|
||||
btn2.y=btn2.y+50
|
||||
btn2.y = btn2.y + 50
|
||||
btn2.onClick:Set(function()
|
||||
-- body
|
||||
ErrorMsgTip:Destroy()
|
||||
|
|
@ -107,9 +107,9 @@ function M:InitView(url)
|
|||
|
||||
if self._room.hpOnOff == 1 and self._room.score_times ~= 1 then
|
||||
-- body
|
||||
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text=self._room.score_times .."倍"
|
||||
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text = self._room.score_times .. "倍"
|
||||
else
|
||||
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text=""
|
||||
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text = ""
|
||||
end
|
||||
|
||||
self.ctr_state = self._view:GetController("state")
|
||||
|
|
@ -128,15 +128,14 @@ function M:InitView(url)
|
|||
|
||||
local list = room.player_list
|
||||
if not room.self_player.ready then
|
||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig then
|
||||
if round>1 then
|
||||
if round > 1 then
|
||||
self._ctr_action.selectedIndex = 1
|
||||
else
|
||||
self._ctr_action.selectedIndex = 2
|
||||
end
|
||||
|
||||
else
|
||||
self._ctr_action.selectedIndex = 1
|
||||
end
|
||||
|
|
@ -153,20 +152,17 @@ function M:InitView(url)
|
|||
self:ReConnectForStart()
|
||||
end
|
||||
else
|
||||
|
||||
self._state.selectedIndex = StateType.Palying
|
||||
self:ReconnectForClearing()
|
||||
|
||||
end
|
||||
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function ()
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function()
|
||||
if self.dismiss_room_cd_time > 0 then
|
||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
end
|
||||
|
||||
end)
|
||||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||
|
|
@ -184,20 +180,19 @@ function M:InitView(url)
|
|||
if room.room_config.people_num == 2 then
|
||||
self._view:GetChild('wanfa_text').text = '二人春天' .. room.score_times .. '倍'
|
||||
else
|
||||
if room.room_config.people_num==3 then
|
||||
if room.room_config.people_num == 3 then
|
||||
self._view:GetChild('wanfa_text').text = '三人春天' .. room.score_times .. '倍'
|
||||
else
|
||||
self._view:GetChild('wanfa_text').text = '四人春天' .. room.score_times .. '倍'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
function M:UpdateCard( index )
|
||||
self._room.pai=index
|
||||
|
||||
function M:UpdateCard(index)
|
||||
self._room.pai = index
|
||||
local card_info = self._player_card_info[1]
|
||||
-- for i=1,#self._room.player_list do
|
||||
-- print(i)
|
||||
-- -- print(i)
|
||||
-- end
|
||||
card_info:updatePoker()
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
|
|
@ -211,11 +206,11 @@ function M:UpdateCard( index )
|
|||
end
|
||||
end
|
||||
end
|
||||
if self.caozuo==1 then
|
||||
if self.caozuo == 1 then
|
||||
local ctr_number = self.pass == nil and 2 or 1
|
||||
local lastCardList = self._gamectr:GetLastCardList(self._room.self_player.seat)
|
||||
local cardType, cardNum, cardLength = self._gamectr:GetCardListInfo(lastCardList)
|
||||
printlog("caozuo",cardType)
|
||||
printlog("caozuo", cardType)
|
||||
local m = false
|
||||
local next_seat = self._room.self_player.seat + 1
|
||||
if next_seat > self._room.room_config.people_num then
|
||||
|
|
@ -225,12 +220,12 @@ function M:UpdateCard( index )
|
|||
m = true
|
||||
end
|
||||
local zdts = self._view:GetController("zidongtishi").selectedIndex
|
||||
self._player_card_info[1]:ShowOutCardOption(ctr_number, cardType, cardNum, cardLength,m)
|
||||
self._player_card_info[1]:ShowOutCardOption(ctr_number, cardType, cardNum, cardLength, m)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateCardSize(index)
|
||||
self._room.cardsize=index
|
||||
self._room.cardsize = index
|
||||
local card_info = self._player_card_info[1]
|
||||
card_info:updatePoker()
|
||||
end
|
||||
|
|
@ -244,7 +239,7 @@ end
|
|||
|
||||
function M:OnPlayerEnter(...)
|
||||
MainView.OnPlayerEnter(self, ...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local index = self:GetPos(p.seat)
|
||||
local info = self._player_info[index]
|
||||
|
|
@ -259,7 +254,7 @@ function M:OnPlayerEnter(...)
|
|||
end
|
||||
|
||||
function M:OnPlayerReady(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local _room = self._room
|
||||
local _player_info = self._player_info
|
||||
|
|
@ -275,15 +270,14 @@ function M:OnPlayerLeave(...)
|
|||
local _room = self._room
|
||||
if not _room.self_player.ready then
|
||||
--self._ctr_action.selectedIndex = 1
|
||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig then
|
||||
if round>1 then
|
||||
if round > 1 then
|
||||
self._ctr_action.selectedIndex = 1
|
||||
else
|
||||
self._ctr_action.selectedIndex = 2
|
||||
end
|
||||
|
||||
else
|
||||
self._ctr_action.selectedIndex = 1
|
||||
end
|
||||
|
|
@ -292,7 +286,6 @@ function M:OnPlayerLeave(...)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function M:EventInit()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
MainView.EventInit(self)
|
||||
|
|
@ -301,8 +294,7 @@ function M:EventInit()
|
|||
local _room = self._room
|
||||
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.EventXiPai,function( ... )
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.EventXiPai, function(...)
|
||||
if self.result_view ~= nil then
|
||||
self.result_view:Destroy()
|
||||
self.result_view = nil
|
||||
|
|
@ -310,7 +302,7 @@ function M:EventInit()
|
|||
|
||||
self._player_card_info[1]:HidePiao()
|
||||
|
||||
if self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
|
|
@ -318,7 +310,7 @@ function M:EventInit()
|
|||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible=false
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
|
|
@ -332,28 +324,24 @@ function M:EventInit()
|
|||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
if head_info._view:GetChild("shengyu")~=nil and head_info._view:GetController("shengyu")~=nil then
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
if self._room.room_config.showlength==1 then
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex=1
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex=0
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..p.hand_count.."张"
|
||||
|
||||
|
||||
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||
end
|
||||
p:Clear()
|
||||
head_info:FillData(p)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
head_info:Ready(false)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -374,34 +362,29 @@ function M:EventInit()
|
|||
end--]]
|
||||
|
||||
|
||||
local arg = {...}
|
||||
local currentPlayer1=arg[1]
|
||||
local currentPlayer2=arg[2]
|
||||
local arg = { ... }
|
||||
local currentPlayer1 = arg[1]
|
||||
local currentPlayer2 = arg[2]
|
||||
self._popEvent = false
|
||||
if ( currentPlayer1 ) then
|
||||
|
||||
local xipaiCB=function ()
|
||||
if (currentPlayer1) then
|
||||
local xipaiCB = function()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai(xipaiCB)
|
||||
|
||||
end
|
||||
|
||||
|
||||
if ( currentPlayer2 ) then
|
||||
if (currentPlayer2) then
|
||||
--self._popEvent = false
|
||||
local xipaiCB2=function ()
|
||||
local xipaiCB2 = function()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai1(xipaiCB2)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnMingCard, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local card = arg[1]
|
||||
self.ctr_state.selectedIndex = 1
|
||||
self.ctr_card_eff.selectedIndex = 1
|
||||
|
|
@ -409,7 +392,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnInitCard, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local round = arg[1]
|
||||
local cardlist = arg[2]
|
||||
|
||||
|
|
@ -421,7 +404,7 @@ function M:EventInit()
|
|||
|
||||
self._player_card_info[1]:HidePiao()
|
||||
|
||||
if self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
|
|
@ -429,7 +412,7 @@ function M:EventInit()
|
|||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible=false
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
|
|
@ -444,21 +427,18 @@ function M:EventInit()
|
|||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
if head_info._view:GetChild("shengyu")~=nil and head_info._view:GetController("shengyu")~=nil then
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
if self._room.room_config.showlength==1 then
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex=1
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex=0
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..p.hand_count.."张"
|
||||
|
||||
|
||||
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||
end
|
||||
p:Clear()
|
||||
head_info:FillData(p)
|
||||
|
|
@ -467,13 +447,12 @@ function M:EventInit()
|
|||
head_info:Ready(false)
|
||||
|
||||
if p.seat == self._room.self_player.seat then
|
||||
if self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
card_info:InitPoker(cardlist,true,1)
|
||||
card_info:InitPoker(cardlist, true, 1)
|
||||
else
|
||||
card_info:InitPoker(cardlist,true)
|
||||
card_info:InitPoker(cardlist, true)
|
||||
end
|
||||
|
||||
else
|
||||
--card_info:UpdateHandPoker(#cardlist,true,false) --todo
|
||||
--card_info:UpdateRemainCard(#cardlist,true)
|
||||
|
|
@ -489,7 +468,7 @@ function M:EventInit()
|
|||
-- head_info._view:GetController("Oener").selectedIndex=1
|
||||
-- end)
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnIndexMove, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local isNewBout = arg[2]
|
||||
local index = self:GetPos(seat)
|
||||
|
|
@ -528,7 +507,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnBombScore, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local scoreList = arg[1]
|
||||
-- for i = 1, #scoreList do
|
||||
-- local player = self._room:GetPlayerBySeat(i)
|
||||
|
|
@ -540,7 +519,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPlaySucc, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card_number = arg[2]
|
||||
local cardstype = arg[3]
|
||||
|
|
@ -550,19 +529,17 @@ function M:EventInit()
|
|||
self.ctr_time.selectedIndex = 0
|
||||
|
||||
local index = self:GetPos(p.seat)
|
||||
if index==1 then
|
||||
self.caozuo=0
|
||||
if index == 1 then
|
||||
self.caozuo = 0
|
||||
end
|
||||
local head_info = self._player_info[index]
|
||||
if head_info._view:GetChild("shengyu")~=nil then
|
||||
if head_info._view:GetChild("shengyu") ~= nil then
|
||||
-- body
|
||||
-- body
|
||||
if card_number~=nil then
|
||||
if card_number ~= nil then
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..card_number.."张"
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. card_number .. "张"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
local card_info = self._player_card_info[index]
|
||||
card_info:SetOutCardInfo(p.out_card_list, false, true)
|
||||
|
|
@ -613,9 +590,8 @@ function M:EventInit()
|
|||
-- end
|
||||
-- end
|
||||
self:_Effect(cardstype, p)
|
||||
|
||||
else
|
||||
if cardstype == 11 and cardstype~=12 then
|
||||
if cardstype == 11 and cardstype ~= 12 then
|
||||
self:_Effect(cardstype, p)
|
||||
end
|
||||
end
|
||||
|
|
@ -632,13 +608,12 @@ function M:EventInit()
|
|||
self:PlaySound(p.self_user.sex, "card_1")
|
||||
end)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSuccCheckCard, function(...)
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local cards = arg[2]
|
||||
--self.MypokerList=cards
|
||||
|
|
@ -657,11 +632,10 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
self._popEvent = true
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSucc, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
|
||||
self.ctr_time.selectedIndex = 0
|
||||
|
|
@ -679,19 +653,18 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnErrorTip, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local error_str = arg[1]
|
||||
self._player_card_info[1]:ErrorTip(error_str)
|
||||
-- self._player_card_info[1]:ResetPoker()
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local piao = arg[1]
|
||||
local reload = arg[2]
|
||||
if reload == 0 then
|
||||
|
||||
if self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
|
|
@ -699,7 +672,7 @@ function M:EventInit()
|
|||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible=false
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
|
|
@ -728,7 +701,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoAction, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local piao = arg[2]
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
|
|
@ -736,15 +709,15 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnOptions, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local play = arg[1]
|
||||
local pass = arg[5]
|
||||
local card_type = arg[2]
|
||||
local card_number = arg[3]
|
||||
local card_length = arg[4]
|
||||
local ctr_number = pass == nil and 2 or 1
|
||||
self.caozuo=1 --记录是否是自己出牌的阶段
|
||||
self.pass=pass
|
||||
self.caozuo = 1 --记录是否是自己出牌的阶段
|
||||
self.pass = pass
|
||||
local m = false
|
||||
local next_seat = self._room.self_player.seat + 1
|
||||
local card_info = self._player_card_info[1]
|
||||
|
|
@ -763,11 +736,11 @@ function M:EventInit()
|
|||
m = true
|
||||
end
|
||||
local zdts = self._view:GetController("zidongtishi").selectedIndex
|
||||
self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length,m,play,zdts)
|
||||
self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts)
|
||||
end)
|
||||
-- 托管
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.Game_TuoGuan, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local tuoguan = arg[1]
|
||||
local seat = arg[2]
|
||||
|
||||
|
|
@ -775,7 +748,7 @@ function M:EventInit()
|
|||
local zhezhao = self._view:GetChild("n109")
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
if (tuoguan == 1) then
|
||||
if (seat == self._room.self_player.seat ) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
tuoguanzhong.visible = true
|
||||
-- tuoguanzhong.sortingOrder = 2
|
||||
zhezhao.visible = true
|
||||
|
|
@ -804,7 +777,7 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnResult, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local over = arg[1]
|
||||
local info = arg[2]
|
||||
local win_seat = arg[3]
|
||||
|
|
@ -825,12 +798,12 @@ function M:EventInit()
|
|||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
otherpoker_list.visible=true
|
||||
otherpoker_list.visible = true
|
||||
end
|
||||
|
||||
if remaincards then
|
||||
-- body
|
||||
local newremaincards = _gamectr:ChangeCodeByFrom(remaincards,true)
|
||||
local newremaincards = _gamectr:ChangeCodeByFrom(remaincards, true)
|
||||
table.sort(remaincards)
|
||||
for i = #newremaincards, 1, -1 do
|
||||
coroutine.start(function()
|
||||
|
|
@ -845,22 +818,20 @@ function M:EventInit()
|
|||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
local card_code_obj = nil
|
||||
if DataManager.CurrenRoom.pai==0 then
|
||||
if card_n==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
if DataManager.CurrenRoom.pai == 0 then
|
||||
if card_n == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
-- body
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n.."_1")
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n .. "_1")
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n)
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||
end
|
||||
|
||||
else
|
||||
if card_n==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
if card_n == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
-- body
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n.."_2")
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n .. "_2")
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
end
|
||||
|
||||
end
|
||||
if card_code_obj ~= nil then
|
||||
card_code_obj:SetScale(0.6, 0.6)
|
||||
|
|
@ -868,14 +839,9 @@ function M:EventInit()
|
|||
poker_item:AddChild(card_code_obj)
|
||||
otherpoker_list:AddChild(poker_item)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -963,7 +929,8 @@ function M:EventInit()
|
|||
self:ChangeBgmMusic(1)
|
||||
|
||||
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, info, self._room.room_id, over, win_seat, 0, remaincards)
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, info, self._room.room_id, over, win_seat, 0,
|
||||
remaincards)
|
||||
self.result_view:Show()
|
||||
if self.WinItem_view ~= nil then
|
||||
self.WinItem_view:Dispose()
|
||||
|
|
@ -980,26 +947,22 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
|
||||
if over==1 then
|
||||
if over == 1 then
|
||||
-- body
|
||||
self:UnmarkSelfTuoguan()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnResultByDissolve, function(...)
|
||||
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local over = arg[1]
|
||||
local info = arg[2]
|
||||
local winseat = arg[3]
|
||||
local dissolve = arg[4]
|
||||
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, info, self._room.room_id, over, winseat, dissolve,nil)
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, info, self._room.room_id, over, winseat, dissolve,
|
||||
nil)
|
||||
self.result_view:Show()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
self:UnmarkSelfTuoguan()
|
||||
|
|
@ -1007,7 +970,7 @@ function M:EventInit()
|
|||
|
||||
-- 确定开始下一局 成功
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnConfrimToNextGameSucc, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local aid = arg[1]
|
||||
local p = self._room:GetPlayerById(aid)
|
||||
if p.seat == self._room.self_player.seat then
|
||||
|
|
@ -1026,7 +989,7 @@ function M:EventInit()
|
|||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible=false
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
--player_head._view:GetController("Oener").selectedIndex=0
|
||||
|
|
@ -1038,23 +1001,21 @@ function M:EventInit()
|
|||
|
||||
-------------------报春提示----------------------------
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertBaoChun, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
printlog("报春自己座位号+++++++++++++++++")
|
||||
self._player_card_info[1]:ShowBaoChun(1)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertTongYiBaoChun, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
printlog("同意报春座位号+++++++++++++++++")
|
||||
self._player_card_info[1]:ShowTongYiBaoChun(2)
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function M:ReConnectForStart()
|
||||
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.is_new_bout = _gamectr:GetIsNewBout(self._room.curren_turn_seat)
|
||||
self._state.selectedIndex = 1
|
||||
|
|
@ -1089,36 +1050,29 @@ function M:ReConnectForStart()
|
|||
head_info:UpdateLineState(player.line_state)
|
||||
head_info:UpdatePiao(player.piao)
|
||||
|
||||
if head_info._view:GetChild("shengyu")~=nil and head_info._view:GetController("shengyu")~=nil then
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
|
||||
if self._room.room_config.showlength==1 then
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex=1
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex=0
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..player.hand_count.."张"
|
||||
|
||||
|
||||
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. player.hand_count .. "张"
|
||||
end
|
||||
if player.seat == self._room.self_player.seat then
|
||||
if player.open ~= nil and player.open == 0 and self._room.room_config.people_num==3 and self._room.room_config.fangzuobi==1 then
|
||||
if player.open ~= nil and player.open == 0 and self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = player.hand_list
|
||||
player_card_info:InitPoker(player.hand_list, false, 1)
|
||||
|
||||
else
|
||||
|
||||
player_card_info:InitPoker(player.hand_list, false)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
player_card_info:SetRemainCardNumber(player.hand_count == 1)
|
||||
if player.hand_count == 1 then
|
||||
self.bgm_index = 2
|
||||
|
|
@ -1170,54 +1124,49 @@ function M:ReconnectForClearing()
|
|||
head_info:UpdateLineState(player.line_state)
|
||||
--head_info._view:GetController("Oener").selectedIndex=0
|
||||
head_info:UpdatePiao(player.piao)
|
||||
if head_info._view:GetChild("shengyu")~=nil and head_info._view:GetController("shengyu")~=nil then
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
if self._room.room_config.showlength==1 then
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex=1
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex=0
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..player.hand_count.."张"
|
||||
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. player.hand_count .. "张"
|
||||
end
|
||||
|
||||
|
||||
if player.seat == self._room.self_player.seat then
|
||||
|
||||
player_card_info:InitPoker(player.hand_list, false)
|
||||
else
|
||||
player_card_info:UpdateHandPoker(player.hand_list, false, true)
|
||||
end
|
||||
if player.out_card_list[1] == 0 then
|
||||
|
||||
player_card_info:SetOutCardInfo(nil, false)
|
||||
else
|
||||
player_card_info:SetOutCardInfo(player.out_card_list, false)
|
||||
end
|
||||
end
|
||||
win_seat=self._room.winseat
|
||||
win_seat = self._room.winseat
|
||||
self._room.winseat = nil
|
||||
|
||||
local remaincards = self._room.remaincards
|
||||
if self._room.game_status==1 then
|
||||
|
||||
|
||||
if self._room.game_status == 1 then
|
||||
-- body
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.3)
|
||||
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, self._room.player_list, self._room.room_id, 0, win_seat,0,remaincards)
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, self._room.player_list, self._room.room_id, 0,
|
||||
win_seat, 0, remaincards)
|
||||
self.result_view:Show()
|
||||
local card_info = self._player_card_info[1]
|
||||
card_info._view:GetChild("out_card_list").visible=true
|
||||
card_info._view:GetChild("out_card_list").visible = true
|
||||
end)
|
||||
if remaincards then
|
||||
|
||||
local newremaincards = self._gamectr:ChangeCodeByFrom(remaincards,true)
|
||||
local newremaincards = self._gamectr:ChangeCodeByFrom(remaincards, true)
|
||||
|
||||
-- body
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
|
|
@ -1225,7 +1174,7 @@ function M:ReconnectForClearing()
|
|||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
otherpoker_list.visible=true
|
||||
otherpoker_list.visible = true
|
||||
end
|
||||
|
||||
for i = #newremaincards, 1, -1 do
|
||||
|
|
@ -1242,14 +1191,14 @@ function M:ReconnectForClearing()
|
|||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
local card_code_obj
|
||||
if DataManager.CurrenRoom.pai==0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n)
|
||||
if DataManager.CurrenRoom.pai == 0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
end
|
||||
if card_n==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
if card_n == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
|
||||
-- body
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n.."_1")
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n .. "_1")
|
||||
end
|
||||
card_code_obj:SetScale(0.6, 0.6)
|
||||
poker_item:AddChild(card_code_obj)
|
||||
|
|
@ -1267,13 +1216,13 @@ function M:CreateRankEff()
|
|||
self.rank_view:GetTransition("t0"):Play()
|
||||
end
|
||||
|
||||
function M:_Effect( type1 ,player)
|
||||
function M:_Effect(type1, player)
|
||||
-- body
|
||||
|
||||
if type1 > 11 or type1 < 3 then
|
||||
return
|
||||
end
|
||||
printlog("effect ",type1)
|
||||
printlog("effect ", type1)
|
||||
local eff_code = 0
|
||||
if type1 == 3 then
|
||||
eff_code = 2
|
||||
|
|
@ -1282,7 +1231,7 @@ function M:_Effect( type1 ,player)
|
|||
elseif type1 == 5 then
|
||||
eff_code = 5
|
||||
elseif type1 == 6 then
|
||||
eff_code=1
|
||||
eff_code = 1
|
||||
elseif type1 == 7 then
|
||||
return
|
||||
elseif type1 == 8 then
|
||||
|
|
@ -1298,31 +1247,31 @@ function M:_Effect( type1 ,player)
|
|||
end
|
||||
local info = self._player_card_info[self:GetPos(player.seat)]
|
||||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/eff_"..eff_code)
|
||||
local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/eff_" .. eff_code)
|
||||
|
||||
effect.touchable = false
|
||||
effect:GetTransition("t0"):Play()
|
||||
-- effect:SetXY((self._view.width - effect.width) / 2,(self._view.hight - effect.hight) / 2)
|
||||
if eff_code==3 then
|
||||
if eff_code == 3 then
|
||||
self._view:AddChild(effect)
|
||||
else
|
||||
pNode:AddChild(effect)
|
||||
end
|
||||
|
||||
|
||||
if eff_code==1 then
|
||||
if eff_code == 1 then
|
||||
self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/eff_feiji")
|
||||
self._view:AddChild(self.eff_feiji)
|
||||
self.eff_feiji:Center()
|
||||
self.eff_feiji:GetTransition("t0"):Play()
|
||||
end
|
||||
if eff_code==3 then
|
||||
if eff_code == 3 then
|
||||
effect:Center()
|
||||
else
|
||||
if self:GetPos(player.seat)== 1 then
|
||||
effect.x,effect.y = 0,24
|
||||
if self:GetPos(player.seat) == 1 then
|
||||
effect.x, effect.y = 0, 24
|
||||
else
|
||||
effect.x,effect.y = 24,67
|
||||
effect.x, effect.y = 24, 67
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1336,7 +1285,7 @@ function M:_Effect( type1 ,player)
|
|||
-- else
|
||||
coroutine.start(function()
|
||||
coroutine.wait(1)
|
||||
if self.eff_feiji~=nil then
|
||||
if self.eff_feiji ~= nil then
|
||||
self.eff_feiji:Dispose()
|
||||
end
|
||||
effect:Dispose()
|
||||
|
|
@ -1344,11 +1293,9 @@ function M:_Effect( type1 ,player)
|
|||
-- end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:UpdateRound(round)
|
||||
local total_round = self._room.room_config.Times
|
||||
printlog("jefe total_round:",total_round)
|
||||
printlog("jefe total_round:", total_round)
|
||||
self._text_round.text = string.format("%d / %d 局", round, total_round)
|
||||
end
|
||||
|
||||
|
|
@ -1408,8 +1355,8 @@ function M:PlayCardEff(card)
|
|||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||
local card_code_obj
|
||||
if DataManager.CurrenRoom.pai==0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card)
|
||||
if DataManager.CurrenRoom.pai == 0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card)
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||
end
|
||||
|
|
@ -1434,7 +1381,6 @@ function M:PlayCardEff(card)
|
|||
coroutine.wait(1)
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function M:ResetPoker()
|
||||
|
|
@ -1445,8 +1391,7 @@ function M:ResetPoker()
|
|||
end
|
||||
|
||||
function M:PlaySound(sex, path)
|
||||
|
||||
local sex_path = ViewUtil.Sex_Chat[sex]-- 1 男 2 女
|
||||
local sex_path = ViewUtil.Sex_Chat[sex] -- 1 男 2 女
|
||||
local sound_path = string.format("extend/poker/chuntian/sound/%s/%s.mp3", sex_path, path)
|
||||
ViewUtil.PlaySound("ChunTianNew_PK", sound_path)
|
||||
end
|
||||
|
|
@ -1459,11 +1404,12 @@ function M:ChangeBgmMusic(bgm_index)
|
|||
end
|
||||
ViewUtil.PlayMuisc("ChunTianNew_PK", string.format("extend/poker/chuntian/sound/bgm%d.mp3", 1))
|
||||
end
|
||||
function M:OnPlayerEnter( ... )
|
||||
local arg = {...}
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
for i=1,#self._room.player_list do
|
||||
if self._room.self_player.seat==self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then
|
||||
for i = 1, #self._room.player_list do
|
||||
if self._room.self_player.seat == self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then
|
||||
-- body
|
||||
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
||||
local _action = self._view:AddChild(ErrorMsgTip)
|
||||
|
|
@ -1472,9 +1418,9 @@ function M:OnPlayerEnter( ... )
|
|||
local btn1 = _action:GetChild("btn_connect")
|
||||
local btn2 = _action:GetChild("btn_back")
|
||||
text.text = "您来晚了,座位有人,请重新进牌桌"
|
||||
btn1.visible=false
|
||||
btn1.visible = false
|
||||
btn2:Center()
|
||||
btn2.y=btn2.y+50
|
||||
btn2.y = btn2.y + 50
|
||||
btn2.onClick:Set(function()
|
||||
-- body
|
||||
ErrorMsgTip:Destroy()
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ local ChunTian_Record_Event = {
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'},
|
||||
{id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2'},
|
||||
{id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3'}
|
||||
{ id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
|
||||
}
|
||||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M, {__index = PKPlayBackView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = PKPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'ChunTian_PlayBackView'
|
||||
self:init()
|
||||
|
||||
|
|
@ -42,7 +42,8 @@ function M:InitView(url)
|
|||
end
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
UIPackage.AddPackage('extend/poker/chuntian/ui/Extend_Poker_ChunTian')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num, default_bg, bg_config)
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num,
|
||||
default_bg, bg_config)
|
||||
self._tex_round = self._view:GetChild('round')
|
||||
self._player_card_info = {}
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -65,7 +66,7 @@ function M:InitView(url)
|
|||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
end
|
||||
local list = self._room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info._view.visible = true
|
||||
|
|
@ -94,7 +95,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
|||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
print("hidezhanji 1111")
|
||||
-- print("hidezhanji 1111")
|
||||
self._currentStep = 1
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -109,12 +110,12 @@ function M:FillRoomData(data)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
|
||||
if p.total_hp then
|
||||
print("hidezhanji 2222")
|
||||
-- print("hidezhanji 2222")
|
||||
|
||||
head_info._view:GetChild('zhanji').visible=false
|
||||
head_info._view:GetChild('zhanji').visible = false
|
||||
|
||||
if room.hpOnOff == 1 or room:checkHpNonnegative() then
|
||||
head_info._view:GetChild('zhanji').visible=true
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||
end
|
||||
end
|
||||
|
|
@ -125,7 +126,6 @@ function M:FillRoomData(data)
|
|||
card_info:UpdateHandPoker(p.hand_list, false, true)
|
||||
end
|
||||
head_info:UpdatePiao(p.piao)
|
||||
|
||||
end
|
||||
|
||||
self:UpdateRound()
|
||||
|
|
@ -136,7 +136,7 @@ end
|
|||
|
||||
function M:ShowStep(index)
|
||||
local step = self._step[index]
|
||||
if step==nil then
|
||||
if step == nil then
|
||||
return
|
||||
end
|
||||
for i = 1, #step.player_card_data do
|
||||
|
|
@ -152,7 +152,6 @@ function M:ShowStep(index)
|
|||
else
|
||||
info:InitPoker(p.hand_list, false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if step.cmd == ChunTian_Record_Event.Evt_OutCard then
|
||||
|
|
@ -194,7 +193,8 @@ function M:ShowStep(index)
|
|||
end
|
||||
if step.cmd == ChunTian_Record_Event.Evt_Result then
|
||||
local Result = step.Result
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type, Result.winseat, 0, Result.remaincards)
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type,
|
||||
Result.winseat, 0, Result.remaincards)
|
||||
local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
|
||||
self._view:AddChildAt(self.result_view._view, num)
|
||||
else
|
||||
|
|
@ -257,6 +257,7 @@ function M:CmdPass(cmd, index)
|
|||
data.cmd = cmd.cmd
|
||||
data.current_out_seat = cmd.seat
|
||||
end
|
||||
|
||||
function M:Cmdresult(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
|||
|
||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = CardView})
|
||||
setmetatable(self, { __index = CardView })
|
||||
self.btn_card = card
|
||||
self.card_code_number = cardcodenum
|
||||
self.card_code_flower = cardcodeflower
|
||||
|
|
@ -38,8 +38,8 @@ local ChunTian_PlayerSelfPokerInfoView = {
|
|||
local M = ChunTian_PlayerSelfPokerInfoView
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = ChunTian_PlayerPokerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = ChunTian_PlayerPokerInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self.gameCtr = ControllerManager.GetController(GameController)
|
||||
|
|
@ -91,7 +91,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
-- self.zhizhanplay=0
|
||||
-- self.zhizhanzdts=0
|
||||
local cs = 1.25
|
||||
if DataManager.CurrenRoom.cardsize==0 then
|
||||
if DataManager.CurrenRoom.cardsize == 0 then
|
||||
cs = 1.35
|
||||
elseif DataManager.CurrenRoom.cardsize == 1 then
|
||||
cs = 1.25
|
||||
|
|
@ -102,7 +102,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
if self.cor_init_poker ~= nil then
|
||||
coroutine.stop(self.cor_init_poker)
|
||||
end
|
||||
-- print(vardump(self.card_list))
|
||||
-- -- print(vardump(self.card_list))
|
||||
self.cor_init_poker = nil
|
||||
self.card_list = {}
|
||||
|
||||
|
|
@ -176,7 +176,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
end
|
||||
)
|
||||
else
|
||||
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
local card_flower_code = pokerList[i]
|
||||
|
|
@ -200,7 +199,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
end
|
||||
|
||||
function M:updatePoker()
|
||||
|
||||
local templist = {}
|
||||
for i = 1, #self.card_list do
|
||||
templist[#templist + 1] = self.card_list[i].card_code_flower
|
||||
|
|
@ -285,7 +283,7 @@ function M:AddCardMoveEvent(card)
|
|||
if card.btn_card.touchable == true then
|
||||
send_card[#send_card + 1] = card
|
||||
self:SetBtnCardColor(card, 1)
|
||||
--print(vardump(card))
|
||||
---- print(vardump(card))
|
||||
if k == #self.card_list then
|
||||
if
|
||||
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
||||
|
|
@ -343,6 +341,7 @@ function M:AddCardMoveEvent(card)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:zhizhanxuanpai() --智障选牌
|
||||
printlog("zhizhanxuanpai")
|
||||
-- body
|
||||
|
|
@ -419,7 +418,6 @@ function M:TouchMoving(context)
|
|||
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
||||
card.btn_card.x < max_x
|
||||
then
|
||||
|
||||
self:SetBtnCardColor(card, 0.8)
|
||||
if #send_card1 == 0 then
|
||||
-- body
|
||||
|
|
@ -470,7 +468,7 @@ function M:TouchMoving(context)
|
|||
end
|
||||
end
|
||||
end
|
||||
--print(vardump(send_card1))
|
||||
---- print(vardump(send_card1))
|
||||
-- local send_card = {}
|
||||
-- self.send_card = {}
|
||||
-- for i = 1, #self.card_list do
|
||||
|
|
@ -602,7 +600,6 @@ function M:SetOutCardBlack()
|
|||
if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
|
||||
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -785,10 +782,10 @@ function M:BtnEvent()
|
|||
end
|
||||
local send_card = {}
|
||||
self.send_card = {}
|
||||
local currentCard={}
|
||||
local currentCard = {}
|
||||
for i = 1, #self.card_list do
|
||||
local card = self.card_list[i]
|
||||
table.insert(currentCard,card.card_code_flower)
|
||||
table.insert(currentCard, card.card_code_flower)
|
||||
if card.btn_card.selected then
|
||||
send_card[#send_card + 1] = card.card_code_flower
|
||||
self.send_card[#self.send_card + 1] = card
|
||||
|
|
@ -798,7 +795,7 @@ function M:BtnEvent()
|
|||
if #send_card == 0 then
|
||||
self:ErrorTip('请选择要出的牌 ')
|
||||
else
|
||||
self.gameCtr:SendCard(send_card,currentCard)
|
||||
self.gameCtr:SendCard(send_card, currentCard)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
|
@ -851,7 +848,7 @@ function M:BtnEvent()
|
|||
|
||||
local function click_tongyibaochun(sindex)
|
||||
self.ctr_baochun.selectedIndex = 0
|
||||
printlog("jefe:",sindex)
|
||||
printlog("jefe:", sindex)
|
||||
self.gameCtr:SendTongYiBaoChun(sindex)
|
||||
end
|
||||
|
||||
|
|
@ -875,8 +872,6 @@ function M:BtnEvent()
|
|||
btn_tongyi.onClick:Set(function()
|
||||
click_tongyibaochun(1)
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function M:ShowTipsCard(index)
|
||||
|
|
@ -897,7 +892,7 @@ function M:ShowTipsCard(index)
|
|||
end
|
||||
|
||||
function M:GetHandCardOffset(count)
|
||||
local start = -70---54
|
||||
local start = -70 ---54
|
||||
|
||||
local offset = 0
|
||||
if count > 10 then
|
||||
|
|
@ -916,6 +911,7 @@ function M:GetHandCardPos(index, card_count)
|
|||
x = start_x + (self.card_width + offset) * (index - 1)
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
||||
function M:GetHandCardPos1(index, card_count)
|
||||
local x, y = 0, -18
|
||||
local offset = self:GetHandCardOffset(card_count)
|
||||
|
|
@ -924,6 +920,7 @@ function M:GetHandCardPos1(index, card_count)
|
|||
x = start_x + (self.card_width + offset) * (index - 1)
|
||||
return x, y
|
||||
end
|
||||
|
||||
function M:ChangeOneCodeByFrom(card)
|
||||
local flower = math.floor(card / 100)
|
||||
local number = card % 100
|
||||
|
|
@ -969,13 +966,13 @@ end
|
|||
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
||||
local tip_list = {}
|
||||
local sidaisan = false
|
||||
local touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
local touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
|
||||
--pt(self.card_list)
|
||||
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
||||
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
|
||||
--pt(card_map)
|
||||
printlog("TIP type:",type)
|
||||
printlog("TIP type:", type)
|
||||
if type == ChunTian_CardType.None then
|
||||
if DataManager.CurrenRoom.is_new_bout then
|
||||
tip_list = self:NewBoutTips(card_map)
|
||||
|
|
@ -1057,7 +1054,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|||
-- body
|
||||
sidaisan = true
|
||||
end
|
||||
|
||||
elseif type == ChunTian_CardType.TuiTuJI then
|
||||
list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4)
|
||||
|
||||
|
|
@ -1085,8 +1081,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|||
-- body
|
||||
tip_list = self:GetMergeAllList(tip_list, tip_templist2)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
|
||||
|
|
@ -1099,7 +1093,7 @@ end
|
|||
|
||||
-- 合并多个list
|
||||
function M:GetMergeAllList(...)
|
||||
local lists = {...}
|
||||
local lists = { ... }
|
||||
local merge_list = {}
|
||||
for i = 1, #lists do
|
||||
local list_item = lists[i]
|
||||
|
|
@ -1127,13 +1121,13 @@ function M:CheckOneCard(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if k > num and #v == 1 then
|
||||
one_card_list[#one_card_list + 1] = {v[1]}
|
||||
one_card_list[#one_card_list + 1] = { v[1] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if k > num and #v ~= 1 then
|
||||
one_card_list[#one_card_list + 1] = {v[1]}
|
||||
one_card_list[#one_card_list + 1] = { v[1] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1148,7 +1142,7 @@ function M:CheckOnePair(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
|
||||
if #v > 1 and k > num then
|
||||
one_pair_list[#one_pair_list + 1] = {v[1], v[2]}
|
||||
one_pair_list[#one_pair_list + 1] = { v[1], v[2] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1163,7 +1157,7 @@ function M:CheckThree(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v > 2 and k > num then
|
||||
three_list[#three_list + 1] = {v[1], v[2], v[3]}
|
||||
three_list[#three_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1210,8 +1204,8 @@ function M:CheckThreeAndOne(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v >= 3 and k > num then
|
||||
three_and_one_list[#three_and_one_list + 1] = {v[1], v[2], v[3]}
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
three_and_one_list[#three_and_one_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
return three_and_one_list, touch_key_list
|
||||
|
|
@ -1225,8 +1219,8 @@ function M:CheckThreeAndTwo(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v >= 3 and k > num then
|
||||
three_and_two_list[#three_and_two_list + 1] = {v[1], v[2], v[3]}
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
three_and_two_list[#three_and_two_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
return three_and_two_list, touch_key_list
|
||||
|
|
@ -1343,7 +1337,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
|||
end
|
||||
if j == i + pair_length - 1 then
|
||||
plane_list[#plane_list + 1] = item_all_list
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1351,7 +1345,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
|||
end
|
||||
|
||||
function M:SetNotTouchCard(touch_key_list, card_map)
|
||||
local all_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
local all_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
for i = 1, #all_key_list do
|
||||
local key = all_key_list[i]
|
||||
local isExsit = self:IsExistByList(touch_key_list, key)
|
||||
|
|
@ -1394,13 +1388,14 @@ function M:GetCardMapAndMaxKey(pokerList)
|
|||
max_key = number
|
||||
end
|
||||
if map[number] == nil then
|
||||
map[number] = {pokerList[i]}
|
||||
map[number] = { pokerList[i] }
|
||||
else
|
||||
map[number][#map[number] + 1] = pokerList[i]
|
||||
end
|
||||
end
|
||||
return map, max_key
|
||||
end
|
||||
|
||||
function M:CheckOnes(pokerMap, num, length)
|
||||
local one_card_list = {}
|
||||
local touch_key_list = {}
|
||||
|
|
@ -1418,7 +1413,7 @@ function M:CheckOnes(pokerMap, num, length)
|
|||
for i = 0, length - 1 do
|
||||
if l == k + i and l ~= 15 and l ~= 16 then
|
||||
-- body
|
||||
text[#text + 1] = {p[1]}
|
||||
text[#text + 1] = { p[1] }
|
||||
text2[#text2 + 1] = l
|
||||
if #text >= length then
|
||||
-- body
|
||||
|
|
@ -1446,6 +1441,7 @@ function M:CheckOnes(pokerMap, num, length)
|
|||
end
|
||||
return one_card_list, touch_key_list, length
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
self:PlayScore(nil)
|
||||
self:SetOutCardInfo(nil, false)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
||||
local ChunTian_RightPanelView = {}
|
||||
local M = ChunTian_RightPanelView
|
||||
local function __init(self,mainView,view)
|
||||
local function __init(self, mainView, view)
|
||||
local right_panel = view
|
||||
|
||||
local btn_setting = right_panel:GetChild("btn_setting")
|
||||
|
|
@ -22,7 +22,7 @@ local function __init(self,mainView,view)
|
|||
end
|
||||
end)
|
||||
else
|
||||
print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
|
||||
-- print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
|
||||
if mainView.dismiss_room_cd_time > 0 then
|
||||
GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
|
|
@ -54,13 +54,14 @@ local function __init(self,mainView,view)
|
|||
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
||||
-- self._timer:Start()
|
||||
end
|
||||
function ChunTian_RightPanelView.new(mainView,view)
|
||||
setmetatable(M, {__index = MainRightPanelView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function ChunTian_RightPanelView.new(mainView, view)
|
||||
setmetatable(M, { __index = MainRightPanelView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ChunTian_RightPanelView"
|
||||
__init(self,mainView,view)
|
||||
__init(self, mainView, view)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:__UpdateTime()
|
||||
self._tex_data.text = os.date("%Y-%m-%d")
|
||||
self._tex_time.text = os.date("%H:%M")
|
||||
|
|
@ -74,7 +75,7 @@ function M:__UpdateTime()
|
|||
local ping = _client:getAveragePingTime()
|
||||
if not ping then return end
|
||||
ping = math.floor(ping / 2)
|
||||
if ping > 300 then ping =300 end
|
||||
if ping > 300 then ping = 300 end
|
||||
if ping <= 100 then
|
||||
self.ctr_xh.selectedIndex = 0
|
||||
elseif ping <= 300 then
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 14
|
||||
self._viewMap = {}
|
||||
|
|
@ -41,10 +41,10 @@ end
|
|||
|
||||
local _gameInfo = nil
|
||||
function M:GetGameInfo()
|
||||
if not _gameInfo then
|
||||
if not _gameInfo then
|
||||
_gameInfo = EXGameInfo.new()
|
||||
end
|
||||
return _gameInfo
|
||||
end
|
||||
return _gameInfo
|
||||
end
|
||||
|
||||
local _ctr_game = nil
|
||||
|
|
@ -59,13 +59,12 @@ function M:NewRoom()
|
|||
return ChunTian_Room.new()
|
||||
end
|
||||
|
||||
|
||||
function M:GetIconUrl()
|
||||
return "ui://Extend_Poker_ChunTian/icon"
|
||||
--
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
|
||||
room.xipaiScore=_tableInfo["xipai_score"]
|
||||
room.xipaiScore = _tableInfo["xipai_score"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||
|
|
@ -91,7 +90,7 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
for i = 1,#playerList do
|
||||
for i = 1, #playerList do
|
||||
local _jp = playerList[i]
|
||||
|
||||
local p = ChunTian_Player.new()
|
||||
|
|
@ -131,7 +130,6 @@ function M:FillRoomData(s2croom)
|
|||
room.owner_id = owner
|
||||
room.game_status = 0
|
||||
if reload then
|
||||
|
||||
local reloadInfo = s2croom["reloadInfo"]
|
||||
|
||||
|
||||
|
|
@ -141,10 +139,8 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_turn_seat = reloadInfo["active_seat"]
|
||||
local info_list = reloadInfo["info_list"]
|
||||
if playing == true then
|
||||
|
||||
|
||||
room.CurnrenState = StateType.Palying
|
||||
room.game_status=1
|
||||
room.game_status = 1
|
||||
|
||||
|
||||
for i = 1, #info_list do
|
||||
|
|
@ -152,7 +148,7 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
if p == room.self_player then
|
||||
p.hand_list = reloadInfo["hand_card"]
|
||||
p.open= reloadInfo["open"]
|
||||
p.open = reloadInfo["open"]
|
||||
end
|
||||
|
||||
p.hand_count = info_list[i]["card_size"]
|
||||
|
|
@ -160,17 +156,17 @@ function M:FillRoomData(s2croom)
|
|||
p.outCards = info_list[i]["outCards"]
|
||||
local last_outcard = info_list[i]["last_outcard"]
|
||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true)
|
||||
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
else
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
end
|
||||
end
|
||||
else
|
||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
--pt(s2croom)
|
||||
room.game_status=1
|
||||
room.game_status = 1
|
||||
|
||||
room.CurnrenState = StateType.PalyingWait
|
||||
|
||||
|
|
@ -185,19 +181,18 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
local last_outcard = info_list[i]["last_outcard"]
|
||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true)
|
||||
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
else
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
end
|
||||
|
||||
p.hand_list = info_list[i]["cards"]
|
||||
p.winscore = info_list[i]["winscore"]
|
||||
p.hand_count = info_list[i]["card_size"]
|
||||
p.thisboomnum=info_list[i]["thisboomnum"]
|
||||
p.open= info_list[i]["open"]
|
||||
p.thisboomnum = info_list[i]["thisboomnum"]
|
||||
p.open = info_list[i]["open"]
|
||||
|
||||
p.handCards = info_list[i]["handCards"]
|
||||
p.outCards = info_list[i]["outCards"]
|
||||
|
|
@ -208,8 +203,6 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:FillPlayBackData(pd_data)
|
||||
local room = DataManager.CurrenRoom
|
||||
local _tableInfo = pd_data["info"]
|
||||
|
|
@ -224,7 +217,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_turn_seat = active_seat
|
||||
room.curren_round = _tableInfo["round"]
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = ChunTian_Player.new()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -245,7 +238,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.hand_list = _hand_card
|
||||
p.hand_count = #_hand_card
|
||||
p.total_score = _jp["score"]
|
||||
p.open= _jp["open"]
|
||||
p.open = _jp["open"]
|
||||
p.hp_info = _jp["hp_info"]
|
||||
if _jp['hp_info'] then
|
||||
p.cur_hp = _jp.hp_info.cur_hp
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ local MuShi_GameController = {}
|
|||
local M = MuShi_GameController
|
||||
|
||||
function M.new()
|
||||
setmetatable(M, {__index = GameController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = GameController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self:init("木虱")
|
||||
self.class = "MuShi_GameController"
|
||||
return self
|
||||
|
|
@ -62,7 +62,6 @@ function M:RegisterEvt()
|
|||
|
||||
|
||||
-- self._eventmap[Protocol.GAME_EVT_READY] = self.OnExTendPlayerReady
|
||||
|
||||
end
|
||||
|
||||
function M:OnExTendPlayerReady(evt_data)
|
||||
|
|
@ -110,7 +109,7 @@ function M:SendBuPai(bupai)
|
|||
_client:send(MuShi_Protocol.MuShi_Send_Piao, _data)
|
||||
end
|
||||
|
||||
function M:SendCard(cards,currentCard)
|
||||
function M:SendCard(cards, currentCard)
|
||||
local _data = {}
|
||||
_data["card"] = cards
|
||||
_data["all_card"] = currentCard
|
||||
|
|
@ -150,12 +149,12 @@ function M:StarQiangZhuang()
|
|||
end
|
||||
|
||||
function M:FinishCuoPai(evt_data)
|
||||
print("上报搓牌返回==================")
|
||||
-- print("上报搓牌返回==================")
|
||||
local seat = evt_data["seat"]
|
||||
local card = evt_data["card"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai,seat,card)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai, seat, card)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -167,7 +166,7 @@ function M:OtherQiangZhuang(evt_data)
|
|||
local index = evt_data["index"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang,seat,index)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang, seat, index)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -179,17 +178,17 @@ function M:DingZhuang(evt_data)
|
|||
local score = evt_data["score"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat,index,score)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat, index, score)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:StarBet(evt_data)
|
||||
printlog("开始下注 ====================================",evt_data["seat"])
|
||||
printlog("开始下注 ====================================", evt_data["seat"])
|
||||
local seat = evt_data["seat"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet,seat)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet, seat)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -202,7 +201,7 @@ function M:OtherBet(evt_data)
|
|||
local score = evt_data["mul"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat,index,score)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat, index, score)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -213,7 +212,7 @@ function M:TiQianStar(evt_data)
|
|||
local agree = evt_data["agree"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat,agree)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat, agree)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -224,7 +223,7 @@ function M:OnAgreeGame(evt_data)
|
|||
local agree = evt_data["agree"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat,agree)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat, agree)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -282,7 +281,7 @@ function M:OnInitCard(evt_data)
|
|||
self._room.curren_round = round
|
||||
--self._room.curren_round = round
|
||||
--DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, cardlist,cardtype,seat,cardopen)
|
||||
DispatchEvent(self._dispatcher,MuShi_GameEvent.OnInitCard,round,playerAry)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, playerAry)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -314,7 +313,8 @@ function M:OnPlaySucc(evt_data)
|
|||
player.hand_count = remain
|
||||
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
|
||||
player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,length)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,
|
||||
length)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -324,7 +324,7 @@ function M:OnPassSucc(evt_data)
|
|||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local p = self._room:GetPlayerBySeat(seat)
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p)
|
||||
end
|
||||
)
|
||||
|
|
@ -339,6 +339,7 @@ function M:OnPutError(evt_data)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:TuoGuan(isTuo)
|
||||
local _data = {}
|
||||
_data["tuoguan"] = isTuo
|
||||
|
|
@ -353,6 +354,7 @@ function M:Game_TuoGuan(evt_data)
|
|||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:OnIndexMove(evt_data)
|
||||
local seat = evt_data["index"]
|
||||
self._cacheEvent:Enqueue(
|
||||
|
|
@ -389,7 +391,6 @@ function M:OnPiaoTip(evt_data)
|
|||
--local reload = evt_data["reload"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips)
|
||||
end
|
||||
)
|
||||
|
|
@ -407,7 +408,7 @@ function M:OnPiaoAction(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat,piao,card)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat, piao, card)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -468,6 +469,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:Game_TuoGuan(evt_data)
|
||||
local tuoguan = evt_data["tuoguan"]
|
||||
local seat = evt_data["seat"]
|
||||
|
|
@ -475,6 +477,7 @@ function M:Game_TuoGuan(evt_data)
|
|||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:ChangeCodeByFrom(cardList, isSort)
|
||||
isSort = isSort or false
|
||||
local new_card_list = {}
|
||||
|
|
@ -595,7 +598,6 @@ end
|
|||
--Bomb = 11
|
||||
-- 牌型,大小, 长度
|
||||
function M:GetCardListInfo(cardlist)
|
||||
|
||||
if #cardlist == 0 then
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
|
|
@ -611,14 +613,12 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = math.floor(cardlist[1] / 10)
|
||||
elseif #cardlist == 3 then
|
||||
card_num = math.floor(cardlist[1] / 10)
|
||||
if card_num==14 and DataManager.CurrenRoom.room_config.threeA==1 then
|
||||
if card_num == 14 and DataManager.CurrenRoom.room_config.threeA == 1 then
|
||||
-- body
|
||||
card_type = MuShi_CardType.Bomb
|
||||
else
|
||||
card_type = MuShi_CardType.Three
|
||||
|
||||
end
|
||||
|
||||
elseif #cardlist == 4 then
|
||||
local max_key = 0
|
||||
for k, v in pairs(card_map) do
|
||||
|
|
@ -675,9 +675,7 @@ function M:GetCardListInfo(cardlist)
|
|||
local max_one_key, max_two_key, max_three_key = 0, 0, 0
|
||||
|
||||
for k, v in pairs(card_map) do
|
||||
|
||||
if #v == 2 then
|
||||
|
||||
if k > max_two_key then
|
||||
max_two_key = k
|
||||
end
|
||||
|
|
@ -687,7 +685,6 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = max_two_key
|
||||
end
|
||||
elseif #v == 1 then
|
||||
|
||||
if k > max_one_key then
|
||||
max_one_key = k
|
||||
end
|
||||
|
|
@ -697,7 +694,6 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = max_one_key
|
||||
end
|
||||
elseif #v == 3 then
|
||||
|
||||
if max_three_key == 0 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
|
|
@ -730,21 +726,13 @@ function M:GetCardListInfo(cardlist)
|
|||
if three_count * 3 == #cardlist then
|
||||
card_type = MuShi_CardType.Plane
|
||||
card_num = max_three_key
|
||||
|
||||
elseif three_count * 4 >= #cardlist and #cardlist%4==0 then
|
||||
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
|
||||
card_type = MuShi_CardType.PlaneAndOne
|
||||
card_num = max_three_key
|
||||
|
||||
|
||||
elseif three_count * 5 >= #cardlist and #cardlist%5==0 then
|
||||
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
|
||||
card_type = MuShi_CardType.PlaneAndTwo
|
||||
card_num = max_three_key
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
return card_type, card_num, card_length, plan_three_count
|
||||
|
|
@ -756,7 +744,7 @@ function M:GetCardMapByList(cardlist)
|
|||
local card = cardlist[i]
|
||||
local card_num = math.floor(cardlist[i] / 10)
|
||||
if card_map[card_num] == nil then
|
||||
card_map[card_num] = {card}
|
||||
card_map[card_num] = { card }
|
||||
else
|
||||
card_map[card_num][#card_map[card_num] + 1] = card
|
||||
end
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -29,15 +29,15 @@ local MuShi_Record_Event = {
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'},
|
||||
{id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'},
|
||||
{id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}
|
||||
{ id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
|
||||
{ id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' }
|
||||
}
|
||||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M, {__index = PKPlayBackView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = PKPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'MuShi_PlayBackView'
|
||||
self:init()
|
||||
|
||||
|
|
@ -51,7 +51,8 @@ function M:InitView(url)
|
|||
end
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
UIPackage.AddPackage('extend/poker/mushi/ui/Extend_Poker_MuShi')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg, bg_config)
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg,
|
||||
bg_config)
|
||||
self._tex_round = self._view:GetChild('round')
|
||||
self._player_card_info = {}
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -74,7 +75,7 @@ function M:InitView(url)
|
|||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
end
|
||||
local list = self._room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info._view.visible = true
|
||||
|
|
@ -111,13 +112,12 @@ function M:InitView(url)
|
|||
self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong
|
||||
|
||||
self:CuoPai()
|
||||
|
||||
end
|
||||
|
||||
function M:CuoPai()
|
||||
self.cuopai = self._view:GetChild("cuopai")
|
||||
self.cuopai.visible = false
|
||||
-- print("self.btnY ",self.btnY)
|
||||
-- -- print("self.btnY ",self.btnY)
|
||||
end
|
||||
|
||||
function M:Wuyong()
|
||||
|
|
@ -132,7 +132,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
|||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
--print("hidezhanji 1111")
|
||||
---- print("hidezhanji 1111")
|
||||
self._currentStep = 1
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -147,11 +147,11 @@ function M:FillRoomData(data)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
|
||||
if p.total_hp then
|
||||
-- print("hidezhanji 2222")
|
||||
head_info._view:GetChild('zhanji').visible=false
|
||||
-- -- print("hidezhanji 2222")
|
||||
head_info._view:GetChild('zhanji').visible = false
|
||||
|
||||
if room.hpOnOff == 1 or room:checkHpNonnegative() then
|
||||
head_info._view:GetChild('zhanji').visible=true
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||
end
|
||||
end
|
||||
|
|
@ -172,7 +172,7 @@ end
|
|||
|
||||
function M:ShowStep(index)
|
||||
local step = self._step[index]
|
||||
if step==nil then
|
||||
if step == nil then
|
||||
return
|
||||
end
|
||||
-- for i = 1, #step.player_card_data do
|
||||
|
|
@ -183,18 +183,18 @@ function M:ShowStep(index)
|
|||
-- end
|
||||
|
||||
-- Evt_alertQiangZhuang = 'alertQiangZhuang',
|
||||
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
||||
-- Evt_zhuangInfo = 'zhuangInfo',
|
||||
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
||||
-- Evt_userXiaZhu = 'userXiaZhu',
|
||||
-- Evt_alertBuPai = 'alertBuPai',
|
||||
-- Evt_playerBuPai = 'playerBuPai'
|
||||
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
||||
-- Evt_zhuangInfo = 'zhuangInfo',
|
||||
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
||||
-- Evt_userXiaZhu = 'userXiaZhu',
|
||||
-- Evt_alertBuPai = 'alertBuPai',
|
||||
-- Evt_playerBuPai = 'playerBuPai'
|
||||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||
player_head:MarkBank(false)
|
||||
player_head:UpdateFen(-1,0)
|
||||
player_head:UpdateFen(-1, 0)
|
||||
end
|
||||
self._player_card_info[1]:StarQiangZhuang(1)
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ function M:ShowStep(index)
|
|||
self._player_card_info[1]:StarQiangZhuang(0)
|
||||
end
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
head_info:UpdateFen(0,index)
|
||||
head_info:UpdateFen(0, index)
|
||||
end
|
||||
|
||||
if step.cmd == MuShi_Record_Event.Evt_zhuangInfo then
|
||||
|
|
@ -217,7 +217,7 @@ function M:ShowStep(index)
|
|||
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||
player_head:MarkBank(false)
|
||||
end
|
||||
head_info:UpdateFen(1,score)
|
||||
head_info:UpdateFen(1, score)
|
||||
head_info:MarkBank(true)
|
||||
end
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ function M:ShowStep(index)
|
|||
local seat = step.seat
|
||||
local index = step.index
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
head_info:UpdateFen(2,index)
|
||||
head_info:UpdateFen(2, index)
|
||||
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:StarBet(0)
|
||||
|
|
@ -241,7 +241,7 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||
local seat = step.seat
|
||||
if(seat == self._room.self_player.seat) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -253,7 +253,7 @@ function M:ShowStep(index)
|
|||
--printlog("补牌================",bupai,card)
|
||||
if (bupai == 1) then
|
||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
card_info:AddPoker(card,1)
|
||||
card_info:AddPoker(card, 1)
|
||||
end
|
||||
if self._room.self_player.seat == seat then
|
||||
local player_card_info = self._player_card_info[1]
|
||||
|
|
@ -263,7 +263,7 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||
local seat = step.seat
|
||||
if(seat == self._room.self_player.seat) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -277,16 +277,15 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_result then
|
||||
local result = step.result
|
||||
for i = 1,#result do
|
||||
for i = 1, #result do
|
||||
local seat = result[i].seat
|
||||
local cardType = result[i].cardType
|
||||
local cardPoint = result[i].cardPoint
|
||||
|
||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
card_info:SetCarType(cardType,cardPoint)
|
||||
card_info:SetCarType(cardType, cardPoint)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:GenerateAllStepData(data)
|
||||
|
|
@ -314,14 +313,12 @@ function M:GenerateAllStepData(data)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:CmdAlertQiangZhuang(cmd,index) --通知抢庄
|
||||
function M:CmdAlertQiangZhuang(cmd, index) --通知抢庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
end
|
||||
|
||||
function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
||||
function M:CmdUserQiangZhuang(cmd, index) --玩家抢庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
|
|
@ -329,7 +326,7 @@ function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
|||
data.score = cmd.data.score
|
||||
end
|
||||
|
||||
function M:CmdZhuangInfo(cmd,index) --定庄
|
||||
function M:CmdZhuangInfo(cmd, index) --定庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
|
|
@ -337,47 +334,45 @@ function M:CmdZhuangInfo(cmd,index) --定庄
|
|||
data.score = cmd.data.score
|
||||
end
|
||||
|
||||
function M:CmdAlertXiaZhu(cmd,index) --通知下注
|
||||
function M:CmdAlertXiaZhu(cmd, index) --通知下注
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.data.cmd
|
||||
data.seat = cmd.data.seat
|
||||
end
|
||||
|
||||
function M:CmdUserXiaZhu(cmd,index) --玩家下注
|
||||
function M:CmdUserXiaZhu(cmd, index) --玩家下注
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
data.index = cmd.data.index
|
||||
end
|
||||
|
||||
function M:CmdAlertBuPai(cmd,index) --通知补牌
|
||||
function M:CmdAlertBuPai(cmd, index) --通知补牌
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.data.cmd
|
||||
data.seat = cmd.data.seat
|
||||
end
|
||||
|
||||
function M:CmdPlayerBuPai(cmd,index) --玩家补牌
|
||||
function M:CmdPlayerBuPai(cmd, index) --玩家补牌
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.bupai = cmd.data.bupai
|
||||
data.card = cmd.data.card
|
||||
end
|
||||
|
||||
function M:CmdPlayerSendCards(cmd,index)
|
||||
function M:CmdPlayerSendCards(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
data.cards = cmd.data.cards
|
||||
end
|
||||
|
||||
function M:CmdResult(cmd,index)
|
||||
function M:CmdResult(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.result = cmd.data.result
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:CopyLastStep(index)
|
||||
local step = {}
|
||||
local last_step = self._step[index]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
|||
|
||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = CardView})
|
||||
setmetatable(self, { __index = CardView })
|
||||
self.btn_card = card
|
||||
self.card_code_number = cardcodenum
|
||||
self.card_code_flower = cardcodeflower
|
||||
|
|
@ -38,8 +38,8 @@ local MuShi_PlayerSelfPokerInfoView = {
|
|||
local M = MuShi_PlayerSelfPokerInfoView
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = MuShi_PlayerPokerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MuShi_PlayerPokerInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self.gameCtr = ControllerManager.GetController(GameController)
|
||||
|
|
@ -113,8 +113,6 @@ function M:init()
|
|||
self:BtnEvent()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:BtnEvent()
|
||||
self.btnBuPai.onClick:Set(function()
|
||||
--printlog("点击补牌=================================")
|
||||
|
|
@ -198,7 +196,7 @@ function M:ChangeCtrBuPai(b)
|
|||
self.ctr_bupai.selectedIndex = b
|
||||
end
|
||||
|
||||
function M:InitPoker(pokerList,cardtype,cardopen)
|
||||
function M:InitPoker(pokerList, cardtype, cardopen)
|
||||
self.cardopen = cardopen
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
|
|
@ -236,10 +234,8 @@ function M:InitPoker2(pokerList)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:AddPoker(poker)
|
||||
--print("玩家自己加牌===========================================")
|
||||
---- print("玩家自己加牌===========================================")
|
||||
local card_number_code = self:ChangeOneCodeByFrom(poker)
|
||||
local card_flower_code = poker
|
||||
local btn_card = self:CreatPoker(poker, 1, 0)
|
||||
|
|
@ -260,12 +256,12 @@ function M:GetHandCardPos(index, card_count)
|
|||
local x, y = 0, -18
|
||||
local offset = 40
|
||||
|
||||
x = offset*index
|
||||
x = offset * index
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
||||
function M:ChangeOneCodeByFrom(card)
|
||||
if(card > 500) then
|
||||
if (card > 500) then
|
||||
return card
|
||||
end
|
||||
local flower = math.floor(card / 100)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
end
|
||||
else
|
||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
--pt(s2croom)
|
||||
room.game_status = 1
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue