全部放大
parent
944b9ed164
commit
9e830c82b5
|
|
@ -67,7 +67,7 @@ function NetClient.new(host, game, protocol)
|
||||||
-- self.responseMap = {}
|
-- self.responseMap = {}
|
||||||
self.onevent = event("onevent", false)
|
self.onevent = event("onevent", false)
|
||||||
self.onconnect = event("onconnect", 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 = LuaNetClient(host, game, self, self.protocol)
|
||||||
self.c__netClient:SetCallBackListener(R.c__ondata)
|
self.c__netClient:SetCallBackListener(R.c__ondata)
|
||||||
|
|
@ -92,7 +92,7 @@ local NULL_JSON = "{}"
|
||||||
--- send
|
--- send
|
||||||
function R.send(self, cmd, data, callback)
|
function R.send(self, cmd, data, callback)
|
||||||
if (debug_print) then
|
if (debug_print) then
|
||||||
print("send host:" .. self.host)
|
-- print("send host:" .. self.host)
|
||||||
end
|
end
|
||||||
if self.c__netClient == nil then
|
if self.c__netClient == nil then
|
||||||
return
|
return
|
||||||
|
|
@ -170,7 +170,7 @@ end
|
||||||
---c#网络层回调函数
|
---c#网络层回调函数
|
||||||
function R.c__onconnect(self, code)
|
function R.c__onconnect(self, code)
|
||||||
if (debug_print) then
|
if (debug_print) then
|
||||||
print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
-- print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||||
end
|
end
|
||||||
self.onconnect(code)
|
self.onconnect(code)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ Queue = {}
|
||||||
|
|
||||||
function Queue.new(capacity)
|
function Queue.new(capacity)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self,{__index = Queue})
|
setmetatable(self, { __index = Queue })
|
||||||
self.capacity = capacity
|
self.capacity = capacity
|
||||||
self.queue = {}
|
self.queue = {}
|
||||||
self.size_ = 0
|
self.size_ = 0
|
||||||
|
|
@ -20,11 +20,11 @@ function Queue:Enqueue(element)
|
||||||
self.queue[self.rear] = element
|
self.queue[self.rear] = element
|
||||||
else
|
else
|
||||||
local temp = (self.rear + 1) % self.capacity
|
local temp = (self.rear + 1) % self.capacity
|
||||||
--print("1111111111111111111====>>>>")
|
---- print("1111111111111111111====>>>>")
|
||||||
--print(temp)
|
---- print(temp)
|
||||||
if temp == self.head then
|
if temp == self.head then
|
||||||
error("Error: capacity is full.")
|
error("Error: capacity is full.")
|
||||||
ViewUtil.ErrorTip(10001,"Error: capacity is full.")
|
ViewUtil.ErrorTip(10001, "Error: capacity is full.")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
self.rear = temp
|
self.rear = temp
|
||||||
|
|
@ -33,12 +33,11 @@ function Queue:Enqueue(element)
|
||||||
self.queue[self.rear] = element
|
self.queue[self.rear] = element
|
||||||
self.size_ = self.size_ + 1
|
self.size_ = self.size_ + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Queue:Dequeue()
|
function Queue:Dequeue()
|
||||||
if self:IsEmpty() then
|
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.")
|
error("Error: The Queue is empty.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -74,16 +73,16 @@ function Queue:dump()
|
||||||
local first_flag = true
|
local first_flag = true
|
||||||
while h ~= r do
|
while h ~= r do
|
||||||
if first_flag == true then
|
if first_flag == true then
|
||||||
str = "{"..self.queue[h]
|
str = "{" .. self.queue[h]
|
||||||
h = (h + 1) % self.capacity
|
h = (h + 1) % self.capacity
|
||||||
first_flag = false
|
first_flag = false
|
||||||
else
|
else
|
||||||
str = str..","..self.queue[h]
|
str = str .. "," .. self.queue[h]
|
||||||
h = (h + 1) % self.capacity
|
h = (h + 1) % self.capacity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
str = str..","..self.queue[r].."}"
|
str = str .. "," .. self.queue[r] .. "}"
|
||||||
if(debug_print) then
|
if (debug_print) then
|
||||||
print(str)
|
-- print(str)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -5,132 +5,131 @@
|
||||||
bit = bit or {}
|
bit = bit or {}
|
||||||
function bit.init32()
|
function bit.init32()
|
||||||
bit.data32 = {}
|
bit.data32 = {}
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
bit.data32[i]=2^(32-i)
|
bit.data32[i] = 2 ^ (32 - i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
bit.init32()
|
bit.init32()
|
||||||
|
|
||||||
function bit:d2b(arg) --bit:d2b
|
function bit:d2b(arg) --bit:d2b
|
||||||
local tr={}
|
local tr = {}
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if arg >= self.data32[i] then
|
if arg >= self.data32[i] then
|
||||||
tr[i]=1
|
tr[i] = 1
|
||||||
arg=arg-self.data32[i]
|
arg = arg - self.data32[i]
|
||||||
else
|
else
|
||||||
tr[i]=0
|
tr[i] = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return tr
|
return tr
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:b2d(arg) --bit:b2d
|
function bit:b2d(arg) --bit:b2d
|
||||||
local nr=0
|
local nr = 0
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if arg[i] ==1 then
|
if arg[i] == 1 then
|
||||||
nr=nr+2^(32-i)
|
nr = nr + 2 ^ (32 - i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nr
|
return nr
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_xor(a,b) --bit:xor
|
function bit:_xor(a, b) --bit:xor
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local op2=self:d2b(b)
|
local op2 = self:d2b(b)
|
||||||
local r={}
|
local r = {}
|
||||||
|
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if op1[i]==op2[i] then
|
if op1[i] == op2[i] then
|
||||||
r[i]=0
|
r[i] = 0
|
||||||
else
|
else
|
||||||
r[i]=1
|
r[i] = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_and(a,b) --bit:_and
|
function bit:_and(a, b) --bit:_and
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local op2=self:d2b(b)
|
local op2 = self:d2b(b)
|
||||||
local r={}
|
local r = {}
|
||||||
|
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if op1[i]==1 and op2[i]==1 then
|
if op1[i] == 1 and op2[i] == 1 then
|
||||||
r[i]=1
|
r[i] = 1
|
||||||
else
|
else
|
||||||
r[i]=0
|
r[i] = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_or(a,b) --bit:_or
|
function bit:_or(a, b) --bit:_or
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local op2=self:d2b(b)
|
local op2 = self:d2b(b)
|
||||||
local r={}
|
local r = {}
|
||||||
|
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if op1[i]==1 or op2[i]==1 then
|
if op1[i] == 1 or op2[i] == 1 then
|
||||||
r[i]=1
|
r[i] = 1
|
||||||
else
|
else
|
||||||
r[i]=0
|
r[i] = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_not(a) --bit:_not
|
function bit:_not(a) --bit:_not
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local r={}
|
local r = {}
|
||||||
|
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
if op1[i]==1 then
|
if op1[i] == 1 then
|
||||||
r[i]=0
|
r[i] = 0
|
||||||
else
|
else
|
||||||
r[i]=1
|
r[i] = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_rshift(a,n) --bit:_rshift
|
function bit:_rshift(a, n) --bit:_rshift
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local r=self:d2b(0)
|
local r = self:d2b(0)
|
||||||
|
|
||||||
if n < 32 and n > 0 then
|
if n < 32 and n > 0 then
|
||||||
for i=1,n do
|
for i = 1, n do
|
||||||
for i=31,1,-1 do
|
for i = 31, 1, -1 do
|
||||||
op1[i+1]=op1[i]
|
op1[i + 1] = op1[i]
|
||||||
end
|
end
|
||||||
op1[1]=0
|
op1[1] = 0
|
||||||
end
|
end
|
||||||
r=op1
|
r = op1
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bit:_lshift(a,n) --bit:_lshift
|
function bit:_lshift(a, n) --bit:_lshift
|
||||||
local op1=self:d2b(a)
|
local op1 = self:d2b(a)
|
||||||
local r=self:d2b(0)
|
local r = self:d2b(0)
|
||||||
|
|
||||||
if n < 32 and n > 0 then
|
if n < 32 and n > 0 then
|
||||||
for i=1,n do
|
for i = 1, n do
|
||||||
for i=1,31 do
|
for i = 1, 31 do
|
||||||
op1[i]=op1[i+1]
|
op1[i] = op1[i + 1]
|
||||||
end
|
end
|
||||||
op1[32]=0
|
op1[32] = 0
|
||||||
end
|
end
|
||||||
r=op1
|
r = op1
|
||||||
end
|
end
|
||||||
return self:b2d(r)
|
return self:b2d(r)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function bit:print(ta)
|
function bit:print(ta)
|
||||||
local sr=""
|
local sr = ""
|
||||||
for i=1,32 do
|
for i = 1, 32 do
|
||||||
sr=sr..ta[i]
|
sr = sr .. ta[i]
|
||||||
end
|
end
|
||||||
print(sr)
|
-- print(sr)
|
||||||
end
|
end
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
string._htmlspecialchars_set = {}
|
string._htmlspecialchars_set = {}
|
||||||
string._htmlspecialchars_set["&"] = "&"
|
string._htmlspecialchars_set["&"] = "&"
|
||||||
string._htmlspecialchars_set["\""] = """
|
string._htmlspecialchars_set["\""] = """
|
||||||
|
|
@ -10,7 +8,7 @@ string._htmlspecialchars_set[">"] = ">"
|
||||||
--[[--
|
--[[--
|
||||||
将特殊字符转为 HTML 转义符
|
将特殊字符转为 HTML 转义符
|
||||||
~~~ lua
|
~~~ lua
|
||||||
print(string.htmlspecialchars("<ABC>"))
|
-- print(string.htmlspecialchars("<ABC>"))
|
||||||
-- 输出 <ABC>
|
-- 输出 <ABC>
|
||||||
~~~
|
~~~
|
||||||
@param string input 输入字符串
|
@param string input 输入字符串
|
||||||
|
|
@ -26,7 +24,7 @@ end
|
||||||
--[[--
|
--[[--
|
||||||
将 HTML 转义符还原为特殊字符,功能与 string.htmlspecialchars() 正好相反
|
将 HTML 转义符还原为特殊字符,功能与 string.htmlspecialchars() 正好相反
|
||||||
~~~ lua
|
~~~ lua
|
||||||
print(string.restorehtmlspecialchars("<ABC>"))
|
-- print(string.restorehtmlspecialchars("<ABC>"))
|
||||||
-- 输出 <ABC>
|
-- 输出 <ABC>
|
||||||
~~~
|
~~~
|
||||||
@param string input 输入字符串
|
@param string input 输入字符串
|
||||||
|
|
@ -42,7 +40,7 @@ end
|
||||||
--[[--
|
--[[--
|
||||||
将字符串中的 \n 换行符转换为 HTML 标记
|
将字符串中的 \n 换行符转换为 HTML 标记
|
||||||
~~~ lua
|
~~~ lua
|
||||||
print(string.nl2br("Hello\nWorld"))
|
-- print(string.nl2br("Hello\nWorld"))
|
||||||
-- 输出
|
-- 输出
|
||||||
-- Hello<br />World
|
-- Hello<br />World
|
||||||
~~~
|
~~~
|
||||||
|
|
@ -56,7 +54,7 @@ end
|
||||||
--[[--
|
--[[--
|
||||||
将字符串中的特殊字符和 \n 换行符转换为 HTML 转移符和标记
|
将字符串中的特殊字符和 \n 换行符转换为 HTML 转移符和标记
|
||||||
~~~ lua
|
~~~ lua
|
||||||
print(string.nl2br("<Hello>\nWorld"))
|
-- print(string.nl2br("<Hello>\nWorld"))
|
||||||
-- 输出
|
-- 输出
|
||||||
-- <Hello><br />World
|
-- <Hello><br />World
|
||||||
~~~
|
~~~
|
||||||
|
|
@ -88,10 +86,10 @@ local res = string.split(input, "-+-")
|
||||||
function string.split(input, delimiter)
|
function string.split(input, delimiter)
|
||||||
input = tostring(input)
|
input = tostring(input)
|
||||||
delimiter = tostring(delimiter)
|
delimiter = tostring(delimiter)
|
||||||
if (delimiter=='') then return false end
|
if (delimiter == '') then return false end
|
||||||
local pos,arr = 0, {}
|
local pos, arr = 0, {}
|
||||||
-- for each divider found
|
-- 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))
|
table.insert(arr, string.sub(input, pos, st - 1))
|
||||||
pos = sp + 1
|
pos = sp + 1
|
||||||
end
|
end
|
||||||
|
|
@ -103,7 +101,7 @@ end
|
||||||
去除输入字符串头部的空白字符,返回结果
|
去除输入字符串头部的空白字符,返回结果
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = " ABC"
|
local input = " ABC"
|
||||||
print(string.ltrim(input))
|
-- print(string.ltrim(input))
|
||||||
-- 输出 ABC,输入字符串前面的两个空格被去掉了
|
-- 输出 ABC,输入字符串前面的两个空格被去掉了
|
||||||
~~~
|
~~~
|
||||||
空白字符包括:
|
空白字符包括:
|
||||||
|
|
@ -123,7 +121,7 @@ end
|
||||||
去除输入字符串尾部的空白字符,返回结果
|
去除输入字符串尾部的空白字符,返回结果
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = "ABC "
|
local input = "ABC "
|
||||||
print(string.ltrim(input))
|
-- print(string.ltrim(input))
|
||||||
-- 输出 ABC,输入字符串最后的两个空格被去掉了
|
-- 输出 ABC,输入字符串最后的两个空格被去掉了
|
||||||
~~~
|
~~~
|
||||||
@param string input 输入字符串
|
@param string input 输入字符串
|
||||||
|
|
@ -149,7 +147,7 @@ end
|
||||||
将字符串的第一个字符转为大写,返回结果
|
将字符串的第一个字符转为大写,返回结果
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = "hello"
|
local input = "hello"
|
||||||
print(string.ucfirst(input))
|
-- print(string.ucfirst(input))
|
||||||
-- 输出 Hello
|
-- 输出 Hello
|
||||||
~~~
|
~~~
|
||||||
@param string input 输入字符串
|
@param string input 输入字符串
|
||||||
|
|
@ -167,7 +165,7 @@ end
|
||||||
将字符串转换为符合 URL 传递要求的格式,并返回转换结果
|
将字符串转换为符合 URL 传递要求的格式,并返回转换结果
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = "hello world"
|
local input = "hello world"
|
||||||
print(string.urlencode(input))
|
-- print(string.urlencode(input))
|
||||||
-- 输出
|
-- 输出
|
||||||
-- hello%20world
|
-- hello%20world
|
||||||
~~~
|
~~~
|
||||||
|
|
@ -188,7 +186,7 @@ end
|
||||||
将 URL 中的特殊字符还原,并返回结果
|
将 URL 中的特殊字符还原,并返回结果
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = "hello%20world"
|
local input = "hello%20world"
|
||||||
print(string.urldecode(input))
|
-- print(string.urldecode(input))
|
||||||
-- 输出
|
-- 输出
|
||||||
-- hello world
|
-- hello world
|
||||||
~~~
|
~~~
|
||||||
|
|
@ -197,9 +195,9 @@ print(string.urldecode(input))
|
||||||
@see string.urlencode
|
@see string.urlencode
|
||||||
]]
|
]]
|
||||||
function string.urldecode(input)
|
function string.urldecode(input)
|
||||||
input = string.gsub (input, "+", " ")
|
input = string.gsub(input, "+", " ")
|
||||||
input = string.gsub (input, "%%(%x%x)", function(h) return string.char(checknumber(h,16)) end)
|
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, "\r\n", "\n")
|
||||||
return input
|
return input
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -207,7 +205,7 @@ end
|
||||||
计算 UTF8 字符串的长度,每一个中文算一个字符
|
计算 UTF8 字符串的长度,每一个中文算一个字符
|
||||||
~~~ lua
|
~~~ lua
|
||||||
local input = "你好World"
|
local input = "你好World"
|
||||||
print(string.utf8len(input))
|
-- print(string.utf8len(input))
|
||||||
-- 输出 7
|
-- 输出 7
|
||||||
~~~
|
~~~
|
||||||
@param string input 输入字符串
|
@param string input 输入字符串
|
||||||
|
|
@ -219,7 +217,7 @@ function string.utf8len(input)
|
||||||
local len = string.len(input)
|
local len = string.len(input)
|
||||||
local left = len
|
local left = len
|
||||||
local cnt = 0
|
local cnt = 0
|
||||||
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}
|
local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
|
||||||
while left ~= 0 do
|
while left ~= 0 do
|
||||||
local tmp = string.byte(input, -left)
|
local tmp = string.byte(input, -left)
|
||||||
local i = #arr
|
local i = #arr
|
||||||
|
|
@ -251,7 +249,7 @@ function string.utf8sub(input, index, endIndex)
|
||||||
local left = len
|
local left = len
|
||||||
local cnt = 0
|
local cnt = 0
|
||||||
local head, tail = 0, 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
|
while left ~= 0 do
|
||||||
if cnt + 1 == index then
|
if cnt + 1 == index then
|
||||||
head = len - left + 1
|
head = len - left + 1
|
||||||
|
|
@ -278,7 +276,7 @@ end
|
||||||
--[[--
|
--[[--
|
||||||
将数值格式化为包含千分位分隔符的字符串
|
将数值格式化为包含千分位分隔符的字符串
|
||||||
~~~ lua
|
~~~ lua
|
||||||
print(string.formatnumberthousands(1924235))
|
-- print(string.formatnumberthousands(1924235))
|
||||||
-- 输出 1,924,235
|
-- 输出 1,924,235
|
||||||
~~~
|
~~~
|
||||||
@param number num 数值
|
@param number num 数值
|
||||||
|
|
@ -294,12 +292,11 @@ function string.formatnumberthousands(num)
|
||||||
return formatted
|
return formatted
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function string.concat(...)
|
||||||
function string.concat( ... )
|
|
||||||
local str = {}
|
local str = {}
|
||||||
local tem = {...}
|
local tem = { ... }
|
||||||
for _,v in ipairs(tem) do
|
for _, v in ipairs(tem) do
|
||||||
str[#str + 1] = v
|
str[#str + 1] = v
|
||||||
end
|
end
|
||||||
return table.concat(str , "")
|
return table.concat(str, "")
|
||||||
end
|
end
|
||||||
|
|
@ -48,11 +48,11 @@ OnInit、DoHideAnimation、DoShowAnimation、OnShown、OnHide。
|
||||||
例子:
|
例子:
|
||||||
MyWinClass = fgui.window_class()
|
MyWinClass = fgui.window_class()
|
||||||
function MyWinClass:ctor()
|
function MyWinClass:ctor()
|
||||||
print('MyWinClass-ctor')
|
-- print('MyWinClass-ctor')
|
||||||
self.contentPane = UIPackage.CreateObject("Basics", "WindowA")
|
self.contentPane = UIPackage.CreateObject("Basics", "WindowA")
|
||||||
end
|
end
|
||||||
function MyWinClass:OnShown()
|
function MyWinClass:OnShown()
|
||||||
print('MyWinClass-onShown')
|
-- print('MyWinClass-onShown')
|
||||||
end
|
end
|
||||||
local win = MyWinClass.New()
|
local win = MyWinClass.New()
|
||||||
win:Show()
|
win:Show()
|
||||||
|
|
@ -74,7 +74,7 @@ function fgui.window_class(base)
|
||||||
tolua.setpeer(ins, t)
|
tolua.setpeer(ins, t)
|
||||||
ins:SetLuaPeer(t)
|
ins:SetLuaPeer(t)
|
||||||
if t.ctor then
|
if t.ctor then
|
||||||
t.ctor(ins,...)
|
t.ctor(ins, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ins
|
return ins
|
||||||
|
|
@ -92,12 +92,12 @@ MyButton = fgui.extension_class(GButton)
|
||||||
fgui.register_extension("ui://包名/我的按钮", MyButton)
|
fgui.register_extension("ui://包名/我的按钮", MyButton)
|
||||||
|
|
||||||
function MyButton:ctor() --当组件构建完成时此方法被调用
|
function MyButton:ctor() --当组件构建完成时此方法被调用
|
||||||
print(self:GetChild("n1"))
|
-- print(self:GetChild("n1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
--添加自定义的方法和字段
|
--添加自定义的方法和字段
|
||||||
function MyButton:Test()
|
function MyButton:Test()
|
||||||
print('test')
|
-- print('test')
|
||||||
end
|
end
|
||||||
|
|
||||||
local get = tolua.initget(MyButton)
|
local get = tolua.initget(MyButton)
|
||||||
|
|
@ -133,7 +133,7 @@ function fgui.extension_class(base)
|
||||||
o.Extend = function(ins)
|
o.Extend = function(ins)
|
||||||
local t = {}
|
local t = {}
|
||||||
setmetatable(t, o)
|
setmetatable(t, o)
|
||||||
tolua.setpeer(ins,t)
|
tolua.setpeer(ins, t)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ GameEvent = {
|
||||||
OnUpdateInfo = 'OnUpdateInfo',
|
OnUpdateInfo = 'OnUpdateInfo',
|
||||||
|
|
||||||
--打开托管
|
--打开托管
|
||||||
TupGuanOpen='TupGuanOpen',
|
TupGuanOpen = 'TupGuanOpen',
|
||||||
--关闭托管
|
--关闭托管
|
||||||
TupGuanClose='TupGuanClose',
|
TupGuanClose = 'TupGuanClose',
|
||||||
|
|
||||||
--麻将修改牌大小
|
--麻将修改牌大小
|
||||||
MJModifySzie='MJModifySzie',
|
MJModifySzie = 'MJModifySzie',
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Base GameController
|
--- Base GameController
|
||||||
|
|
@ -40,7 +40,7 @@ GameController = {
|
||||||
|
|
||||||
local M = GameController
|
local M = GameController
|
||||||
|
|
||||||
setmetatable(M, {__index = IController})
|
setmetatable(M, { __index = IController })
|
||||||
|
|
||||||
function M:init(name)
|
function M:init(name)
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
@ -48,7 +48,7 @@ function M:init(name)
|
||||||
self._cacheEvent = Queue.new(1000)
|
self._cacheEvent = Queue.new(1000)
|
||||||
self._eventmap = {}
|
self._eventmap = {}
|
||||||
self._dispatcher = {}
|
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_JOIN] = self.OnEventPlayerEnter
|
||||||
self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState
|
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_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips
|
||||||
|
|
||||||
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DispatchEvent(_dispatcher, evt_name, ...)
|
function DispatchEvent(_dispatcher, evt_name, ...)
|
||||||
|
|
@ -86,9 +84,8 @@ function M:AddEventListener(evt_name, func)
|
||||||
self._dispatcher[evt_name] = func
|
self._dispatcher[evt_name] = func
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:ResetConnect()
|
function M:ResetConnect()
|
||||||
-- print("断线重连================")
|
-- -- print("断线重连================")
|
||||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||||
ViewManager.refreshGameView()
|
ViewManager.refreshGameView()
|
||||||
end
|
end
|
||||||
|
|
@ -101,6 +98,7 @@ function M:PlayerReady()
|
||||||
if not _client then
|
if not _client then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
print("====================================1发送准备")
|
||||||
_client:send(Protocol.GAME_READY)
|
_client:send(Protocol.GAME_READY)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -163,9 +161,9 @@ function M:AskDismissRoom()
|
||||||
if not _client then
|
if not _client then
|
||||||
return
|
return
|
||||||
end
|
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
|
if res.ReturnCode == 84 then
|
||||||
ViewUtil.ErrorTip(res.ReturnCode,"解散失败")
|
ViewUtil.ErrorTip(res.ReturnCode, "解散失败")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -178,7 +176,7 @@ function M:DismissRoomVote(agree)
|
||||||
if not _client then
|
if not _client then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- print(agree)
|
-- -- print(agree)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data['result'] = agree
|
_data['result'] = agree
|
||||||
_client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data)
|
_client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data)
|
||||||
|
|
@ -261,7 +259,7 @@ end
|
||||||
|
|
||||||
-- 玩家进
|
-- 玩家进
|
||||||
function M:OnEventPlayerEnter(evt_data)
|
function M:OnEventPlayerEnter(evt_data)
|
||||||
--print("进入房间++++++++++++++++++++++++++++++++++++++")
|
---- print("进入房间++++++++++++++++++++++++++++++++++++++")
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
local p = self._room:NewPlayer()
|
local p = self._room:NewPlayer()
|
||||||
|
|
@ -286,7 +284,6 @@ function M:OnEventPlayerEnter(evt_data)
|
||||||
p.line_state = 1
|
p.line_state = 1
|
||||||
DataManager.CurrenRoom:AddPlayer(p)
|
DataManager.CurrenRoom:AddPlayer(p)
|
||||||
DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p)
|
DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p)
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -325,15 +322,14 @@ function M:OnEventPlayerReady(evt_data)
|
||||||
local pid = evt_data['aid']
|
local pid = evt_data['aid']
|
||||||
local p = self._room:GetPlayerById(pid)
|
local p = self._room:GetPlayerById(pid)
|
||||||
p.ready = true
|
p.ready = true
|
||||||
if evt_data.start~=nil then
|
if evt_data.start ~= nil then
|
||||||
if evt_data.start==1 then
|
if evt_data.start == 1 then
|
||||||
p.isSendCardState=true
|
p.isSendCardState = true
|
||||||
else
|
else
|
||||||
p.isSendCardState=false
|
p.isSendCardState = false
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
p.isSendCardState=false
|
p.isSendCardState = false
|
||||||
end
|
end
|
||||||
|
|
||||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||||
|
|
@ -341,22 +337,20 @@ function M:OnEventPlayerReady(evt_data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:OnEventPlayerXiPaiReady(evt_data)
|
function M:OnEventPlayerXiPaiReady(evt_data)
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
local pid = evt_data['aid']
|
local pid = evt_data['aid']
|
||||||
local p = self._room:GetPlayerById(pid)
|
local p = self._room:GetPlayerById(pid)
|
||||||
p.ready = true
|
p.ready = true
|
||||||
if evt_data.start~=nil then
|
if evt_data.start ~= nil then
|
||||||
if evt_data.start==1 then
|
if evt_data.start == 1 then
|
||||||
p.isSendCardState=true
|
p.isSendCardState = true
|
||||||
else
|
else
|
||||||
p.isSendCardState=false
|
p.isSendCardState = false
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
p.isSendCardState=false
|
p.isSendCardState = false
|
||||||
end
|
end
|
||||||
|
|
||||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||||
|
|
@ -364,8 +358,6 @@ function M:OnEventPlayerXiPaiReady(evt_data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 聊天事件
|
-- 聊天事件
|
||||||
function M:OnEventInteraction(evt_data)
|
function M:OnEventInteraction(evt_data)
|
||||||
if self._room.ban_chat1 == false or self._room.ban_chat2 == false then
|
if self._room.ban_chat1 == false or self._room.ban_chat2 == false then
|
||||||
|
|
@ -396,7 +388,6 @@ function M:OnEventUpdateGPS(evt_data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 被踢出房间事件
|
-- 被踢出房间事件
|
||||||
function M:OnEventKicked()
|
function M:OnEventKicked()
|
||||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||||
|
|
@ -544,7 +535,7 @@ end
|
||||||
|
|
||||||
function M:OnEnter()
|
function M:OnEnter()
|
||||||
if (debug_print) then
|
if (debug_print) then
|
||||||
print(self._name .. '进入Game控制器')
|
-- print(self._name .. '进入Game控制器')
|
||||||
end
|
end
|
||||||
self._room = DataManager.CurrenRoom
|
self._room = DataManager.CurrenRoom
|
||||||
local _client = ControllerManager.GameNetClinet
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
|
@ -555,14 +546,14 @@ end
|
||||||
|
|
||||||
function M:OnExit()
|
function M:OnExit()
|
||||||
if (debug_print) then
|
if (debug_print) then
|
||||||
print(self._name .. ' 离开Game控制器')
|
-- print(self._name .. ' 离开Game控制器')
|
||||||
end
|
end
|
||||||
ControllerManager.SetGameNetClient(nil)
|
ControllerManager.SetGameNetClient(nil)
|
||||||
self._cacheEvent:Clear()
|
self._cacheEvent:Clear()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnNetEvent(msg)
|
function M:__OnNetEvent(msg)
|
||||||
--print("Game消息ID===>>"..msg.Command)
|
---- print("Game消息ID===>>"..msg.Command)
|
||||||
local func = self._eventmap[msg.Command]
|
local func = self._eventmap[msg.Command]
|
||||||
if (func ~= nil) then
|
if (func ~= nil) then
|
||||||
func(self, msg.Data)
|
func(self, msg.Data)
|
||||||
|
|
@ -586,36 +577,30 @@ function M:ReturnToRoom()
|
||||||
end,
|
end,
|
||||||
self.tmpGroupID
|
self.tmpGroupID
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:OnEvtOpenTupGTips(msg)
|
function M:OnEvtOpenTupGTips(msg)
|
||||||
--print("显示托管倒计时=====================")
|
---- print("显示托管倒计时=====================")
|
||||||
pt(msg)
|
pt(msg)
|
||||||
local pid = msg['aid']
|
local pid = msg['aid']
|
||||||
local p = self._room:GetPlayerById(pid)
|
local p = self._room:GetPlayerById(pid)
|
||||||
local t=msg['time']
|
local t = msg['time']
|
||||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,true, t)
|
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, true, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:OnEvtCloseTupGTips(msg)
|
function M:OnEvtCloseTupGTips(msg)
|
||||||
--print("关闭托管倒计时=================")
|
---- print("关闭托管倒计时=================")
|
||||||
--pt(msg)
|
--pt(msg)
|
||||||
local pid = msg['aid']
|
local pid = msg['aid']
|
||||||
local p = self._room:GetPlayerById(pid)
|
local p = self._room:GetPlayerById(pid)
|
||||||
local t=msg['time']
|
local t = msg['time']
|
||||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,false, t)
|
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:DispatchEventTuoGuan(p, isShow, t)
|
||||||
function M:DispatchEventTuoGuan(p,isShow,t)
|
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
|
||||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,isShow, t)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:OnEvtOpenGameHuTuoGtips(isAuto)
|
function M:OnEvtOpenGameHuTuoGtips(isAuto)
|
||||||
local _client = ControllerManager.GameNetClinet
|
local _client = ControllerManager.GameNetClinet
|
||||||
if not _client then
|
if not _client then
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ function M:connect(host, groupId, callback)
|
||||||
self._mgr_client:destroy()
|
self._mgr_client:destroy()
|
||||||
self._mgr_client = nil
|
self._mgr_client = nil
|
||||||
end
|
end
|
||||||
print("666666666666666666666666666 ", host)
|
-- print("666666666666666666666666666 ", host)
|
||||||
local _mgr_client = NetClient.new(self.host, "mgr_group")
|
local _mgr_client = NetClient.new(self.host, "mgr_group")
|
||||||
self._mgr_client = _mgr_client
|
self._mgr_client = _mgr_client
|
||||||
_mgr_client:connect()
|
_mgr_client:connect()
|
||||||
|
|
@ -186,7 +186,7 @@ end
|
||||||
|
|
||||||
-- 更新玩法
|
-- 更新玩法
|
||||||
function M:OnEvtUpdatePlay(evt_data)
|
function M:OnEvtUpdatePlay(evt_data)
|
||||||
--print("更新玩法=============》》》")
|
---- print("更新玩法=============》》》")
|
||||||
--pt(evt_data)
|
--pt(evt_data)
|
||||||
local pid = evt_data.pid
|
local pid = evt_data.pid
|
||||||
local group = DataManager.groups:get(self.groupId)
|
local group = DataManager.groups:get(self.groupId)
|
||||||
|
|
@ -354,7 +354,7 @@ function M:OnExit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnNetEvent(msg)
|
function M:__OnNetEvent(msg)
|
||||||
--print("消息ID===>>"..msg.Command)
|
---- print("消息ID===>>"..msg.Command)
|
||||||
local func = self._eventmap[msg.Command]
|
local func = self._eventmap[msg.Command]
|
||||||
if (func ~= nil) then func(self, msg.Data) end
|
if (func ~= nil) then func(self, msg.Data) end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
LoddyController = {}
|
LoddyController = {}
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
--- Create a new LoddyController
|
--- Create a new LoddyController
|
||||||
function LoddyController.new()
|
function LoddyController.new()
|
||||||
setmetatable(M, {__index = IController})
|
setmetatable(M, { __index = IController })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.baseType = LoddyController
|
self.baseType = LoddyController
|
||||||
self.class = "Loddy"
|
self.class = "Loddy"
|
||||||
self.recordList = {}
|
self.recordList = {}
|
||||||
|
|
@ -14,11 +13,11 @@ function LoddyController.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.OnEnter(self)
|
function M.OnEnter(self)
|
||||||
--print(vardump(self,"loddy controller enter"))
|
---- print(vardump(self,"loddy controller enter"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.OnExit(self)
|
function M.OnExit(self)
|
||||||
--print(vardump(self,"loddy controller exit"))
|
---- print(vardump(self,"loddy controller exit"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function __FillRoomData(s2croom)
|
local function __FillRoomData(s2croom)
|
||||||
|
|
@ -27,7 +26,7 @@ local function __FillRoomData(s2croom)
|
||||||
extend:FillRoomData(s2croom)
|
extend:FillRoomData(s2croom)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function __ConntectGameServer(cmd,room, host, _data,callback)
|
local function __ConntectGameServer(cmd, room, host, _data, callback)
|
||||||
-- local _data = {}
|
-- local _data = {}
|
||||||
_data["session"] = room.session
|
_data["session"] = room.session
|
||||||
local _game_client = NetClient.new(host, "game")
|
local _game_client = NetClient.new(host, "game")
|
||||||
|
|
@ -35,7 +34,7 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
||||||
ControllerManager.SetGameNetClient(_game_client)
|
ControllerManager.SetGameNetClient(_game_client)
|
||||||
_game_client.onconnect:Add(function(code)
|
_game_client.onconnect:Add(function(code)
|
||||||
if (code == SocketCode.Connect) then
|
if (code == SocketCode.Connect) then
|
||||||
_game_client:send(cmd, _data, function (response)
|
_game_client:send(cmd, _data, function(response)
|
||||||
if (response.ReturnCode == 0) then
|
if (response.ReturnCode == 0) then
|
||||||
_game_client.onconnect:Clear()
|
_game_client.onconnect:Clear()
|
||||||
_game_client.onconnect:Add(ControllerManager.OnConnect)
|
_game_client.onconnect:Add(ControllerManager.OnConnect)
|
||||||
|
|
@ -44,17 +43,16 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
||||||
end
|
end
|
||||||
_game_client:destroy()
|
_game_client:destroy()
|
||||||
if ControllerManager.GameNetClinet == _game_client then
|
if ControllerManager.GameNetClinet == _game_client then
|
||||||
ControllerManager.GameNetClinet =nil
|
ControllerManager.GameNetClinet = nil
|
||||||
end
|
end
|
||||||
callback(response)
|
callback(response)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
else
|
else
|
||||||
if ControllerManager.GameNetClinet == _game_client then
|
if ControllerManager.GameNetClinet == _game_client then
|
||||||
ControllerManager.GameNetClinet =nil
|
ControllerManager.GameNetClinet = nil
|
||||||
end
|
end
|
||||||
_game_client:destroy()
|
_game_client:destroy()
|
||||||
callback({ReturnCode = 101})
|
callback({ ReturnCode = 101 })
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -68,15 +66,15 @@ function M:CreateRoom(game_id, _data, callback)
|
||||||
data.config_data = _data
|
data.config_data = _data
|
||||||
-- local runtime = os.clock()
|
-- local runtime = os.clock()
|
||||||
_client:send(Protocol.WEB_CREATE_ROOM, data, function(res)
|
_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
|
if (res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
|
||||||
self:JoinRoom("000000",callback)
|
self:JoinRoom("000000", callback)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if (res.ReturnCode == 0) then
|
if (res.ReturnCode == 0) then
|
||||||
local json = res.Data
|
local json = res.Data
|
||||||
local game_info = json["game_info"]
|
local game_info = json["game_info"]
|
||||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||||
ExtendHotupdate.UpdateGame(game_info,function()
|
ExtendHotupdate.UpdateGame(game_info, function()
|
||||||
res.ReturnCode = -2
|
res.ReturnCode = -2
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
|
|
@ -104,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
|
||||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||||
|
|
||||||
-- game_net =
|
-- 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
|
if (response.ReturnCode == 0) then
|
||||||
-- game_net:clearEvent()
|
-- game_net:clearEvent()
|
||||||
local _s2croom = response.Data
|
local _s2croom = response.Data
|
||||||
|
|
@ -118,7 +116,7 @@ function M:CreateRoom(game_id, _data, callback)
|
||||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||||
extend:FillRoomData(_s2croom)
|
extend:FillRoomData(_s2croom)
|
||||||
ControllerManager.ChangeController(GameController)
|
ControllerManager.ChangeController(GameController)
|
||||||
-- print("create room:"..(os.clock()-runtime))
|
-- -- print("create room:"..(os.clock()-runtime))
|
||||||
callback(response)
|
callback(response)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -132,7 +130,7 @@ function M:CreateRoom(game_id, _data, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
local join_room_frame = 0
|
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
|
local last_frame = join_room_frame
|
||||||
join_room_frame = Time.frameCount
|
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["floor"] = group_layer
|
||||||
_data["platform"] = GetPlatform()
|
_data["platform"] = GetPlatform()
|
||||||
local _client = ControllerManager.WebClient;
|
local _client = ControllerManager.WebClient;
|
||||||
_client:send(cmd, _data, function( res)
|
_client:send(cmd, _data, function(res)
|
||||||
if (res.ReturnCode == 0) then
|
if (res.ReturnCode == 0) then
|
||||||
local json = res.Data
|
local json = res.Data
|
||||||
local game_info = json["game_info"]
|
local game_info = json["game_info"]
|
||||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||||
ExtendHotupdate.UpdateGame(game_info,function()
|
ExtendHotupdate.UpdateGame(game_info, function()
|
||||||
res.ReturnCode = -2
|
res.ReturnCode = -2
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
|
|
@ -182,10 +180,10 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
||||||
end
|
end
|
||||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||||
-- local game_net = nil
|
-- local game_net = nil
|
||||||
--print(vardump(room))
|
---- print(vardump(room))
|
||||||
-- game_net =
|
-- game_net =
|
||||||
__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)
|
||||||
if (res1.ReturnCode ~= 0 ) then
|
if (res1.ReturnCode ~= 0) then
|
||||||
if (callback) then callback(res1) end
|
if (callback) then callback(res1) end
|
||||||
else
|
else
|
||||||
local _s2croom = res1.Data
|
local _s2croom = res1.Data
|
||||||
|
|
@ -211,11 +209,10 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:JoinRoom(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)
|
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM, room_id, callback, group_id, group_layer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:ResetJionRoom(callback)
|
function M:ResetJionRoom(callback)
|
||||||
local _game = ControllerManager.GetController(GameController)
|
local _game = ControllerManager.GetController(GameController)
|
||||||
local o_room = DataManager.CurrenRoom
|
local o_room = DataManager.CurrenRoom
|
||||||
|
|
@ -241,14 +238,14 @@ function M:ResetJionRoom(callback)
|
||||||
room.create_time = o_room.create_time
|
room.create_time = o_room.create_time
|
||||||
room:SetReloadStatus(true)
|
room:SetReloadStatus(true)
|
||||||
DataManager.CurrenRoom = room
|
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)
|
room:SetReloadStatus(false)
|
||||||
if (res1.ReturnCode ~= 0 ) then
|
if (res1.ReturnCode ~= 0) then
|
||||||
if (callback) then callback(res1) end
|
if (callback) then callback(res1) end
|
||||||
else
|
else
|
||||||
printlog("ResetJionRoom==>>>")
|
printlog("ResetJionRoom==>>>")
|
||||||
pt(res1)
|
pt(res1)
|
||||||
ControllerManager.enterPlayerData=res1.Data.tableInfo.playerData
|
ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
|
||||||
local _s2croom = res1.Data
|
local _s2croom = res1.Data
|
||||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||||
extend:FillRoomData(_s2croom)
|
extend:FillRoomData(_s2croom)
|
||||||
|
|
@ -260,7 +257,7 @@ end
|
||||||
|
|
||||||
function M:UpdatePlayerInfo(callback)
|
function M:UpdatePlayerInfo(callback)
|
||||||
local _client = ControllerManager.WebClient
|
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
|
if res.ReturnCode == 0 then
|
||||||
DataManager.SelfUser.diamo = res.Data.diamo
|
DataManager.SelfUser.diamo = res.Data.diamo
|
||||||
DataManager.SelfUser.invited = res.Data.invitation
|
DataManager.SelfUser.invited = res.Data.invitation
|
||||||
|
|
@ -272,12 +269,12 @@ function M:UpdatePlayerInfo(callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateNotice(id,callback)
|
function M:UpdateNotice(id, callback)
|
||||||
local _client = ControllerManager.WebClient
|
local _client = ControllerManager.WebClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = id
|
_data.id = id
|
||||||
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function (res)
|
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function(res)
|
||||||
--print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
---- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 and #res.Data.notice_list > 0 then
|
if res.ReturnCode == 0 and #res.Data.notice_list > 0 then
|
||||||
callback(true, res.Data)
|
callback(true, res.Data)
|
||||||
|
|
@ -298,10 +295,10 @@ function M:RequestRecordList(callback, roomid)
|
||||||
proto = Protocol.WEB_GET_MILITARY_BY_ROOMID
|
proto = Protocol.WEB_GET_MILITARY_BY_ROOMID
|
||||||
_data.roomId = roomid
|
_data.roomId = roomid
|
||||||
end
|
end
|
||||||
_client:send(proto, _data, function (res)
|
_client:send(proto, _data, function(res)
|
||||||
self.recordList = nil
|
self.recordList = nil
|
||||||
-- print(vardump(res))
|
-- -- print(vardump(res))
|
||||||
if (res.ReturnCode == 0 or res.ReturnCode == 19 ) then
|
if (res.ReturnCode == 0 or res.ReturnCode == 19) then
|
||||||
--self:RequestRankList(callback)
|
--self:RequestRankList(callback)
|
||||||
self.recordList = {}
|
self.recordList = {}
|
||||||
if res.ReturnCode == 19 then return end
|
if res.ReturnCode == 19 then return end
|
||||||
|
|
@ -335,8 +332,8 @@ function M:RequestRecordList(callback, roomid)
|
||||||
end
|
end
|
||||||
local round_count = record_list_item["round"]
|
local round_count = record_list_item["round"]
|
||||||
|
|
||||||
for j = 1,round_count do
|
for j = 1, round_count do
|
||||||
local round_score_str = record_list_item["round_"..j]
|
local round_score_str = record_list_item["round_" .. j]
|
||||||
local m_round_game = MGameTimes.new()
|
local m_round_game = MGameTimes.new()
|
||||||
if round_score_str then
|
if round_score_str then
|
||||||
local round_score_item = json.decode(round_score_str)
|
local round_score_item = json.decode(round_score_str)
|
||||||
|
|
@ -359,16 +356,15 @@ function M:RequestRecordList(callback, roomid)
|
||||||
end)
|
end)
|
||||||
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
|
if game_info and ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||||
ExtendHotupdate.UpdateGame(game_info,function()
|
ExtendHotupdate.UpdateGame(game_info, function()
|
||||||
self:RequestPlayBack(_data,callback)
|
self:RequestPlayBack(_data, callback)
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local _client = ControllerManager.WebClient
|
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
|
if res.ReturnCode == 0 then
|
||||||
local data = json.decode(res.Data.playback)
|
local data = json.decode(res.Data.playback)
|
||||||
local cmdList = data.cmdList
|
local cmdList = data.cmdList
|
||||||
|
|
@ -381,28 +377,24 @@ function M:RequestPlayBack(_data,callback,game_info)
|
||||||
if not room.self_player then
|
if not room.self_player then
|
||||||
room.self_player = room:GetPlayerBySeat(1)
|
room.self_player = room:GetPlayerBySeat(1)
|
||||||
end
|
end
|
||||||
callback(res.ReturnCode,data)
|
callback(res.ReturnCode, data)
|
||||||
else
|
else
|
||||||
callback(res.ReturnCode,nil)
|
callback(res.ReturnCode, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--获取手机验证码
|
--获取手机验证码
|
||||||
function M:GetPhoneCode(phone,callback)
|
function M:GetPhoneCode(phone, callback)
|
||||||
local _client = ControllerManager.WebClient
|
local _client = ControllerManager.WebClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["phone"]=phone
|
_data["phone"] = phone
|
||||||
_client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res)
|
_client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:GetUserInfo(callback)
|
function M:GetUserInfo(callback)
|
||||||
local _client = ControllerManager.WebClient
|
local _client = ControllerManager.WebClient
|
||||||
_client:send(Protocol.WEB_GET_USER_INFO, nil, function(res)
|
_client:send(Protocol.WEB_GET_USER_INFO, nil, function(res)
|
||||||
|
|
@ -419,7 +411,7 @@ function M:GetUserInfo(callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateUserInfo(_data,callback)
|
function M:UpdateUserInfo(_data, callback)
|
||||||
local _client = ControllerManager.WebClient
|
local _client = ControllerManager.WebClient
|
||||||
_client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res)
|
_client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ local function __Login(cmd, _data, callBack)
|
||||||
end
|
end
|
||||||
|
|
||||||
_client:setSession(data["session_id"] .. "," .. data["token"])
|
_client:setSession(data["session_id"] .. "," .. data["token"])
|
||||||
print("11111111111111111111111111111111")
|
-- print("11111111111111111111111111111111")
|
||||||
pt(data)
|
pt(data)
|
||||||
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web)
|
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web)
|
||||||
ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"]))
|
ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"]))
|
||||||
|
|
@ -129,11 +129,11 @@ function M:QuickLogin(session_id, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.OnEnter(self)
|
function M.OnEnter(self)
|
||||||
--print("login controller enter")
|
---- print("login controller enter")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.OnExit(self)
|
function M.OnExit(self)
|
||||||
--print("login controller exit")
|
---- print("login controller exit")
|
||||||
end
|
end
|
||||||
|
|
||||||
--字符串类json格式转化为表
|
--字符串类json格式转化为表
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
NewGroupController = {}
|
NewGroupController = {}
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
@ -7,14 +6,13 @@ local GroupMgrController = import(".GroupMgrController")
|
||||||
|
|
||||||
--- Create a new NewGroupController
|
--- Create a new NewGroupController
|
||||||
function NewGroupController.new()
|
function NewGroupController.new()
|
||||||
setmetatable(M, {__index = IController})
|
setmetatable(M, { __index = IController })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.baseType = NewGroupController
|
self.baseType = NewGroupController
|
||||||
self.class = "NewGroup"
|
self.class = "NewGroup"
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--获取圈列表
|
--获取圈列表
|
||||||
function M:FG_GroupList(callback)
|
function M:FG_GroupList(callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -27,7 +25,7 @@ function M:FG_GroupList(callback)
|
||||||
local r_groups = res.Data.groups
|
local r_groups = res.Data.groups
|
||||||
local l_groups = DataManager.groups
|
local l_groups = DataManager.groups
|
||||||
l_groups:clear()
|
l_groups:clear()
|
||||||
for i=1,#r_groups do
|
for i = 1, #r_groups do
|
||||||
local tem = r_groups[i]
|
local tem = r_groups[i]
|
||||||
local group = GroupData.new()
|
local group = GroupData.new()
|
||||||
group.id = tem.id
|
group.id = tem.id
|
||||||
|
|
@ -54,7 +52,7 @@ end
|
||||||
function M:FG_CreateGroup(name, pay_type, type, callback)
|
function M:FG_CreateGroup(name, pay_type, type, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.name= name
|
data.name = name
|
||||||
data.pay_type = pay_type
|
data.pay_type = pay_type
|
||||||
data.type = type
|
data.type = type
|
||||||
_client:send(Protocol.WEB_FG_CREATE_GROUP, data, function(res)
|
_client:send(Protocol.WEB_FG_CREATE_GROUP, data, function(res)
|
||||||
|
|
@ -78,7 +76,7 @@ function M:FG_CreateGroup(name, pay_type, type, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--删除圈
|
--删除圈
|
||||||
function M:FG_RemoveGroup(id,callback)
|
function M:FG_RemoveGroup(id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -106,7 +104,7 @@ function M:FG_ExitGroup(group_id, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--加入圈
|
--加入圈
|
||||||
function M:FG_JoinGroup(id,callback)
|
function M:FG_JoinGroup(id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -116,7 +114,7 @@ function M:FG_JoinGroup(id,callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--置顶圈
|
--置顶圈
|
||||||
function M:FG_TopGroup(group_id,top,callback)
|
function M:FG_TopGroup(group_id, top, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -131,7 +129,8 @@ function M:FG_TopGroup(group_id,top,callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -151,7 +150,7 @@ function M:FG_UpdateGroupInfo(id, name, notice, ban, dissolve_opt, kick_opt, app
|
||||||
end
|
end
|
||||||
|
|
||||||
--圈邀请列表
|
--圈邀请列表
|
||||||
function M:FG_GroupJoins(id,callback)
|
function M:FG_GroupJoins(id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -161,7 +160,7 @@ function M:FG_GroupJoins(id,callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--圈审核玩家加入
|
--圈审核玩家加入
|
||||||
function M:FG_GroupVerifyJoin(id,tagId,allow,callback)
|
function M:FG_GroupVerifyJoin(id, tagId, allow, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -181,24 +180,22 @@ function M:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, callback
|
||||||
data.num = num
|
data.num = num
|
||||||
data.minus_only = minus_only
|
data.minus_only = minus_only
|
||||||
data.type = sort_type
|
data.type = sort_type
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
||||||
--print("查询圈子玩家列表============")
|
---- print("查询圈子玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local group = DataManager.groups:get(group_id)
|
local group = DataManager.groups:get(group_id)
|
||||||
local members = res.Data.members
|
local members = res.Data.members
|
||||||
for i=1,#members do
|
for i = 1, #members do
|
||||||
local m = members[i]
|
local m = members[i]
|
||||||
group:addMember(m)
|
group:addMember(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:FG_GroupMembers11(group_id, limit, num, minus_only, sort_type, callback)
|
function M:FG_GroupMembers11(group_id, limit, num, minus_only, sort_type, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
|
|
@ -207,26 +204,25 @@ function M:FG_GroupMembers11(group_id, limit, num, minus_only, sort_type, callba
|
||||||
data.num = num
|
data.num = num
|
||||||
data.minus_only = minus_only
|
data.minus_only = minus_only
|
||||||
data.type = sort_type
|
data.type = sort_type
|
||||||
self.currentGroupMembersData=data
|
self.currentGroupMembersData = data
|
||||||
self.currentGroupMembersCallBack=callback
|
self.currentGroupMembersCallBack = callback
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
_client:send(Protocol.WEB_FG_GROUP_MEMBERS, data, function(res)
|
||||||
--print("查询圈子玩家列表============")
|
---- print("查询圈子玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local group = DataManager.groups:get(group_id)
|
local group = DataManager.groups:get(group_id)
|
||||||
local members = res.Data.members
|
local members = res.Data.members
|
||||||
for i=1,#members do
|
for i = 1, #members do
|
||||||
local m = members[i]
|
local m = members[i]
|
||||||
group:addMember(m)
|
group:addMember(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -236,26 +232,25 @@ function M:FG_GroupMembers12(group_id, limit, num,type,online, callback)
|
||||||
data.type = type
|
data.type = type
|
||||||
--data.minus_only = minus_only
|
--data.minus_only = minus_only
|
||||||
--data.type = sort_type
|
--data.type = sort_type
|
||||||
self.currentGroupMembersData=data
|
self.currentGroupMembersData = data
|
||||||
self.currentGroupMembersCallBack=callback
|
self.currentGroupMembersCallBack = callback
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, data, function(res)
|
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, data, function(res)
|
||||||
--print("查询圈子玩家列表============")
|
---- print("查询圈子玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local group = DataManager.groups:get(group_id)
|
local group = DataManager.groups:get(group_id)
|
||||||
local members = res.Data.members
|
local members = res.Data.members
|
||||||
for i=1,#members do
|
for i = 1, #members do
|
||||||
local m = members[i]
|
local m = members[i]
|
||||||
group:addMember(m)
|
group:addMember(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -269,30 +264,27 @@ function M:FG_GroupTiChu(group_id,limit, num,callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:SendGetGroupMembersInfo()
|
function M:SendGetGroupMembersInfo()
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
if self.currentGroupMembersData and self.currentGroupMembersCallBack then
|
if self.currentGroupMembersData and self.currentGroupMembersCallBack then
|
||||||
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, self.currentGroupMembersData, function(res)
|
_client:send(Protocol.WEB_FG_GROUP_MEMBERS1, self.currentGroupMembersData, function(res)
|
||||||
--print("查询圈子玩家列表============")
|
---- print("查询圈子玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local group = DataManager.groups:get(self.currentGroupMembersData.id)
|
local group = DataManager.groups:get(self.currentGroupMembersData.id)
|
||||||
local members = res.Data.members
|
local members = res.Data.members
|
||||||
for i=1,#members do
|
for i = 1, #members do
|
||||||
local m = members[i]
|
local m = members[i]
|
||||||
group:addMember(m)
|
group:addMember(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.currentGroupMembersCallBack(res)
|
self.currentGroupMembersCallBack(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
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.tagName = tag_name
|
||||||
data.tagType = tag_type
|
data.tagType = tag_type
|
||||||
_client:send(Protocol.WEB_FG_FIND_MEMBER, data, function(res)
|
_client:send(Protocol.WEB_FG_FIND_MEMBER, data, function(res)
|
||||||
--print("查询圈子单个玩家列表============")
|
---- print("查询圈子单个玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local group = DataManager.groups:get(group_id)
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 强制提取
|
-- 强制提取
|
||||||
function M:FG_TakeHp1(group_id, tagId, callback)
|
function M:FG_TakeHp1(group_id, tagId, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -325,7 +315,7 @@ function M:FG_TakeHp1(group_id, tagId, callback)
|
||||||
data.tagId = tagId
|
data.tagId = tagId
|
||||||
|
|
||||||
_client:send(Protocol.WEB_FG_TAKE_HP, data, function(res)
|
_client:send(Protocol.WEB_FG_TAKE_HP, data, function(res)
|
||||||
--print("查询圈子单个玩家列表============")
|
---- print("查询圈子单个玩家列表============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
|
|
@ -356,7 +346,7 @@ function M:FG_MovePartner(group_id, member_id, partner_id, callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -387,8 +377,7 @@ function M:FG_QueryPartnerList(group_id, query_id, query_nick, callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
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)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
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)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -442,7 +428,7 @@ function M:FG_GetZuanShiStat(group_id,limit,num,time_type,begin_time,end_time,ca
|
||||||
end
|
end
|
||||||
|
|
||||||
-- WEB_FG_FIND_PARTNER_STAT
|
-- 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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -460,7 +446,7 @@ function M:FG_FindPartnerStat(group_id,member_id,limit,num,time_type,begin_time,
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -481,7 +467,8 @@ end
|
||||||
--find_partner_stat_member
|
--find_partner_stat_member
|
||||||
|
|
||||||
-- WEB_FG_FIND_PARTNER_STAT
|
-- 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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -501,7 +488,8 @@ function M:FG_FindPartnerStatMember(group_id,uid,root_uid,member_id,limit,num,ti
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -521,8 +509,7 @@ function M:FG_FindPartnerZuanShiMember(group_id,uid,root_uid,member_id,limit,num
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FG_GetMembersCount(group_id,callback)
|
function M:FG_GetMembersCount(group_id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -548,8 +535,7 @@ function M:FG_GetMembersCount(group_id,callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
|
|
||||||
|
|
@ -569,7 +555,7 @@ function M:FG_GetPartnerStatMember(group_id,uid,root_uid,limit,num,time_type,beg
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -587,8 +573,7 @@ function M:FG_GetDirectMemberStat(group_id,uid,root_uid,limit,num,time_type,begi
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
|
|
||||||
|
|
@ -608,7 +593,7 @@ function M:FG_GetPartnerZuanShiMember(group_id,uid,root_uid,limit,num,time_type,
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -626,8 +611,7 @@ function M:FG_GetDirectZuanShiStat(group_id,uid,root_uid,limit,num,time_type,beg
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
|
|
||||||
|
|
@ -648,7 +632,6 @@ function M:FG_GetPartnerStatPlay(group_id,uid,parent_id,limit,num,time_type,begi
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 获取合伙人成员列表
|
-- 获取合伙人成员列表
|
||||||
function M:FG_GetPartnerMembers(group_id, partner_id, limit, num, quary_id, callback)
|
function M:FG_GetPartnerMembers(group_id, partner_id, limit, num, quary_id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -737,7 +720,7 @@ function M:FG_GetHpLogDetail(group_id, id, roomid, time, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--获取所有玩法
|
--获取所有玩法
|
||||||
function M:FG_GetAllplays(groupid,uid,callback)
|
function M:FG_GetAllplays(groupid, uid, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = groupid
|
data.id = groupid
|
||||||
|
|
@ -748,7 +731,7 @@ function M:FG_GetAllplays(groupid,uid,callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--设置屏蔽玩法
|
--设置屏蔽玩法
|
||||||
function M:FG_SetBanPlayid(groupId,pid,ban,uid,callback)
|
function M:FG_SetBanPlayid(groupId, pid, ban, uid, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.groupid = groupId
|
data.groupid = groupId
|
||||||
|
|
@ -772,10 +755,8 @@ function M:FG_GetRewards(group_id, pid, lev, callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -790,7 +771,7 @@ function M:FG_SetRewards(group_id, tag, lev, partner_id, all, val, single,callb
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -805,7 +786,7 @@ function M:FG_SetXIPAI(group_id, tag, lev, partner_id, all, val, single,callbac
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -820,7 +801,6 @@ function M:FG_SetANCHOU(group_id, tag, lev, partner_id, all, val, single,callba
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 获取奖励日志
|
-- 获取奖励日志
|
||||||
function M:FG_GetRewardsLog(group_id, limit, num, begin_time, end_time, tag, callback)
|
function M:FG_GetRewardsLog(group_id, limit, num, begin_time, end_time, tag, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -850,7 +830,7 @@ function M:FG_GetRewardStatistic(group_id, pid, begin_time, end_time, callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -903,7 +883,7 @@ function M:FG_GetGameStat(group_id, callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -943,7 +923,8 @@ function M:FG_GetGroupRecord(group_id, platform, qid, limit, num, callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -979,7 +960,6 @@ function M:FG_GetGroupPersonRecord(group_id, platform, qid, time_type, begin_tim
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 根据房间号查询战绩
|
-- 根据房间号查询战绩
|
||||||
function M:FG_GetRecordByRoomid(group_id, roomid, platform, callback)
|
function M:FG_GetRecordByRoomid(group_id, roomid, platform, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -993,7 +973,7 @@ function M:FG_GetRecordByRoomid(group_id, roomid, platform, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取能量包数据
|
-- 获取能量包数据
|
||||||
function M:FG_GetTakeInfo(group_id, tagId,callback)
|
function M:FG_GetTakeInfo(group_id, tagId, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -1003,9 +983,8 @@ function M:FG_GetTakeInfo(group_id, tagId,callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 获取银行信息
|
-- 获取银行信息
|
||||||
function M:FG_GetBankInfo(group_id, tagId,callback)
|
function M:FG_GetBankInfo(group_id, tagId, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -1015,37 +994,30 @@ function M:FG_GetBankInfo(group_id, tagId,callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
data.hp=gethp
|
data.hp = gethp
|
||||||
data.tagId = tagId
|
data.tagId = tagId
|
||||||
_client:send(Protocol.TAKE_BANK_HP, data, function(res)
|
_client:send(Protocol.TAKE_BANK_HP, data, function(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
data.hp=gethp
|
data.hp = gethp
|
||||||
data.tagId = tagId
|
data.tagId = tagId
|
||||||
_client:send(Protocol.SAVE_BANK_HP, data, function(res)
|
_client:send(Protocol.SAVE_BANK_HP, data, function(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -1057,7 +1029,7 @@ function M:FG_TakeHp(group_id, num, tagId,callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -1071,9 +1043,8 @@ function M:FG_GetTakeLog(group_id, limit, num, begin_time, end_time, tagId,callb
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = group_id
|
data.id = group_id
|
||||||
|
|
@ -1087,7 +1058,6 @@ function M:FG_GetBankLog(group_id, limit, num, begin_time, end_time, tagId,callb
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 获取能量包统计
|
-- 获取能量包统计
|
||||||
function M:FG_GetFagPackInfo(group_id, callback)
|
function M:FG_GetFagPackInfo(group_id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
|
|
@ -1099,7 +1069,7 @@ function M:FG_GetFagPackInfo(group_id, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
--圈删除玩家
|
--圈删除玩家
|
||||||
function M:FG_GroupRemoveMember(id,tagId,callback)
|
function M:FG_GroupRemoveMember(id, tagId, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local data = {}
|
local data = {}
|
||||||
data.id = id
|
data.id = id
|
||||||
|
|
@ -1112,6 +1082,7 @@ function M:FG_GroupRemoveMember(id,tagId,callback)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FG_GroupSetVip(group_id, member_id, isvip, callback)
|
function M:FG_GroupSetVip(group_id, member_id, isvip, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
|
|
@ -1129,11 +1100,12 @@ function M:FG_GroupSetVip(group_id, member_id, isvip, callback)
|
||||||
callback(res)
|
callback(res)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
function M:FG_EnterGroup(group_id,callback)
|
|
||||||
|
function M:FG_EnterGroup(group_id, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
printlog("FG_EnterGroup===>>>",_data.id)
|
printlog("FG_EnterGroup===>>>", _data.id)
|
||||||
_client:send(Protocol.WEB_ENTER_GROUP, _data, function(res)
|
_client:send(Protocol.WEB_ENTER_GROUP, _data, function(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
-- 获取玩法列表
|
-- 获取玩法列表
|
||||||
|
|
@ -1143,7 +1115,7 @@ function M:FG_EnterGroup(group_id,callback)
|
||||||
group.hide_action = res.Data.hide_action
|
group.hide_action = res.Data.hide_action
|
||||||
|
|
||||||
self.mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
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
|
if res1.ReturnCode == 0 then
|
||||||
callback(res)
|
callback(res)
|
||||||
else
|
else
|
||||||
|
|
@ -1153,7 +1125,6 @@ function M:FG_EnterGroup(group_id,callback)
|
||||||
else
|
else
|
||||||
callback(res)
|
callback(res)
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1164,7 +1135,7 @@ function M:FG_ExitGroupMgr()
|
||||||
end
|
end
|
||||||
|
|
||||||
--指定圈删除房间
|
--指定圈删除房间
|
||||||
function M:FG_RemoveRoom(group_id,roomid,callback)
|
function M:FG_RemoveRoom(group_id, roomid, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
@ -1221,27 +1192,24 @@ function M:FG_BanMember(group_id, member_id, ban, opType, callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
_data.tagId = member_id
|
_data.tagId = member_id
|
||||||
_client:send(Protocol.GROUP_GET_BLACK_MEMBER, _data, function(res)
|
_client:send(Protocol.GROUP_GET_BLACK_MEMBER, _data, function(res)
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
_data.tagId = member_id
|
_data.tagId = member_id
|
||||||
_data.ban =opt
|
_data.ban = opt
|
||||||
_data.opType = 2
|
_data.opType = 2
|
||||||
_data.ban_rate = ban_rate
|
_data.ban_rate = ban_rate
|
||||||
_data.ban_max_value = black_max_value
|
_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 group = DataManager.groups:get(group_id)
|
||||||
local member = group:getMember(member_id)
|
local member = group:getMember(member_id)
|
||||||
if member then
|
if member then
|
||||||
member.group_black=opt
|
member.group_black = opt
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
callback(res)
|
callback(res)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 设置禁止同桌
|
-- 设置禁止同桌
|
||||||
function M:FG_SetBanTable(group_id, member_id, list, del_list, callback)
|
function M:FG_SetBanTable(group_id, member_id, list, del_list, callback)
|
||||||
if #list == 0 then table.insert(list, 0) end
|
if #list == 0 then table.insert(list, 0) end
|
||||||
|
|
@ -1285,8 +1251,7 @@ function M:FG_GetBanTable(group_id, member_id, callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:GetAddMember(group_id, member_id, callback)
|
||||||
function M:GetAddMember(group_id,member_id,callback)
|
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
@ -1296,9 +1261,8 @@ function M:GetAddMember(group_id,member_id,callback)
|
||||||
end)
|
end)
|
||||||
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 _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
@ -1309,7 +1273,7 @@ function M:FG_AddMember(group_id,member_id,callback)
|
||||||
end
|
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 _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
@ -1421,7 +1385,7 @@ function M:FG_SetPartnerThreshold(group_id, uid, score, callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FG_StopService(group_id,ban,callback)
|
function M:FG_StopService(group_id, ban, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
@ -1447,7 +1411,7 @@ function M:FG_AddPlay(group_id, game_id, config_data, name, hpData, hpOnOff, gty
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FG_DelPlay(group_id,pid,callback)
|
function M:FG_DelPlay(group_id, pid, callback)
|
||||||
local _client = ControllerManager.GroupClient
|
local _client = ControllerManager.GroupClient
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data.id = group_id
|
_data.id = group_id
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
|
||||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||||
extend:FillRoomData(_s2croom)
|
extend:FillRoomData(_s2croom)
|
||||||
ControllerManager.ChangeController(GameController)
|
ControllerManager.ChangeController(GameController)
|
||||||
-- print("create room:"..(os.clock()-runtime))
|
-- -- print("create room:"..(os.clock()-runtime))
|
||||||
callback(response)
|
callback(response)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function ControllerManager.Init()
|
||||||
|
|
||||||
local hostIp = GetGameInfo("login_url")
|
local hostIp = GetGameInfo("login_url")
|
||||||
if (debug_print) then
|
if (debug_print) then
|
||||||
print("hostIp:::" .. hostIp)
|
-- print("hostIp:::" .. hostIp)
|
||||||
end
|
end
|
||||||
ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web)
|
ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web)
|
||||||
--ControllerManager.GroupClient = nil--NetClient.new("http://192.168.0.1:8081/", "web_group", 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
|
end
|
||||||
|
|
||||||
function ControllerManager.OnConnect(code)
|
function ControllerManager.OnConnect(code)
|
||||||
print("=======================================ControllerManager", code)
|
-- print("=======================================ControllerManager", code)
|
||||||
if (code ~= SocketCode.Connect) then
|
if (code ~= SocketCode.Connect) then
|
||||||
ControllerManager.SetGameNetClient(nil)
|
ControllerManager.SetGameNetClient(nil)
|
||||||
if code ~= SocketCode.DisconnectByServer then
|
if code ~= SocketCode.DisconnectByServer then
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ local TableBG = {}
|
||||||
|
|
||||||
local M = TableBG
|
local M = TableBG
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
{ id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
|
||||||
{id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01"},
|
{ id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01" },
|
||||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||||
}
|
}
|
||||||
|
|
||||||
function TableBG.GetBGConfig(config)
|
function TableBG.GetBGConfig(config)
|
||||||
|
|
@ -49,7 +49,7 @@ end
|
||||||
function TableBG.GetTableBG(game_id)
|
function TableBG.GetTableBG(game_id)
|
||||||
local id = -1
|
local id = -1
|
||||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
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
|
if json_data ~= nil then
|
||||||
local config_data = json.decode(json_data)
|
local config_data = json.decode(json_data)
|
||||||
id = GetBG(config_data, game_id)
|
id = GetBG(config_data, game_id)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ local function __ShowTip(_version_view, text, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function __update_check(data, onback, _version_view)
|
local function __update_check(data, onback, _version_view)
|
||||||
print("===================updateCheck")
|
-- print("===================updateCheck")
|
||||||
local tex_tip = _version_view:GetChild("tex_info")
|
local tex_tip = _version_view:GetChild("tex_info")
|
||||||
for k, game_data in ipairs(data) do
|
for k, game_data in ipairs(data) do
|
||||||
local asset_path = game_data["bundle"]:gsub("\r\n", "")
|
local asset_path = game_data["bundle"]:gsub("\r\n", "")
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ local _isInit = false
|
||||||
|
|
||||||
local function __new_config(data)
|
local function __new_config(data)
|
||||||
local ec = reimport(data.bundle .. ".ExtendConfig")
|
local ec = reimport(data.bundle .. ".ExtendConfig")
|
||||||
print("初始化ExtendManager===>>>" .. data.bundle)
|
-- print("初始化ExtendManager===>>>" .. data.bundle)
|
||||||
--pt(data)
|
--pt(data)
|
||||||
local config = ec.new()
|
local config = ec.new()
|
||||||
ec.game_data = data
|
ec.game_data = data
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@ local WindowMap = {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local WindowQueue= {
|
local WindowQueue = {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local M = BaseWindow
|
local M = BaseWindow
|
||||||
|
|
||||||
function BaseWindow.new(url,blur_view)
|
function BaseWindow.new(url, blur_view)
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "BaseWindow"
|
self.class = "BaseWindow"
|
||||||
-- self._blur_view = blur_view
|
-- self._blur_view = blur_view
|
||||||
self:init(url)
|
self:init(url)
|
||||||
|
|
@ -68,7 +68,7 @@ function M:init(url)
|
||||||
printlog(self._view)
|
printlog(self._view)
|
||||||
-- self._view.fairyBatching = true
|
-- self._view.fairyBatching = true
|
||||||
local btn_close = self._view:GetChild("btn_close")
|
local btn_close = self._view:GetChild("btn_close")
|
||||||
if(btn_close) then
|
if (btn_close) then
|
||||||
btn_close.onClick:Set(function()
|
btn_close.onClick:Set(function()
|
||||||
self:CloseEvent()
|
self:CloseEvent()
|
||||||
end)
|
end)
|
||||||
|
|
@ -83,7 +83,7 @@ function M:init(url)
|
||||||
win_mode.touchable = false
|
win_mode.touchable = false
|
||||||
self:CloseEvent()
|
self:CloseEvent()
|
||||||
end)
|
end)
|
||||||
printlog("======================================",self._full)
|
printlog("======================================", self._full)
|
||||||
if self._full then
|
if self._full then
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
if self._anim_pop == 0 then
|
if self._anim_pop == 0 then
|
||||||
|
|
@ -120,7 +120,7 @@ end
|
||||||
|
|
||||||
-- 显示窗口
|
-- 显示窗口
|
||||||
function M:Show()
|
function M:Show()
|
||||||
print("===========================================entershow",M.class)
|
-- print("===========================================entershow",M.class)
|
||||||
local contentPane = self._root_view:GetChild("contentPane")
|
local contentPane = self._root_view:GetChild("contentPane")
|
||||||
if self._anim_pop == 1 then
|
if self._anim_pop == 1 then
|
||||||
contentPane:GetTransition("left_pop"):Play()
|
contentPane:GetTransition("left_pop"):Play()
|
||||||
|
|
@ -140,7 +140,7 @@ function M:Show()
|
||||||
local _inQueue = false
|
local _inQueue = false
|
||||||
|
|
||||||
if self._new_hide then
|
if self._new_hide then
|
||||||
for i=1,#WindowQueue do
|
for i = 1, #WindowQueue do
|
||||||
local win = WindowQueue[i]
|
local win = WindowQueue[i]
|
||||||
if win == self then
|
if win == self then
|
||||||
_inQueue = true
|
_inQueue = true
|
||||||
|
|
@ -168,9 +168,9 @@ function M:Close()
|
||||||
-- BlurView(self._blur_view,false)
|
-- BlurView(self._blur_view,false)
|
||||||
-- end
|
-- end
|
||||||
if self._queue then
|
if self._queue then
|
||||||
for i,v in ipairs(WindowQueue) do
|
for i, v in ipairs(WindowQueue) do
|
||||||
if v == self then
|
if v == self then
|
||||||
table.remove(WindowQueue,i)
|
table.remove(WindowQueue, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -194,9 +194,9 @@ function M:Destroy()
|
||||||
if not _destroy_all then
|
if not _destroy_all then
|
||||||
self:Close()
|
self:Close()
|
||||||
if self._put_map then
|
if self._put_map then
|
||||||
for i,v in ipairs(WindowMap) do
|
for i, v in ipairs(WindowMap) do
|
||||||
if v == self then
|
if v == self then
|
||||||
table.remove(WindowMap,i)
|
table.remove(WindowMap, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -245,7 +245,7 @@ end
|
||||||
function BaseWindow.DestroyAll()
|
function BaseWindow.DestroyAll()
|
||||||
_destroy_all = true
|
_destroy_all = true
|
||||||
local list = WindowMap
|
local list = WindowMap
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local win = list[i]
|
local win = list[i]
|
||||||
win:Destroy()
|
win:Destroy()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,13 @@ function M:init(url)
|
||||||
list_playName.onClickItem:Add(function()
|
list_playName.onClickItem:Add(function()
|
||||||
self.showView.visible = false
|
self.showView.visible = false
|
||||||
local index = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
|
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
|
local playView
|
||||||
if not playDetail then
|
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
|
if playDetail then
|
||||||
playView = view:AddChild(playDetail)
|
playView = view:AddChild(playDetail)
|
||||||
playView.name = string.format("Label_Detail_%d",index)
|
playView.name = string.format("Label_Detail_%d", index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not playDetail then
|
if not playDetail then
|
||||||
|
|
@ -80,17 +80,17 @@ function M:init(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CreatePlay()
|
function M:CreatePlay()
|
||||||
ViewUtil.ShowModalWait(self._root_view,"正在创建房间...")
|
ViewUtil.ShowModalWait(self._root_view, "正在创建房间...")
|
||||||
local loddyCtr = ControllerManager.GetController(LoddyController)
|
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)
|
local config = ExtendManager.GetExtendConfig(gameId)
|
||||||
print("==============================config")
|
-- print("==============================config")
|
||||||
pt(config)
|
pt(config)
|
||||||
local mode = config:GetGameInfo()
|
local mode = config:GetGameInfo()
|
||||||
print("==============================mode")
|
-- print("==============================mode")
|
||||||
pt(mode)
|
pt(mode)
|
||||||
local _data = mode:SelectedConfigData()
|
local _data = mode:SelectedConfigData()
|
||||||
print("==============================_data")
|
-- print("==============================_data")
|
||||||
pt(_data)
|
pt(_data)
|
||||||
-- loddyCtr:CreateRoom(gameId,_data, function (res)
|
-- loddyCtr:CreateRoom(gameId,_data, function (res)
|
||||||
-- self:__OnCreateRoomAction(res)
|
-- self:__OnCreateRoomAction(res)
|
||||||
|
|
@ -111,7 +111,7 @@ function M:initePlayInfo()
|
||||||
local games = DataManager.SelfUser.games
|
local games = DataManager.SelfUser.games
|
||||||
for i = 1, #games do
|
for i = 1, #games do
|
||||||
if PlayInfo[1].playListInfo[games[i].game_id] then
|
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
|
||||||
end
|
end
|
||||||
pt(PlayInfo)
|
pt(PlayInfo)
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||||
list_familyNumber:SetVirtual()
|
list_familyNumber:SetVirtual()
|
||||||
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
||||||
local members = res.Data.members
|
local members = res.Data.members
|
||||||
print("==========================res.Data.members")
|
-- print("==========================res.Data.members")
|
||||||
pt(res.Data.members)
|
pt(res.Data.members)
|
||||||
ViewUtil:CloseModalWait()
|
ViewUtil:CloseModalWait()
|
||||||
if res.ReturnCode ~= 0 then
|
if res.ReturnCode ~= 0 then
|
||||||
|
|
@ -303,7 +303,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local roomList = self._group.rooms
|
local roomList = self._group.rooms
|
||||||
print("=========================playList,rooms")
|
-- print("=========================playList,rooms")
|
||||||
pt(playList)
|
pt(playList)
|
||||||
pt(roomList)
|
pt(roomList)
|
||||||
local roomCtr = ControllerManager.GetController(RoomController)
|
local roomCtr = ControllerManager.GetController(RoomController)
|
||||||
|
|
@ -405,7 +405,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
local all_num = #playList + #roomList
|
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)
|
pt(list_room)
|
||||||
list_room.numItems = all_num
|
list_room.numItems = all_num
|
||||||
list_gamePlay.numItems = #playList + 1
|
list_gamePlay.numItems = #playList + 1
|
||||||
|
|
@ -418,7 +418,7 @@ function M:ConnetFamily(index, groups, isCreate)
|
||||||
local list_family = self._view:GetChild('list_family')
|
local list_family = self._view:GetChild('list_family')
|
||||||
list_family:SetVirtual()
|
list_family:SetVirtual()
|
||||||
self._group = DataManager.groups:get(groups[index].id)
|
self._group = DataManager.groups:get(groups[index].id)
|
||||||
print("===================================self._group")
|
-- print("===================================self._group")
|
||||||
pt(self._group)
|
pt(self._group)
|
||||||
self._roomNum = self._group.room_num
|
self._roomNum = self._group.room_num
|
||||||
|
|
||||||
|
|
@ -533,7 +533,7 @@ function M:OnUpdate()
|
||||||
self._group.update_room = false
|
self._group.update_room = false
|
||||||
self._fristRoom = true
|
self._fristRoom = true
|
||||||
end
|
end
|
||||||
print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
-- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||||
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ function M:OnCreateRoom(mode_data)
|
||||||
local mode = mode_data.data
|
local mode = mode_data.data
|
||||||
--点击建房按钮后保存当前游戏的config
|
--点击建房按钮后保存当前游戏的config
|
||||||
local _data = mode:SelectedConfigData()
|
local _data = mode:SelectedConfigData()
|
||||||
--print("OnCreateRoom================")
|
---- print("OnCreateRoom================")
|
||||||
--pt(_data)
|
--pt(_data)
|
||||||
if not _data["stamina"] then _data["stamina"] = 0 end
|
if not _data["stamina"] then _data["stamina"] = 0 end
|
||||||
local user_id = DataManager.SelfUser.account_id
|
local user_id = DataManager.SelfUser.account_id
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
--进入房间View对象
|
--进入房间View对象
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -9,8 +8,8 @@ local KEY_DEL = "del"
|
||||||
local KEY_CLEAR = "reset"
|
local KEY_CLEAR = "reset"
|
||||||
|
|
||||||
function JoinRoomView.new()
|
function JoinRoomView.new()
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "JoinRoomView"
|
self.class = "JoinRoomView"
|
||||||
self._currenIndex = 0
|
self._currenIndex = 0
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
|
|
@ -19,35 +18,35 @@ function JoinRoomView.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
|
|
||||||
self.tex_num = self._view:GetChild("show_text")
|
self.tex_num = self._view:GetChild("show_text")
|
||||||
self:ClearNumTex()
|
self:ClearNumTex()
|
||||||
|
|
||||||
for i = 0 , 9 do
|
for i = 0, 9 do
|
||||||
local obj = self._view:GetChild("btn_num_"..i)
|
local obj = self._view:GetChild("btn_num_" .. i)
|
||||||
obj.onClick:Add(handler(self , self.OnNumButtonAction))
|
obj.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
local btn_reset = self._view:GetChild("btn_reset")
|
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")
|
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
|
end
|
||||||
|
|
||||||
function M:OnNumButtonAction(context)
|
function M:OnNumButtonAction(context)
|
||||||
local typer = string.sub(context.sender.name ,5)
|
local typer = string.sub(context.sender.name, 5)
|
||||||
printlog("==========================OnNumButtonAction==============================")
|
printlog("==========================OnNumButtonAction==============================")
|
||||||
printlog(typer)
|
printlog(typer)
|
||||||
if typer == KEY_DEL then
|
if typer == KEY_DEL then
|
||||||
if (self._currenIndex > 0) then
|
if (self._currenIndex > 0) then
|
||||||
self._currenIndex = self._currenIndex - 1
|
self._currenIndex = self._currenIndex - 1
|
||||||
printlog("==================test=================")
|
printlog("==================test=================")
|
||||||
print("ok")
|
-- print("ok")
|
||||||
printlog(#self._texnum_str)
|
printlog(#self._texnum_str)
|
||||||
printlog(self._currenIndex)
|
printlog(self._currenIndex)
|
||||||
printlog("==================test=================")
|
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
|
self.tex_num.text = self._texnum_str
|
||||||
end
|
end
|
||||||
elseif typer == KEY_CLEAR then
|
elseif typer == KEY_CLEAR then
|
||||||
|
|
@ -55,9 +54,9 @@ function M:OnNumButtonAction(context)
|
||||||
else
|
else
|
||||||
if (self._currenIndex < 6) then
|
if (self._currenIndex < 6) then
|
||||||
self._currenIndex = self._currenIndex + 1
|
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
|
self.tex_num.text = self._texnum_str
|
||||||
if(self._currenIndex == 6) then
|
if (self._currenIndex == 6) then
|
||||||
self:JoinRoom(self._texnum_str)
|
self:JoinRoom(self._texnum_str)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -65,19 +64,19 @@ function M:OnNumButtonAction(context)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:JoinRoom(str)
|
function M:JoinRoom(str)
|
||||||
ViewUtil.ShowModalWait(self._root_view,"正在加入房间...")
|
ViewUtil.ShowModalWait(self._root_view, "正在加入房间...")
|
||||||
local boddyCtr = ControllerManager.GetController(LoddyController)
|
local boddyCtr = ControllerManager.GetController(LoddyController)
|
||||||
boddyCtr:JoinRoom(str, function (response)
|
boddyCtr:JoinRoom(str, function(response)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if response.ReturnCode == -2 then
|
if response.ReturnCode == -2 then
|
||||||
self:JoinRoom(str)
|
self:JoinRoom(str)
|
||||||
return
|
return
|
||||||
elseif response.ReturnCode ~=0 then
|
elseif response.ReturnCode ~= 0 then
|
||||||
ViewUtil.ErrorTip(response.ReturnCode,"进入房间失败")
|
ViewUtil.ErrorTip(response.ReturnCode, "进入房间失败")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
ViewManager.ChangeView(ViewManager.View_Main,DataManager.CurrenRoom.game_id)
|
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ function M:init(url)
|
||||||
local view = self._view
|
local view = self._view
|
||||||
local user = self.user;
|
local user = self.user;
|
||||||
|
|
||||||
print("================phone=====================")
|
-- print("================phone=====================")
|
||||||
for k, v in pairs(user) do
|
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
|
end
|
||||||
|
|
||||||
--show
|
--show
|
||||||
|
|
|
||||||
|
|
@ -3,25 +3,25 @@
|
||||||
local LobbyShopView = {}
|
local LobbyShopView = {}
|
||||||
|
|
||||||
local M = LobbyShopView
|
local M = LobbyShopView
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
|
|
||||||
local SHOP_LIST = {
|
local SHOP_LIST = {
|
||||||
{
|
{
|
||||||
num=2000,
|
num = 2000,
|
||||||
price=300
|
price = 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
num=1000,
|
num = 1000,
|
||||||
price=165
|
price = 165
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
num=300,
|
num = 300,
|
||||||
price=50
|
price = 50
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function LobbyShopView.new(Fct_UpdateDiamo)
|
function LobbyShopView.new(Fct_UpdateDiamo)
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = 'ShopView'
|
self.class = 'ShopView'
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
self:init('ui://Lobby/Shop')
|
self:init('ui://Lobby/Shop')
|
||||||
|
|
@ -37,28 +37,25 @@ function M:init(url)
|
||||||
|
|
||||||
for i = 1, #SHOP_LIST do
|
for i = 1, #SHOP_LIST do
|
||||||
local shopChild = UIPackage.CreateObjectFromURL('ui://Lobby/c_shop_child')
|
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')
|
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()
|
shopBuyBtn.onClick:Set(function()
|
||||||
local index = i;
|
local index = i;
|
||||||
if false then
|
if false then
|
||||||
--发送购买给后端
|
--发送购买给后端
|
||||||
else
|
else
|
||||||
--假数据
|
--假数据
|
||||||
print("===================shop====================")
|
-- print("===================shop====================")
|
||||||
print(SHOP_LIST[index].num)
|
-- print(SHOP_LIST[index].num)
|
||||||
print(DataManager.SelfUser.diamo)
|
-- print(DataManager.SelfUser.diamo)
|
||||||
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num
|
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num
|
||||||
print(DataManager.SelfUser.diamo)
|
-- print(DataManager.SelfUser.diamo)
|
||||||
self.UpdateDiamo()
|
self.UpdateDiamo()
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
shopList:AddChild(shopChild)
|
shopList:AddChild(shopChild)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ local NoticeView = {}
|
||||||
local M = NoticeView
|
local M = NoticeView
|
||||||
|
|
||||||
function NoticeView.new(blur_view)
|
function NoticeView.new(blur_view)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "NoticeView"
|
self.class = "NoticeView"
|
||||||
-- self._blur_view = blur_view
|
-- self._blur_view = blur_view
|
||||||
self:init("ui://Lobby/pop_notice")
|
self:init("ui://Lobby/pop_notice")
|
||||||
|
|
@ -12,7 +12,7 @@ function NoticeView.new(blur_view)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
self._close_zone = true
|
self._close_zone = true
|
||||||
end
|
end
|
||||||
|
|
@ -40,7 +40,6 @@ function M:FillData(data)
|
||||||
end
|
end
|
||||||
list.selectedIndex = 0
|
list.selectedIndex = 0
|
||||||
self:ShowIndex(1)
|
self:ShowIndex(1)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowIndex(index)
|
function M:ShowIndex(index)
|
||||||
|
|
@ -56,9 +55,7 @@ function M:ShowIndex(index)
|
||||||
|
|
||||||
-- pic.text = "<img src=\""..notices[index].picture.."\"></img>"
|
-- pic.text = "<img src=\""..notices[index].picture.."\"></img>"
|
||||||
-- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>"
|
-- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>"
|
||||||
-- print(pic.text)
|
-- -- print(pic.text)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Destroy(flag)
|
function M:Destroy(flag)
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ local PhonePasswordView = {}
|
||||||
local M = PhonePasswordView
|
local M = PhonePasswordView
|
||||||
|
|
||||||
function PhonePasswordView.new(callback)
|
function PhonePasswordView.new(callback)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PhonePasswordView"
|
self.class = "PhonePasswordView"
|
||||||
self._callback = callback
|
self._callback = callback
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
|
|
@ -14,11 +14,11 @@ function PhonePasswordView.new(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
self.ctr_update = self._view:GetController("update")
|
self.ctr_update = self._view:GetController("update")
|
||||||
if DataManager.SelfUser.password then
|
if DataManager.SelfUser.password then
|
||||||
--self.ctr_update.selectedIndex = 1
|
--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)
|
--self._view:GetChild("tex_phone").text = DataManager.SelfUser.account_id--ViewUtil.phone_hide(DataManager.SelfUser.phone)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ function M:GetCode()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||||
loddyctr:GetPhoneCode(phone,function( res)
|
loddyctr:GetPhoneCode(phone, function(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
self._view:GetController("code").selectedIndex = 1
|
self._view:GetController("code").selectedIndex = 1
|
||||||
self._left_time = 120
|
self._left_time = 120
|
||||||
|
|
@ -60,10 +60,10 @@ function M:OnUpdate()
|
||||||
_left_time = _left_time - deltaTime
|
_left_time = _left_time - deltaTime
|
||||||
_left_time = math.max(0, _left_time)
|
_left_time = math.max(0, _left_time)
|
||||||
local leftTime = math.floor(_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
|
self._left_time = _left_time
|
||||||
else
|
else
|
||||||
self._view:GetController("code").selectedIndex=0
|
self._view:GetController("code").selectedIndex = 0
|
||||||
UpdateBeat:Remove(self.OnUpdate, self)
|
UpdateBeat:Remove(self.OnUpdate, self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -75,10 +75,9 @@ end
|
||||||
|
|
||||||
--绑定
|
--绑定
|
||||||
function M:Bind()
|
function M:Bind()
|
||||||
|
|
||||||
local tex_passwd = self._view:GetChild("tex_passwd")
|
local tex_passwd = self._view:GetChild("tex_passwd")
|
||||||
local password = tex_passwd.text
|
local password = tex_passwd.text
|
||||||
if string.len(password) <6 then
|
if string.len(password) < 6 then
|
||||||
ViewUtil.ShowTips("请输入5位以上的密码")
|
ViewUtil.ShowTips("请输入5位以上的密码")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -93,24 +92,23 @@ function M:Bind()
|
||||||
-- _data.phone = DataManager.SelfUser.phone
|
-- _data.phone = DataManager.SelfUser.phone
|
||||||
-- _data.code = code
|
-- _data.code = code
|
||||||
-- end
|
-- end
|
||||||
ViewUtil.ShowModalWait(self._root_view,"正在提交...")
|
ViewUtil.ShowModalWait(self._root_view, "正在提交...")
|
||||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||||
_data.password = password
|
_data.password = password
|
||||||
_data.type =3
|
_data.type = 3
|
||||||
|
|
||||||
loddyctr:UpdateUserInfo(_data,function( res)
|
loddyctr:UpdateUserInfo(_data, function(res)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if (res.ReturnCode ==0) then
|
if (res.ReturnCode == 0) then
|
||||||
DataManager.SelfUser.password = "123"
|
DataManager.SelfUser.password = "123"
|
||||||
if self._callback then self._callback() end
|
if self._callback then self._callback() end
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res.ReturnCode,"提交失败")
|
ViewUtil.ErrorTip(res.ReturnCode, "提交失败")
|
||||||
end
|
end
|
||||||
self:Close()
|
self:Close()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:CheckInputCode()
|
function M:CheckInputCode()
|
||||||
local code = self._view:GetChild("tex_code").text
|
local code = self._view:GetChild("tex_code").text
|
||||||
if not (string.len(code) == 6) then
|
if not (string.len(code) == 6) then
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ RankView = {}
|
||||||
|
|
||||||
local M = RankView
|
local M = RankView
|
||||||
|
|
||||||
function RankView.new( main_view,video )
|
function RankView.new(main_view, video)
|
||||||
UIPackage.AddPackage("base/rank/ui/Rank")
|
UIPackage.AddPackage("base/rank/ui/Rank")
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "RankView"
|
self.class = "RankView"
|
||||||
self._animation = false
|
self._animation = false
|
||||||
self._full = true
|
self._full = true
|
||||||
|
|
@ -24,9 +24,8 @@ function RankView.new( main_view,video )
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init( url )
|
function M:init(url)
|
||||||
|
BaseWindow.init(self, url)
|
||||||
BaseWindow.init(self,url)
|
|
||||||
|
|
||||||
self._view:GetController("tab").selectedIndex = self._video and 1 or 0
|
self._view:GetController("tab").selectedIndex = self._video and 1 or 0
|
||||||
self._curren_tex = ""
|
self._curren_tex = ""
|
||||||
|
|
@ -37,18 +36,15 @@ function M:init( url )
|
||||||
for i = 0, 9 do
|
for i = 0, 9 do
|
||||||
local btn = develop_panel:GetChild("btn_" .. i)
|
local btn = develop_panel:GetChild("btn_" .. i)
|
||||||
btn.onClick:Add(function()
|
btn.onClick:Add(function()
|
||||||
|
|
||||||
if self._curren_len < 6 then
|
if self._curren_len < 6 then
|
||||||
|
|
||||||
self._curren_tex = self._curren_tex .. i
|
self._curren_tex = self._curren_tex .. i
|
||||||
self._curren_len = self._curren_len + 1
|
self._curren_len = self._curren_len + 1
|
||||||
self.tex_roomid.text = self._curren_tex
|
self.tex_roomid.text = self._curren_tex
|
||||||
|
|
||||||
if self._curren_len == 6 then
|
if self._curren_len == 6 then
|
||||||
|
|
||||||
ViewUtil.ShowModalWait(self._root_view)
|
ViewUtil.ShowModalWait(self._root_view)
|
||||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||||
loddyCtr1:RequestRecordList(function (result)
|
loddyCtr1:RequestRecordList(function(result)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
|
|
@ -79,8 +75,6 @@ function M:init( url )
|
||||||
self._curren_len = 0
|
self._curren_len = 0
|
||||||
self.tex_roomid.text = self._curren_tex
|
self.tex_roomid.text = self._curren_tex
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:readData()
|
function M:readData()
|
||||||
|
|
@ -90,7 +84,7 @@ function M:readData()
|
||||||
record_list_1:RemoveChildrenToPool()
|
record_list_1:RemoveChildrenToPool()
|
||||||
|
|
||||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||||
loddyCtr1:RequestRecordList(function (result)
|
loddyCtr1:RequestRecordList(function(result)
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -101,7 +95,6 @@ function M:readData()
|
||||||
|
|
||||||
|
|
||||||
self:InitRecord1(loddyCtr1.recordList)
|
self:InitRecord1(loddyCtr1.recordList)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -118,21 +111,18 @@ end
|
||||||
|
|
||||||
local load_head_num = 0
|
local load_head_num = 0
|
||||||
function M:InitRecord1(recordList, develop_tool)
|
function M:InitRecord1(recordList, develop_tool)
|
||||||
|
---- print("InitRecord1=========")
|
||||||
--print("InitRecord1=========")
|
|
||||||
pt(recordList)
|
pt(recordList)
|
||||||
local main_view = self._view
|
local main_view = self._view
|
||||||
-- 战绩 list
|
-- 战绩 list
|
||||||
local record_list_1, ctr_recored, ctr_no_record
|
local record_list_1, ctr_recored, ctr_no_record
|
||||||
if develop_tool then
|
if develop_tool then
|
||||||
|
|
||||||
ctr_recored = main_view:GetController("developer")
|
ctr_recored = main_view:GetController("developer")
|
||||||
ctr_recored.selectedIndex = 1
|
ctr_recored.selectedIndex = 1
|
||||||
|
|
||||||
record_list_1 = main_view:GetChild("lst_record")
|
record_list_1 = main_view:GetChild("lst_record")
|
||||||
local btn_backto_search = main_view:GetChild("btn_backto_search")
|
local btn_backto_search = main_view:GetChild("btn_backto_search")
|
||||||
btn_backto_search.onClick:Set(function()
|
btn_backto_search.onClick:Set(function()
|
||||||
|
|
||||||
ctr_recored.selectedIndex = 0
|
ctr_recored.selectedIndex = 0
|
||||||
|
|
||||||
self._curren_tex = ""
|
self._curren_tex = ""
|
||||||
|
|
@ -146,8 +136,7 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
end
|
end
|
||||||
record_list_1:RemoveChildrenToPool()
|
record_list_1:RemoveChildrenToPool()
|
||||||
ctr_no_record.selectedIndex = #recordList == 0 and 1 or 0
|
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 record_list_item = recordList[i]
|
||||||
local total_score_list = record_list_item.TotalScoreList
|
local total_score_list = record_list_item.TotalScoreList
|
||||||
local item = record_list_1:AddItemFromPool()
|
local item = record_list_1:AddItemFromPool()
|
||||||
|
|
@ -165,7 +154,7 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
local game_data = ExtendManager.GetGameData(game_id)
|
local game_data = ExtendManager.GetGameData(game_id)
|
||||||
local room_type_str = record_list_item.GameInfo.name
|
local room_type_str = record_list_item.GameInfo.name
|
||||||
local room_id_str = record_list_item.RoomId
|
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 room_time_str = os.date("%Y-%m-%d %H:%M", time)
|
||||||
local item_score_list = record_list_item.GameTimes
|
local item_score_list = record_list_item.GameTimes
|
||||||
local play_back_id = record_list_item.PlayBackId
|
local play_back_id = record_list_item.PlayBackId
|
||||||
|
|
@ -184,7 +173,7 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
-- 显示 每个玩家的 名字和 分数
|
-- 显示 每个玩家的 名字和 分数
|
||||||
-- player_list 是聊天室数据
|
-- player_list 是聊天室数据
|
||||||
local 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_list_item = total_score_list[j]
|
||||||
local player_item = player_item_list:AddItemFromPool()
|
local player_item = player_item_list:AddItemFromPool()
|
||||||
player_item:GetChild("n0").text = player_list_item.Name
|
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
|
player_item:GetController("num_color").selectedIndex = 0
|
||||||
end
|
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] = {}
|
||||||
player_list[j].id = player_list_item.Id
|
player_list[j].id = player_list_item.Id
|
||||||
player_list[j].score = score
|
player_list[j].score = score
|
||||||
|
|
@ -207,9 +196,9 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
player_list[j].nick = player_list_item.Name
|
player_list[j].nick = player_list_item.Name
|
||||||
end
|
end
|
||||||
-- 点击事件
|
-- 点击事件
|
||||||
item.onClick:Add(function ()
|
item.onClick:Add(function()
|
||||||
|
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str, item_score_list, game_id,
|
||||||
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str,item_score_list, game_id, develop_tool, record_list_item)
|
develop_tool, record_list_item)
|
||||||
end)
|
end)
|
||||||
-- 分享
|
-- 分享
|
||||||
item:GetChild("btn_screenshot").onClick:Set(function()
|
item:GetChild("btn_screenshot").onClick:Set(function()
|
||||||
|
|
@ -240,14 +229,14 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
item:GetChild("score").text = score
|
item:GetChild("score").text = score
|
||||||
if score < 0 then item:GetController("di").selectedIndex = 1 end
|
if score < 0 then item:GetController("di").selectedIndex = 1 end
|
||||||
if p.Portrait and p.Portrait ~= "" then
|
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
|
load_head_num = load_head_num - 1
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
load_head_num = load_head_num - 1
|
load_head_num = load_head_num - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
coroutine.start(function ( ... )
|
coroutine.start(function(...)
|
||||||
local left_time = 4
|
local left_time = 4
|
||||||
while (true) do
|
while (true) do
|
||||||
if load_head_num == 0 or left_time == 0 then
|
if load_head_num == 0 or left_time == 0 then
|
||||||
|
|
@ -266,7 +255,8 @@ function M:InitRecord1(recordList, develop_tool)
|
||||||
end)
|
end)
|
||||||
item:GetChild("btn_link").onClick:Set(function()
|
item:GetChild("btn_link").onClick:Set(function()
|
||||||
local group_id = record_list_item.group_id and tonumber(record_list_item.group_id) or 0
|
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
|
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
|
local hpType = record_item.GameInfo.hpType
|
||||||
|
|
||||||
record_list_2:RemoveChildrenToPool()
|
record_list_2:RemoveChildrenToPool()
|
||||||
for i=1,#item_score do
|
for i = 1, #item_score do
|
||||||
local item_player_info = item_score[i]
|
local item_player_info = item_score[i]
|
||||||
local play_back_id = item_player_info.PlayBackId
|
local play_back_id = item_player_info.PlayBackId
|
||||||
local player_score = item_player_info.PlayerList
|
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)
|
record_item_2:GetChild("Number").text = tostring(i)
|
||||||
|
|
||||||
player_item_list:RemoveChildrenToPool()
|
player_item_list:RemoveChildrenToPool()
|
||||||
for j=1,#player_score do
|
for j = 1, #player_score do
|
||||||
|
|
||||||
local player_item = player_item_list:AddItemFromPool()
|
local player_item = player_item_list:AddItemFromPool()
|
||||||
player_item:GetChild("n0").text = player_score[j].Name
|
player_item:GetChild("n0").text = player_score[j].Name
|
||||||
local player_score_text = player_item:GetChild("n1")
|
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
|
else
|
||||||
player_item:GetController("num_color").selectedIndex = 0
|
player_item:GetController("num_color").selectedIndex = 0
|
||||||
end
|
end
|
||||||
player_score_text.text = score >= 0 and "+"..score or score
|
player_score_text.text = score >= 0 and "+" .. score or score
|
||||||
|
|
||||||
end
|
end
|
||||||
local btn_play_back = record_item_2:GetChild("btn_play_back")
|
local btn_play_back = record_item_2:GetChild("btn_play_back")
|
||||||
btn_play_back.onClick:Set(function()
|
btn_play_back.onClick:Set(function()
|
||||||
--print("点击进入回放=====")
|
---- print("点击进入回放=====")
|
||||||
if DataManager.SelfUser.playback[playback_id] ~= nil and DataManager.SelfUser.playback[playback_id][i] ~= nil then
|
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()
|
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||||
DataManager.CurrenRoom = room
|
DataManager.CurrenRoom = room
|
||||||
room.game_id = game_id
|
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._totalRound = #item_score
|
||||||
main:FillRoomData(DataManager.SelfUser.playback[playback_id][i])
|
main:FillRoomData(DataManager.SelfUser.playback[playback_id][i])
|
||||||
else
|
else
|
||||||
--print("2222222222222")
|
---- print("2222222222222")
|
||||||
ViewUtil.ShowModalWait(self._view)
|
ViewUtil.ShowModalWait(self._view)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["military_id"] = playback_id
|
_data["military_id"] = playback_id
|
||||||
_data["round"] = tostring(i)
|
_data["round"] = tostring(i)
|
||||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||||
loddyCtr1:RequestPlayBack(_data,function(code,data)
|
loddyCtr1:RequestPlayBack(_data, function(code, data)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if code == 0 then
|
if code == 0 then
|
||||||
if DataManager.SelfUser.playback[playback_id] ~= nil 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._currentId = playback_id
|
||||||
main._currentRound = i
|
main._currentRound = i
|
||||||
main._totalRound = #item_score
|
main._totalRound = #item_score
|
||||||
--print(main)
|
---- print(main)
|
||||||
main:FillRoomData(data)
|
main:FillRoomData(data)
|
||||||
elseif code == 25 then
|
elseif code == 25 then
|
||||||
ViewUtil.ErrorTip(code, "回放未找到!")
|
ViewUtil.ErrorTip(code, "回放未找到!")
|
||||||
btn_play_back.grayed = true
|
btn_play_back.grayed = true
|
||||||
end
|
end
|
||||||
end, record_item.GameInfo)
|
end, record_item.GameInfo)
|
||||||
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GenaratePlayBack(id, game_id, ...)
|
function M:GenaratePlayBack(id, game_id, ...)
|
||||||
local tem =nil
|
local tem = nil
|
||||||
local dview_class = nil
|
local dview_class = nil
|
||||||
if not dview_class then
|
if not dview_class then
|
||||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||||
dview_class = exconfig:GetView(id)
|
dview_class = exconfig:GetView(id)
|
||||||
--print(dview_class)
|
---- print(dview_class)
|
||||||
end
|
end
|
||||||
if not dview_class then
|
if not dview_class then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
tem = dview_class.new(...)
|
tem = dview_class.new(...)
|
||||||
tem.Id = id
|
tem.Id = id
|
||||||
tem:Show()
|
tem:Show()
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ local UserEditView = {}
|
||||||
local M = UserEditView
|
local M = UserEditView
|
||||||
|
|
||||||
function UserEditView.new(callback)
|
function UserEditView.new(callback)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "UserEditView"
|
self.class = "UserEditView"
|
||||||
self._callback = callback
|
self._callback = callback
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
|
|
@ -18,7 +18,7 @@ function UserEditView.new(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
|
|
||||||
local btn_head = self._view:GetChild("btn_head")
|
local btn_head = self._view:GetChild("btn_head")
|
||||||
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||||
|
|
@ -42,7 +42,7 @@ function M:init(url)
|
||||||
btn_edit_portrait.onClick:Set(function()
|
btn_edit_portrait.onClick:Set(function()
|
||||||
-- local edit_portrait_view = EditPortraitView.new(function()
|
-- local edit_portrait_view = EditPortraitView.new(function()
|
||||||
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||||
-- --print(DataManager.SelfUser.head_url)
|
-- ---- print(DataManager.SelfUser.head_url)
|
||||||
-- self._callback()
|
-- self._callback()
|
||||||
-- end)
|
-- end)
|
||||||
-- edit_portrait_view:Show()
|
-- edit_portrait_view:Show()
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ LobbyView = {}
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function LobbyView.new()
|
function LobbyView.new()
|
||||||
-- print("new lobbyView!!!!")
|
-- -- print("new lobbyView!!!!")
|
||||||
setmetatable(M, { __index = BaseView })
|
setmetatable(M, { __index = BaseView })
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "LobbyView"
|
self.class = "LobbyView"
|
||||||
|
|
@ -38,7 +38,7 @@ function LobbyView.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitView(url)
|
function M:InitView(url)
|
||||||
-- print("init lobbyView!!!!")
|
-- -- print("init lobbyView!!!!")
|
||||||
BaseView.InitView(self, url)
|
BaseView.InitView(self, url)
|
||||||
self._full_offset = false
|
self._full_offset = false
|
||||||
local view = self._view
|
local view = self._view
|
||||||
|
|
@ -338,7 +338,7 @@ function M:__show_service()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__GetMessage(data)
|
function M:__GetMessage(data)
|
||||||
-- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
-- -- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
||||||
if not data or not data.notice_list then
|
if not data or not data.notice_list then
|
||||||
self._mesList = ""
|
self._mesList = ""
|
||||||
else
|
else
|
||||||
|
|
@ -364,7 +364,7 @@ function M:__PopMsg(index)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__moveMsg(index)
|
function M:__moveMsg(index)
|
||||||
-- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
-- -- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
if not self._tex_message then return end
|
if not self._tex_message then return end
|
||||||
index, self._tex_message.text = self:__PopMsg(index)
|
index, self._tex_message.text = self:__PopMsg(index)
|
||||||
self._tex_message.x = self._message.width
|
self._tex_message.x = self._message.width
|
||||||
|
|
@ -392,8 +392,8 @@ end
|
||||||
function M:__ShowShare()
|
function M:__ShowShare()
|
||||||
local pop_share = self._view:GetChild("pop_share")
|
local pop_share = self._view:GetChild("pop_share")
|
||||||
local shareUrl = GetGameInfo("invite_link") .. "?uid=" .. DataManager.SelfUser.account_id
|
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")
|
local btn_wx_session = pop_share:GetChild("btn_wx_session")
|
||||||
btn_wx_session.onClick:Add(function()
|
btn_wx_session.onClick:Add(function()
|
||||||
shareQRCodePicture(shareUrl, 0)
|
shareQRCodePicture(shareUrl, 0)
|
||||||
|
|
@ -437,7 +437,7 @@ function M:Destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Show()
|
function M:Show()
|
||||||
--print("on lobbyView show~~~~~~")
|
---- print("on lobbyView show~~~~~~")
|
||||||
BaseView.Show(self)
|
BaseView.Show(self)
|
||||||
ViewUtil.PlaySoundBg()
|
ViewUtil.PlaySoundBg()
|
||||||
UpdateBeat:Add(self.OnUpdate, self)
|
UpdateBeat:Add(self.OnUpdate, self)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ function M:init()
|
||||||
|
|
||||||
local view = self._view
|
local view = self._view
|
||||||
-- view:GetChild("tex_version").text = "Version:" .. GetGameInfoPlatform("version")
|
-- 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
|
view:GetController("test").selectedIndex = GameApplication.Instance.accountTest and 1 or 0
|
||||||
self.agree = view:GetController("agree");
|
self.agree = view:GetController("agree");
|
||||||
-- Utils.LoadBg("loginbg", view)
|
-- Utils.LoadBg("loginbg", view)
|
||||||
|
|
@ -70,7 +70,7 @@ function M:init()
|
||||||
Utils.SaveLocalFile(key, json.encode(_data))
|
Utils.SaveLocalFile(key, json.encode(_data))
|
||||||
end)
|
end)
|
||||||
if not s then
|
if not s then
|
||||||
print("Error:" .. e)
|
-- print("Error:" .. e)
|
||||||
end
|
end
|
||||||
|
|
||||||
DataManager.SelfUser.acc = utez
|
DataManager.SelfUser.acc = utez
|
||||||
|
|
@ -218,7 +218,7 @@ end
|
||||||
function M:QuickLogin()
|
function M:QuickLogin()
|
||||||
if (not GameApplication.Instance.accountTest) then
|
if (not GameApplication.Instance.accountTest) then
|
||||||
local session_id = PlayerPrefs.GetString("session_id")
|
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
|
if session_id and string.len(session_id) > 3 then
|
||||||
ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...")
|
ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...")
|
||||||
local loginCtr = ControllerManager.GetController(LoginController)
|
local loginCtr = ControllerManager.GetController(LoginController)
|
||||||
|
|
@ -231,8 +231,8 @@ end
|
||||||
|
|
||||||
function M:LoginCallBack(result, data)
|
function M:LoginCallBack(result, data)
|
||||||
self.isWXCallBackMark = true
|
self.isWXCallBackMark = true
|
||||||
--print("微信登录返回================================================================")
|
---- print("微信登录返回================================================================")
|
||||||
--print("result===>"..result)
|
---- print("result===>"..result)
|
||||||
--pt(data)
|
--pt(data)
|
||||||
if (not result) or result ~= 0 then
|
if (not result) or result ~= 0 then
|
||||||
if result == 10 then
|
if result == 10 then
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ function M:SetTuoGuanState()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitView(url, isHideIpAdds)
|
function M:InitView(url, isHideIpAdds)
|
||||||
--print("url===>>>")
|
---- print("url===>>>")
|
||||||
--print(url)
|
---- print(url)
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
BaseView.InitView(self, url)
|
BaseView.InitView(self, url)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
@ -668,7 +668,7 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.TupGuanOpen,
|
GameEvent.TupGuanOpen,
|
||||||
function(...)
|
function(...)
|
||||||
--print("刷新托管数据=====")
|
---- print("刷新托管数据=====")
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
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
|
if p.isSendCardState ~= nil and p.isSendCardState == true then
|
||||||
p.isSendCardState = false
|
p.isSendCardState = false
|
||||||
ControllerManager.IsSendCard = false
|
ControllerManager.IsSendCard = false
|
||||||
--print("进入设置计时器控制==========")
|
---- print("进入设置计时器控制==========")
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
--print("计时器倒计时5s=============")
|
---- print("计时器倒计时5s=============")
|
||||||
coroutine.wait(5)
|
coroutine.wait(5)
|
||||||
--print("当前状态==============")
|
---- print("当前状态==============")
|
||||||
--print(ControllerManager.IsSendCard)
|
---- print(ControllerManager.IsSendCard)
|
||||||
if ControllerManager.IsSendCard == true then
|
if ControllerManager.IsSendCard == true then
|
||||||
--print("以发送开牌======================")
|
---- print("以发送开牌======================")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
--print("开始断线重连")
|
---- print("开始断线重连")
|
||||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||||
ViewManager.refreshGameView()
|
ViewManager.refreshGameView()
|
||||||
end
|
end
|
||||||
|
|
@ -1097,7 +1097,7 @@ end
|
||||||
|
|
||||||
--游戏激活
|
--游戏激活
|
||||||
function M:OnApplicationActive()
|
function M:OnApplicationActive()
|
||||||
--print("游戏激活================")
|
---- print("游戏激活================")
|
||||||
if os.time() - last_pause_time > 15 then
|
if os.time() - last_pause_time > 15 then
|
||||||
last_pause_time = os.time()
|
last_pause_time = os.time()
|
||||||
ControllerManager.WebClient:clearActionQueue()
|
ControllerManager.WebClient:clearActionQueue()
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@ GroupNumberInputView_Game = import(".MngView.GroupNumberInputView")
|
||||||
local GroupInfoView = {}
|
local GroupInfoView = {}
|
||||||
local M = GroupInfoView
|
local M = GroupInfoView
|
||||||
|
|
||||||
local currentSelectPlay=0
|
local currentSelectPlay = 0
|
||||||
|
|
||||||
function GroupInfoView.new(curGroup, fg_info)
|
function GroupInfoView.new(curGroup, fg_info)
|
||||||
setmetatable(M, {__index = BaseView})
|
setmetatable(M, { __index = BaseView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = 'GroupInfoView'
|
self.class = 'GroupInfoView'
|
||||||
self.curGroup = curGroup
|
self.curGroup = curGroup
|
||||||
curGroup.layer = 0
|
curGroup.layer = 0
|
||||||
|
|
@ -35,7 +35,7 @@ function GroupInfoView.new(curGroup, fg_info)
|
||||||
self.lstgameVisible = false
|
self.lstgameVisible = false
|
||||||
self.isShowRoomItem = (self.curGroup.lev == 1 or self.curGroup.lev == 2)
|
self.isShowRoomItem = (self.curGroup.lev == 1 or self.curGroup.lev == 2)
|
||||||
DataManager.SelfUser.cur_group = self
|
DataManager.SelfUser.cur_group = self
|
||||||
self.FillGameItemList={}
|
self.FillGameItemList = {}
|
||||||
self:InitView('ui://NewGroup/Main_GroupInfo')
|
self:InitView('ui://NewGroup/Main_GroupInfo')
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
@ -110,7 +110,7 @@ local function RoomWeight1(room)
|
||||||
elseif #room.plist == 0 then
|
elseif #room.plist == 0 then
|
||||||
weight = weight + 0
|
weight = weight + 0
|
||||||
elseif room.maxPlayers > #room.plist then
|
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
|
elseif room.maxPlayers == #room.plist then
|
||||||
weight = weight + 1
|
weight = weight + 1
|
||||||
end
|
end
|
||||||
|
|
@ -124,13 +124,13 @@ end
|
||||||
-- 房间排序
|
-- 房间排序
|
||||||
local function SortRooms(a, b)
|
local function SortRooms(a, b)
|
||||||
-- printlog("SortRooms====》》》》",currentSelectPlay)
|
-- printlog("SortRooms====》》》》",currentSelectPlay)
|
||||||
if currentSelectPlay==0 then
|
if currentSelectPlay == 0 then
|
||||||
local rwa = RoomWeight(a)
|
local rwa = RoomWeight(a)
|
||||||
local rwb = RoomWeight(b)
|
local rwb = RoomWeight(b)
|
||||||
if rwa ~= rwb then
|
if rwa ~= rwb then
|
||||||
return rwa > rwb
|
return rwa > rwb
|
||||||
else
|
else
|
||||||
return a.pid<b.pid
|
return a.pid < b.pid
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local rwa = RoomWeight1(a)
|
local rwa = RoomWeight1(a)
|
||||||
|
|
@ -138,7 +138,7 @@ local function SortRooms(a, b)
|
||||||
if rwa ~= rwb then
|
if rwa ~= rwb then
|
||||||
return rwa < rwb
|
return rwa < rwb
|
||||||
else
|
else
|
||||||
return a.pid<b.pid
|
return a.pid < b.pid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -165,7 +165,7 @@ local function __fillRoomItem(self, index, item, room)
|
||||||
local room_item = self.roomItems[item]
|
local room_item = self.roomItems[item]
|
||||||
local play = self.curGroup:getPlay(room.pid)
|
local play = self.curGroup:getPlay(room.pid)
|
||||||
if not room_item then
|
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
|
self.roomItems[item] = room_item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -180,16 +180,16 @@ local function __fillRoomItem(self, index, item, room)
|
||||||
|
|
||||||
local str = ""
|
local str = ""
|
||||||
if room.limitInRoom then
|
if room.limitInRoom then
|
||||||
str = str..room.limitInRoom/1000
|
str = str .. room.limitInRoom / 1000
|
||||||
end
|
end
|
||||||
|
|
||||||
if room.round==nil then
|
if room.round == nil then
|
||||||
room.round=0
|
room.round = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--printlog("wwwwwwwwwww1111111111111111 ",room.round," ",room.times)
|
--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)
|
local name = __getLayerName(self, room.pid)
|
||||||
room_item.tex_gamename.text = name
|
room_item.tex_gamename.text = name
|
||||||
room_item.tex_limit.text = str
|
room_item.tex_limit.text = str
|
||||||
|
|
@ -230,15 +230,14 @@ local function __fillRoomItem(self, index, item, room)
|
||||||
local p = plist[i]
|
local p = plist[i]
|
||||||
if isHidden == 0 then
|
if isHidden == 0 then
|
||||||
p_head.tex_name.text = ViewUtil.stringEllipsis(p.nick)
|
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)
|
ImageLoad.Load(p.portrait, btn_head._iconObject, self.class)
|
||||||
|
|
||||||
if p.hp then
|
if p.hp then
|
||||||
local str1="积分:"
|
local str1 = "积分:"
|
||||||
local hp=p.hp/1000
|
local hp = p.hp / 1000
|
||||||
p_head.text_score.text=str1..hp
|
p_head.text_score.text = str1 .. hp
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
p_head.tex_name.text = "智能"
|
p_head.tex_name.text = "智能"
|
||||||
p_head.tex_id.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 self.curGroup.lev == 3 then
|
||||||
-- 房间点击:假房间 匹配,真房间 加入
|
-- 房间点击:假房间 匹配,真房间 加入
|
||||||
if room.default or isHidden == 1 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
|
else
|
||||||
self:__joinRoom(roomid)
|
self:__joinRoom(roomid)
|
||||||
end
|
end
|
||||||
|
|
@ -291,7 +290,7 @@ local function __fillRoomItem(self, index, item, room)
|
||||||
function()
|
function()
|
||||||
riv:Dispose()
|
riv:Dispose()
|
||||||
if room.default or isHidden == 1 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
|
else
|
||||||
self:__joinRoom(roomid)
|
self:__joinRoom(roomid)
|
||||||
end
|
end
|
||||||
|
|
@ -345,7 +344,6 @@ local function __fillRoomItem(self, index, item, room)
|
||||||
self.fg_info[key] = room.pid
|
self.fg_info[key] = room.pid
|
||||||
local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
local filename = 'fginfo_' .. DataManager.SelfUser.account_id
|
||||||
Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
Utils.SaveLocalFile(filename, json.encode(self.fg_info))
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -376,7 +374,7 @@ local function __fillRoomData(self)
|
||||||
-- 单个玩法
|
-- 单个玩法
|
||||||
local rooms = self.curGroup:getPlay(currentPlayID).rooms
|
local rooms = self.curGroup:getPlay(currentPlayID).rooms
|
||||||
local trooms = {}
|
local trooms = {}
|
||||||
for i=1,#rooms do
|
for i = 1, #rooms do
|
||||||
local room = rooms[i]
|
local room = rooms[i]
|
||||||
local play = self.curGroup:getPlay(room.pid)
|
local play = self.curGroup:getPlay(room.pid)
|
||||||
local isvip = 0
|
local isvip = 0
|
||||||
|
|
@ -406,16 +404,13 @@ local function __fillRoomData(self)
|
||||||
if isvip == self._showVipRooms then
|
if isvip == self._showVipRooms then
|
||||||
if isHidden == 1 then
|
if isHidden == 1 then
|
||||||
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
||||||
table.insert( trooms,room )
|
table.insert(trooms, room)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert( trooms,room )
|
table.insert(trooms, room)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self.curRooms = membe_clone(trooms)
|
self.curRooms = membe_clone(trooms)
|
||||||
|
|
||||||
|
|
@ -435,28 +430,26 @@ local function __fillRoomData(self)
|
||||||
|
|
||||||
------
|
------
|
||||||
if isvip == self._showVipRooms then
|
if isvip == self._showVipRooms then
|
||||||
local hp=json.decode(play.hpData)
|
local hp = json.decode(play.hpData)
|
||||||
if hp and hp.maxRound then
|
if hp and hp.maxRound then
|
||||||
room.times=hp.maxRound
|
room.times = hp.maxRound
|
||||||
end
|
end
|
||||||
|
|
||||||
if hp and hp.limitInRoom then
|
if hp and hp.limitInRoom then
|
||||||
room.limitInRoom=hp.limitInRoom
|
room.limitInRoom = hp.limitInRoom
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
table.insert( self.curRooms,room )
|
table.insert(self.curRooms, room)
|
||||||
|
|
||||||
end
|
end
|
||||||
-----
|
-----
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
if currentGameID == 0 then
|
if currentGameID == 0 then
|
||||||
--printlog("aaaaaaaaaaaaaaaaa222222222222222222222222222")
|
--printlog("aaaaaaaaaaaaaaaaa222222222222222222222222222")
|
||||||
local rooms = curGroup.rooms
|
local rooms = curGroup.rooms
|
||||||
local trooms = {}
|
local trooms = {}
|
||||||
for i=1,#rooms do
|
for i = 1, #rooms do
|
||||||
local room = rooms[i]
|
local room = rooms[i]
|
||||||
local play = self.curGroup:getPlay(room.pid)
|
local play = self.curGroup:getPlay(room.pid)
|
||||||
local isvip = 0
|
local isvip = 0
|
||||||
|
|
@ -485,15 +478,13 @@ local function __fillRoomData(self)
|
||||||
if isvip == self._showVipRooms then
|
if isvip == self._showVipRooms then
|
||||||
if play.isHidden == 1 then
|
if play.isHidden == 1 then
|
||||||
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
if #room.plist == room.maxPlayers or self.curGroup.lev < 3 then
|
||||||
table.insert( trooms,room )
|
table.insert(trooms, room)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert( trooms,room )
|
table.insert(trooms, room)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self.curRooms = membe_clone(trooms)
|
self.curRooms = membe_clone(trooms)
|
||||||
|
|
||||||
|
|
@ -514,20 +505,19 @@ local function __fillRoomData(self)
|
||||||
play.isvip = isvip
|
play.isvip = isvip
|
||||||
end
|
end
|
||||||
if isvip == self._showVipRooms then
|
if isvip == self._showVipRooms then
|
||||||
local hp=json.decode(self.curGroup.playList[i].hpData)
|
local hp = json.decode(self.curGroup.playList[i].hpData)
|
||||||
defaultRoom.limitInRoom=hp.limitInRoom
|
defaultRoom.limitInRoom = hp.limitInRoom
|
||||||
if hp.maxRound then
|
if hp.maxRound then
|
||||||
defaultRoom.times=hp.maxRound
|
defaultRoom.times = hp.maxRound
|
||||||
end
|
end
|
||||||
local totalNum=1
|
local totalNum = 1
|
||||||
if hp.tex_times_room then
|
if hp.tex_times_room then
|
||||||
totalNum=hp.tex_times_room/1000
|
totalNum = hp.tex_times_room / 1000
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,totalNum do
|
for i = 1, totalNum do
|
||||||
self.curRooms[#self.curRooms + 1] = defaultRoom
|
self.curRooms[#self.curRooms + 1] = defaultRoom
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -571,42 +561,40 @@ local function __fillRoomData(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local hp=json.decode(p_data.hpData)
|
local hp = json.decode(p_data.hpData)
|
||||||
if hp and hp.maxRound then
|
if hp and hp.maxRound then
|
||||||
self.curGroup.default_rooms[i].times=hp.maxRound
|
self.curGroup.default_rooms[i].times = hp.maxRound
|
||||||
end
|
end
|
||||||
|
|
||||||
if hp and hp.limitInRoom then
|
if hp and hp.limitInRoom then
|
||||||
self.curGroup.default_rooms[i].limitInRoom=hp.limitInRoom
|
self.curGroup.default_rooms[i].limitInRoom = hp.limitInRoom
|
||||||
end
|
end
|
||||||
|
|
||||||
local totalNum=1
|
local totalNum = 1
|
||||||
if hp and hp.tex_times_room then
|
if hp and hp.tex_times_room then
|
||||||
totalNum=hp.tex_times_room/1000
|
totalNum = hp.tex_times_room / 1000
|
||||||
end
|
end
|
||||||
for j=1,totalNum do
|
for j = 1, totalNum do
|
||||||
self.curRooms[#self.curRooms + 1] = self.curGroup.default_rooms[i]
|
self.curRooms[#self.curRooms + 1] = self.curGroup.default_rooms[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
currentSelectPlay=self:GetSelectedPlayID()
|
currentSelectPlay = self:GetSelectedPlayID()
|
||||||
table.sort(self.curRooms,SortRooms )
|
table.sort(self.curRooms, SortRooms)
|
||||||
list_offline = {}
|
list_offline = {}
|
||||||
|
|
||||||
if self.curGroup.lev < 3 then
|
if self.curGroup.lev < 3 then
|
||||||
self.lst_room.numItems = #self.curRooms
|
self.lst_room.numItems = #self.curRooms
|
||||||
else
|
else
|
||||||
if self.curGroup.show_num > 0 and #self.curRooms > self.curGroup.show_num then
|
if self.curGroup.show_num > 0 and #self.curRooms > self.curGroup.show_num then
|
||||||
|
|
||||||
local tr = {}
|
local tr = {}
|
||||||
|
|
||||||
for j = 1, #self.curRooms do
|
for j = 1, #self.curRooms do
|
||||||
if #tr < self.curGroup.show_num or self.curRooms[j].default == true then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -650,7 +638,7 @@ end
|
||||||
function M:InitRoomInfoView()
|
function M:InitRoomInfoView()
|
||||||
local room = self.roominfo.room
|
local room = self.roominfo.room
|
||||||
if not room.default then
|
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)
|
self.roominfo.view:GetChild('tex_round').text = string.format('(%s/%s)', room.round, room.times)
|
||||||
local lst_player = self.roominfo.view:GetChild('lst_player')
|
local lst_player = self.roominfo.view:GetChild('lst_player')
|
||||||
lst_player:RemoveChildrenToPool()
|
lst_player:RemoveChildrenToPool()
|
||||||
|
|
@ -694,7 +682,6 @@ local function __fillPlayItem(self, index, item)
|
||||||
if (index == 0) then
|
if (index == 0) then
|
||||||
tex_game.text = __getLayerName(self, 0)
|
tex_game.text = __getLayerName(self, 0)
|
||||||
else
|
else
|
||||||
|
|
||||||
pipeijoin.onClick:Add(
|
pipeijoin.onClick:Add(
|
||||||
function()
|
function()
|
||||||
local currentPlayID = self:GetSelectedPlayID()
|
local currentPlayID = self:GetSelectedPlayID()
|
||||||
|
|
@ -717,7 +704,7 @@ local function __fillPlayItem(self, index, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:__startGame("",currentPlayID, false)
|
self:__startGame("", currentPlayID, false)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
tex_game.text = __getLayerName(self, self.playIdList[index])
|
tex_game.text = __getLayerName(self, self.playIdList[index])
|
||||||
|
|
@ -726,7 +713,6 @@ end
|
||||||
|
|
||||||
local _iconMap = {}
|
local _iconMap = {}
|
||||||
local function __fillExtendIcon(id, callback)
|
local function __fillExtendIcon(id, callback)
|
||||||
|
|
||||||
local File = System.IO.File
|
local File = System.IO.File
|
||||||
local path = Application.persistentDataPath .. '/UserData/Icon'
|
local path = Application.persistentDataPath .. '/UserData/Icon'
|
||||||
if not System.IO.Directory.Exists(path) then
|
if not System.IO.Directory.Exists(path) then
|
||||||
|
|
@ -760,7 +746,7 @@ local function __fillExtendIcon(id, callback)
|
||||||
local texture = UnityEngine.Texture2D(128, 128)
|
local texture = UnityEngine.Texture2D(128, 128)
|
||||||
texture:LoadImage(bytes)
|
texture:LoadImage(bytes)
|
||||||
local ntexture = FairyGUI.NTexture(texture)
|
local ntexture = FairyGUI.NTexture(texture)
|
||||||
_iconMap[id] = {texture = texture, ntexture = ntexture}
|
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
||||||
callback(ntexture)
|
callback(ntexture)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -771,17 +757,17 @@ local function __fillExtendIcon(id, callback)
|
||||||
local texture = UnityEngine.Texture2D(128, 128)
|
local texture = UnityEngine.Texture2D(128, 128)
|
||||||
texture:LoadImage(bytes)
|
texture:LoadImage(bytes)
|
||||||
local ntexture = FairyGUI.NTexture(texture)
|
local ntexture = FairyGUI.NTexture(texture)
|
||||||
_iconMap[id] = {texture = texture, ntexture = ntexture}
|
_iconMap[id] = { texture = texture, ntexture = ntexture }
|
||||||
callback(ntexture)
|
callback(ntexture)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetGameName(index)
|
local function GetGameName(index)
|
||||||
if index==0 then return "全 部" end
|
if index == 0 then return "全 部" end
|
||||||
local list = DataManager.SelfUser.games
|
local list = DataManager.SelfUser.games
|
||||||
for k,v in ipairs(list) do
|
for k, v in ipairs(list) do
|
||||||
if v.game_id==index then
|
if v.game_id == index then
|
||||||
return v.name
|
return v.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -791,41 +777,40 @@ end
|
||||||
|
|
||||||
-- 玩法名字显示
|
-- 玩法名字显示
|
||||||
local function __fillGameItem(self, index, item)
|
local function __fillGameItem(self, index, item)
|
||||||
local gameName=""
|
local gameName = ""
|
||||||
if (index == 0) then
|
if (index == 0) then
|
||||||
item.icon = 'ui://NewGroup/quyxtb'
|
item.icon = 'ui://NewGroup/quyxtb'
|
||||||
gameName=GetGameName(0)
|
gameName = GetGameName(0)
|
||||||
item:GetChild("n11").text=gameName
|
item:GetChild("n11").text = gameName
|
||||||
if self.currentGameItemName==nil then
|
if self.currentGameItemName == nil then
|
||||||
item.icon = 'ui://NewGroup/quyxtb-1'
|
item.icon = 'ui://NewGroup/quyxtb-1'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local gameId = self.gameIdList[index]
|
local gameId = self.gameIdList[index]
|
||||||
local config = ExtendManager.GetExtendConfig(gameId)
|
local config = ExtendManager.GetExtendConfig(gameId)
|
||||||
local mode = config:GetGameInfo()
|
local mode = config:GetGameInfo()
|
||||||
local iconName=mode:GetIconUrl1()
|
local iconName = mode:GetIconUrl1()
|
||||||
item.icon = iconName
|
item.icon = iconName
|
||||||
gameName=GetGameName(gameId)
|
gameName = GetGameName(gameId)
|
||||||
item:GetChild("n11").text=gameName
|
item:GetChild("n11").text = gameName
|
||||||
end
|
end
|
||||||
|
|
||||||
if item.icon==self.currentGameItemName then
|
if item.icon == self.currentGameItemName then
|
||||||
item.icon=self.currentGameItemName.."-1"
|
item.icon = self.currentGameItemName .. "-1"
|
||||||
item:GetChild("n11").text=gameName
|
item:GetChild("n11").text = gameName
|
||||||
end
|
end
|
||||||
item:GetChild("n22").text=index+1
|
item:GetChild("n22").text = index + 1
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function __analysePlayListData(self)
|
local function __analysePlayListData(self)
|
||||||
self.playIdList = {}
|
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)
|
local json_data = Utils.LoadLocalFile(playName)
|
||||||
if json_data then
|
if json_data then
|
||||||
local data = json.decode(json_data)
|
local data = json.decode(json_data)
|
||||||
DataManager.SelfUser.PlayLocalList=data
|
DataManager.SelfUser.PlayLocalList = data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -846,7 +831,7 @@ local function __analysePlayListData(self)
|
||||||
end
|
end
|
||||||
p_data.isvip = isvip
|
p_data.isvip = isvip
|
||||||
|
|
||||||
local isHasPlayC=true
|
local isHasPlayC = true
|
||||||
--[[for k,v in pairs(DataManager.SelfUser.PlayLocalList) do
|
--[[for k,v in pairs(DataManager.SelfUser.PlayLocalList) do
|
||||||
if tonumber(k)==p_data.id then
|
if tonumber(k)==p_data.id then
|
||||||
isHasPlayC=v
|
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
|
self._view:GetChild('tex_name').text = self.curGroup.name
|
||||||
|
|
||||||
|
|
@ -1024,9 +1009,9 @@ function M:InitView(url)
|
||||||
self.lst_game.onClickItem:Add(
|
self.lst_game.onClickItem:Add(
|
||||||
function(pas)
|
function(pas)
|
||||||
if self.currentSelectItem == pas.data then return end
|
if self.currentSelectItem == pas.data then return end
|
||||||
local name=pas.data.icon
|
local name = pas.data.icon
|
||||||
self.currentSelectItem = pas.data
|
self.currentSelectItem = pas.data
|
||||||
self.currentGameItemName=name
|
self.currentGameItemName = name
|
||||||
self.lst_layer.selectedIndex = 0
|
self.lst_layer.selectedIndex = 0
|
||||||
self:__refreshPay()
|
self:__refreshPay()
|
||||||
__analyseGameListData(self)
|
__analyseGameListData(self)
|
||||||
|
|
@ -1060,8 +1045,8 @@ function M:InitView(url)
|
||||||
|
|
||||||
local btn_quanbu = self._view:GetChild('btn_quanbu')
|
local btn_quanbu = self._view:GetChild('btn_quanbu')
|
||||||
btn_quanbu.onClick:Set(
|
btn_quanbu.onClick:Set(
|
||||||
function ()
|
function()
|
||||||
self.lst_layer.selectedIndex=0
|
self.lst_layer.selectedIndex = 0
|
||||||
self:__loadPlayData()
|
self:__loadPlayData()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -1097,7 +1082,7 @@ function M:InitView(url)
|
||||||
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
ViewUtil.ErrorTip(nil, '没有选择玩法')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:__startGame("",pid, false)
|
self:__startGame("", pid, false)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1105,7 +1090,6 @@ function M:InitView(url)
|
||||||
local btn_start2 = self._view:GetChild('btn_start2')
|
local btn_start2 = self._view:GetChild('btn_start2')
|
||||||
btn_start2.onClick:Set(
|
btn_start2.onClick:Set(
|
||||||
function()
|
function()
|
||||||
|
|
||||||
local currentPlayID = self:GetSelectedPlayID()
|
local currentPlayID = self:GetSelectedPlayID()
|
||||||
if currentPlayID == 0 then
|
if currentPlayID == 0 then
|
||||||
if self.lst_layer.selectedIndex == 0 and self.lst_game.selectedIndex > 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
|
||||||
end
|
end
|
||||||
|
|
||||||
self:__startGame("",currentPlayID, false)
|
self:__startGame("", currentPlayID, false)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
-- 选择玩法按钮
|
-- 选择玩法按钮
|
||||||
local btn_choose = self._view:GetChild('btn_choose')
|
local btn_choose = self._view:GetChild('btn_choose')
|
||||||
btn_choose.onClick:Set(
|
btn_choose.onClick:Set(
|
||||||
function ()
|
function()
|
||||||
self.lstgameVisible = not self.lstgameVisible
|
self.lstgameVisible = not self.lstgameVisible
|
||||||
if (self.lstgameVisible) then
|
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
|
else
|
||||||
self.lst_game:TweenMove(Vector2.New(3,760), 0.3)
|
self.lst_game:TweenMove(Vector2.New(3, 760), 0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
-- function()
|
-- function()
|
||||||
-- local sgv =
|
-- local sgv =
|
||||||
|
|
@ -1229,7 +1212,7 @@ function M:InitView(url)
|
||||||
self:__loadGroupData()
|
self:__loadGroupData()
|
||||||
self:__refreshManager()
|
self:__refreshManager()
|
||||||
UpdateBeat:Add(self.__onUpdate, self)
|
UpdateBeat:Add(self.__onUpdate, self)
|
||||||
self._view.visible=false
|
self._view.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__saveLastData()
|
function M:__saveLastData()
|
||||||
|
|
@ -1251,7 +1234,7 @@ function M:__loadLastData()
|
||||||
table.insert(self.gameIdList, t.gameId)
|
table.insert(self.gameIdList, t.gameId)
|
||||||
end
|
end
|
||||||
table.insert(self.playIdList, t.id)
|
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)
|
table.insert(self.curRooms, room)
|
||||||
self.playNames[t.id] = t.name
|
self.playNames[t.id] = t.name
|
||||||
end
|
end
|
||||||
|
|
@ -1272,13 +1255,13 @@ function M:__onUpdate()
|
||||||
if self._pipeiTime and self._pipeiTime > 0 then
|
if self._pipeiTime and self._pipeiTime > 0 then
|
||||||
local deltaTime = Time.deltaTime
|
local deltaTime = Time.deltaTime
|
||||||
self._pipeiTime = self._pipeiTime - 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
|
if self._pipeiTime == 0 then
|
||||||
self._view:GetChild('node_matching'):GetChild('text_time').text = "当前排位时间较长,请耐心等待..."
|
self._view:GetChild('node_matching'):GetChild('text_time').text = "当前排位时间较长,请耐心等待..."
|
||||||
self._view:GetChild('node_matching'):GetController('quxiao').selectedIndex = 1
|
self._view:GetChild('node_matching'):GetController('quxiao').selectedIndex = 1
|
||||||
else
|
else
|
||||||
local time = math.floor(self._pipeiTime)
|
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
|
||||||
end
|
end
|
||||||
if self.__join_room then
|
if self.__join_room then
|
||||||
|
|
@ -1405,7 +1388,7 @@ function M:__joinRoom(room_id)
|
||||||
)
|
)
|
||||||
end
|
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
|
if isHidden == nil then
|
||||||
isHidden = 0
|
isHidden = 0
|
||||||
local play = self.curGroup:getPlay(pid)
|
local play = self.curGroup:getPlay(pid)
|
||||||
|
|
@ -1567,13 +1550,15 @@ function M:_evtUpdateMsg()
|
||||||
self:_setHongDian(true)
|
self:_setHongDian(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_setHongDian(isShow)
|
function M:_setHongDian(isShow)
|
||||||
--红点提示
|
--红点提示
|
||||||
local member_tips = self._view:GetChild('member_tips')
|
local member_tips = self._view:GetChild('member_tips')
|
||||||
member_tips.visible = isShow
|
member_tips.visible = isShow
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_evtInvited(...)
|
function M:_evtInvited(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local data = arg[1]
|
local data = arg[1]
|
||||||
local imv =
|
local imv =
|
||||||
FGInvitedMsgView.new(
|
FGInvitedMsgView.new(
|
||||||
|
|
@ -1589,7 +1574,6 @@ end
|
||||||
|
|
||||||
-- 更新牌友圈事件
|
-- 更新牌友圈事件
|
||||||
function M:_evtUpdateGroup(...)
|
function M:_evtUpdateGroup(...)
|
||||||
|
|
||||||
-- local btn_remit = self._view:GetChild('btn_remit')
|
-- local btn_remit = self._view:GetChild('btn_remit')
|
||||||
-- local option = self.curGroup.option or 0
|
-- local option = self.curGroup.option or 0
|
||||||
|
|
||||||
|
|
@ -1630,10 +1614,10 @@ function M:__refreshManager()
|
||||||
local btn_partner = self._view:GetChild('btn_partner')
|
local btn_partner = self._view:GetChild('btn_partner')
|
||||||
btn_partner.onClick:Set(
|
btn_partner.onClick:Set(
|
||||||
function()
|
function()
|
||||||
--print("成员..........................................")
|
---- print("成员..........................................")
|
||||||
if not self.mng_view3 then
|
if not self.mng_view3 then
|
||||||
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
||||||
self.mng_view3:SetCurrentGroupInfoViewIns(function ()
|
self.mng_view3:SetCurrentGroupInfoViewIns(function()
|
||||||
self:OnclickMember()
|
self:OnclickMember()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -1645,7 +1629,7 @@ function M:__refreshManager()
|
||||||
|
|
||||||
local btn_play = self._view:GetChild('btn_play')
|
local btn_play = self._view:GetChild('btn_play')
|
||||||
btn_play.onClick:Set(function()
|
btn_play.onClick:Set(function()
|
||||||
local gl_view =GroupMngGameListView.new(self.curGroup.id)
|
local gl_view = GroupMngGameListView.new(self.curGroup.id)
|
||||||
gl_view:Show()
|
gl_view:Show()
|
||||||
-- self:SetRoomListVisible(false)
|
-- self:SetRoomListVisible(false)
|
||||||
end)
|
end)
|
||||||
|
|
@ -1662,7 +1646,6 @@ function M:__refreshManager()
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:OnclickMember()
|
function M:OnclickMember()
|
||||||
if not self.mng_view3 then
|
if not self.mng_view3 then
|
||||||
self.mng_view3 = GroupManagerView.new(self._root_view, self.curGroup.id, 5)
|
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_room = false
|
||||||
curGroup.update_info = false
|
curGroup.update_info = false
|
||||||
curGroup.update_joins = false
|
curGroup.update_joins = false
|
||||||
ViewUtil.ShowModalWait(self._root_view,"正在进入牌友圈,请稍等...")
|
ViewUtil.ShowModalWait(self._root_view, "正在进入牌友圈,请稍等...")
|
||||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||||
fgCtr:FG_EnterGroup(
|
fgCtr:FG_EnterGroup(
|
||||||
curGroup.id,
|
curGroup.id,
|
||||||
|
|
@ -1733,7 +1716,7 @@ function M:__loadGroupData()
|
||||||
--self._view.visible=false
|
--self._view.visible=false
|
||||||
--ViewUtil.ErrorTip(res.ReturnCode, "获取圈子数据失败")
|
--ViewUtil.ErrorTip(res.ReturnCode, "获取圈子数据失败")
|
||||||
else
|
else
|
||||||
self._view.visible=true
|
self._view.visible = true
|
||||||
self:Show()
|
self:Show()
|
||||||
self:__saveLastData()
|
self:__saveLastData()
|
||||||
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
|
||||||
|
|
@ -1759,12 +1742,12 @@ function M:__loadGroupData()
|
||||||
|
|
||||||
local btn_vip = self._view:GetChild("btn_vip")
|
local btn_vip = self._view:GetChild("btn_vip")
|
||||||
if self.curGroup.isvip == 1 then
|
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
|
self._showVipRooms = vip
|
||||||
btn_vip:GetController("vip").selectedIndex = math.abs( self._showVipRooms - 1)
|
btn_vip:GetController("vip").selectedIndex = math.abs(self._showVipRooms - 1)
|
||||||
btn_vip.onClick:Set(function ()
|
btn_vip.onClick:Set(function()
|
||||||
btn_vip:GetController("vip").selectedIndex = self._showVipRooms
|
btn_vip:GetController("vip").selectedIndex = self._showVipRooms
|
||||||
self._showVipRooms = math.abs( self._showVipRooms - 1 )
|
self._showVipRooms = math.abs(self._showVipRooms - 1)
|
||||||
self:_evtUpdatePlay()
|
self:_evtUpdatePlay()
|
||||||
local key = tostring(self.curGroup.id) .. "vip"
|
local key = tostring(self.curGroup.id) .. "vip"
|
||||||
self.fg_info[key] = self._showVipRooms
|
self.fg_info[key] = self._showVipRooms
|
||||||
|
|
@ -1853,15 +1836,16 @@ function M:__loadGroupData()
|
||||||
local btn_bxx = self._view:GetChild('btn_bxx')
|
local btn_bxx = self._view:GetChild('btn_bxx')
|
||||||
btn_bxx.onClick:Set(
|
btn_bxx.onClick:Set(
|
||||||
function()
|
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
|
-- if self.curGroup.lev==3 and self.curGroup.partnerLev>0 or self.curGroup.lev==1 or self.curGroup.lev==2 then
|
||||||
-- ctrNum=2
|
-- ctrNum=2
|
||||||
-- end
|
-- end
|
||||||
if self.curGroup.lev==1 then
|
if self.curGroup.lev == 1 then
|
||||||
ctrNum=2
|
ctrNum = 2
|
||||||
end
|
end
|
||||||
ctrNum=2
|
ctrNum = 2
|
||||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,DataManager.SelfUser.account_id)
|
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum,
|
||||||
|
DataManager.SelfUser.account_id)
|
||||||
gmv:SetCallback(
|
gmv:SetCallback(
|
||||||
function()
|
function()
|
||||||
btn_bxx.selected = false
|
btn_bxx.selected = false
|
||||||
|
|
@ -1876,7 +1860,7 @@ function M:__loadGroupData()
|
||||||
end
|
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')
|
ViewUtil.ShowModalWait(self._root_view, '正在加入游戏...', 'join_room')
|
||||||
local _gameCtrl = ControllerManager.GetController(GameController)
|
local _gameCtrl = ControllerManager.GetController(GameController)
|
||||||
local _currentCtrl = ControllerManager.GetCurrenController()
|
local _currentCtrl = ControllerManager.GetCurrenController()
|
||||||
|
|
@ -1890,7 +1874,7 @@ function M:__startGame(roomid,pid, is_null,isHidden, callback)
|
||||||
isHidden,
|
isHidden,
|
||||||
function(code)
|
function(code)
|
||||||
if code == -2 then
|
if code == -2 then
|
||||||
self:__startGame(roomid,pid, is_null, isHidden, callback)
|
self:__startGame(roomid, pid, is_null, isHidden, callback)
|
||||||
elseif code ~= 0 then
|
elseif code ~= 0 then
|
||||||
ViewUtil.ErrorMsg(self._root_view, code, '进入房间失败')
|
ViewUtil.ErrorMsg(self._root_view, code, '进入房间失败')
|
||||||
ViewUtil.CloseModalWait('join_room')
|
ViewUtil.CloseModalWait('join_room')
|
||||||
|
|
@ -1980,15 +1964,16 @@ function M:showPipei(play)
|
||||||
end
|
end
|
||||||
self._pipeiTime = 20
|
self._pipeiTime = 20
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:hidePipei()
|
function M:hidePipei()
|
||||||
--print("hidePipei=============")
|
---- print("hidePipei=============")
|
||||||
--print(self._view)
|
---- print(self._view)
|
||||||
--print(self._view:GetController('pipei'))
|
---- print(self._view:GetController('pipei'))
|
||||||
if self._view:GetController('pipei') then
|
if self._view:GetController('pipei') then
|
||||||
self._view:GetController('pipei').selectedIndex = 0
|
self._view:GetController('pipei').selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetCallBack(callback)
|
function M:SetCallBack(callback)
|
||||||
self._callback = nil
|
self._callback = nil
|
||||||
self._callback = callback
|
self._callback = callback
|
||||||
|
|
@ -2055,4 +2040,3 @@ function M:Destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ local GroupMainView = {}
|
||||||
|
|
||||||
local M = GroupMainView
|
local M = GroupMainView
|
||||||
|
|
||||||
function GroupMainView.new(main_view, root_view,par_veiw)
|
function GroupMainView.new(main_view, root_view, par_veiw)
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = 'GroupMainView'
|
self.class = 'GroupMainView'
|
||||||
UIPackage.AddPackage('base/newgroup/ui/NewGroup')
|
UIPackage.AddPackage('base/newgroup/ui/NewGroup')
|
||||||
self._view = main_view
|
self._view = main_view
|
||||||
|
|
@ -21,7 +21,7 @@ function GroupMainView.new(main_view, root_view,par_veiw)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitView(url)
|
function M:InitView(url)
|
||||||
--print(url)
|
---- print(url)
|
||||||
-- BlurView(self._view:GetChild("bg"),true)
|
-- BlurView(self._view:GetChild("bg"),true)
|
||||||
if DataManager.SelfUser.agent > 0 then
|
if DataManager.SelfUser.agent > 0 then
|
||||||
self._view:GetController('agent').selectedIndex = 1
|
self._view:GetController('agent').selectedIndex = 1
|
||||||
|
|
@ -37,7 +37,7 @@ function M:InitView(url)
|
||||||
cgv:Show()
|
cgv:Show()
|
||||||
cgv:SetCallback(function(name, pay_type, fg_type)
|
cgv:SetCallback(function(name, pay_type, fg_type)
|
||||||
ViewUtil.ShowModalWait(cgv._root_view)
|
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()
|
ViewUtil.CloseModalWait()
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
|
|
@ -147,7 +147,6 @@ function M:DEnterGroup()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function SortGroups(a, b)
|
local function SortGroups(a, b)
|
||||||
local sort_a = 0
|
local sort_a = 0
|
||||||
local sort_b = 0
|
local sort_b = 0
|
||||||
|
|
@ -157,9 +156,9 @@ local function SortGroups(a, b)
|
||||||
return sort_a > sort_b
|
return sort_a > sort_b
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__fill_item(item,group)
|
function M:__fill_item(item, group)
|
||||||
item:GetChild('tex_name').text = group.name
|
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
|
local p_num = group.total_member_num
|
||||||
item:GetChild('tex_p_num').text = p_num > 99 and '99+' or p_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
|
end
|
||||||
else
|
else
|
||||||
if group.show_num > 0 and group.room_num > group.show_num then
|
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
|
else
|
||||||
item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num
|
item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num
|
||||||
end
|
end
|
||||||
|
|
@ -192,7 +191,7 @@ function M:FillData()
|
||||||
local new_info = {}
|
local new_info = {}
|
||||||
for i = 1, #groups do
|
for i = 1, #groups do
|
||||||
local key = tostring(groups[i].id)
|
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
|
if not fg_info[key] then
|
||||||
new_info[key] = 0
|
new_info[key] = 0
|
||||||
if not fg_info_changed then
|
if not fg_info_changed then
|
||||||
|
|
@ -220,7 +219,7 @@ function M:FillData()
|
||||||
else
|
else
|
||||||
self.btn_joingroup:GetController("info").selectedIndex = 1
|
self.btn_joingroup:GetController("info").selectedIndex = 1
|
||||||
ctr_empty_group.selectedIndex = 0
|
ctr_empty_group.selectedIndex = 0
|
||||||
self:__fill_item(self.btn_joingroup,groups[1])
|
self:__fill_item(self.btn_joingroup, groups[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
local lst_group = self._view:GetChild('lst_group')
|
local lst_group = self._view:GetChild('lst_group')
|
||||||
|
|
@ -230,7 +229,7 @@ function M:FillData()
|
||||||
|
|
||||||
local item = lst_group:AddItemFromPool()
|
local item = lst_group:AddItemFromPool()
|
||||||
item.data = group
|
item.data = group
|
||||||
self:__fill_item(item,group)
|
self:__fill_item(item, group)
|
||||||
|
|
||||||
local btn_top = item:GetChild('btn_top')
|
local btn_top = item:GetChild('btn_top')
|
||||||
local ctr_select = btn_top:GetController('select')
|
local ctr_select = btn_top:GetController('select')
|
||||||
|
|
@ -240,7 +239,7 @@ function M:FillData()
|
||||||
context:StopPropagation()
|
context:StopPropagation()
|
||||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||||
ViewUtil.ShowModalWait(self._root_view)
|
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()
|
ViewUtil.CloseModalWait()
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
|
|
@ -274,7 +273,7 @@ function M:EnterGroup(fg_id)
|
||||||
--self._view.visible = false
|
--self._view.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Show(fg_id,callback)
|
function M:Show(fg_id, callback)
|
||||||
local fgCtr1 = ControllerManager.GetController(NewGroupController)
|
local fgCtr1 = ControllerManager.GetController(NewGroupController)
|
||||||
fgCtr1:FG_GroupList(function(res)
|
fgCtr1:FG_GroupList(function(res)
|
||||||
if self._is_destroy then
|
if self._is_destroy then
|
||||||
|
|
@ -294,7 +293,6 @@ function M:Show(fg_id,callback)
|
||||||
callback(-1)
|
callback(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ local GroupManagerView = {}
|
||||||
local M = GroupManagerView
|
local M = GroupManagerView
|
||||||
|
|
||||||
function GroupManagerView.new(blur_view, gid, btn_type, callback)
|
function GroupManagerView.new(blur_view, gid, btn_type, callback)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "GroupManagerView"
|
self.class = "GroupManagerView"
|
||||||
-- self._close_destroy = true
|
-- self._close_destroy = true
|
||||||
self._put_map = false
|
self._put_map = false
|
||||||
|
|
@ -26,7 +26,7 @@ end
|
||||||
-- 获取界面配置
|
-- 获取界面配置
|
||||||
local function getPageConfig(id)
|
local function getPageConfig(id)
|
||||||
--pt(MngPageConfig.PageList)
|
--pt(MngPageConfig.PageList)
|
||||||
for i=1,#MngPageConfig.PageList do
|
for i = 1, #MngPageConfig.PageList do
|
||||||
local tem = MngPageConfig.PageList[i]
|
local tem = MngPageConfig.PageList[i]
|
||||||
if tem.id == id then
|
if tem.id == id then
|
||||||
return tem
|
return tem
|
||||||
|
|
@ -35,7 +35,7 @@ local function getPageConfig(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url, btn_type)
|
function M:init(url, btn_type)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
self.titleTxt = self._view:GetChild("n79")
|
self.titleTxt = self._view:GetChild("n79")
|
||||||
-- if btn_type == 2 then
|
-- if btn_type == 2 then
|
||||||
-- self._view:GetChild("n0"):GetChild("icon").url = "ui://m7iejg46p41ohx8"
|
-- 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
|
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])
|
local page = getPageConfig(self.page_config[i])
|
||||||
--如果界面无show_key,或圈子中对应的key为true才显示界面
|
--如果界面无show_key,或圈子中对应的key为true才显示界面
|
||||||
if not page.show_key or (page.show_key and group[page.show_key]) then
|
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)
|
local offset = get_offset(self._full_offset)
|
||||||
gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset
|
gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset
|
||||||
gmsv._view.height = GRoot.inst.height
|
gmsv._view.height = GRoot.inst.height
|
||||||
gmsv._view.x = 0--offset
|
gmsv._view.x = 0 --offset
|
||||||
|
|
||||||
-- first_page_config = getPageConfig(self.page_config[2])
|
-- first_page_config = getPageConfig(self.page_config[2])
|
||||||
-- gmsv = first_page_config.view.new(self.group_id, self._root_view)
|
-- 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 index = self.ctr_index.selectedIndex
|
||||||
local page_info = getPageConfig(self.page_config[index + 1])
|
local page_info = getPageConfig(self.page_config[index + 1])
|
||||||
if not self._view_map[index + 1] then
|
if not self._view_map[index + 1] then
|
||||||
|
|
||||||
local tem = page_info.view.new(self.group_id, self._root_view)
|
local tem = page_info.view.new(self.group_id, self._root_view)
|
||||||
|
|
||||||
-- anchor:AddRelation(self._root_view, RelationType.Size,true)
|
-- anchor:AddRelation(self._root_view, RelationType.Size,true)
|
||||||
--tem._view:Center(true)
|
--tem._view:Center(true)
|
||||||
|
|
||||||
--print("222222222222222",anchor._view)
|
---- print("222222222222222",anchor._view)
|
||||||
anchor:AddChild(tem._view)
|
anchor:AddChild(tem._view)
|
||||||
-- tem._view.parent = anchor
|
-- tem._view.parent = anchor
|
||||||
|
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset
|
tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset
|
||||||
tem._view.height = GRoot.inst.height
|
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:AddRelation(self._root_view, RelationType.Size)
|
||||||
-- tem._view:MakeFullScreen()
|
-- tem._view:MakeFullScreen()
|
||||||
|
|
||||||
|
|
@ -176,12 +175,10 @@ function M:init(url, btn_type)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack)
|
function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack)
|
||||||
self.groupInfoViewCallBack=groupInfoViewCallBack
|
self.groupInfoViewCallBack = groupInfoViewCallBack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 获取指定ID的页面
|
-- 获取指定ID的页面
|
||||||
function M:GetPageByID(id)
|
function M:GetPageByID(id)
|
||||||
for i, v in pairs(self._view_map) do
|
for i, v in pairs(self._view_map) do
|
||||||
|
|
@ -221,7 +218,7 @@ end
|
||||||
-- quick_access_id 是快速访问标志,打开对应id的页面
|
-- quick_access_id 是快速访问标志,打开对应id的页面
|
||||||
function M:Show(quick_access_id)
|
function M:Show(quick_access_id)
|
||||||
local index = self.ctr_index.selectedIndex
|
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
|
if not quick_access_id then
|
||||||
local page_info = getPageConfig(self.page_config[index + 1])
|
local page_info = getPageConfig(self.page_config[index + 1])
|
||||||
if page_info.refresh then self._view_map[index + 1]:initData() end
|
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 tex_name = self._view:GetChild("tex_name")
|
||||||
local name = tex_name.text
|
local name = tex_name.text
|
||||||
print("jefe:")
|
-- print("jefe:")
|
||||||
pt(self.hpData)
|
pt(self.hpData)
|
||||||
|
|
||||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||||
|
|
@ -469,7 +469,7 @@ function M:FillFagData()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
--print("======新增玩法=============")
|
---- print("======新增玩法=============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local play = {}
|
local play = {}
|
||||||
|
|
@ -510,7 +510,7 @@ function M:FillFagData()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
--print("======修改玩法=============")
|
---- print("======修改玩法=============")
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local play = {}
|
local play = {}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ local GroupMemberFagLogView = {}
|
||||||
local M = GroupMemberFagLogView
|
local M = GroupMemberFagLogView
|
||||||
|
|
||||||
function GroupMemberFagLogView.new(group_id, member, not_manager)
|
function GroupMemberFagLogView.new(group_id, member, not_manager)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "GroupMemberFagLogView"
|
self.class = "GroupMemberFagLogView"
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
-- self._blur_view = blur_view
|
-- self._blur_view = blur_view
|
||||||
|
|
@ -25,7 +25,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
|
|
||||||
local btn_close = self._view:GetChild("btn_close")
|
local btn_close = self._view:GetChild("btn_close")
|
||||||
btn_close.onClick:Set(function()
|
btn_close.onClick:Set(function()
|
||||||
|
|
@ -51,8 +51,7 @@ function M:init(url)
|
||||||
self:OnRenderItem(index, obj)
|
self:OnRenderItem(index, obj)
|
||||||
end
|
end
|
||||||
self.lst_fag.scrollPane.onPullUpRelease:Set(function()
|
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)
|
end)
|
||||||
if not self.not_manager then
|
if not self.not_manager then
|
||||||
self._view:GetController("manager").selectedIndex = 1
|
self._view:GetController("manager").selectedIndex = 1
|
||||||
|
|
@ -75,7 +74,8 @@ function M:init(url)
|
||||||
end
|
end
|
||||||
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.begin_time, self.end_time = self.time_panel:GetDate()
|
||||||
|
|
||||||
self._view:GetChild("btn_search").onClick:Set(function()
|
self._view:GetChild("btn_search").onClick:Set(function()
|
||||||
|
|
@ -93,7 +93,7 @@ function M:GetFilter()
|
||||||
local filter = 0
|
local filter = 0
|
||||||
for i = 1, 8 do
|
for i = 1, 8 do
|
||||||
local tem = math.pow(2, i - 1)
|
local tem = math.pow(2, i - 1)
|
||||||
--print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
---- print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
||||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||||
if btn_filter and btn_filter.selected then
|
if btn_filter and btn_filter.selected then
|
||||||
filter = filter + tem
|
filter = filter + tem
|
||||||
|
|
@ -150,7 +150,8 @@ function M:GetData(index)
|
||||||
if filter == 0 then return end
|
if filter == 0 then return end
|
||||||
ViewUtil.ShowModalWait()
|
ViewUtil.ShowModalWait()
|
||||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
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
|
if self._is_destroy then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -160,7 +161,7 @@ function M:GetData(index)
|
||||||
else
|
else
|
||||||
local data = res.Data.hp_logs
|
local data = res.Data.hp_logs
|
||||||
if #data == 0 then return end
|
if #data == 0 then return end
|
||||||
-- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
-- -- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||||
-- pt(data)
|
-- pt(data)
|
||||||
-- pt(self.member)
|
-- pt(self.member)
|
||||||
for i = 1, #data do
|
for i = 1, #data do
|
||||||
|
|
@ -177,18 +178,18 @@ function M:GuoLv(data)
|
||||||
if self.member.lev == 1 then
|
if self.member.lev == 1 then
|
||||||
local m_data_other = {}
|
local m_data_other = {}
|
||||||
local m_data_my = {}
|
local m_data_my = {}
|
||||||
for i=1,#data do
|
for i = 1, #data do
|
||||||
if self.member.uid ~= data[i].mgr_id then
|
if self.member.uid ~= data[i].mgr_id then
|
||||||
table.insert(m_data_other,data[i])
|
table.insert(m_data_other, data[i])
|
||||||
else
|
else
|
||||||
table.insert(m_data_my,data[i])
|
table.insert(m_data_my, data[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- printlog("比较计算=========m_data_my>>>",#m_data_my)
|
-- printlog("比较计算=========m_data_my>>>",#m_data_my)
|
||||||
-- printlog("比较计算=========m_data_other>>>",#m_data_other)
|
-- 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
|
for i = 1, #m_data_my do
|
||||||
self.hp_log[#self.hp_log + 1] = m_data_my[i]
|
self.hp_log[#self.hp_log + 1] = m_data_my[i]
|
||||||
end
|
end
|
||||||
|
|
@ -203,9 +204,9 @@ function M:GuoLv(data)
|
||||||
local m_data_other = {}
|
local m_data_other = {}
|
||||||
local m_data_my = {}
|
local m_data_my = {}
|
||||||
|
|
||||||
for i=1,#data do
|
for i = 1, #data do
|
||||||
if self.member.uid ~= data[i].mgr_id then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -217,13 +218,12 @@ function M:GuoLv(data)
|
||||||
end
|
end
|
||||||
self.m_index = #data - #m_data_other + self.m_index
|
self.m_index = #data - #m_data_other + self.m_index
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fillItem(data, obj)
|
local function fillItem(data, obj)
|
||||||
local num = d2ad(data.hp)
|
local num = d2ad(data.hp)
|
||||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
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)
|
obj:GetChild("tex_reason").text = __getReason(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -236,7 +236,7 @@ function M:OnRenderItem(index, obj)
|
||||||
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
|
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
|
||||||
obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
|
obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
|
||||||
obj:GetChild("tex_reason").text = __getReason(data)
|
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")
|
local btn_head = obj:GetChild("btn_head")
|
||||||
btn_head.icon = "ui://Common/Head0"
|
btn_head.icon = "ui://Common/Head0"
|
||||||
ImageLoad.Load(self.member.portrait, btn_head._iconObject)
|
ImageLoad.Load(self.member.portrait, btn_head._iconObject)
|
||||||
|
|
@ -261,7 +261,7 @@ function M:OnRenderItem(index, obj)
|
||||||
local item = lst:AddItemFromPool()
|
local item = lst:AddItemFromPool()
|
||||||
fillItem(data.detail[i], item)
|
fillItem(data.detail[i], item)
|
||||||
end
|
end
|
||||||
obj.height =95 * (#data.detail+1)
|
obj.height = 95 * (#data.detail + 1)
|
||||||
self.lst_fag:RefreshVirtualList()
|
self.lst_fag:RefreshVirtualList()
|
||||||
self.lst_fag:ScrollToView(index)
|
self.lst_fag:ScrollToView(index)
|
||||||
else
|
else
|
||||||
|
|
@ -281,7 +281,7 @@ function M:OnRenderItem(index, obj)
|
||||||
local item = lst:AddItemFromPool()
|
local item = lst:AddItemFromPool()
|
||||||
fillItem(data.detail[i], item)
|
fillItem(data.detail[i], item)
|
||||||
end
|
end
|
||||||
obj.height =95 * (#data.detail+1)
|
obj.height = 95 * (#data.detail + 1)
|
||||||
self.lst_fag:RefreshVirtualList()
|
self.lst_fag:RefreshVirtualList()
|
||||||
self.lst_fag:ScrollToView(index)
|
self.lst_fag:ScrollToView(index)
|
||||||
end
|
end
|
||||||
|
|
@ -311,7 +311,7 @@ end
|
||||||
-- 填充日统计对象
|
-- 填充日统计对象
|
||||||
function M:OnRenderDailyItem(index, obj)
|
function M:OnRenderDailyItem(index, obj)
|
||||||
local data = self.daily_count[#self.daily_count - index]
|
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)
|
local num = d2ad(data.num)
|
||||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local GroupSetPermissionView = import(".GroupSetPermissionView")
|
||||||
local GroupBanSameTableView = import(".GroupBanSameTableView")
|
local GroupBanSameTableView = import(".GroupBanSameTableView")
|
||||||
local MngPermission = import(".MngPermission")
|
local MngPermission = import(".MngPermission")
|
||||||
local GroupSetTagView = import("../GroupSetTagView")
|
local GroupSetTagView = import("../GroupSetTagView")
|
||||||
local GroupSetMemberInfoDiaoduView=import('.GroupSetMemberInfoDiaoduView')
|
local GroupSetMemberInfoDiaoduView = import('.GroupSetMemberInfoDiaoduView')
|
||||||
local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView")
|
local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView")
|
||||||
|
|
||||||
-- 牌友圈成员体力值记录
|
-- 牌友圈成员体力值记录
|
||||||
|
|
@ -12,13 +12,13 @@ local GroupMemberOperateView = {}
|
||||||
|
|
||||||
local M = GroupMemberOperateView
|
local M = GroupMemberOperateView
|
||||||
|
|
||||||
function GroupMemberOperateView.new(group_id, member, callBack,callBack1)
|
function GroupMemberOperateView.new(group_id, member, callBack, callBack1)
|
||||||
setmetatable(M, {__index = BaseWindow})
|
setmetatable(M, { __index = BaseWindow })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "GroupMemberOperateView"
|
self.class = "GroupMemberOperateView"
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
-- self._blur_view = blur_view
|
-- self._blur_view = blur_view
|
||||||
--print("GroupMemberOperateView==============")
|
---- print("GroupMemberOperateView==============")
|
||||||
--pt(member)
|
--pt(member)
|
||||||
self.member = member
|
self.member = member
|
||||||
self.group_id = group_id
|
self.group_id = group_id
|
||||||
|
|
@ -30,11 +30,11 @@ end
|
||||||
|
|
||||||
-- 管理员权限
|
-- 管理员权限
|
||||||
local MngPermissionList = {
|
local MngPermissionList = {
|
||||||
DeleteMember = 1,-- 删除成员
|
DeleteMember = 1, -- 删除成员
|
||||||
AddMember = 2,--添加成员
|
AddMember = 2, --添加成员
|
||||||
SetFag = 3,--设置体力值
|
SetFag = 3, --设置体力值
|
||||||
BanPlaying = 4,--禁止游戏
|
BanPlaying = 4, --禁止游戏
|
||||||
BanSameTable = 5--禁止同桌
|
BanSameTable = 5 --禁止同桌
|
||||||
}
|
}
|
||||||
|
|
||||||
local function CheckPermission(lev, permission)
|
local function CheckPermission(lev, permission)
|
||||||
|
|
@ -46,11 +46,11 @@ local function CheckPermission(lev, permission)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init(url)
|
function M:init(url)
|
||||||
BaseWindow.init(self,url)
|
BaseWindow.init(self, url)
|
||||||
|
|
||||||
local member = self.member
|
local member = self.member
|
||||||
local group = DataManager.groups:get(self.group_id)
|
local group = DataManager.groups:get(self.group_id)
|
||||||
--print("DataManager.groups:get(self.group_id)")
|
---- print("DataManager.groups:get(self.group_id)")
|
||||||
--pt(group)
|
--pt(group)
|
||||||
local perm_array = MngPermission.getPermData(group.permission)
|
local perm_array = MngPermission.getPermData(group.permission)
|
||||||
|
|
||||||
|
|
@ -105,7 +105,6 @@ function M:init(url)
|
||||||
|
|
||||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||||
self._view:GetChild("btn_deploy").onClick:Set(function()
|
self._view:GetChild("btn_deploy").onClick:Set(function()
|
||||||
|
|
||||||
local gniv = GroupNumberInputView.new(nil, function(num)
|
local gniv = GroupNumberInputView.new(nil, function(num)
|
||||||
ViewUtil.ShowModalWait()
|
ViewUtil.ShowModalWait()
|
||||||
local parent_id = tonumber(num)
|
local parent_id = tonumber(num)
|
||||||
|
|
@ -128,7 +127,7 @@ function M:init(url)
|
||||||
ctr_superior.selectedIndex = 1
|
ctr_superior.selectedIndex = 1
|
||||||
ViewUtil.ShowBannerOnScreenCenter("调配玩家成功")
|
ViewUtil.ShowBannerOnScreenCenter("调配玩家成功")
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"调配玩家失败")
|
ViewUtil.ErrorTip(res1.ReturnCode, "调配玩家失败")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -138,7 +137,7 @@ function M:init(url)
|
||||||
end)
|
end)
|
||||||
local vipbtn = self._view:GetChild("btn_vip")
|
local vipbtn = self._view:GetChild("btn_vip")
|
||||||
if vipbtn ~= nil then
|
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.visible = true
|
||||||
vipbtn.selected = member.isvip == 1 and true or false
|
vipbtn.selected = member.isvip == 1 and true or false
|
||||||
vipbtn.onClick:Set(function()
|
vipbtn.onClick:Set(function()
|
||||||
|
|
@ -153,7 +152,7 @@ function M:init(url)
|
||||||
self.callBack()
|
self.callBack()
|
||||||
else
|
else
|
||||||
vipbtn.selected = not vipbtn.selected
|
vipbtn.selected = not vipbtn.selected
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置vip失败")
|
ViewUtil.ErrorTip(res1.ReturnCode, "设置vip失败")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -167,7 +166,7 @@ function M:init(url)
|
||||||
lst_mng:RemoveChildrenToPool()
|
lst_mng:RemoveChildrenToPool()
|
||||||
-- 删除按钮
|
-- 删除按钮
|
||||||
local option = group.option or 0
|
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()
|
local btn_del = lst_mng:AddItemFromPool()
|
||||||
btn_del.icon = "ui://NewGroup/mng_del"
|
btn_del.icon = "ui://NewGroup/mng_del"
|
||||||
btn_del.onClick:Set(function()
|
btn_del.onClick:Set(function()
|
||||||
|
|
@ -187,12 +186,11 @@ function M:init(url)
|
||||||
ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家")
|
ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家")
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"删除成员失败")
|
ViewUtil.ErrorTip(res1.ReturnCode, "删除成员失败")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
_curren_msg:Show()
|
_curren_msg:Show()
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -224,7 +222,7 @@ function M:init(url)
|
||||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||||
self.callBack()
|
self.callBack()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"禁止娱乐失败!")
|
ViewUtil.ErrorTip(res1.ReturnCode, "禁止娱乐失败!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -232,8 +230,8 @@ function M:init(url)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
--print("group.type=====================")
|
---- print("group.type=====================")
|
||||||
--print(group.type)
|
---- print(group.type)
|
||||||
--pt(group)
|
--pt(group)
|
||||||
if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then
|
if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then
|
||||||
local btn_ban = lst_mng:AddItemFromPool()
|
local btn_ban = lst_mng:AddItemFromPool()
|
||||||
|
|
@ -263,7 +261,7 @@ function M:init(url)
|
||||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||||
self.callBack()
|
self.callBack()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
ViewUtil.ErrorTip(res1.ReturnCode, val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
||||||
end
|
end
|
||||||
end)
|
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)
|
local btv = GroupBanSameTableView.new(self.blur_view, self.group_id, member.uid, res.Data)
|
||||||
btv:Show()
|
btv:Show()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res.ReturnCode,"获取禁止同桌列表失败!")
|
ViewUtil.ErrorTip(res.ReturnCode, "获取禁止同桌列表失败!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
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
|
--if false then
|
||||||
local btn_set_mng = lst_mng:AddItemFromPool()
|
local btn_set_mng = lst_mng:AddItemFromPool()
|
||||||
btn_set_mng.icon = "ui://NewGroup/zhengzu"
|
btn_set_mng.icon = "ui://NewGroup/zhengzu"
|
||||||
|
|
@ -304,16 +302,13 @@ function M:init(url)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
--pt(res)
|
--pt(res)
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
local diaoduView=GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
local diaoduView = GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
||||||
diaoduView:SetCurrentState(res.Data.group_black+1,res.Data)
|
diaoduView:SetCurrentState(res.Data.group_black + 1, res.Data)
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res.ReturnCode,"获取整组调度失败!")
|
ViewUtil.ErrorTip(res.ReturnCode, "获取整组调度失败!")
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -344,7 +339,7 @@ function M:init(url)
|
||||||
end
|
end
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置副群主失败!")
|
ViewUtil.ErrorTip(res1.ReturnCode, "设置副群主失败!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -376,7 +371,7 @@ function M:init(url)
|
||||||
|
|
||||||
self:Destroy()
|
self:Destroy()
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置合伙人失败失败!")
|
ViewUtil.ErrorTip(res1.ReturnCode, "设置合伙人失败失败!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
@ -454,7 +449,7 @@ function M:init(url)
|
||||||
local btn_banplays = lst_mng:AddItemFromPool()
|
local btn_banplays = lst_mng:AddItemFromPool()
|
||||||
btn_banplays.icon = "ui://NewGroup/mng_ban_plays"
|
btn_banplays.icon = "ui://NewGroup/mng_ban_plays"
|
||||||
btn_banplays.onClick:Set(function()
|
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()
|
banplays:Show()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -463,8 +458,8 @@ function M:init(url)
|
||||||
local btn_qiangzhi = lst_mng:AddItemFromPool()
|
local btn_qiangzhi = lst_mng:AddItemFromPool()
|
||||||
btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi"
|
btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi"
|
||||||
btn_qiangzhi.onClick:Set(function()
|
btn_qiangzhi.onClick:Set(function()
|
||||||
local msg_tip = MsgWindow.new(self._root_view,"确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
local msg_tip = MsgWindow.new(self._root_view, "确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
||||||
msg_tip.onOk:Add(function( ... )
|
msg_tip.onOk:Add(function(...)
|
||||||
ViewUtil.ShowModalWait()
|
ViewUtil.ShowModalWait()
|
||||||
fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res)
|
fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
|
|
@ -499,10 +494,9 @@ function M:MovePartner(parent_id, member, obj)
|
||||||
obj:GetController("show_superior").selectedIndex = 1
|
obj:GetController("show_superior").selectedIndex = 1
|
||||||
ViewUtil.ShowBannerOnScreenCenter("转移成功")
|
ViewUtil.ShowBannerOnScreenCenter("转移成功")
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res1.ReturnCode,"转移失败")
|
ViewUtil.ErrorTip(res1.ReturnCode, "转移失败")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -65,7 +65,7 @@ function M:OnRenderItem(index, obj)
|
||||||
local hpStr
|
local hpStr
|
||||||
local hpData = json.decode(play.hpData)
|
local hpData = json.decode(play.hpData)
|
||||||
if play.hpOnOff == 1 then
|
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_type = play.rewardType == 1 and "赢家返点" or (play.rewardType == 2 and "人头返点")
|
||||||
local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点"
|
local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点"
|
||||||
local str_hp_type = hpData.type == 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 GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||||
|
|
||||||
|
|
||||||
local MngPermission = import('.MngPermission')
|
local MngPermission = import('.MngPermission')
|
||||||
|
|
@ -62,15 +62,15 @@ function M:FillView()
|
||||||
end
|
end
|
||||||
self.lst_member.scrollPane.onPullUpRelease:Set(
|
self.lst_member.scrollPane.onPullUpRelease:Set(
|
||||||
function()
|
function()
|
||||||
--print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
---- print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
||||||
self:GetMemberData(self.lst_member.numItems)
|
self:GetMemberData(self.lst_member.numItems)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
--local n50=self._view:GetChild('n50')
|
--local n50=self._view:GetChild('n50')
|
||||||
--print(n50)
|
---- print(n50)
|
||||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
--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')
|
local ctr_search = self._view:GetController('search')
|
||||||
self._view:GetChild('btn_search').onClick:Set(
|
self._view:GetChild('btn_search').onClick:Set(
|
||||||
|
|
@ -151,7 +151,7 @@ function M:FillView()
|
||||||
pt(response)
|
pt(response)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
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()
|
self:ClearNumTex()
|
||||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||||
else
|
else
|
||||||
|
|
@ -174,9 +174,6 @@ function M:FillView()
|
||||||
self:initData()
|
self:initData()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 快速访问
|
-- 快速访问
|
||||||
|
|
@ -187,8 +184,8 @@ end
|
||||||
|
|
||||||
-- 获取成员数据
|
-- 获取成员数据
|
||||||
function M:GetMemberData(index)
|
function M:GetMemberData(index)
|
||||||
--print("11111111111111111111")
|
---- print("11111111111111111111")
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
local group = DataManager.groups:get(self.group_id)
|
local group = DataManager.groups:get(self.group_id)
|
||||||
if index == 0 then
|
if index == 0 then
|
||||||
group:clearMember()
|
group:clearMember()
|
||||||
|
|
@ -287,11 +284,11 @@ function M:FillItem(obj, member, refresh)
|
||||||
|
|
||||||
|
|
||||||
--上级
|
--上级
|
||||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||||
if member.parentId==0 then
|
if member.parentId == 0 then
|
||||||
obj:GetChild('tex_shangjiID').text=""
|
obj:GetChild('tex_shangjiID').text = ""
|
||||||
else
|
else
|
||||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
|
||||||
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||||
local GroupStatMember = import('.GroupStatMember')
|
local GroupStatMember = import('.GroupStatMember')
|
||||||
local GroupMngFagPackView = import('../GroupMngFagPackView')
|
local GroupMngFagPackView = import('../GroupMngFagPackView')
|
||||||
|
|
||||||
|
|
@ -64,14 +64,13 @@ function M:FillView()
|
||||||
local rtype = self._view:GetChild("n132")
|
local rtype = self._view:GetChild("n132")
|
||||||
rtype.visible = false
|
rtype.visible = false
|
||||||
|
|
||||||
rtype.onChanged:Set(function ()
|
rtype.onChanged:Set(function()
|
||||||
if tostring(self.online) == rtype.value then
|
if tostring(self.online) == rtype.value then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.online = tonumber(rtype.value)
|
self.online = tonumber(rtype.value)
|
||||||
self:GetMemberData(0)
|
self:GetMemberData(0)
|
||||||
--printlog("aaaaaaaa222222222222222222222222222222")
|
--printlog("aaaaaaaa222222222222222222222222222222")
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- 初始化成员列表
|
-- 初始化成员列表
|
||||||
|
|
@ -88,9 +87,9 @@ function M:FillView()
|
||||||
)
|
)
|
||||||
|
|
||||||
--local n50=self._view:GetChild('n50')
|
--local n50=self._view:GetChild('n50')
|
||||||
--print(n50)
|
---- print(n50)
|
||||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
--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')
|
local ctr_search = self._view:GetController('search')
|
||||||
self._view:GetChild('btn_search').onClick:Set(
|
self._view:GetChild('btn_search').onClick:Set(
|
||||||
|
|
@ -171,7 +170,7 @@ function M:FillView()
|
||||||
pt(response)
|
pt(response)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
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()
|
self:ClearNumTex()
|
||||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||||
else
|
else
|
||||||
|
|
@ -200,13 +199,10 @@ function M:FillView()
|
||||||
--self._view:GetChild("n50").selected = true
|
--self._view:GetChild("n50").selected = true
|
||||||
ctr_page.onChanged:Set(
|
ctr_page.onChanged:Set(
|
||||||
function()
|
function()
|
||||||
|
|
||||||
self.stype = ctr_page.selectedIndex + 1
|
self.stype = ctr_page.selectedIndex + 1
|
||||||
self:initData()
|
self:initData()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 快速访问
|
-- 快速访问
|
||||||
|
|
@ -217,8 +213,8 @@ end
|
||||||
|
|
||||||
-- 获取成员数据
|
-- 获取成员数据
|
||||||
function M:GetMemberData(index)
|
function M:GetMemberData(index)
|
||||||
--print("11111111111111111111")
|
---- print("11111111111111111111")
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
-- local iClear = false
|
-- local iClear = false
|
||||||
-- local rtype = self._view:GetChild("n132").value
|
-- local rtype = self._view:GetChild("n132").value
|
||||||
-- if tostring(self.online) ~= rtype then
|
-- if tostring(self.online) ~= rtype then
|
||||||
|
|
@ -324,8 +320,8 @@ function M:FillItem(obj, member, refresh)
|
||||||
-- else
|
-- else
|
||||||
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
|
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
|
||||||
-- end
|
-- end
|
||||||
--print("11111aaaaaaaaaaaaaaaaaaaa ",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)
|
obj:GetChild('tex_last_login').text = "最近登录:" .. os.date('%Y/%m/%d', member.last_time)
|
||||||
else
|
else
|
||||||
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
|
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
|
||||||
end
|
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_ruhui').text = os.date('%Y/%m/%d %H:%M:%S', member.join_time)
|
||||||
|
|
||||||
--上级
|
--上级
|
||||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||||
if member.parentId==0 then
|
if member.parentId == 0 then
|
||||||
obj:GetChild('tex_shangjiID').text=""
|
obj:GetChild('tex_shangjiID').text = ""
|
||||||
else
|
else
|
||||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -451,16 +447,17 @@ function M:FillItem(obj, member, refresh)
|
||||||
)
|
)
|
||||||
|
|
||||||
local btnBxx = obj:GetChild('btn_bxx')
|
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)
|
--btnBxx.visible = not (DataManager.SelfUser.account_id == member.uid)
|
||||||
obj:GetChild('btn_bxx').onClick:Set(
|
obj:GetChild('btn_bxx').onClick:Set(
|
||||||
function()
|
function()
|
||||||
local ctrNum=1
|
local ctrNum = 1
|
||||||
-- if not (member.lev == 3 and member.partnerLev == 0) then
|
-- if not (member.lev == 3 and member.partnerLev == 0) then
|
||||||
-- ctrNum = 2
|
-- ctrNum = 2
|
||||||
-- end
|
-- end
|
||||||
ctrNum=2
|
ctrNum = 2
|
||||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,member.uid)
|
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum, member.uid)
|
||||||
gmv:SetCallback(
|
gmv:SetCallback(
|
||||||
function()
|
function()
|
||||||
btnBxx.selected = false
|
btnBxx.selected = false
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ local M = PlayerInfoView
|
||||||
|
|
||||||
function M.new(view, main_view, isHideIpAdds)
|
function M.new(view, main_view, isHideIpAdds)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self, {__index = PlayerInfoView})
|
setmetatable(self, { __index = PlayerInfoView })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._main_view = main_view
|
self._main_view = main_view
|
||||||
self._isHideIpAdds = isHideIpAdds
|
self._isHideIpAdds = isHideIpAdds
|
||||||
self.isShowTGTimer=false
|
self.isShowTGTimer = false
|
||||||
self.currentTime=0
|
self.currentTime = 0
|
||||||
self.totalTime=0
|
self.totalTime = 0
|
||||||
--self.isShow = fasle
|
--self.isShow = fasle
|
||||||
self:init()
|
self:init()
|
||||||
return self
|
return self
|
||||||
|
|
@ -41,33 +41,33 @@ function M:init()
|
||||||
self._tex_player_name = player_name_score:GetChild('tex_player_name')
|
self._tex_player_name = player_name_score:GetChild('tex_player_name')
|
||||||
self._tex_player_id = player_name_score:GetChild('tex_player_id')
|
self._tex_player_id = player_name_score:GetChild('tex_player_id')
|
||||||
self._tex_score = player_name_score:GetChild('tex_score')
|
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")
|
self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1")
|
||||||
if self._tex_score1 then
|
if self._tex_score1 then
|
||||||
self._tex_score1.visible=true
|
self._tex_score1.visible = true
|
||||||
end
|
end
|
||||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||||
if self._tex_score2 then
|
if self._tex_score2 then
|
||||||
self._tex_score2.visible=true
|
self._tex_score2.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
|
self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
|
||||||
if self._tex_n4 then
|
if self._tex_n4 then
|
||||||
self._tex_n4.visible=true
|
self._tex_n4.visible = true
|
||||||
end
|
end
|
||||||
self._tex_n5 = self._view:GetChild("info"):GetChild("n5")
|
self._tex_n5 = self._view:GetChild("info"):GetChild("n5")
|
||||||
if self._tex_n5 then
|
if self._tex_n5 then
|
||||||
self._tex_n5.visible=true
|
self._tex_n5.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
self.n3Bg=self._view:GetChild("info"):GetChild("n3")
|
self.n3Bg = self._view:GetChild("info"):GetChild("n3")
|
||||||
if self.n3Bg then
|
if self.n3Bg then
|
||||||
--self.n3Bg:SetSize(138,55)
|
--self.n3Bg:SetSize(138,55)
|
||||||
end
|
end
|
||||||
self.zhanjitext=self._view:GetChild("text_jifen")
|
self.zhanjitext = self._view:GetChild("text_jifen")
|
||||||
if self.zhanjitext then
|
if self.zhanjitext then
|
||||||
self.zhanjitext.text=0
|
self.zhanjitext.text = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -83,57 +83,53 @@ function M:init()
|
||||||
self._ctr_mask_voice = view:GetController('mask_voice')
|
self._ctr_mask_voice = view:GetController('mask_voice')
|
||||||
self._ctr_dismiss_room = view:GetController('dismiss_room')
|
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
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowTGTips(isShow, time)
|
||||||
function M:IsShowTGTips(isShow,time)
|
|
||||||
--printlog("isShowisShowisShow==== ",isShow," time ",time)
|
--printlog("isShowisShowisShow==== ",isShow," time ",time)
|
||||||
if time==nil then time=0 end
|
if time == nil then time = 0 end
|
||||||
|
|
||||||
self.isShowTGTimer = isShow
|
self.isShowTGTimer = isShow
|
||||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
||||||
end
|
end
|
||||||
self.currentTime=0
|
self.currentTime = 0
|
||||||
if isShow then
|
if isShow then
|
||||||
if self.PlayerTGTips then
|
if self.PlayerTGTips then
|
||||||
self.PlayerTGTips.text="开启托管剩余时间"..time.."s"
|
self.PlayerTGTips.text = "开启托管剩余时间" .. time .. "s"
|
||||||
end
|
end
|
||||||
self.totalTime=time
|
self.totalTime = time
|
||||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||||
--UpdateBeat:Add(self.OnUpdate,self)
|
--UpdateBeat:Add(self.OnUpdate,self)
|
||||||
-- printlog("aaaaaaaaa111111111111111111111111111111")
|
-- printlog("aaaaaaaaa111111111111111111111111111111")
|
||||||
--TimerManager.RemoveTimer(self.OnUpdate)
|
--TimerManager.RemoveTimer(self.OnUpdate)
|
||||||
TimerManager.AddTimer(self.OnUpdate,self)
|
TimerManager.AddTimer(self.OnUpdate, self)
|
||||||
--printlog(self)
|
--printlog(self)
|
||||||
else
|
else
|
||||||
-- printlog("移除IsShowTGTips",self.isShow)
|
-- printlog("移除IsShowTGTips",self.isShow)
|
||||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:OnUpdate()
|
function M:OnUpdate()
|
||||||
--printlog("OnUpdate=====================")
|
--printlog("OnUpdate=====================")
|
||||||
if self.isShowTGTimer then
|
if self.isShowTGTimer then
|
||||||
self.currentTime=self.currentTime+Time.deltaTime
|
self.currentTime = self.currentTime + Time.deltaTime
|
||||||
if self.currentTime>=1 then
|
if self.currentTime >= 1 then
|
||||||
self.currentTime=0
|
self.currentTime = 0
|
||||||
self.totalTime=self.totalTime-1
|
self.totalTime = self.totalTime - 1
|
||||||
--printlog("当前计时器===>>>",self.totalTime)
|
--printlog("当前计时器===>>>",self.totalTime)
|
||||||
if self.PlayerTGTips then
|
if self.PlayerTGTips then
|
||||||
self.PlayerTGTips.text="开启托管剩余时间"..self.totalTime.."s"
|
self.PlayerTGTips.text = "开启托管剩余时间" .. self.totalTime .. "s"
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.totalTime<=0 then
|
if self.totalTime <= 0 then
|
||||||
self.isShowTGTimer=false
|
self.isShowTGTimer = false
|
||||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||||
end
|
end
|
||||||
|
|
@ -144,7 +140,6 @@ function M:OnUpdate()
|
||||||
self:muShiPlayerUpdate()
|
self:muShiPlayerUpdate()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillData(player)
|
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
|
--and player.self_user.account_id ~= room.self_player.self_user.account_id
|
||||||
then
|
then
|
||||||
if player.orgSeat and player.orgSeat > 0 then
|
if player.orgSeat and player.orgSeat > 0 then
|
||||||
self._tex_player_name.text = "玩家"..player.orgSeat
|
self._tex_player_name.text = "玩家" .. player.orgSeat
|
||||||
else
|
else
|
||||||
self._tex_player_name.text = "玩家"..player.seat
|
self._tex_player_name.text = "玩家" .. player.seat
|
||||||
player.orgSeat = membe_clone(player.seat)
|
player.orgSeat = membe_clone(player.seat)
|
||||||
end
|
end
|
||||||
if self._tex_player_id then
|
if self._tex_player_id then
|
||||||
|
|
@ -187,7 +182,7 @@ function M:FillData(player)
|
||||||
else
|
else
|
||||||
self._tex_player_name.text = player.self_user.nick_name
|
self._tex_player_name.text = player.self_user.nick_name
|
||||||
if self._tex_player_id then
|
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
|
||||||
end
|
end
|
||||||
self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0
|
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
|
local room = DataManager.CurrenRoom
|
||||||
if room:checkHpNonnegative() then
|
if room:checkHpNonnegative() then
|
||||||
if self._player.cur_hp then
|
if self._player.cur_hp then
|
||||||
-- print(self._player.total_hp)
|
-- -- print(self._player.total_hp)
|
||||||
-- if self._player.total_hp then
|
-- if self._player.total_hp then
|
||||||
-- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp)
|
-- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp)
|
||||||
-- else
|
-- else
|
||||||
|
|
@ -339,9 +334,11 @@ function M:MarkTuoguan()
|
||||||
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
|
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
|
||||||
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
|
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UnmarkTuoguan()
|
function M:UnmarkTuoguan()
|
||||||
self:RemoveMarkFromHead('mark_tuoguan')
|
self:RemoveMarkFromHead('mark_tuoguan')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 动态的往头像上加载组件
|
-- 动态的往头像上加载组件
|
||||||
function M:AddMarkToHead(com, key)
|
function M:AddMarkToHead(com, key)
|
||||||
if key then
|
if key then
|
||||||
|
|
@ -354,6 +351,7 @@ function M:AddMarkToHead(com, key)
|
||||||
com.touchable = false
|
com.touchable = false
|
||||||
com.xy = self:GetHeadCenter()
|
com.xy = self:GetHeadCenter()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 动态移除组件
|
-- 动态移除组件
|
||||||
function M:RemoveMarkFromHead(key)
|
function M:RemoveMarkFromHead(key)
|
||||||
if self[key] then
|
if self[key] then
|
||||||
|
|
@ -363,11 +361,10 @@ function M:RemoveMarkFromHead(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Destroy()
|
function M:Destroy()
|
||||||
self.isShowTGTimer=false
|
self.isShowTGTimer = false
|
||||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||||
self.OnUpdate=nil
|
self.OnUpdate = nil
|
||||||
self.muShiPlayerUpdate=nil
|
self.muShiPlayerUpdate = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ function M:FillData(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print("============================playinfoview")
|
-- print("============================playinfoview")
|
||||||
pt(player)
|
pt(player)
|
||||||
|
|
||||||
if isHidden
|
if isHidden
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,8 @@ end
|
||||||
function ViewUtil.HandCardSort2(a, b)
|
function ViewUtil.HandCardSort2(a, b)
|
||||||
a = tonumber(string.sub(a, 2))
|
a = tonumber(string.sub(a, 2))
|
||||||
b = tonumber(string.sub(b, 2))
|
b = tonumber(string.sub(b, 2))
|
||||||
--print(a)
|
---- print(a)
|
||||||
--print(b)
|
---- print(b)
|
||||||
return a < b
|
return a < b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ function get_gps(callback)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
if not s then
|
if not s then
|
||||||
--print("Error" .. e)
|
---- print("Error" .. e)
|
||||||
end
|
end
|
||||||
elseif Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then
|
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)))
|
-- 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
|
end
|
||||||
|
|
||||||
local function __OnGameConnectAction(state)
|
local function __OnGameConnectAction(state)
|
||||||
--print("state:"..state)
|
---- print("state:"..state)
|
||||||
NetResetConnectWindow.CloseNetReset()
|
NetResetConnectWindow.CloseNetReset()
|
||||||
if state == SocketCode.Connect then
|
if state == SocketCode.Connect then
|
||||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||||
|
|
@ -150,14 +150,14 @@ function ViewManager.ChangeView(id, game_id, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ViewManager.OnApplicationPause()
|
function ViewManager.OnApplicationPause()
|
||||||
-- print("game pause")
|
-- -- print("game pause")
|
||||||
if (_currenView ~= nil) then
|
if (_currenView ~= nil) then
|
||||||
_currenView:OnApplicationPause()
|
_currenView:OnApplicationPause()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ViewManager.OnApplicationActive()
|
function ViewManager.OnApplicationActive()
|
||||||
-- print("game active")
|
-- -- print("game active")
|
||||||
if (_currenView ~= nil) then
|
if (_currenView ~= nil) then
|
||||||
_currenView:OnApplicationActive()
|
_currenView:OnApplicationActive()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local debugger_reLoadFile =nil
|
local debugger_reLoadFile = nil
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
debugger_reLoadFile = require("luaideReLoadFile")
|
debugger_reLoadFile = require("luaideReLoadFile")
|
||||||
end,function()
|
end, function()
|
||||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||||
end)
|
end)
|
||||||
local debugger_stackInfo = nil
|
local debugger_stackInfo = nil
|
||||||
|
|
@ -392,6 +392,7 @@ local function createJson()
|
||||||
function json.null()
|
function json.null()
|
||||||
return json.null -- so json.null() will also return null ;-)
|
return json.null -- so json.null() will also return null ;-)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Internal, PRIVATE functions.
|
-- Internal, PRIVATE functions.
|
||||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
-- 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
|
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||||
-- scanned.
|
-- scanned.
|
||||||
function decode_scanConstant(s, startPos)
|
function decode_scanConstant(s, startPos)
|
||||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||||
local constNames = {"true", "false", "null"}
|
local constNames = { "true", "false", "null" }
|
||||||
|
|
||||||
for i, k in pairs(constNames) do
|
for i, k in pairs(constNames) do
|
||||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||||
|
|
@ -776,17 +777,17 @@ function print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 1}
|
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
|
|
@ -800,46 +801,48 @@ function luaIdePrintWarn(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 2}
|
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function luaIdePrintErr(...)
|
function luaIdePrintErr(...)
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||||
debugger_print(...)
|
debugger_print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 3}
|
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
--@region 辅助方法
|
--@region 辅助方法
|
||||||
|
|
@ -977,7 +980,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
return tostring(v)
|
return tostring(v)
|
||||||
end
|
end
|
||||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
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)
|
local function _dump(value, desciption, indent, nest, keylen)
|
||||||
desciption = desciption or "<var>"
|
desciption = desciption or "<var>"
|
||||||
local spc = ""
|
local spc = ""
|
||||||
|
|
@ -1026,7 +1029,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
end
|
end
|
||||||
_dump(value, desciption, "- ", 1)
|
_dump(value, desciption, "- ", 1)
|
||||||
for i, line in ipairs(result) do
|
for i, line in ipairs(result) do
|
||||||
print(line)
|
-- print(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
@ -1035,9 +1038,7 @@ local function debugger_valueToString(v)
|
||||||
local vstr = nil
|
local vstr = nil
|
||||||
if (vtype == "userdata") then
|
if (vtype == "userdata") then
|
||||||
if (LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
|
return "userdata", vtype
|
||||||
return "userdata",vtype
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
end
|
end
|
||||||
|
|
@ -1045,11 +1046,11 @@ local function debugger_valueToString(v)
|
||||||
local value = vtype
|
local value = vtype
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
value = tostring(v)
|
value = tostring(v)
|
||||||
end,function()
|
end, function()
|
||||||
value = vtype
|
value = vtype
|
||||||
end)
|
end)
|
||||||
return value, vtype
|
return value, vtype
|
||||||
elseif (vtype == "number" or vtype == "string" ) then
|
elseif (vtype == "number" or vtype == "string") then
|
||||||
return v, vtype
|
return v, vtype
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
|
|
@ -1057,12 +1058,12 @@ local function debugger_valueToString(v)
|
||||||
end
|
end
|
||||||
local function debugger_setVarInfo(name, value)
|
local function debugger_setVarInfo(name, value)
|
||||||
local valueStr, valueType = debugger_valueToString(value)
|
local valueStr, valueType = debugger_valueToString(value)
|
||||||
local nameStr,nameType = debugger_valueToString(name)
|
local nameStr, nameType = debugger_valueToString(name)
|
||||||
if(valueStr == nil) then
|
if (valueStr == nil) then
|
||||||
valueStr = valueType
|
valueStr = valueType
|
||||||
end
|
end
|
||||||
local valueInfo = {
|
local valueInfo = {
|
||||||
name =nameStr,
|
name = nameStr,
|
||||||
valueType = valueType,
|
valueType = valueType,
|
||||||
valueStr = ZZBase64.encode(valueStr)
|
valueStr = ZZBase64.encode(valueStr)
|
||||||
}
|
}
|
||||||
|
|
@ -1100,7 +1101,7 @@ local function debugger_getvalue(f)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return {locals = locals, ups = ups}
|
return { locals = locals, ups = ups }
|
||||||
end
|
end
|
||||||
--获取堆栈
|
--获取堆栈
|
||||||
debugger_stackInfo =
|
debugger_stackInfo =
|
||||||
|
|
@ -1146,7 +1147,7 @@ debugger_stackInfo =
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||||
local data = {
|
local data = {
|
||||||
stack = stackInfo.stack,
|
stack = stackInfo.stack,
|
||||||
vars = stackInfo.vars,
|
vars = stackInfo.vars,
|
||||||
|
|
@ -1157,7 +1158,7 @@ debugger_stackInfo =
|
||||||
}
|
}
|
||||||
LuaDebugger.currentTempFunc = data.funcs[1]
|
LuaDebugger.currentTempFunc = data.funcs[1]
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
--===========================点断信息==================================================
|
--===========================点断信息==================================================
|
||||||
--根据不同的游戏引擎进行定时获取断点信息
|
--根据不同的游戏引擎进行定时获取断点信息
|
||||||
|
|
@ -1167,12 +1168,12 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
if (jit) then
|
if (jit) then
|
||||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||||
print(msg)
|
-- print(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
local msg, status = breakInfoSocket:receive()
|
local msg, status = breakInfoSocket:receive()
|
||||||
if(LuaDebugger.isLaunch and status == "closed") then
|
if (LuaDebugger.isLaunch and status == "closed") then
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
if (msg) then
|
if (msg) then
|
||||||
|
|
@ -1182,12 +1183,12 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||||
LuaDebugger.loadScriptBody = netData.data
|
LuaDebugger.loadScriptBody = netData.data
|
||||||
debugger_exeLuaString()
|
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
|
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||||
LuaDebugger.reLoadFileBody = netData.data
|
LuaDebugger.reLoadFileBody = netData.data
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
breakInfoSocket,
|
breakInfoSocket,
|
||||||
|
|
@ -1290,7 +1291,7 @@ debugger_setBreak =
|
||||||
end
|
end
|
||||||
LuaDebugger.isHook = false
|
LuaDebugger.isHook = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function debugger_checkFileIsBreak(fileName)
|
local function debugger_checkFileIsBreak(fileName)
|
||||||
return LuaDebugger.breakInfos[fileName]
|
return LuaDebugger.breakInfos[fileName]
|
||||||
end
|
end
|
||||||
|
|
@ -1322,7 +1323,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. condition)
|
local fun = loadstring("return " .. condition)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
return fun()
|
return fun()
|
||||||
|
|
@ -1332,21 +1333,20 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (status and msg) then
|
if (status and msg) then
|
||||||
callBack()
|
callBack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--执行lua字符串
|
--执行lua字符串
|
||||||
debugger_exeLuaString = function()
|
debugger_exeLuaString = function()
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
|
|
||||||
local script = LuaDebugger.loadScriptBody.script
|
local script = LuaDebugger.loadScriptBody.script
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
local currentTabble = {_G = _G}
|
local currentTabble = { _G = _G }
|
||||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||||
frameId = frameId
|
frameId = frameId
|
||||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||||
|
|
@ -1359,7 +1359,7 @@ debugger_exeLuaString = function()
|
||||||
for k, v in pairs(locals) do
|
for k, v in pairs(locals) do
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
|
|
||||||
local fun = loadstring(script)
|
local fun = loadstring(script)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
|
|
@ -1374,50 +1374,47 @@ debugger_exeLuaString = function()
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
|
|
||||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
LuaDebugger.loadScriptBody.script = nil
|
LuaDebugger.loadScriptBody.script = nil
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||||
|
.C2S_HITBreakPoint)
|
||||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||||
end
|
end
|
||||||
LuaDebugger.loadScriptBody.complete = true
|
LuaDebugger.loadScriptBody.complete = true
|
||||||
|
|
||||||
end
|
end
|
||||||
--@region 调试中修改变量值
|
--@region 调试中修改变量值
|
||||||
|
|
||||||
|
|
||||||
--根据key 值在 value 查找
|
--根据key 值在 value 查找
|
||||||
local function debugger_getTablekey(key,keyType,value)
|
local function debugger_getTablekey(key, keyType, value)
|
||||||
if(keyType == -1) then
|
if (keyType == -1) then
|
||||||
return key
|
return key
|
||||||
elseif(keyType == 1) then
|
elseif (keyType == 1) then
|
||||||
return tonumber(key)
|
return tonumber(key)
|
||||||
elseif(keyType == 2) then
|
elseif (keyType == 2) then
|
||||||
local valueKey = nil
|
local valueKey = nil
|
||||||
for k,v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
local nameType = type(k)
|
local nameType = type(k)
|
||||||
if(nameType == "userdata" or nameType == "table") then
|
if (nameType == "userdata" or nameType == "table") then
|
||||||
if (not LuaDebugger.isFoxGloryProject) then
|
if (not LuaDebugger.isFoxGloryProject) then
|
||||||
valueKey = tostring(k)
|
valueKey = tostring(k)
|
||||||
if(key == valueKey) then
|
if (key == valueKey) then
|
||||||
return k
|
return k
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function debugger_setVarValue(server, data)
|
local function debugger_setVarValue(server, data)
|
||||||
|
|
||||||
local newValue = nil
|
local newValue = nil
|
||||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||||
local firstKeyName = data.keys[1]
|
local firstKeyName = data.keys[1]
|
||||||
--@region vars check
|
--@region vars check
|
||||||
local localValueChangeIndex = -1
|
local localValueChangeIndex = -1
|
||||||
|
|
@ -1432,7 +1429,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(firstKeyName == name) then
|
if (firstKeyName == name) then
|
||||||
localValueChangeIndex = i
|
localValueChangeIndex = i
|
||||||
oldValue = value
|
oldValue = value
|
||||||
end
|
end
|
||||||
|
|
@ -1450,7 +1447,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||||
upValueFun = func
|
upValueFun = func
|
||||||
oldValue = value
|
oldValue = value
|
||||||
upValueChangeIndex = i
|
upValueChangeIndex = i
|
||||||
|
|
@ -1462,8 +1459,8 @@ local function debugger_setVarValue(server, data)
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
local vars = {locals = locals, ups = ups}
|
local vars = { locals = locals, ups = ups }
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
local currentTabble = {}
|
local currentTabble = {}
|
||||||
|
|
@ -1480,7 +1477,7 @@ local function debugger_setVarValue(server, data)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. data.value)
|
local fun = loadstring("return " .. data.value)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
newValue = fun()
|
newValue = fun()
|
||||||
|
|
@ -1490,7 +1487,7 @@ local function debugger_setVarValue(server, data)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "============================")
|
-- print(error, "============================")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1499,39 +1496,37 @@ local function debugger_setVarValue(server, data)
|
||||||
-- local 查找并替换
|
-- local 查找并替换
|
||||||
local keyLength = #data.keys
|
local keyLength = #data.keys
|
||||||
|
|
||||||
if(keyLength == 1) then
|
if (keyLength == 1) then
|
||||||
if(localValueChangeIndex ~= -1) then
|
if (localValueChangeIndex ~= -1) then
|
||||||
|
|
||||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||||
elseif(upValueFun ~= nil) then
|
elseif (upValueFun ~= nil) then
|
||||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||||
else
|
else
|
||||||
--全局变量查找
|
--全局变量查找
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
_G[firstKeyName] = newValue
|
_G[firstKeyName] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(not oldValue) then
|
if (not oldValue) then
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
oldValue = _G[firstKeyName]
|
oldValue = _G[firstKeyName]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local tempValue = oldValue
|
local tempValue = oldValue
|
||||||
for i=2,keyLength-1 do
|
for i = 2, keyLength - 1 do
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||||
data.varInfo = varInfo
|
data.varInfo = varInfo
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||||
|
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
@ -1543,41 +1538,41 @@ checkSetVar =
|
||||||
function()
|
function()
|
||||||
if (LuaDebugger.isSetVar) then
|
if (LuaDebugger.isSetVar) then
|
||||||
LuaDebugger.isSetVar = false
|
LuaDebugger.isSetVar = false
|
||||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("设置变量", error)
|
-- print("设置变量", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isLoadLuaScript) then
|
elseif (LuaDebugger.isLoadLuaScript) then
|
||||||
LuaDebugger.isLoadLuaScript = false
|
LuaDebugger.isLoadLuaScript = false
|
||||||
debugger_exeLuaString()
|
debugger_exeLuaString()
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("执行代码", error)
|
-- print("执行代码", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isReLoadFile) then
|
elseif (LuaDebugger.isReLoadFile) then
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("重新加载文件", error)
|
-- print("重新加载文件", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1627,7 +1622,7 @@ local function debugger_getValueByScript(value, script)
|
||||||
val = fun()
|
val = fun()
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "====>")
|
-- print(error, "====>")
|
||||||
val = nil
|
val = nil
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -1894,7 +1889,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
||||||
vinfos = {}
|
vinfos = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
m = getmetatable(value)
|
m = getmetatable(value)
|
||||||
|
|
@ -1944,7 +1938,6 @@ local function debugger_getBreakVar(body, server)
|
||||||
if (value) then
|
if (value) then
|
||||||
local valueType = type(value)
|
local valueType = type(value)
|
||||||
if (valueType == "table" or valueType == "userdata") then
|
if (valueType == "table" or valueType == "userdata") then
|
||||||
|
|
||||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||||
else
|
else
|
||||||
if (valueType == "function") then
|
if (valueType == "function") then
|
||||||
|
|
@ -1979,9 +1972,9 @@ local function debugger_getBreakVar(body, server)
|
||||||
xpcall(
|
xpcall(
|
||||||
exe,
|
exe,
|
||||||
function(error)
|
function(error)
|
||||||
-- print("获取变量错误 错误消息-----------------")
|
-- -- print("获取变量错误 错误消息-----------------")
|
||||||
-- print(error)
|
-- -- print(error)
|
||||||
-- print(debug.traceback("", 2))
|
-- -- print(debug.traceback("", 2))
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
server,
|
server,
|
||||||
LuaDebugger.event.C2S_ReqVar,
|
LuaDebugger.event.C2S_ReqVar,
|
||||||
|
|
@ -2018,7 +2011,7 @@ local function debugger_loop(server)
|
||||||
while true do
|
while true do
|
||||||
local line, status = server:receive()
|
local line, status = server:receive()
|
||||||
if (status == "closed") then
|
if (status == "closed") then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
|
|
@ -2030,13 +2023,12 @@ local function debugger_loop(server)
|
||||||
local event = netData.event
|
local event = netData.event
|
||||||
local body = netData.data
|
local body = netData.data
|
||||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||||
--设置断点信息
|
--设置断点信息
|
||||||
local function setB()
|
local function setB()
|
||||||
|
|
@ -2045,7 +2037,7 @@ local function debugger_loop(server)
|
||||||
xpcall(
|
xpcall(
|
||||||
setB,
|
setB,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||||
|
|
@ -2156,29 +2148,26 @@ local function debugger_loop(server)
|
||||||
end
|
end
|
||||||
coro_debugger = coroutine.create(debugger_loop)
|
coro_debugger = coroutine.create(debugger_loop)
|
||||||
debug_hook = function(event, line)
|
debug_hook = function(event, line)
|
||||||
|
if (not LuaDebugger.isHook) then
|
||||||
if(not LuaDebugger.isHook) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.Run) then
|
if (LuaDebugger.Run) then
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
local isCheck = false
|
local isCheck = false
|
||||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||||
|
|
||||||
for bk, linesInfo in pairs(breakInfo) 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
|
isCheck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(isCheck) then
|
if (isCheck) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not isCheck) then
|
if (not isCheck) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -2209,7 +2198,7 @@ debug_hook = function(event, line)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
||||||
-- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
-- -- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||||
local file = nil
|
local file = nil
|
||||||
if (event == "call") then
|
if (event == "call") then
|
||||||
-- end
|
-- end
|
||||||
|
|
@ -2217,7 +2206,7 @@ debug_hook = function(event, line)
|
||||||
if (not LuaDebugger.Run) then
|
if (not LuaDebugger.Run) then
|
||||||
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
||||||
end
|
end
|
||||||
-- print("stepIn",LuaDebugger.StepNextLevel)
|
-- -- print("stepIn",LuaDebugger.StepNextLevel)
|
||||||
|
|
||||||
local stepInfo = getinfo(2, "S")
|
local stepInfo = getinfo(2, "S")
|
||||||
local source = stepInfo.source
|
local source = stepInfo.source
|
||||||
|
|
@ -2259,7 +2248,6 @@ debug_hook = function(event, line)
|
||||||
local breakInfo = LuaDebugger.breakInfos[file]
|
local breakInfo = LuaDebugger.breakInfos[file]
|
||||||
local breakData = nil
|
local breakData = nil
|
||||||
if (breakInfo) then
|
if (breakInfo) then
|
||||||
|
|
||||||
local ischeck = false
|
local ischeck = false
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
|
|
@ -2299,13 +2287,13 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
pathNamesCount = pathNamesCount - 1
|
pathNamesCount = pathNamesCount - 1
|
||||||
hitPathNamesCount = hitPathNamesCount - 1
|
hitPathNamesCount = hitPathNamesCount - 1
|
||||||
checkCount = checkCount+1
|
checkCount = checkCount + 1
|
||||||
|
|
||||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(checkCount>0) then
|
if (checkCount > 0) then
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -2384,7 +2372,7 @@ end
|
||||||
local function debugger_xpcall()
|
local function debugger_xpcall()
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
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
|
data.stack[1].isXpCall = true
|
||||||
end
|
end
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
|
|
@ -2396,8 +2384,8 @@ local function start()
|
||||||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||||
LuaDebugger.DebugLuaFie = fileName
|
LuaDebugger.DebugLuaFie = fileName
|
||||||
local socket = createSocket()
|
local socket = createSocket()
|
||||||
print(controller_host)
|
-- print(controller_host)
|
||||||
print(controller_port)
|
-- print(controller_port)
|
||||||
|
|
||||||
local server = socket.connect(controller_host, controller_port)
|
local server = socket.connect(controller_host, controller_port)
|
||||||
debug_server = server
|
debug_server = server
|
||||||
|
|
@ -2427,15 +2415,15 @@ local function start()
|
||||||
debug.sethook(debug_hook, "lrc")
|
debug.sethook(debug_hook, "lrc")
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print("error:", error)
|
-- print("error:", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (jit) then
|
if (jit) then
|
||||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||||
print("error======================================================")
|
-- print("error======================================================")
|
||||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||||
|
|
||||||
print(msg)
|
-- print(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_resume(coro_debugger, server)
|
_resume(coro_debugger, server)
|
||||||
|
|
@ -2444,16 +2432,16 @@ local function start()
|
||||||
end
|
end
|
||||||
function StartDebug(host, port)
|
function StartDebug(host, port)
|
||||||
if (not host) then
|
if (not host) then
|
||||||
print("error host nil")
|
-- print("error host nil")
|
||||||
end
|
end
|
||||||
if (not port) then
|
if (not port) then
|
||||||
print("error prot nil")
|
-- print("error prot nil")
|
||||||
end
|
end
|
||||||
if (type(host) ~= "string") then
|
if (type(host) ~= "string") then
|
||||||
print("error host not string")
|
-- print("error host not string")
|
||||||
end
|
end
|
||||||
if (type(port) ~= "number") then
|
if (type(port) ~= "number") then
|
||||||
print("error host not number")
|
-- print("error host not number")
|
||||||
end
|
end
|
||||||
controller_host = host
|
controller_host = host
|
||||||
controller_port = port
|
controller_port = port
|
||||||
|
|
@ -2461,7 +2449,7 @@ function StartDebug(host, port)
|
||||||
start,
|
start,
|
||||||
function(error)
|
function(error)
|
||||||
-- body
|
-- body
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
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', '+', '/',
|
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||||
};
|
};
|
||||||
ZZBase64.__decode = {}
|
ZZBase64.__decode = {}
|
||||||
for k,v in pairs(ZZBase64.__code) do
|
for k, v in pairs(ZZBase64.__code) do
|
||||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.encode(text)
|
function ZZBase64.encode(text)
|
||||||
|
|
@ -2489,14 +2477,14 @@ function ZZBase64.encode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for i = 1, len, 3 do
|
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 b = string.byte(text, i + 1)
|
||||||
local c = string.byte(text, i + 2)
|
local c = string.byte(text, i + 2)
|
||||||
-- num = a<<16 + b<<8 + c
|
-- num = a<<16 + b<<8 + c
|
||||||
local num = a * 65536 + b * 256 + c
|
local num = a * 65536 + b * 256 + c
|
||||||
for j = 1, 4 do
|
for j = 1, 4 do
|
||||||
--tmp = num >> ((4 -j) * 6)
|
--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
|
--curPos = tmp&0x3f
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2533,13 +2521,13 @@ function ZZBase64.__left2(res, index, text, len)
|
||||||
res[index + 3] = "="
|
res[index + 3] = "="
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.__left1(res, index,text, len)
|
function ZZBase64.__left1(res, index, text, len)
|
||||||
local num = string.byte(text, len + 1)
|
local num = string.byte(text, len + 1)
|
||||||
num = num * 16
|
num = num * 16
|
||||||
|
|
||||||
local tmp = math.floor(num / 64)
|
local tmp = math.floor(num / 64)
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index ] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
||||||
curPos = num % 64 + 1
|
curPos = num % 64 + 1
|
||||||
res[index + 1] = ZZBase64.__code[curPos]
|
res[index + 1] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2562,11 +2550,11 @@ function ZZBase64.decode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
local decode = ZZBase64.__decode
|
local decode = ZZBase64.__decode
|
||||||
for i =1, len, 4 do
|
for i = 1, len, 4 do
|
||||||
local a = decode[string.byte(text,i )]
|
local a = decode[string.byte(text, i)]
|
||||||
local b = decode[string.byte(text,i + 1)]
|
local b = decode[string.byte(text, i + 1)]
|
||||||
local c = decode[string.byte(text,i + 2)]
|
local c = decode[string.byte(text, i + 2)]
|
||||||
local d = decode[string.byte(text,i + 3)]
|
local d = decode[string.byte(text, i + 3)]
|
||||||
|
|
||||||
--num = a<<18 + b<<12 + c<<6 + d
|
--num = a<<18 + b<<12 + c<<6 + d
|
||||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||||
|
|
@ -2575,7 +2563,7 @@ function ZZBase64.decode(text)
|
||||||
num = math.floor(num / 256)
|
num = math.floor(num / 256)
|
||||||
local f = string.char(num % 256)
|
local f = string.char(num % 256)
|
||||||
num = math.floor(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 + 1] = f
|
||||||
res[index + 2] = e
|
res[index + 2] = e
|
||||||
index = index + 3
|
index = index + 3
|
||||||
|
|
@ -2611,7 +2599,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
||||||
res[index] = string.char(num)
|
res[index] = string.char(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return StartDebug
|
return StartDebug
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local debugger_reLoadFile =nil
|
local debugger_reLoadFile = nil
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
debugger_reLoadFile = require("luaideReLoadFile")
|
debugger_reLoadFile = require("luaideReLoadFile")
|
||||||
end,function()
|
end, function()
|
||||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||||
end)
|
end)
|
||||||
local sethook = debug.sethook
|
local sethook = debug.sethook
|
||||||
|
|
@ -13,9 +13,9 @@ local checkSetVar = nil
|
||||||
local loadstring_ = nil
|
local loadstring_ = nil
|
||||||
local debugger_sendMsg = nil
|
local debugger_sendMsg = nil
|
||||||
if (loadstring) then
|
if (loadstring) then
|
||||||
loadstring_ = loadstring
|
loadstring_ = loadstring
|
||||||
else
|
else
|
||||||
loadstring_ = load
|
loadstring_ = load
|
||||||
end
|
end
|
||||||
local ZZBase64 = {}
|
local ZZBase64 = {}
|
||||||
local LuaDebugTool_ = nil
|
local LuaDebugTool_ = nil
|
||||||
|
|
@ -366,6 +366,7 @@ local function createJson()
|
||||||
function json.null()
|
function json.null()
|
||||||
return json.null -- so json.null() will also return null ;-)
|
return json.null -- so json.null() will also return null ;-)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Internal, PRIVATE functions.
|
-- Internal, PRIVATE functions.
|
||||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
-- 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
|
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||||
-- scanned.
|
-- scanned.
|
||||||
function decode_scanConstant(s, startPos)
|
function decode_scanConstant(s, startPos)
|
||||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||||
local constNames = {"true", "false", "null"}
|
local constNames = { "true", "false", "null" }
|
||||||
|
|
||||||
for i, k in pairs(constNames) do
|
for i, k in pairs(constNames) do
|
||||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||||
|
|
@ -694,7 +695,7 @@ local LuaDebugger = {
|
||||||
runLineCount = 0,
|
runLineCount = 0,
|
||||||
--分割字符串缓存
|
--分割字符串缓存
|
||||||
splitFilePaths = {},
|
splitFilePaths = {},
|
||||||
version="0.9.3",
|
version = "0.9.3",
|
||||||
serVarLevel = 4
|
serVarLevel = 4
|
||||||
}
|
}
|
||||||
local debug_hook = nil
|
local debug_hook = nil
|
||||||
|
|
@ -747,17 +748,17 @@ function print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 1}
|
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
|
|
@ -771,46 +772,48 @@ function luaIdePrintWarn(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 2}
|
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function luaIdePrintErr(...)
|
function luaIdePrintErr(...)
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||||
debugger_print(...)
|
debugger_print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 3}
|
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
--@region 辅助方法
|
--@region 辅助方法
|
||||||
|
|
@ -948,7 +951,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
return tostring(v)
|
return tostring(v)
|
||||||
end
|
end
|
||||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
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)
|
local function _dump(value, desciption, indent, nest, keylen)
|
||||||
desciption = desciption or "<var>"
|
desciption = desciption or "<var>"
|
||||||
local spc = ""
|
local spc = ""
|
||||||
|
|
@ -997,7 +1000,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
end
|
end
|
||||||
_dump(value, desciption, "- ", 1)
|
_dump(value, desciption, "- ", 1)
|
||||||
for i, line in ipairs(result) do
|
for i, line in ipairs(result) do
|
||||||
print(line)
|
-- print(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
@ -1005,27 +1008,24 @@ local function debugger_valueToString(v)
|
||||||
local vtype = type(v)
|
local vtype = type(v)
|
||||||
local vstr = nil
|
local vstr = nil
|
||||||
if (vtype == "userdata") then
|
if (vtype == "userdata") then
|
||||||
if (LuaDebugger.isFoxGloryProject ) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
|
return "userdata", vtype
|
||||||
return "userdata",vtype
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
end
|
end
|
||||||
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
||||||
local value = vtype
|
local value = vtype
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
if(LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
value = vtype
|
value = vtype
|
||||||
else
|
else
|
||||||
value = tostring(v)
|
value = tostring(v)
|
||||||
end
|
end
|
||||||
|
end, function()
|
||||||
end,function()
|
|
||||||
value = vtype
|
value = vtype
|
||||||
end)
|
end)
|
||||||
return value, vtype
|
return value, vtype
|
||||||
elseif (vtype == "number" or vtype == "string" ) then
|
elseif (vtype == "number" or vtype == "string") then
|
||||||
return v, vtype
|
return v, vtype
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
|
|
@ -1033,12 +1033,12 @@ local function debugger_valueToString(v)
|
||||||
end
|
end
|
||||||
local function debugger_setVarInfo(name, value)
|
local function debugger_setVarInfo(name, value)
|
||||||
local valueStr, valueType = debugger_valueToString(value)
|
local valueStr, valueType = debugger_valueToString(value)
|
||||||
local nameStr,nameType = debugger_valueToString(name)
|
local nameStr, nameType = debugger_valueToString(name)
|
||||||
if(valueStr == nil) then
|
if (valueStr == nil) then
|
||||||
valueStr = valueType
|
valueStr = valueType
|
||||||
end
|
end
|
||||||
local valueInfo = {
|
local valueInfo = {
|
||||||
name =nameStr,
|
name = nameStr,
|
||||||
valueType = valueType,
|
valueType = valueType,
|
||||||
valueStr = ZZBase64.encode(valueStr)
|
valueStr = ZZBase64.encode(valueStr)
|
||||||
}
|
}
|
||||||
|
|
@ -1076,7 +1076,7 @@ local function debugger_getvalue(f)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return {locals = locals, ups = ups}
|
return { locals = locals, ups = ups }
|
||||||
end
|
end
|
||||||
--获取堆栈
|
--获取堆栈
|
||||||
debugger_stackInfo =
|
debugger_stackInfo =
|
||||||
|
|
@ -1122,7 +1122,7 @@ debugger_stackInfo =
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||||
local data = {
|
local data = {
|
||||||
stack = stackInfo.stack,
|
stack = stackInfo.stack,
|
||||||
vars = stackInfo.vars,
|
vars = stackInfo.vars,
|
||||||
|
|
@ -1133,23 +1133,23 @@ debugger_stackInfo =
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
--==============================工具方法 end======================================================
|
--==============================工具方法 end======================================================
|
||||||
--===========================点断信息==================================================
|
--===========================点断信息==================================================
|
||||||
--根据不同的游戏引擎进行定时获取断点信息
|
--根据不同的游戏引擎进行定时获取断点信息
|
||||||
--CCDirector:sharedDirector():getScheduler()
|
--CCDirector:sharedDirector():getScheduler()
|
||||||
local debugger_setBreak = nil
|
local debugger_setBreak = nil
|
||||||
local function debugger_receiveDebugBreakInfo()
|
local function debugger_receiveDebugBreakInfo()
|
||||||
if(not jit) then
|
if (not jit) then
|
||||||
if(_VERSION)then
|
if (_VERSION) then
|
||||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||||
else
|
else
|
||||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
local msg, status = breakInfoSocket:receive()
|
local msg, status = breakInfoSocket:receive()
|
||||||
if(LuaDebugger.isLaunch == true and status == "closed") then
|
if (LuaDebugger.isLaunch == true and status == "closed") then
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
if (msg) then
|
if (msg) then
|
||||||
|
|
@ -1159,7 +1159,7 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||||
LuaDebugger.loadScriptBody = netData.data
|
LuaDebugger.loadScriptBody = netData.data
|
||||||
debugger_exeLuaString()
|
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
|
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||||
LuaDebugger.reLoadFileBody = netData.data
|
LuaDebugger.reLoadFileBody = netData.data
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
|
|
@ -1267,7 +1267,7 @@ debugger_setBreak =
|
||||||
end
|
end
|
||||||
LuaDebugger.isHook = false
|
LuaDebugger.isHook = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function debugger_checkFileIsBreak(fileName)
|
local function debugger_checkFileIsBreak(fileName)
|
||||||
return LuaDebugger.breakInfos[fileName]
|
return LuaDebugger.breakInfos[fileName]
|
||||||
end
|
end
|
||||||
|
|
@ -1299,7 +1299,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. condition)
|
local fun = loadstring("return " .. condition)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
return fun()
|
return fun()
|
||||||
|
|
@ -1309,21 +1309,20 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (status and msg) then
|
if (status and msg) then
|
||||||
callBack()
|
callBack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--执行lua字符串
|
--执行lua字符串
|
||||||
debugger_exeLuaString = function()
|
debugger_exeLuaString = function()
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
|
|
||||||
local script = LuaDebugger.loadScriptBody.script
|
local script = LuaDebugger.loadScriptBody.script
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
local currentTabble = {_G = _G}
|
local currentTabble = { _G = _G }
|
||||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||||
frameId = frameId
|
frameId = frameId
|
||||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||||
|
|
@ -1336,7 +1335,7 @@ debugger_exeLuaString = function()
|
||||||
for k, v in pairs(locals) do
|
for k, v in pairs(locals) do
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
|
|
||||||
local fun = loadstring(script)
|
local fun = loadstring(script)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
|
|
@ -1351,50 +1350,47 @@ debugger_exeLuaString = function()
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
|
|
||||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
LuaDebugger.loadScriptBody.script = nil
|
LuaDebugger.loadScriptBody.script = nil
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||||
|
.C2S_HITBreakPoint)
|
||||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||||
end
|
end
|
||||||
LuaDebugger.loadScriptBody.complete = true
|
LuaDebugger.loadScriptBody.complete = true
|
||||||
|
|
||||||
end
|
end
|
||||||
--@region 调试中修改变量值
|
--@region 调试中修改变量值
|
||||||
|
|
||||||
|
|
||||||
--根据key 值在 value 查找
|
--根据key 值在 value 查找
|
||||||
local function debugger_getTablekey(key,keyType,value)
|
local function debugger_getTablekey(key, keyType, value)
|
||||||
if(keyType == -1) then
|
if (keyType == -1) then
|
||||||
return key
|
return key
|
||||||
elseif(keyType == 1) then
|
elseif (keyType == 1) then
|
||||||
return tonumber(key)
|
return tonumber(key)
|
||||||
elseif(keyType == 2) then
|
elseif (keyType == 2) then
|
||||||
local valueKey = nil
|
local valueKey = nil
|
||||||
for k,v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
local nameType = type(k)
|
local nameType = type(k)
|
||||||
if(nameType == "userdata" or nameType == "table") then
|
if (nameType == "userdata" or nameType == "table") then
|
||||||
if (not LuaDebugger.isFoxGloryProject) then
|
if (not LuaDebugger.isFoxGloryProject) then
|
||||||
valueKey = tostring(k)
|
valueKey = tostring(k)
|
||||||
if(key == valueKey) then
|
if (key == valueKey) then
|
||||||
return k
|
return k
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function debugger_setVarValue(server, data)
|
local function debugger_setVarValue(server, data)
|
||||||
|
|
||||||
local newValue = nil
|
local newValue = nil
|
||||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||||
local firstKeyName = data.keys[1]
|
local firstKeyName = data.keys[1]
|
||||||
--@region vars check
|
--@region vars check
|
||||||
local localValueChangeIndex = -1
|
local localValueChangeIndex = -1
|
||||||
|
|
@ -1409,7 +1405,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(firstKeyName == name) then
|
if (firstKeyName == name) then
|
||||||
localValueChangeIndex = i
|
localValueChangeIndex = i
|
||||||
oldValue = value
|
oldValue = value
|
||||||
end
|
end
|
||||||
|
|
@ -1427,7 +1423,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||||
upValueFun = func
|
upValueFun = func
|
||||||
oldValue = value
|
oldValue = value
|
||||||
upValueChangeIndex = i
|
upValueChangeIndex = i
|
||||||
|
|
@ -1439,8 +1435,8 @@ local function debugger_setVarValue(server, data)
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
local vars = {locals = locals, ups = ups}
|
local vars = { locals = locals, ups = ups }
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
local currentTabble = {}
|
local currentTabble = {}
|
||||||
|
|
@ -1457,7 +1453,7 @@ local function debugger_setVarValue(server, data)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. data.value)
|
local fun = loadstring("return " .. data.value)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
newValue = fun()
|
newValue = fun()
|
||||||
|
|
@ -1467,7 +1463,7 @@ local function debugger_setVarValue(server, data)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "============================")
|
-- print(error, "============================")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1476,39 +1472,37 @@ local function debugger_setVarValue(server, data)
|
||||||
-- local 查找并替换
|
-- local 查找并替换
|
||||||
local keyLength = #data.keys
|
local keyLength = #data.keys
|
||||||
|
|
||||||
if(keyLength == 1) then
|
if (keyLength == 1) then
|
||||||
if(localValueChangeIndex ~= -1) then
|
if (localValueChangeIndex ~= -1) then
|
||||||
|
|
||||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||||
elseif(upValueFun ~= nil) then
|
elseif (upValueFun ~= nil) then
|
||||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||||
else
|
else
|
||||||
--全局变量查找
|
--全局变量查找
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
_G[firstKeyName] = newValue
|
_G[firstKeyName] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(not oldValue) then
|
if (not oldValue) then
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
oldValue = _G[firstKeyName]
|
oldValue = _G[firstKeyName]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local tempValue = oldValue
|
local tempValue = oldValue
|
||||||
for i=2,keyLength-1 do
|
for i = 2, keyLength - 1 do
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||||
data.varInfo = varInfo
|
data.varInfo = varInfo
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||||
|
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
@ -1520,41 +1514,41 @@ checkSetVar =
|
||||||
function()
|
function()
|
||||||
if (LuaDebugger.isSetVar) then
|
if (LuaDebugger.isSetVar) then
|
||||||
LuaDebugger.isSetVar = false
|
LuaDebugger.isSetVar = false
|
||||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("设置变量", error)
|
-- print("设置变量", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isLoadLuaScript) then
|
elseif (LuaDebugger.isLoadLuaScript) then
|
||||||
LuaDebugger.isLoadLuaScript = false
|
LuaDebugger.isLoadLuaScript = false
|
||||||
debugger_exeLuaString()
|
debugger_exeLuaString()
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("执行代码", error)
|
-- print("执行代码", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isReLoadFile) then
|
elseif (LuaDebugger.isReLoadFile) then
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("重新加载文件", error)
|
-- print("重新加载文件", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1604,7 +1598,7 @@ local function debugger_getValueByScript(value, script)
|
||||||
val = fun()
|
val = fun()
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "====>")
|
-- print(error, "====>")
|
||||||
val = nil
|
val = nil
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -1745,7 +1739,6 @@ end
|
||||||
return
|
return
|
||||||
]]
|
]]
|
||||||
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
||||||
|
|
||||||
for i, mtable in ipairs(metatables) do
|
for i, mtable in ipairs(metatables) do
|
||||||
if (metatable == mtable) then
|
if (metatable == mtable) then
|
||||||
return vinfos
|
return vinfos
|
||||||
|
|
@ -1801,7 +1794,6 @@ local function debugger_getmetatable(value, metatable, vinfos, server, variables
|
||||||
else
|
else
|
||||||
return vinfos
|
return vinfos
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
||||||
if (valueType == "userdata") then
|
if (valueType == "userdata") then
|
||||||
|
|
@ -1874,7 +1866,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
||||||
vinfos = {}
|
vinfos = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
m = getmetatable(value)
|
m = getmetatable(value)
|
||||||
|
|
@ -1924,11 +1915,10 @@ local function debugger_getBreakVar(body, server)
|
||||||
if (value) then
|
if (value) then
|
||||||
local valueType = type(value)
|
local valueType = type(value)
|
||||||
if (valueType == "table" or valueType == "userdata") then
|
if (valueType == "table" or valueType == "userdata") then
|
||||||
|
|
||||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||||
else
|
else
|
||||||
if (valueType == "function") then
|
if (valueType == "function") then
|
||||||
if(LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
value = "function"
|
value = "function"
|
||||||
else
|
else
|
||||||
value = tostring(value)
|
value = tostring(value)
|
||||||
|
|
@ -1963,9 +1953,9 @@ local function debugger_getBreakVar(body, server)
|
||||||
xpcall(
|
xpcall(
|
||||||
exe,
|
exe,
|
||||||
function(error)
|
function(error)
|
||||||
-- print("获取变量错误 错误消息-----------------")
|
-- -- print("获取变量错误 错误消息-----------------")
|
||||||
-- print(error)
|
-- -- print(error)
|
||||||
-- print(debug.traceback("", 2))
|
-- -- print(debug.traceback("", 2))
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
server,
|
server,
|
||||||
LuaDebugger.event.C2S_ReqVar,
|
LuaDebugger.event.C2S_ReqVar,
|
||||||
|
|
@ -1991,7 +1981,6 @@ local function ResetDebugInfo()
|
||||||
LuaDebugger.StepIn = false
|
LuaDebugger.StepIn = false
|
||||||
LuaDebugger.StepNext = false
|
LuaDebugger.StepNext = false
|
||||||
LuaDebugger.StepOut = false
|
LuaDebugger.StepOut = false
|
||||||
|
|
||||||
end
|
end
|
||||||
local function debugger_loop(server)
|
local function debugger_loop(server)
|
||||||
server = debug_server
|
server = debug_server
|
||||||
|
|
@ -2002,7 +1991,7 @@ local function debugger_loop(server)
|
||||||
while true do
|
while true do
|
||||||
local line, status = server:receive()
|
local line, status = server:receive()
|
||||||
if (status == "closed") then
|
if (status == "closed") then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
|
|
@ -2014,13 +2003,12 @@ local function debugger_loop(server)
|
||||||
local event = netData.event
|
local event = netData.event
|
||||||
local body = netData.data
|
local body = netData.data
|
||||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||||
--设置断点信息
|
--设置断点信息
|
||||||
local function setB()
|
local function setB()
|
||||||
|
|
@ -2029,7 +2017,7 @@ local function debugger_loop(server)
|
||||||
xpcall(
|
xpcall(
|
||||||
setB,
|
setB,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||||
|
|
@ -2041,7 +2029,7 @@ local function debugger_loop(server)
|
||||||
LuaDebugger.currentDebuggerData = nil
|
LuaDebugger.currentDebuggerData = nil
|
||||||
LuaDebugger.Run = true
|
LuaDebugger.Run = true
|
||||||
LuaDebugger.tempRunFlag = true
|
LuaDebugger.tempRunFlag = true
|
||||||
LuaDebugger.currentLine= nil
|
LuaDebugger.currentLine = nil
|
||||||
local data = coroutine.yield()
|
local data = coroutine.yield()
|
||||||
LuaDebugger.serVarLevel = 4
|
LuaDebugger.serVarLevel = 4
|
||||||
LuaDebugger.currentDebuggerData = data
|
LuaDebugger.currentDebuggerData = data
|
||||||
|
|
@ -2142,42 +2130,37 @@ local function debugger_loop(server)
|
||||||
end
|
end
|
||||||
coro_debugger = coroutine.create(debugger_loop)
|
coro_debugger = coroutine.create(debugger_loop)
|
||||||
debug_hook = function(event, line)
|
debug_hook = function(event, line)
|
||||||
|
if (not LuaDebugger.isHook) then
|
||||||
if(not LuaDebugger.isHook) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.Run) then
|
if (LuaDebugger.Run) then
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
local isCheck = false
|
local isCheck = false
|
||||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||||
|
|
||||||
for bk, linesInfo in pairs(breakInfo) 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
|
isCheck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(isCheck) then
|
if (isCheck) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not isCheck) then
|
if (not isCheck) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local file = nil
|
local file = nil
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
|
|
||||||
local funs = nil
|
local funs = nil
|
||||||
local funlength =0
|
local funlength = 0
|
||||||
if(LuaDebugger.currentDebuggerData) then
|
if (LuaDebugger.currentDebuggerData) then
|
||||||
funs = LuaDebugger.currentDebuggerData.funcs
|
funs = LuaDebugger.currentDebuggerData.funcs
|
||||||
funlength = #funs
|
funlength = #funs
|
||||||
end
|
end
|
||||||
|
|
@ -2185,47 +2168,44 @@ debug_hook = function(event, line)
|
||||||
local tempFunc = stepInfo.func
|
local tempFunc = stepInfo.func
|
||||||
local source = stepInfo.source
|
local source = stepInfo.source
|
||||||
file = getSource(source);
|
file = getSource(source);
|
||||||
if(source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
if (source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||||
if(funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
if (funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount+1
|
LuaDebugger.runLineCount = LuaDebugger.runLineCount + 1
|
||||||
end
|
end
|
||||||
local breakInfo = LuaDebugger.breakInfos[file]
|
local breakInfo = LuaDebugger.breakInfos[file]
|
||||||
local breakData = nil
|
local breakData = nil
|
||||||
local ischeck = false
|
local ischeck = false
|
||||||
if(breakInfo) then
|
if (breakInfo) then
|
||||||
|
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
if(lines and lines[line]) then
|
if (lines and lines[line]) then
|
||||||
ischeck = true
|
ischeck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local isHit = false
|
local isHit = false
|
||||||
if(ischeck) then
|
if (ischeck) then
|
||||||
|
|
||||||
--并且在断点中
|
--并且在断点中
|
||||||
local info = stepInfo
|
local info = stepInfo
|
||||||
local source = string.lower( info.source )
|
local source = string.lower(info.source)
|
||||||
local fullName,dir,fileName = debugger_getFilePathInfo(source)
|
local fullName, dir, fileName = debugger_getFilePathInfo(source)
|
||||||
local hitPathNames = splitFilePath(fullName)
|
local hitPathNames = splitFilePath(fullName)
|
||||||
|
|
||||||
local hitCounts = {}
|
local hitCounts = {}
|
||||||
local debugHitCounts = nil
|
local debugHitCounts = nil
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
|
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
local pathNames = lineInfo.pathNames
|
local pathNames = lineInfo.pathNames
|
||||||
debugHitCounts = lineInfo.hitCounts
|
debugHitCounts = lineInfo.hitCounts
|
||||||
if(lines and lines[line]) then
|
if (lines and lines[line]) then
|
||||||
breakData = lines[line]
|
breakData = lines[line]
|
||||||
--判断路径
|
--判断路径
|
||||||
hitCounts[k] = 0
|
hitCounts[k] = 0
|
||||||
local hitPathNamesCount = #hitPathNames
|
local hitPathNamesCount = #hitPathNames
|
||||||
local pathNamesCount = #pathNames
|
local pathNamesCount = #pathNames
|
||||||
local checkCount = 0;
|
local checkCount = 0;
|
||||||
while(true) do
|
while (true) do
|
||||||
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|
@ -2233,57 +2213,55 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
pathNamesCount = pathNamesCount - 1
|
pathNamesCount = pathNamesCount - 1
|
||||||
hitPathNamesCount = hitPathNamesCount - 1
|
hitPathNamesCount = hitPathNamesCount - 1
|
||||||
checkCount = checkCount+1
|
checkCount = checkCount + 1
|
||||||
if(pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(checkCount>0) then
|
if (checkCount > 0) then
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
breakData = nil
|
breakData = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(breakData) then
|
if (breakData) then
|
||||||
local hitFieName = ""
|
local hitFieName = ""
|
||||||
local maxCount = 0
|
local maxCount = 0
|
||||||
for k, v in pairs(hitCounts) do
|
for k, v in pairs(hitCounts) do
|
||||||
if(v > maxCount) then
|
if (v > maxCount) then
|
||||||
maxCount = v
|
maxCount = v
|
||||||
hitFieName = k;
|
hitFieName = k;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local hitPathNamesLength = #hitPathNames
|
local hitPathNamesLength = #hitPathNames
|
||||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||||
if(hitFieName ~= "") then
|
if (hitFieName ~= "") then
|
||||||
|
|
||||||
local hitCount = breakData.hitCondition
|
local hitCount = breakData.hitCondition
|
||||||
local clientHitCount = debugHitCounts[breakData.line]
|
local clientHitCount = debugHitCounts[breakData.line]
|
||||||
clientHitCount = clientHitCount + 1
|
clientHitCount = clientHitCount + 1
|
||||||
debugHitCounts[breakData.line] = clientHitCount
|
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
|
LuaDebugger.runLineCount = 0
|
||||||
elseif(LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
elseif (LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.tempRunFlag = nil
|
LuaDebugger.tempRunFlag = nil
|
||||||
elseif(clientHitCount >= hitCount) then
|
elseif (clientHitCount >= hitCount) then
|
||||||
isHit = true
|
isHit = true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(LuaDebugger.StepOut) then
|
if (LuaDebugger.StepOut) then
|
||||||
if(funlength == 1) then
|
if (funlength == 1) then
|
||||||
ResetDebugInfo();
|
ResetDebugInfo();
|
||||||
LuaDebugger.Run = true
|
LuaDebugger.Run = true
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if(funs[2] == tempFunc) then
|
if (funs[2] == tempFunc) then
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||||
-- print("StepIn 挂起")
|
-- -- print("StepIn 挂起")
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
|
|
@ -2292,35 +2270,34 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.StepIn) then
|
if (LuaDebugger.StepIn) then
|
||||||
if(funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
if (funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||||
-- print("StepIn 挂起")
|
-- -- print("StepIn 挂起")
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.StepNext ) then
|
if (LuaDebugger.StepNext) then
|
||||||
local isNext = false
|
local isNext = false
|
||||||
if(funs) then
|
if (funs) then
|
||||||
for i,f in ipairs(funs) do
|
for i, f in ipairs(funs) do
|
||||||
if(tempFunc == f) then
|
if (tempFunc == f) then
|
||||||
if(LuaDebugger.currentLine == line) then
|
if (LuaDebugger.currentLine == line) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
isNext =true
|
isNext = true
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
isNext = true
|
||||||
isNext =true
|
|
||||||
end
|
end
|
||||||
if(isNext) then
|
if (isNext) then
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.currentLine = line
|
LuaDebugger.currentLine = line
|
||||||
|
|
@ -2335,17 +2312,15 @@ debug_hook = function(event, line)
|
||||||
|
|
||||||
|
|
||||||
--断点判断
|
--断点判断
|
||||||
if(isHit) then
|
if (isHit) then
|
||||||
|
|
||||||
|
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.currentLine = line
|
LuaDebugger.currentLine = line
|
||||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(3, sevent)
|
local data = debugger_stackInfo(3, sevent)
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
if(breakData and breakData.condition) then
|
if (breakData and breakData.condition) then
|
||||||
debugger_conditionStr(breakData.condition,data.vars,function()
|
debugger_conditionStr(breakData.condition, data.vars, function()
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
end)
|
end)
|
||||||
|
|
@ -2362,7 +2337,7 @@ end
|
||||||
local function debugger_xpcall()
|
local function debugger_xpcall()
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
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
|
data.stack[1].isXpCall = true
|
||||||
end
|
end
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
|
|
@ -2371,12 +2346,11 @@ local function debugger_xpcall()
|
||||||
end
|
end
|
||||||
--调试开始
|
--调试开始
|
||||||
local function start()
|
local function start()
|
||||||
|
|
||||||
local socket = createSocket()
|
local socket = createSocket()
|
||||||
print(controller_host)
|
-- print(controller_host)
|
||||||
print(controller_port)
|
-- print(controller_port)
|
||||||
|
|
||||||
local fullName,dirName,fileName = debugger_getFilePathInfo(getinfo(1).source)
|
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||||
LuaDebugger.DebugLuaFie = fileName
|
LuaDebugger.DebugLuaFie = fileName
|
||||||
local server = socket.connect(controller_host, controller_port)
|
local server = socket.connect(controller_host, controller_port)
|
||||||
debug_server = server;
|
debug_server = server;
|
||||||
|
|
@ -2384,7 +2358,7 @@ local function start()
|
||||||
--创建breakInfo socket
|
--创建breakInfo socket
|
||||||
socket = createSocket()
|
socket = createSocket()
|
||||||
breakInfoSocket = socket.connect(controller_host, controller_port)
|
breakInfoSocket = socket.connect(controller_host, controller_port)
|
||||||
if(breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
breakInfoSocket:settimeout(0)
|
breakInfoSocket:settimeout(0)
|
||||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
||||||
name = "breakPointSocket"
|
name = "breakPointSocket"
|
||||||
|
|
@ -2399,46 +2373,41 @@ local function start()
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
sethook(debug_hook, "lrc")
|
sethook(debug_hook, "lrc")
|
||||||
end, function(error)
|
end, function(error)
|
||||||
print("error:", error)
|
-- print("error:", error)
|
||||||
end)
|
end)
|
||||||
if(not jit) then
|
if (not jit) then
|
||||||
if(_VERSION)then
|
if (_VERSION) then
|
||||||
print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
-- print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||||
else
|
else
|
||||||
print("当前为lua版本,请使用LuaDebug 进行调试!")
|
-- print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
_resume(coro_debugger, server)
|
_resume(coro_debugger, server)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function StartDebug(host, port)
|
function StartDebug(host, port)
|
||||||
|
if (not host) then
|
||||||
|
-- print("error host nil")
|
||||||
if(not host) then
|
|
||||||
print("error host nil")
|
|
||||||
end
|
end
|
||||||
if(not port) then
|
if (not port) then
|
||||||
print("error prot nil")
|
-- print("error prot nil")
|
||||||
end
|
end
|
||||||
if(type(host) ~= "string") then
|
if (type(host) ~= "string") then
|
||||||
print("error host not string")
|
-- print("error host not string")
|
||||||
end
|
end
|
||||||
if(type(port) ~= "number") then
|
if (type(port) ~= "number") then
|
||||||
print("error host not number")
|
-- print("error host not number")
|
||||||
end
|
end
|
||||||
controller_host = host
|
controller_host = host
|
||||||
controller_port = port
|
controller_port = port
|
||||||
xpcall(start, function(error)
|
xpcall(start, function(error)
|
||||||
-- body
|
-- body
|
||||||
print(error)
|
-- print(error)
|
||||||
end)
|
end)
|
||||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--base64
|
--base64
|
||||||
|
|
||||||
local string = string
|
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',
|
'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',
|
'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', '+', '/',
|
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||||
};
|
};
|
||||||
ZZBase64.__decode = {}
|
ZZBase64.__decode = {}
|
||||||
for k,v in pairs(ZZBase64.__code) do
|
for k, v in pairs(ZZBase64.__code) do
|
||||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.encode(text)
|
function ZZBase64.encode(text)
|
||||||
|
|
@ -2461,14 +2430,14 @@ function ZZBase64.encode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for i = 1, len, 3 do
|
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 b = string.byte(text, i + 1)
|
||||||
local c = string.byte(text, i + 2)
|
local c = string.byte(text, i + 2)
|
||||||
-- num = a<<16 + b<<8 + c
|
-- num = a<<16 + b<<8 + c
|
||||||
local num = a * 65536 + b * 256 + c
|
local num = a * 65536 + b * 256 + c
|
||||||
for j = 1, 4 do
|
for j = 1, 4 do
|
||||||
--tmp = num >> ((4 -j) * 6)
|
--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
|
--curPos = tmp&0x3f
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2505,13 +2474,13 @@ function ZZBase64.__left2(res, index, text, len)
|
||||||
res[index + 3] = "="
|
res[index + 3] = "="
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.__left1(res, index,text, len)
|
function ZZBase64.__left1(res, index, text, len)
|
||||||
local num = string.byte(text, len + 1)
|
local num = string.byte(text, len + 1)
|
||||||
num = num * 16
|
num = num * 16
|
||||||
|
|
||||||
local tmp = math.floor(num / 64)
|
local tmp = math.floor(num / 64)
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index ] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
||||||
curPos = num % 64 + 1
|
curPos = num % 64 + 1
|
||||||
res[index + 1] = ZZBase64.__code[curPos]
|
res[index + 1] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2534,11 +2503,11 @@ function ZZBase64.decode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
local decode = ZZBase64.__decode
|
local decode = ZZBase64.__decode
|
||||||
for i =1, len, 4 do
|
for i = 1, len, 4 do
|
||||||
local a = decode[string.byte(text,i )]
|
local a = decode[string.byte(text, i)]
|
||||||
local b = decode[string.byte(text,i + 1)]
|
local b = decode[string.byte(text, i + 1)]
|
||||||
local c = decode[string.byte(text,i + 2)]
|
local c = decode[string.byte(text, i + 2)]
|
||||||
local d = decode[string.byte(text,i + 3)]
|
local d = decode[string.byte(text, i + 3)]
|
||||||
|
|
||||||
--num = a<<18 + b<<12 + c<<6 + d
|
--num = a<<18 + b<<12 + c<<6 + d
|
||||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||||
|
|
@ -2547,7 +2516,7 @@ function ZZBase64.decode(text)
|
||||||
num = math.floor(num / 256)
|
num = math.floor(num / 256)
|
||||||
local f = string.char(num % 256)
|
local f = string.char(num % 256)
|
||||||
num = math.floor(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 + 1] = f
|
||||||
res[index + 2] = e
|
res[index + 2] = e
|
||||||
index = index + 3
|
index = index + 3
|
||||||
|
|
@ -2583,7 +2552,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
||||||
res[index] = string.char(num)
|
res[index] = string.char(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return StartDebug
|
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()
|
local timer = Timer.New(function()
|
||||||
breakSocketHandle() end, 1, -1, false)
|
breakSocketHandle()
|
||||||
|
end, 1, -1, false)
|
||||||
timer:Start();
|
timer:Start();
|
||||||
|
|
||||||
require "Core.init"
|
require "Core.init"
|
||||||
json = require 'cjson'
|
json = require 'cjson'
|
||||||
require'FairyGUI'
|
require 'FairyGUI'
|
||||||
require'Game.ControllerManager'
|
require 'Game.ControllerManager'
|
||||||
require'Game.ViewManager'
|
require 'Game.ViewManager'
|
||||||
require'Game.DataManager'
|
require 'Game.DataManager'
|
||||||
require "Game.ExtendManager"
|
require "Game.ExtendManager"
|
||||||
require "Game.ExtendHotupdate"
|
require "Game.ExtendHotupdate"
|
||||||
require "TableData"
|
require "TableData"
|
||||||
|
|
@ -19,7 +20,7 @@ Utils = Game.Utils
|
||||||
PlayerPrefs = UnityEngine.PlayerPrefs
|
PlayerPrefs = UnityEngine.PlayerPrefs
|
||||||
RuntimePlatform = UnityEngine.RuntimePlatform
|
RuntimePlatform = UnityEngine.RuntimePlatform
|
||||||
Application = UnityEngine.Application
|
Application = UnityEngine.Application
|
||||||
Screen=UnityEngine.Screen
|
Screen = UnityEngine.Screen
|
||||||
ResourcesManager = taurus.unity.ResourcesManager
|
ResourcesManager = taurus.unity.ResourcesManager
|
||||||
-- require 'tolua.reflection'
|
-- require 'tolua.reflection'
|
||||||
-- tolua.loadassembly('Assembly-CSharp')
|
-- tolua.loadassembly('Assembly-CSharp')
|
||||||
|
|
@ -31,21 +32,22 @@ local _game_info
|
||||||
local panel = nil
|
local panel = nil
|
||||||
|
|
||||||
|
|
||||||
oldGameVersion=2 --1 原始 2 老游戏新加功能
|
oldGameVersion = 2 --1 原始 2 老游戏新加功能
|
||||||
|
|
||||||
--主入口函数。从这里开始lua逻辑
|
--主入口函数。从这里开始lua逻辑
|
||||||
function Main()
|
function Main()
|
||||||
--PlayerPrefs.DeleteKey('session_id')
|
--PlayerPrefs.DeleteKey('session_id')
|
||||||
Application.targetFrameRate = 60
|
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.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("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
|
||||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
||||||
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
||||||
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
||||||
--pt(_game_info)
|
--pt(_game_info)
|
||||||
debug_print = false--GetGameInfo("debug_print")
|
debug_print = false --GetGameInfo("debug_print")
|
||||||
if Application.platform == RuntimePlatform.WindowsEditor then
|
if Application.platform == RuntimePlatform.WindowsEditor then
|
||||||
debug_print = true
|
debug_print = true
|
||||||
end
|
end
|
||||||
|
|
@ -89,10 +91,8 @@ function Main()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function GetGameInfo(key)
|
function GetGameInfo(key)
|
||||||
return _game_info[key]
|
return _game_info[key]
|
||||||
end
|
end
|
||||||
|
|
@ -107,7 +107,7 @@ function GetGameInfoPlatform(key)
|
||||||
return _platfrom[key]
|
return _platfrom[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
function BlurView(view,enabled)
|
function BlurView(view, enabled)
|
||||||
if enabled then
|
if enabled then
|
||||||
local bf = FairyGUI.BlurFilter()
|
local bf = FairyGUI.BlurFilter()
|
||||||
bf.blurSize = 0.05
|
bf.blurSize = 0.05
|
||||||
|
|
@ -142,7 +142,7 @@ function ShareScreenShot(n, callback)
|
||||||
json_data["mediaObject"] = mediaObject
|
json_data["mediaObject"] = mediaObject
|
||||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||||
json_data["scene"] = 0
|
json_data["scene"] = 0
|
||||||
local json_str =json.encode(json_data)
|
local json_str = json.encode(json_data)
|
||||||
TakeScreenShot.Take(function()
|
TakeScreenShot.Take(function()
|
||||||
-- 1微信 2支付宝
|
-- 1微信 2支付宝
|
||||||
GameApplication.Instance:ShareLink(n or 1, json_str, nil)
|
GameApplication.Instance:ShareLink(n or 1, json_str, nil)
|
||||||
|
|
@ -152,44 +152,43 @@ function ShareScreenShot(n, callback)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function shareQRCodePicture(url,secene)
|
function shareQRCodePicture(url, secene)
|
||||||
--print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
print(url)
|
-- print(url)
|
||||||
print(secene)
|
-- print(secene)
|
||||||
local json_data = {}
|
local json_data = {}
|
||||||
json_data["title"] = "湘北联赛"
|
json_data["title"] = "湘北联赛"
|
||||||
local mediaObject = {}
|
local mediaObject = {}
|
||||||
local filename = "qrcode" .. DataManager.SelfUser.account_id
|
local filename = "qrcode" .. DataManager.SelfUser.account_id
|
||||||
print(Application.persistentDataPath)
|
-- print(Application.persistentDataPath)
|
||||||
mediaObject["path"] = Application.persistentDataPath
|
mediaObject["path"] = Application.persistentDataPath
|
||||||
mediaObject["filename"] = filename
|
mediaObject["filename"] = filename
|
||||||
mediaObject["type"] = 1
|
mediaObject["type"] = 1
|
||||||
json_data["mediaObject"] = mediaObject
|
json_data["mediaObject"] = mediaObject
|
||||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||||
json_data["scene"] = secene
|
json_data["scene"] = secene
|
||||||
print("json_data==================")
|
-- print("json_data==================")
|
||||||
local json_str = json.encode(json_data)
|
local json_str = json.encode(json_data)
|
||||||
pt(json_str)
|
pt(json_str)
|
||||||
local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250)
|
local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250)
|
||||||
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png",typeof(UnityEngine.Texture2D))
|
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png", typeof(UnityEngine.Texture2D))
|
||||||
filename = filename ..".jpg"
|
filename = filename .. ".jpg"
|
||||||
print("text2==========")
|
-- print("text2==========")
|
||||||
print(tex2)
|
-- print(tex2)
|
||||||
print("text1==========")
|
-- print("text1==========")
|
||||||
print(tex1)
|
-- print(tex1)
|
||||||
print("filename==========")
|
-- print("filename==========")
|
||||||
print(filename)
|
-- print(filename)
|
||||||
QRCodePicture.CombanitePicture(tex1,tex2,393,1334-802-250,filename)
|
QRCodePicture.CombanitePicture(tex1, tex2, 393, 1334 - 802 - 250, filename)
|
||||||
|
|
||||||
GameApplication.Instance:ShareLink(1, json_str, nil)
|
GameApplication.Instance:ShareLink(1, json_str, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name)
|
function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function UISetController(root,controller_name, gear_display, selectedIndex)
|
function UISetController(root, controller_name, gear_display, selectedIndex)
|
||||||
local ctr = root:GetController(controller_name)
|
local ctr = root:GetController(controller_name)
|
||||||
local gear = gear_display:GetGear(0)
|
local gear = gear_display:GetGear(0)
|
||||||
|
|
||||||
|
|
@ -202,9 +201,9 @@ local bg_url = nil
|
||||||
function LoadGameBg(url, main_view)
|
function LoadGameBg(url, main_view)
|
||||||
local win_mode = main_view:GetChild("win_mode")
|
local win_mode = main_view:GetChild("win_mode")
|
||||||
win_mode:RemoveChildren(0, -1, true)
|
win_mode:RemoveChildren(0, -1, true)
|
||||||
local tex_bg = ResourcesManager.LoadObjectByGroup(url..".png",typeof(UnityEngine.Texture), url)
|
local tex_bg = ResourcesManager.LoadObjectByGroup(url .. ".png", typeof(UnityEngine.Texture), url)
|
||||||
print("===========================mainbg")
|
-- print("===========================mainbg")
|
||||||
print(url..".png",typeof(UnityEngine.Texture), url)
|
-- print(url..".png",typeof(UnityEngine.Texture), url)
|
||||||
local bg = GImage()
|
local bg = GImage()
|
||||||
bg.texture = FairyGUI.NTexture(tex_bg)
|
bg.texture = FairyGUI.NTexture(tex_bg)
|
||||||
bg.width = win_mode.width
|
bg.width = win_mode.width
|
||||||
|
|
@ -225,7 +224,7 @@ function AddPanel(child)
|
||||||
panel:AddChild(child)
|
panel:AddChild(child)
|
||||||
end
|
end
|
||||||
|
|
||||||
function AddPanelAt(child,index)
|
function AddPanelAt(child, index)
|
||||||
child:MakeFullScreen()
|
child:MakeFullScreen()
|
||||||
child:AddRelation(GRoot.inst, RelationType.Size)
|
child:AddRelation(GRoot.inst, RelationType.Size)
|
||||||
panel:AddChildAt(child, index)
|
panel:AddChildAt(child, index)
|
||||||
|
|
@ -261,118 +260,111 @@ function OnApplicationActive()
|
||||||
ViewManager.OnApplicationActive()
|
ViewManager.OnApplicationActive()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function pt(...)
|
function pt(...)
|
||||||
if debug_print then
|
if debug_print then
|
||||||
local arg={...}
|
local arg = { ... }
|
||||||
local has=false
|
local has = false
|
||||||
for _,v in pairs(arg) do
|
for _, v in pairs(arg) do
|
||||||
if v and type(v)=="table" then
|
if v and type(v) == "table" then
|
||||||
has=true
|
has = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not has then
|
if not has then
|
||||||
print(...)
|
-- print(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local content=""
|
local content = ""
|
||||||
for _,v in pairs(arg) do
|
for _, v in pairs(arg) do
|
||||||
if v=="table" then
|
if v == "table" then
|
||||||
content=content..tostring(v).."\n"
|
content = content .. tostring(v) .. "\n"
|
||||||
else
|
else
|
||||||
content=content.."==>[T]:"..LuaPrint(v,limit),debug.traceback().."\n"
|
content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n"
|
||||||
end
|
end
|
||||||
print(content)
|
-- print(content)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function LuaPrint(lua_table, limit, indent, step)
|
||||||
function LuaPrint(lua_table,limit,indent,step)
|
step = step or 0
|
||||||
step=step or 0
|
indent = indent or 0
|
||||||
indent=indent or 0
|
local content = ""
|
||||||
local content=""
|
if limit ~= nil then
|
||||||
if limit~=nil then
|
if step > limit then
|
||||||
if step>limit then
|
|
||||||
return "..."
|
return "..."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if step>10 then
|
if step > 10 then
|
||||||
return content.."..."
|
return content .. "..."
|
||||||
end
|
end
|
||||||
if lua_table==nil then
|
if lua_table == nil then
|
||||||
return "nil"
|
return "nil"
|
||||||
end
|
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)
|
return tostring(lua_table)
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(lua_table)=="string" or type(lua_table)=="number" then
|
if type(lua_table) == "string" or type(lua_table) == "number" then
|
||||||
return "[No-Table]:"..lua_table
|
return "[No-Table]:" .. lua_table
|
||||||
end
|
end
|
||||||
|
|
||||||
for k,v in pairs(lua_table) do
|
for k, v in pairs(lua_table) do
|
||||||
if k~="_class_type" then
|
if k ~= "_class_type" then
|
||||||
local szBuffer=""
|
local szBuffer = ""
|
||||||
Typev=type(v)
|
Typev = type(v)
|
||||||
if Typev =="table" then
|
if Typev == "table" then
|
||||||
szBuffer="{"
|
szBuffer = "{"
|
||||||
end
|
end
|
||||||
local szPrefix=string.rep(" ",indent)
|
local szPrefix = string.rep(" ", indent)
|
||||||
if Typev=="table" and v._fields then
|
if Typev == "table" and v._fields then
|
||||||
local kk,vv=next(v._fields)
|
local kk, vv = next(v._fields)
|
||||||
if type(vv)=="table" then
|
if type(vv) == "table" then
|
||||||
content=content.."\n\t"..kk.name.."={"..LuaPrint(vv._fields,5,indent+1,step+1).."}"
|
content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) ..
|
||||||
|
"}"
|
||||||
else
|
else
|
||||||
content=content.."\n\t"..kk.name.."="..vv
|
content = content .. "\n\t" .. kk.name .. "=" .. vv
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if type(k)=="table" then
|
if type(k) == "table" then
|
||||||
if k.name then
|
if k.name then
|
||||||
if type(v)~="table" then
|
if type(v) ~= "table" then
|
||||||
content=content.."\n"..k.name.."="..v
|
content = content .. "\n" .. k.name .. "=" .. v
|
||||||
else
|
else
|
||||||
content=content.."\n"..k.name.." = list:"
|
content = content .. "\n" .. k.name .. " = list:"
|
||||||
local tmp="\n"
|
local tmp = "\n"
|
||||||
for ka,va in ipairs(v) do
|
for ka, va in ipairs(v) do
|
||||||
tmp=tmp.."#"..ka.."_"..tostring(va)
|
tmp = tmp .. "#" .. ka .. "_" .. tostring(va)
|
||||||
end
|
end
|
||||||
content=content..tmp
|
content = content .. tmp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif type(k) == "function" then
|
||||||
elseif type(k)=="function" then
|
content = content .. "\n fun=function"
|
||||||
content=content.."\n fun=function"
|
|
||||||
else
|
else
|
||||||
formatting=szPrefix..tostring(k).." = "..szBuffer
|
formatting = szPrefix .. tostring(k) .. " = " .. szBuffer
|
||||||
if Typev=="table" then
|
if Typev == "table" then
|
||||||
content=content.."\n"..formatting
|
content = content .. "\n" .. formatting
|
||||||
content=content..LuaPrint(v,limit,indent+1,step+1)
|
content = content .. LuaPrint(v, limit, indent + 1, step + 1)
|
||||||
content=content.."\n"..szPrefix.."},"
|
content = content .. "\n" .. szPrefix .. "},"
|
||||||
else
|
else
|
||||||
local szValue=""
|
local szValue = ""
|
||||||
if Typev=="string" then
|
if Typev == "string" then
|
||||||
szValue=string.format("%q",v)
|
szValue = string.format("%q", v)
|
||||||
else
|
else
|
||||||
szValue=tostring(v)
|
szValue = tostring(v)
|
||||||
end
|
end
|
||||||
content=content.."\n"..formatting..(szValue or "nil")..","
|
content = content .. "\n" .. formatting .. (szValue or "nil") .. ","
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return content
|
return content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function printlog(...)
|
function printlog(...)
|
||||||
if debug_print then
|
if debug_print then
|
||||||
print(...)
|
-- print(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local debugger_reLoadFile =nil
|
local debugger_reLoadFile = nil
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
debugger_reLoadFile = require("luaideReLoadFile")
|
debugger_reLoadFile = require("luaideReLoadFile")
|
||||||
end,function()
|
end, function()
|
||||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||||
end)
|
end)
|
||||||
local debugger_stackInfo = nil
|
local debugger_stackInfo = nil
|
||||||
|
|
@ -392,6 +392,7 @@ local function createJson()
|
||||||
function json.null()
|
function json.null()
|
||||||
return json.null -- so json.null() will also return null ;-)
|
return json.null -- so json.null() will also return null ;-)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Internal, PRIVATE functions.
|
-- Internal, PRIVATE functions.
|
||||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
-- 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
|
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||||
-- scanned.
|
-- scanned.
|
||||||
function decode_scanConstant(s, startPos)
|
function decode_scanConstant(s, startPos)
|
||||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||||
local constNames = {"true", "false", "null"}
|
local constNames = { "true", "false", "null" }
|
||||||
|
|
||||||
for i, k in pairs(constNames) do
|
for i, k in pairs(constNames) do
|
||||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||||
|
|
@ -776,17 +777,17 @@ function print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 1}
|
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
|
|
@ -800,46 +801,48 @@ function luaIdePrintWarn(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 2}
|
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function luaIdePrintErr(...)
|
function luaIdePrintErr(...)
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||||
debugger_print(...)
|
debugger_print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 3}
|
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
--@region 辅助方法
|
--@region 辅助方法
|
||||||
|
|
@ -977,7 +980,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
return tostring(v)
|
return tostring(v)
|
||||||
end
|
end
|
||||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
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)
|
local function _dump(value, desciption, indent, nest, keylen)
|
||||||
desciption = desciption or "<var>"
|
desciption = desciption or "<var>"
|
||||||
local spc = ""
|
local spc = ""
|
||||||
|
|
@ -1026,7 +1029,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
end
|
end
|
||||||
_dump(value, desciption, "- ", 1)
|
_dump(value, desciption, "- ", 1)
|
||||||
for i, line in ipairs(result) do
|
for i, line in ipairs(result) do
|
||||||
print(line)
|
-- print(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
@ -1035,9 +1038,7 @@ local function debugger_valueToString(v)
|
||||||
local vstr = nil
|
local vstr = nil
|
||||||
if (vtype == "userdata") then
|
if (vtype == "userdata") then
|
||||||
if (LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
|
return "userdata", vtype
|
||||||
return "userdata",vtype
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
end
|
end
|
||||||
|
|
@ -1045,11 +1046,11 @@ local function debugger_valueToString(v)
|
||||||
local value = vtype
|
local value = vtype
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
value = tostring(v)
|
value = tostring(v)
|
||||||
end,function()
|
end, function()
|
||||||
value = vtype
|
value = vtype
|
||||||
end)
|
end)
|
||||||
return value, vtype
|
return value, vtype
|
||||||
elseif (vtype == "number" or vtype == "string" ) then
|
elseif (vtype == "number" or vtype == "string") then
|
||||||
return v, vtype
|
return v, vtype
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
|
|
@ -1057,12 +1058,12 @@ local function debugger_valueToString(v)
|
||||||
end
|
end
|
||||||
local function debugger_setVarInfo(name, value)
|
local function debugger_setVarInfo(name, value)
|
||||||
local valueStr, valueType = debugger_valueToString(value)
|
local valueStr, valueType = debugger_valueToString(value)
|
||||||
local nameStr,nameType = debugger_valueToString(name)
|
local nameStr, nameType = debugger_valueToString(name)
|
||||||
if(valueStr == nil) then
|
if (valueStr == nil) then
|
||||||
valueStr = valueType
|
valueStr = valueType
|
||||||
end
|
end
|
||||||
local valueInfo = {
|
local valueInfo = {
|
||||||
name =nameStr,
|
name = nameStr,
|
||||||
valueType = valueType,
|
valueType = valueType,
|
||||||
valueStr = ZZBase64.encode(valueStr)
|
valueStr = ZZBase64.encode(valueStr)
|
||||||
}
|
}
|
||||||
|
|
@ -1100,7 +1101,7 @@ local function debugger_getvalue(f)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return {locals = locals, ups = ups}
|
return { locals = locals, ups = ups }
|
||||||
end
|
end
|
||||||
--获取堆栈
|
--获取堆栈
|
||||||
debugger_stackInfo =
|
debugger_stackInfo =
|
||||||
|
|
@ -1146,7 +1147,7 @@ debugger_stackInfo =
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||||
local data = {
|
local data = {
|
||||||
stack = stackInfo.stack,
|
stack = stackInfo.stack,
|
||||||
vars = stackInfo.vars,
|
vars = stackInfo.vars,
|
||||||
|
|
@ -1157,7 +1158,7 @@ debugger_stackInfo =
|
||||||
}
|
}
|
||||||
LuaDebugger.currentTempFunc = data.funcs[1]
|
LuaDebugger.currentTempFunc = data.funcs[1]
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
--===========================点断信息==================================================
|
--===========================点断信息==================================================
|
||||||
--根据不同的游戏引擎进行定时获取断点信息
|
--根据不同的游戏引擎进行定时获取断点信息
|
||||||
|
|
@ -1167,12 +1168,12 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
if (jit) then
|
if (jit) then
|
||||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||||
print(msg)
|
-- print(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
local msg, status = breakInfoSocket:receive()
|
local msg, status = breakInfoSocket:receive()
|
||||||
if(LuaDebugger.isLaunch and status == "closed") then
|
if (LuaDebugger.isLaunch and status == "closed") then
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
if (msg) then
|
if (msg) then
|
||||||
|
|
@ -1182,12 +1183,12 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||||
LuaDebugger.loadScriptBody = netData.data
|
LuaDebugger.loadScriptBody = netData.data
|
||||||
debugger_exeLuaString()
|
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
|
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||||
LuaDebugger.reLoadFileBody = netData.data
|
LuaDebugger.reLoadFileBody = netData.data
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
breakInfoSocket,
|
breakInfoSocket,
|
||||||
|
|
@ -1290,7 +1291,7 @@ debugger_setBreak =
|
||||||
end
|
end
|
||||||
LuaDebugger.isHook = false
|
LuaDebugger.isHook = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function debugger_checkFileIsBreak(fileName)
|
local function debugger_checkFileIsBreak(fileName)
|
||||||
return LuaDebugger.breakInfos[fileName]
|
return LuaDebugger.breakInfos[fileName]
|
||||||
end
|
end
|
||||||
|
|
@ -1322,7 +1323,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. condition)
|
local fun = loadstring("return " .. condition)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
return fun()
|
return fun()
|
||||||
|
|
@ -1332,21 +1333,20 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (status and msg) then
|
if (status and msg) then
|
||||||
callBack()
|
callBack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--执行lua字符串
|
--执行lua字符串
|
||||||
debugger_exeLuaString = function()
|
debugger_exeLuaString = function()
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
|
|
||||||
local script = LuaDebugger.loadScriptBody.script
|
local script = LuaDebugger.loadScriptBody.script
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
local currentTabble = {_G = _G}
|
local currentTabble = { _G = _G }
|
||||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||||
frameId = frameId
|
frameId = frameId
|
||||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||||
|
|
@ -1359,7 +1359,7 @@ debugger_exeLuaString = function()
|
||||||
for k, v in pairs(locals) do
|
for k, v in pairs(locals) do
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
|
|
||||||
local fun = loadstring(script)
|
local fun = loadstring(script)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
|
|
@ -1374,50 +1374,47 @@ debugger_exeLuaString = function()
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
|
|
||||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
LuaDebugger.loadScriptBody.script = nil
|
LuaDebugger.loadScriptBody.script = nil
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||||
|
.C2S_HITBreakPoint)
|
||||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||||
end
|
end
|
||||||
LuaDebugger.loadScriptBody.complete = true
|
LuaDebugger.loadScriptBody.complete = true
|
||||||
|
|
||||||
end
|
end
|
||||||
--@region 调试中修改变量值
|
--@region 调试中修改变量值
|
||||||
|
|
||||||
|
|
||||||
--根据key 值在 value 查找
|
--根据key 值在 value 查找
|
||||||
local function debugger_getTablekey(key,keyType,value)
|
local function debugger_getTablekey(key, keyType, value)
|
||||||
if(keyType == -1) then
|
if (keyType == -1) then
|
||||||
return key
|
return key
|
||||||
elseif(keyType == 1) then
|
elseif (keyType == 1) then
|
||||||
return tonumber(key)
|
return tonumber(key)
|
||||||
elseif(keyType == 2) then
|
elseif (keyType == 2) then
|
||||||
local valueKey = nil
|
local valueKey = nil
|
||||||
for k,v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
local nameType = type(k)
|
local nameType = type(k)
|
||||||
if(nameType == "userdata" or nameType == "table") then
|
if (nameType == "userdata" or nameType == "table") then
|
||||||
if (not LuaDebugger.isFoxGloryProject) then
|
if (not LuaDebugger.isFoxGloryProject) then
|
||||||
valueKey = tostring(k)
|
valueKey = tostring(k)
|
||||||
if(key == valueKey) then
|
if (key == valueKey) then
|
||||||
return k
|
return k
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function debugger_setVarValue(server, data)
|
local function debugger_setVarValue(server, data)
|
||||||
|
|
||||||
local newValue = nil
|
local newValue = nil
|
||||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||||
local firstKeyName = data.keys[1]
|
local firstKeyName = data.keys[1]
|
||||||
--@region vars check
|
--@region vars check
|
||||||
local localValueChangeIndex = -1
|
local localValueChangeIndex = -1
|
||||||
|
|
@ -1432,7 +1429,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(firstKeyName == name) then
|
if (firstKeyName == name) then
|
||||||
localValueChangeIndex = i
|
localValueChangeIndex = i
|
||||||
oldValue = value
|
oldValue = value
|
||||||
end
|
end
|
||||||
|
|
@ -1450,7 +1447,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||||
upValueFun = func
|
upValueFun = func
|
||||||
oldValue = value
|
oldValue = value
|
||||||
upValueChangeIndex = i
|
upValueChangeIndex = i
|
||||||
|
|
@ -1462,8 +1459,8 @@ local function debugger_setVarValue(server, data)
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
local vars = {locals = locals, ups = ups}
|
local vars = { locals = locals, ups = ups }
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
local currentTabble = {}
|
local currentTabble = {}
|
||||||
|
|
@ -1480,7 +1477,7 @@ local function debugger_setVarValue(server, data)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. data.value)
|
local fun = loadstring("return " .. data.value)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
newValue = fun()
|
newValue = fun()
|
||||||
|
|
@ -1490,7 +1487,7 @@ local function debugger_setVarValue(server, data)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "============================")
|
-- print(error, "============================")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1499,39 +1496,37 @@ local function debugger_setVarValue(server, data)
|
||||||
-- local 查找并替换
|
-- local 查找并替换
|
||||||
local keyLength = #data.keys
|
local keyLength = #data.keys
|
||||||
|
|
||||||
if(keyLength == 1) then
|
if (keyLength == 1) then
|
||||||
if(localValueChangeIndex ~= -1) then
|
if (localValueChangeIndex ~= -1) then
|
||||||
|
|
||||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||||
elseif(upValueFun ~= nil) then
|
elseif (upValueFun ~= nil) then
|
||||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||||
else
|
else
|
||||||
--全局变量查找
|
--全局变量查找
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
_G[firstKeyName] = newValue
|
_G[firstKeyName] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(not oldValue) then
|
if (not oldValue) then
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
oldValue = _G[firstKeyName]
|
oldValue = _G[firstKeyName]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local tempValue = oldValue
|
local tempValue = oldValue
|
||||||
for i=2,keyLength-1 do
|
for i = 2, keyLength - 1 do
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||||
data.varInfo = varInfo
|
data.varInfo = varInfo
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||||
|
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
@ -1543,41 +1538,41 @@ checkSetVar =
|
||||||
function()
|
function()
|
||||||
if (LuaDebugger.isSetVar) then
|
if (LuaDebugger.isSetVar) then
|
||||||
LuaDebugger.isSetVar = false
|
LuaDebugger.isSetVar = false
|
||||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("设置变量", error)
|
-- print("设置变量", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isLoadLuaScript) then
|
elseif (LuaDebugger.isLoadLuaScript) then
|
||||||
LuaDebugger.isLoadLuaScript = false
|
LuaDebugger.isLoadLuaScript = false
|
||||||
debugger_exeLuaString()
|
debugger_exeLuaString()
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("执行代码", error)
|
-- print("执行代码", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isReLoadFile) then
|
elseif (LuaDebugger.isReLoadFile) then
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("重新加载文件", error)
|
-- print("重新加载文件", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1627,7 +1622,7 @@ local function debugger_getValueByScript(value, script)
|
||||||
val = fun()
|
val = fun()
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "====>")
|
-- print(error, "====>")
|
||||||
val = nil
|
val = nil
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -1894,7 +1889,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
||||||
vinfos = {}
|
vinfos = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
m = getmetatable(value)
|
m = getmetatable(value)
|
||||||
|
|
@ -1944,7 +1938,6 @@ local function debugger_getBreakVar(body, server)
|
||||||
if (value) then
|
if (value) then
|
||||||
local valueType = type(value)
|
local valueType = type(value)
|
||||||
if (valueType == "table" or valueType == "userdata") then
|
if (valueType == "table" or valueType == "userdata") then
|
||||||
|
|
||||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||||
else
|
else
|
||||||
if (valueType == "function") then
|
if (valueType == "function") then
|
||||||
|
|
@ -1979,9 +1972,9 @@ local function debugger_getBreakVar(body, server)
|
||||||
xpcall(
|
xpcall(
|
||||||
exe,
|
exe,
|
||||||
function(error)
|
function(error)
|
||||||
-- print("获取变量错误 错误消息-----------------")
|
-- -- print("获取变量错误 错误消息-----------------")
|
||||||
-- print(error)
|
-- -- print(error)
|
||||||
-- print(debug.traceback("", 2))
|
-- -- print(debug.traceback("", 2))
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
server,
|
server,
|
||||||
LuaDebugger.event.C2S_ReqVar,
|
LuaDebugger.event.C2S_ReqVar,
|
||||||
|
|
@ -2018,7 +2011,7 @@ local function debugger_loop(server)
|
||||||
while true do
|
while true do
|
||||||
local line, status = server:receive()
|
local line, status = server:receive()
|
||||||
if (status == "closed") then
|
if (status == "closed") then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
|
|
@ -2030,13 +2023,12 @@ local function debugger_loop(server)
|
||||||
local event = netData.event
|
local event = netData.event
|
||||||
local body = netData.data
|
local body = netData.data
|
||||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||||
--设置断点信息
|
--设置断点信息
|
||||||
local function setB()
|
local function setB()
|
||||||
|
|
@ -2045,7 +2037,7 @@ local function debugger_loop(server)
|
||||||
xpcall(
|
xpcall(
|
||||||
setB,
|
setB,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||||
|
|
@ -2156,29 +2148,26 @@ local function debugger_loop(server)
|
||||||
end
|
end
|
||||||
coro_debugger = coroutine.create(debugger_loop)
|
coro_debugger = coroutine.create(debugger_loop)
|
||||||
debug_hook = function(event, line)
|
debug_hook = function(event, line)
|
||||||
|
if (not LuaDebugger.isHook) then
|
||||||
if(not LuaDebugger.isHook) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.Run) then
|
if (LuaDebugger.Run) then
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
local isCheck = false
|
local isCheck = false
|
||||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||||
|
|
||||||
for bk, linesInfo in pairs(breakInfo) 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
|
isCheck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(isCheck) then
|
if (isCheck) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not isCheck) then
|
if (not isCheck) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -2209,7 +2198,7 @@ debug_hook = function(event, line)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
-- debugger_dump(LuaDebugger,"LuaDebugger")
|
||||||
-- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
-- -- print(LuaDebugger.StepNextLevel,"LuaDebugger.StepNextLevel")
|
||||||
local file = nil
|
local file = nil
|
||||||
if (event == "call") then
|
if (event == "call") then
|
||||||
-- end
|
-- end
|
||||||
|
|
@ -2217,7 +2206,7 @@ debug_hook = function(event, line)
|
||||||
if (not LuaDebugger.Run) then
|
if (not LuaDebugger.Run) then
|
||||||
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
LuaDebugger.StepNextLevel = LuaDebugger.StepNextLevel + 1
|
||||||
end
|
end
|
||||||
-- print("stepIn",LuaDebugger.StepNextLevel)
|
-- -- print("stepIn",LuaDebugger.StepNextLevel)
|
||||||
|
|
||||||
local stepInfo = getinfo(2, "S")
|
local stepInfo = getinfo(2, "S")
|
||||||
local source = stepInfo.source
|
local source = stepInfo.source
|
||||||
|
|
@ -2259,7 +2248,6 @@ debug_hook = function(event, line)
|
||||||
local breakInfo = LuaDebugger.breakInfos[file]
|
local breakInfo = LuaDebugger.breakInfos[file]
|
||||||
local breakData = nil
|
local breakData = nil
|
||||||
if (breakInfo) then
|
if (breakInfo) then
|
||||||
|
|
||||||
local ischeck = false
|
local ischeck = false
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
|
|
@ -2299,13 +2287,13 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
pathNamesCount = pathNamesCount - 1
|
pathNamesCount = pathNamesCount - 1
|
||||||
hitPathNamesCount = hitPathNamesCount - 1
|
hitPathNamesCount = hitPathNamesCount - 1
|
||||||
checkCount = checkCount+1
|
checkCount = checkCount + 1
|
||||||
|
|
||||||
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(checkCount>0) then
|
if (checkCount > 0) then
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -2384,7 +2372,7 @@ end
|
||||||
local function debugger_xpcall()
|
local function debugger_xpcall()
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
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
|
data.stack[1].isXpCall = true
|
||||||
end
|
end
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
|
|
@ -2396,8 +2384,8 @@ local function start()
|
||||||
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||||
LuaDebugger.DebugLuaFie = fileName
|
LuaDebugger.DebugLuaFie = fileName
|
||||||
local socket = createSocket()
|
local socket = createSocket()
|
||||||
print(controller_host)
|
-- print(controller_host)
|
||||||
print(controller_port)
|
-- print(controller_port)
|
||||||
|
|
||||||
local server = socket.connect(controller_host, controller_port)
|
local server = socket.connect(controller_host, controller_port)
|
||||||
debug_server = server
|
debug_server = server
|
||||||
|
|
@ -2427,15 +2415,15 @@ local function start()
|
||||||
debug.sethook(debug_hook, "lrc")
|
debug.sethook(debug_hook, "lrc")
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print("error:", error)
|
-- print("error:", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (jit) then
|
if (jit) then
|
||||||
if (LuaDebugger.debugLuaType ~= "jit") then
|
if (LuaDebugger.debugLuaType ~= "jit") then
|
||||||
print("error======================================================")
|
-- print("error======================================================")
|
||||||
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
local msg = "当前luajit版本为: " .. jit.version .. " 请使用LuaDebugjit 进行调试!"
|
||||||
|
|
||||||
print(msg)
|
-- print(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_resume(coro_debugger, server)
|
_resume(coro_debugger, server)
|
||||||
|
|
@ -2444,16 +2432,16 @@ local function start()
|
||||||
end
|
end
|
||||||
function StartDebug(host, port)
|
function StartDebug(host, port)
|
||||||
if (not host) then
|
if (not host) then
|
||||||
print("error host nil")
|
-- print("error host nil")
|
||||||
end
|
end
|
||||||
if (not port) then
|
if (not port) then
|
||||||
print("error prot nil")
|
-- print("error prot nil")
|
||||||
end
|
end
|
||||||
if (type(host) ~= "string") then
|
if (type(host) ~= "string") then
|
||||||
print("error host not string")
|
-- print("error host not string")
|
||||||
end
|
end
|
||||||
if (type(port) ~= "number") then
|
if (type(port) ~= "number") then
|
||||||
print("error host not number")
|
-- print("error host not number")
|
||||||
end
|
end
|
||||||
controller_host = host
|
controller_host = host
|
||||||
controller_port = port
|
controller_port = port
|
||||||
|
|
@ -2461,7 +2449,7 @@ function StartDebug(host, port)
|
||||||
start,
|
start,
|
||||||
function(error)
|
function(error)
|
||||||
-- body
|
-- body
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
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', '+', '/',
|
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||||
};
|
};
|
||||||
ZZBase64.__decode = {}
|
ZZBase64.__decode = {}
|
||||||
for k,v in pairs(ZZBase64.__code) do
|
for k, v in pairs(ZZBase64.__code) do
|
||||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.encode(text)
|
function ZZBase64.encode(text)
|
||||||
|
|
@ -2489,14 +2477,14 @@ function ZZBase64.encode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for i = 1, len, 3 do
|
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 b = string.byte(text, i + 1)
|
||||||
local c = string.byte(text, i + 2)
|
local c = string.byte(text, i + 2)
|
||||||
-- num = a<<16 + b<<8 + c
|
-- num = a<<16 + b<<8 + c
|
||||||
local num = a * 65536 + b * 256 + c
|
local num = a * 65536 + b * 256 + c
|
||||||
for j = 1, 4 do
|
for j = 1, 4 do
|
||||||
--tmp = num >> ((4 -j) * 6)
|
--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
|
--curPos = tmp&0x3f
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2533,13 +2521,13 @@ function ZZBase64.__left2(res, index, text, len)
|
||||||
res[index + 3] = "="
|
res[index + 3] = "="
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.__left1(res, index,text, len)
|
function ZZBase64.__left1(res, index, text, len)
|
||||||
local num = string.byte(text, len + 1)
|
local num = string.byte(text, len + 1)
|
||||||
num = num * 16
|
num = num * 16
|
||||||
|
|
||||||
local tmp = math.floor(num / 64)
|
local tmp = math.floor(num / 64)
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index ] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
||||||
curPos = num % 64 + 1
|
curPos = num % 64 + 1
|
||||||
res[index + 1] = ZZBase64.__code[curPos]
|
res[index + 1] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2562,11 +2550,11 @@ function ZZBase64.decode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
local decode = ZZBase64.__decode
|
local decode = ZZBase64.__decode
|
||||||
for i =1, len, 4 do
|
for i = 1, len, 4 do
|
||||||
local a = decode[string.byte(text,i )]
|
local a = decode[string.byte(text, i)]
|
||||||
local b = decode[string.byte(text,i + 1)]
|
local b = decode[string.byte(text, i + 1)]
|
||||||
local c = decode[string.byte(text,i + 2)]
|
local c = decode[string.byte(text, i + 2)]
|
||||||
local d = decode[string.byte(text,i + 3)]
|
local d = decode[string.byte(text, i + 3)]
|
||||||
|
|
||||||
--num = a<<18 + b<<12 + c<<6 + d
|
--num = a<<18 + b<<12 + c<<6 + d
|
||||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||||
|
|
@ -2575,7 +2563,7 @@ function ZZBase64.decode(text)
|
||||||
num = math.floor(num / 256)
|
num = math.floor(num / 256)
|
||||||
local f = string.char(num % 256)
|
local f = string.char(num % 256)
|
||||||
num = math.floor(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 + 1] = f
|
||||||
res[index + 2] = e
|
res[index + 2] = e
|
||||||
index = index + 3
|
index = index + 3
|
||||||
|
|
@ -2611,7 +2599,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
||||||
res[index] = string.char(num)
|
res[index] = string.char(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return StartDebug
|
return StartDebug
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local debugger_reLoadFile =nil
|
local debugger_reLoadFile = nil
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
debugger_reLoadFile = require("luaideReLoadFile")
|
debugger_reLoadFile = require("luaideReLoadFile")
|
||||||
end,function()
|
end, function()
|
||||||
debugger_reLoadFile = function() print("未实现代码重载") end
|
debugger_reLoadFile = function() print("未实现代码重载") end
|
||||||
end)
|
end)
|
||||||
local sethook = debug.sethook
|
local sethook = debug.sethook
|
||||||
|
|
@ -13,9 +13,9 @@ local checkSetVar = nil
|
||||||
local loadstring_ = nil
|
local loadstring_ = nil
|
||||||
local debugger_sendMsg = nil
|
local debugger_sendMsg = nil
|
||||||
if (loadstring) then
|
if (loadstring) then
|
||||||
loadstring_ = loadstring
|
loadstring_ = loadstring
|
||||||
else
|
else
|
||||||
loadstring_ = load
|
loadstring_ = load
|
||||||
end
|
end
|
||||||
local ZZBase64 = {}
|
local ZZBase64 = {}
|
||||||
local LuaDebugTool_ = nil
|
local LuaDebugTool_ = nil
|
||||||
|
|
@ -366,6 +366,7 @@ local function createJson()
|
||||||
function json.null()
|
function json.null()
|
||||||
return json.null -- so json.null() will also return null ;-)
|
return json.null -- so json.null() will also return null ;-)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Internal, PRIVATE functions.
|
-- Internal, PRIVATE functions.
|
||||||
-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
|
-- 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
|
-- @return object, int The object (true, false or nil) and the position at which the next character should be
|
||||||
-- scanned.
|
-- scanned.
|
||||||
function decode_scanConstant(s, startPos)
|
function decode_scanConstant(s, startPos)
|
||||||
local consts = {["true"] = true, ["false"] = false, ["null"] = nil}
|
local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
|
||||||
local constNames = {"true", "false", "null"}
|
local constNames = { "true", "false", "null" }
|
||||||
|
|
||||||
for i, k in pairs(constNames) do
|
for i, k in pairs(constNames) do
|
||||||
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
if string.sub(s, startPos, startPos + string.len(k) - 1) == k then
|
||||||
|
|
@ -694,7 +695,7 @@ local LuaDebugger = {
|
||||||
runLineCount = 0,
|
runLineCount = 0,
|
||||||
--分割字符串缓存
|
--分割字符串缓存
|
||||||
splitFilePaths = {},
|
splitFilePaths = {},
|
||||||
version="0.9.3",
|
version = "0.9.3",
|
||||||
serVarLevel = 4
|
serVarLevel = 4
|
||||||
}
|
}
|
||||||
local debug_hook = nil
|
local debug_hook = nil
|
||||||
|
|
@ -747,17 +748,17 @@ function print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 1}
|
data = { msg = ZZBase64.encode(str), type = 1 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
|
|
@ -771,46 +772,48 @@ function luaIdePrintWarn(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 2}
|
data = { msg = ZZBase64.encode(str), type = 2 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function luaIdePrintErr(...)
|
function luaIdePrintErr(...)
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 3) then
|
||||||
debugger_print(...)
|
debugger_print(...)
|
||||||
end
|
end
|
||||||
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
if (LuaDebugger.isProntToConsole == 1 or LuaDebugger.isProntToConsole == 2) then
|
||||||
if (debug_server) then
|
if (debug_server) then
|
||||||
local arg = {...} --这里的...和{}符号中间需要有空格号,否则会出错
|
local arg = { ... } --这里的...和{}符号中间需要有空格号,否则会出错
|
||||||
local str = ""
|
local str = ""
|
||||||
if (#arg == 0) then
|
if (#arg == 0) then
|
||||||
arg = {"nil"}
|
arg = { "nil" }
|
||||||
end
|
end
|
||||||
for k, v in pairs(arg) do
|
for k, v in pairs(arg) do
|
||||||
str = str .. tostring(v) .. "\t"
|
str = str .. tostring(v) .. "\t"
|
||||||
end
|
end
|
||||||
local sendMsg = {
|
local sendMsg = {
|
||||||
event = LuaDebugger.event.C2S_LuaPrint,
|
event = LuaDebugger.event.C2S_LuaPrint,
|
||||||
data = {msg = ZZBase64.encode(str), type = 3}
|
data = { msg = ZZBase64.encode(str), type = 3 }
|
||||||
}
|
}
|
||||||
local sendStr = json.encode(sendMsg)
|
local sendStr = json.encode(sendMsg)
|
||||||
debug_server:send(sendStr .. "__debugger_k0204__")
|
debug_server:send(sendStr .. "__debugger_k0204__")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
--@region 辅助方法
|
--@region 辅助方法
|
||||||
|
|
@ -948,7 +951,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
return tostring(v)
|
return tostring(v)
|
||||||
end
|
end
|
||||||
local traceback = debugger_strSplit(debug.traceback("", 2), "\n")
|
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)
|
local function _dump(value, desciption, indent, nest, keylen)
|
||||||
desciption = desciption or "<var>"
|
desciption = desciption or "<var>"
|
||||||
local spc = ""
|
local spc = ""
|
||||||
|
|
@ -997,7 +1000,7 @@ local function debugger_dump(value, desciption, nesting)
|
||||||
end
|
end
|
||||||
_dump(value, desciption, "- ", 1)
|
_dump(value, desciption, "- ", 1)
|
||||||
for i, line in ipairs(result) do
|
for i, line in ipairs(result) do
|
||||||
print(line)
|
-- print(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
@ -1005,27 +1008,24 @@ local function debugger_valueToString(v)
|
||||||
local vtype = type(v)
|
local vtype = type(v)
|
||||||
local vstr = nil
|
local vstr = nil
|
||||||
if (vtype == "userdata") then
|
if (vtype == "userdata") then
|
||||||
if (LuaDebugger.isFoxGloryProject ) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
|
return "userdata", vtype
|
||||||
return "userdata",vtype
|
|
||||||
|
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
end
|
end
|
||||||
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
elseif (vtype == "table" or vtype == "function" or vtype == "boolean") then
|
||||||
local value = vtype
|
local value = vtype
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
if(LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
value = vtype
|
value = vtype
|
||||||
else
|
else
|
||||||
value = tostring(v)
|
value = tostring(v)
|
||||||
end
|
end
|
||||||
|
end, function()
|
||||||
end,function()
|
|
||||||
value = vtype
|
value = vtype
|
||||||
end)
|
end)
|
||||||
return value, vtype
|
return value, vtype
|
||||||
elseif (vtype == "number" or vtype == "string" ) then
|
elseif (vtype == "number" or vtype == "string") then
|
||||||
return v, vtype
|
return v, vtype
|
||||||
else
|
else
|
||||||
return tostring(v), vtype
|
return tostring(v), vtype
|
||||||
|
|
@ -1033,12 +1033,12 @@ local function debugger_valueToString(v)
|
||||||
end
|
end
|
||||||
local function debugger_setVarInfo(name, value)
|
local function debugger_setVarInfo(name, value)
|
||||||
local valueStr, valueType = debugger_valueToString(value)
|
local valueStr, valueType = debugger_valueToString(value)
|
||||||
local nameStr,nameType = debugger_valueToString(name)
|
local nameStr, nameType = debugger_valueToString(name)
|
||||||
if(valueStr == nil) then
|
if (valueStr == nil) then
|
||||||
valueStr = valueType
|
valueStr = valueType
|
||||||
end
|
end
|
||||||
local valueInfo = {
|
local valueInfo = {
|
||||||
name =nameStr,
|
name = nameStr,
|
||||||
valueType = valueType,
|
valueType = valueType,
|
||||||
valueStr = ZZBase64.encode(valueStr)
|
valueStr = ZZBase64.encode(valueStr)
|
||||||
}
|
}
|
||||||
|
|
@ -1076,7 +1076,7 @@ local function debugger_getvalue(f)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return {locals = locals, ups = ups}
|
return { locals = locals, ups = ups }
|
||||||
end
|
end
|
||||||
--获取堆栈
|
--获取堆栈
|
||||||
debugger_stackInfo =
|
debugger_stackInfo =
|
||||||
|
|
@ -1122,7 +1122,7 @@ debugger_stackInfo =
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local stackInfo = {stack = stack, vars = varInfos, funcs = funcs}
|
local stackInfo = { stack = stack, vars = varInfos, funcs = funcs }
|
||||||
local data = {
|
local data = {
|
||||||
stack = stackInfo.stack,
|
stack = stackInfo.stack,
|
||||||
vars = stackInfo.vars,
|
vars = stackInfo.vars,
|
||||||
|
|
@ -1133,23 +1133,23 @@ debugger_stackInfo =
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
--==============================工具方法 end======================================================
|
--==============================工具方法 end======================================================
|
||||||
--===========================点断信息==================================================
|
--===========================点断信息==================================================
|
||||||
--根据不同的游戏引擎进行定时获取断点信息
|
--根据不同的游戏引擎进行定时获取断点信息
|
||||||
--CCDirector:sharedDirector():getScheduler()
|
--CCDirector:sharedDirector():getScheduler()
|
||||||
local debugger_setBreak = nil
|
local debugger_setBreak = nil
|
||||||
local function debugger_receiveDebugBreakInfo()
|
local function debugger_receiveDebugBreakInfo()
|
||||||
if(not jit) then
|
if (not jit) then
|
||||||
if(_VERSION)then
|
if (_VERSION) then
|
||||||
print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
-- print("当前lua版本为: ".._VERSION.." 请使用 -----LuaDebug.lua----- 进行调试!")
|
||||||
else
|
else
|
||||||
print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
-- print("当前为lua版本,请使用-----LuaDebug.lua-----进行调试!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
local msg, status = breakInfoSocket:receive()
|
local msg, status = breakInfoSocket:receive()
|
||||||
if(LuaDebugger.isLaunch == true and status == "closed") then
|
if (LuaDebugger.isLaunch == true and status == "closed") then
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
if (msg) then
|
if (msg) then
|
||||||
|
|
@ -1159,7 +1159,7 @@ local function debugger_receiveDebugBreakInfo()
|
||||||
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
elseif netData.event == LuaDebugger.event.S2C_LoadLuaScript then
|
||||||
LuaDebugger.loadScriptBody = netData.data
|
LuaDebugger.loadScriptBody = netData.data
|
||||||
debugger_exeLuaString()
|
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
|
elseif netData.event == LuaDebugger.event.S2C_ReLoadFile then
|
||||||
LuaDebugger.reLoadFileBody = netData.data
|
LuaDebugger.reLoadFileBody = netData.data
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
|
|
@ -1267,7 +1267,7 @@ debugger_setBreak =
|
||||||
end
|
end
|
||||||
LuaDebugger.isHook = false
|
LuaDebugger.isHook = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function debugger_checkFileIsBreak(fileName)
|
local function debugger_checkFileIsBreak(fileName)
|
||||||
return LuaDebugger.breakInfos[fileName]
|
return LuaDebugger.breakInfos[fileName]
|
||||||
end
|
end
|
||||||
|
|
@ -1299,7 +1299,7 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. condition)
|
local fun = loadstring("return " .. condition)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
return fun()
|
return fun()
|
||||||
|
|
@ -1309,21 +1309,20 @@ function debugger_conditionStr(condition, vars, callBack)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (status and msg) then
|
if (status and msg) then
|
||||||
callBack()
|
callBack()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--执行lua字符串
|
--执行lua字符串
|
||||||
debugger_exeLuaString = function()
|
debugger_exeLuaString = function()
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
|
|
||||||
local script = LuaDebugger.loadScriptBody.script
|
local script = LuaDebugger.loadScriptBody.script
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
local currentTabble = {_G = _G}
|
local currentTabble = { _G = _G }
|
||||||
local frameId = LuaDebugger.loadScriptBody.frameId
|
local frameId = LuaDebugger.loadScriptBody.frameId
|
||||||
frameId = frameId
|
frameId = frameId
|
||||||
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
local func = LuaDebugger.currentDebuggerData.funcs[frameId]
|
||||||
|
|
@ -1336,7 +1335,7 @@ debugger_exeLuaString = function()
|
||||||
for k, v in pairs(locals) do
|
for k, v in pairs(locals) do
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
|
|
||||||
local fun = loadstring(script)
|
local fun = loadstring(script)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
|
|
@ -1351,50 +1350,47 @@ debugger_exeLuaString = function()
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
|
|
||||||
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
-- debugger_sendMsg(debug_server, LuaDebugger.event.C2S_LoadLuaScript, LuaDebugger.loadScriptBody)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
LuaDebugger.loadScriptBody.script = nil
|
LuaDebugger.loadScriptBody.script = nil
|
||||||
if (LuaDebugger.loadScriptBody.isBreak) then
|
if (LuaDebugger.loadScriptBody.isBreak) then
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event
|
||||||
|
.C2S_HITBreakPoint)
|
||||||
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
LuaDebugger.loadScriptBody.stack = LuaDebugger.currentDebuggerData.stack
|
||||||
end
|
end
|
||||||
LuaDebugger.loadScriptBody.complete = true
|
LuaDebugger.loadScriptBody.complete = true
|
||||||
|
|
||||||
end
|
end
|
||||||
--@region 调试中修改变量值
|
--@region 调试中修改变量值
|
||||||
|
|
||||||
|
|
||||||
--根据key 值在 value 查找
|
--根据key 值在 value 查找
|
||||||
local function debugger_getTablekey(key,keyType,value)
|
local function debugger_getTablekey(key, keyType, value)
|
||||||
if(keyType == -1) then
|
if (keyType == -1) then
|
||||||
return key
|
return key
|
||||||
elseif(keyType == 1) then
|
elseif (keyType == 1) then
|
||||||
return tonumber(key)
|
return tonumber(key)
|
||||||
elseif(keyType == 2) then
|
elseif (keyType == 2) then
|
||||||
local valueKey = nil
|
local valueKey = nil
|
||||||
for k,v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
local nameType = type(k)
|
local nameType = type(k)
|
||||||
if(nameType == "userdata" or nameType == "table") then
|
if (nameType == "userdata" or nameType == "table") then
|
||||||
if (not LuaDebugger.isFoxGloryProject) then
|
if (not LuaDebugger.isFoxGloryProject) then
|
||||||
valueKey = tostring(k)
|
valueKey = tostring(k)
|
||||||
if(key == valueKey) then
|
if (key == valueKey) then
|
||||||
return k
|
return k
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function debugger_setVarValue(server, data)
|
local function debugger_setVarValue(server, data)
|
||||||
|
|
||||||
local newValue = nil
|
local newValue = nil
|
||||||
local level = LuaDebugger.serVarLevel+LuaDebugger.setVarBody.frameId
|
local level = LuaDebugger.serVarLevel + LuaDebugger.setVarBody.frameId
|
||||||
local firstKeyName = data.keys[1]
|
local firstKeyName = data.keys[1]
|
||||||
--@region vars check
|
--@region vars check
|
||||||
local localValueChangeIndex = -1
|
local localValueChangeIndex = -1
|
||||||
|
|
@ -1409,7 +1405,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(firstKeyName == name) then
|
if (firstKeyName == name) then
|
||||||
localValueChangeIndex = i
|
localValueChangeIndex = i
|
||||||
oldValue = value
|
oldValue = value
|
||||||
end
|
end
|
||||||
|
|
@ -1427,7 +1423,7 @@ local function debugger_setVarValue(server, data)
|
||||||
if not name then
|
if not name then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if(localValueChangeIndex == -1 and firstKeyName == name) then
|
if (localValueChangeIndex == -1 and firstKeyName == name) then
|
||||||
upValueFun = func
|
upValueFun = func
|
||||||
oldValue = value
|
oldValue = value
|
||||||
upValueChangeIndex = i
|
upValueChangeIndex = i
|
||||||
|
|
@ -1439,8 +1435,8 @@ local function debugger_setVarValue(server, data)
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
local vars = {locals = locals, ups = ups}
|
local vars = { locals = locals, ups = ups }
|
||||||
|
|
||||||
local function loadScript()
|
local function loadScript()
|
||||||
local currentTabble = {}
|
local currentTabble = {}
|
||||||
|
|
@ -1457,7 +1453,7 @@ local function debugger_setVarValue(server, data)
|
||||||
currentTabble[k] = v
|
currentTabble[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setmetatable(currentTabble, {__index = _G})
|
setmetatable(currentTabble, { __index = _G })
|
||||||
local fun = loadstring("return " .. data.value)
|
local fun = loadstring("return " .. data.value)
|
||||||
setfenv(fun, currentTabble)
|
setfenv(fun, currentTabble)
|
||||||
newValue = fun()
|
newValue = fun()
|
||||||
|
|
@ -1467,7 +1463,7 @@ local function debugger_setVarValue(server, data)
|
||||||
xpcall(
|
xpcall(
|
||||||
loadScript,
|
loadScript,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "============================")
|
-- print(error, "============================")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1476,39 +1472,37 @@ local function debugger_setVarValue(server, data)
|
||||||
-- local 查找并替换
|
-- local 查找并替换
|
||||||
local keyLength = #data.keys
|
local keyLength = #data.keys
|
||||||
|
|
||||||
if(keyLength == 1) then
|
if (keyLength == 1) then
|
||||||
if(localValueChangeIndex ~= -1) then
|
if (localValueChangeIndex ~= -1) then
|
||||||
|
|
||||||
debug.setlocal(level, localValueChangeIndex, newValue)
|
debug.setlocal(level, localValueChangeIndex, newValue)
|
||||||
elseif(upValueFun ~= nil) then
|
elseif (upValueFun ~= nil) then
|
||||||
debug.setupvalue( upValueFun, upValueChangeIndex, newValue )
|
debug.setupvalue(upValueFun, upValueChangeIndex, newValue)
|
||||||
else
|
else
|
||||||
--全局变量查找
|
--全局变量查找
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
_G[firstKeyName] = newValue
|
_G[firstKeyName] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(not oldValue) then
|
if (not oldValue) then
|
||||||
if(_G[firstKeyName]) then
|
if (_G[firstKeyName]) then
|
||||||
oldValue = _G[firstKeyName]
|
oldValue = _G[firstKeyName]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local tempValue = oldValue
|
local tempValue = oldValue
|
||||||
for i=2,keyLength-1 do
|
for i = 2, keyLength - 1 do
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue = oldValue[debugger_getTablekey(data.keys[i],data.numberTypes[i],oldValue)]
|
oldValue = oldValue[debugger_getTablekey(data.keys[i], data.numberTypes[i], oldValue)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(tempValue) then
|
if (tempValue) then
|
||||||
oldValue[debugger_getTablekey(data.keys[keyLength],data.numberTypes[keyLength],oldValue)] = newValue
|
oldValue[debugger_getTablekey(data.keys[keyLength], data.numberTypes[keyLength], oldValue)] = newValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
local varInfo = debugger_setVarInfo(data.varName, newValue)
|
||||||
data.varInfo = varInfo
|
data.varInfo = varInfo
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
LuaDebugger.currentDebuggerData = debugger_stackInfo(LuaDebugger.serVarLevel, LuaDebugger.event.C2S_HITBreakPoint)
|
||||||
|
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
@ -1520,41 +1514,41 @@ checkSetVar =
|
||||||
function()
|
function()
|
||||||
if (LuaDebugger.isSetVar) then
|
if (LuaDebugger.isSetVar) then
|
||||||
LuaDebugger.isSetVar = false
|
LuaDebugger.isSetVar = false
|
||||||
debugger_setVarValue(debug_server,LuaDebugger.setVarBody)
|
debugger_setVarValue(debug_server, LuaDebugger.setVarBody)
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.setVarBody)
|
_resume(coro_debugger, LuaDebugger.setVarBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("设置变量", error)
|
-- print("设置变量", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isLoadLuaScript) then
|
elseif (LuaDebugger.isLoadLuaScript) then
|
||||||
LuaDebugger.isLoadLuaScript = false
|
LuaDebugger.isLoadLuaScript = false
|
||||||
debugger_exeLuaString()
|
debugger_exeLuaString()
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("执行代码", error)
|
-- print("执行代码", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif(LuaDebugger.isReLoadFile) then
|
elseif (LuaDebugger.isReLoadFile) then
|
||||||
LuaDebugger.isReLoadFile = false
|
LuaDebugger.isReLoadFile = false
|
||||||
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
LuaDebugger.reLoadFileBody.isReLoad = debugger_reLoadFile(LuaDebugger.reLoadFileBody)
|
||||||
print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
-- print("重载结果:",LuaDebugger.reLoadFileBody.isReLoad)
|
||||||
LuaDebugger.reLoadFileBody.script = nil
|
LuaDebugger.reLoadFileBody.script = nil
|
||||||
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel+1
|
LuaDebugger.serVarLevel = LuaDebugger.serVarLevel + 1
|
||||||
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
_resume(coro_debugger, LuaDebugger.reLoadFileBody)
|
||||||
xpcall(
|
xpcall(
|
||||||
checkSetVar,
|
checkSetVar,
|
||||||
function(error)
|
function(error)
|
||||||
print("重新加载文件", error)
|
-- print("重新加载文件", error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1604,7 +1598,7 @@ local function debugger_getValueByScript(value, script)
|
||||||
val = fun()
|
val = fun()
|
||||||
end,
|
end,
|
||||||
function(error)
|
function(error)
|
||||||
print(error, "====>")
|
-- print(error, "====>")
|
||||||
val = nil
|
val = nil
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -1745,7 +1739,6 @@ end
|
||||||
return
|
return
|
||||||
]]
|
]]
|
||||||
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
local function debugger_getmetatable(value, metatable, vinfos, server, variablesReference, debugSpeedIndex, metatables)
|
||||||
|
|
||||||
for i, mtable in ipairs(metatables) do
|
for i, mtable in ipairs(metatables) do
|
||||||
if (metatable == mtable) then
|
if (metatable == mtable) then
|
||||||
return vinfos
|
return vinfos
|
||||||
|
|
@ -1801,7 +1794,6 @@ local function debugger_getmetatable(value, metatable, vinfos, server, variables
|
||||||
else
|
else
|
||||||
return vinfos
|
return vinfos
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
local function debugger_sendTableField(luatable, vinfos, server, variablesReference, debugSpeedIndex, valueType)
|
||||||
if (valueType == "userdata") then
|
if (valueType == "userdata") then
|
||||||
|
|
@ -1874,7 +1866,6 @@ local function debugger_sendTableValues(value, server, variablesReference, debug
|
||||||
vinfos = {}
|
vinfos = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
m = getmetatable(value)
|
m = getmetatable(value)
|
||||||
|
|
@ -1924,11 +1915,10 @@ local function debugger_getBreakVar(body, server)
|
||||||
if (value) then
|
if (value) then
|
||||||
local valueType = type(value)
|
local valueType = type(value)
|
||||||
if (valueType == "table" or valueType == "userdata") then
|
if (valueType == "table" or valueType == "userdata") then
|
||||||
|
|
||||||
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
debugger_sendTableValues(value, server, variablesReference, debugSpeedIndex)
|
||||||
else
|
else
|
||||||
if (valueType == "function") then
|
if (valueType == "function") then
|
||||||
if(LuaDebugger.isFoxGloryProject) then
|
if (LuaDebugger.isFoxGloryProject) then
|
||||||
value = "function"
|
value = "function"
|
||||||
else
|
else
|
||||||
value = tostring(value)
|
value = tostring(value)
|
||||||
|
|
@ -1963,9 +1953,9 @@ local function debugger_getBreakVar(body, server)
|
||||||
xpcall(
|
xpcall(
|
||||||
exe,
|
exe,
|
||||||
function(error)
|
function(error)
|
||||||
-- print("获取变量错误 错误消息-----------------")
|
-- -- print("获取变量错误 错误消息-----------------")
|
||||||
-- print(error)
|
-- -- print(error)
|
||||||
-- print(debug.traceback("", 2))
|
-- -- print(debug.traceback("", 2))
|
||||||
debugger_sendMsg(
|
debugger_sendMsg(
|
||||||
server,
|
server,
|
||||||
LuaDebugger.event.C2S_ReqVar,
|
LuaDebugger.event.C2S_ReqVar,
|
||||||
|
|
@ -1991,7 +1981,6 @@ local function ResetDebugInfo()
|
||||||
LuaDebugger.StepIn = false
|
LuaDebugger.StepIn = false
|
||||||
LuaDebugger.StepNext = false
|
LuaDebugger.StepNext = false
|
||||||
LuaDebugger.StepOut = false
|
LuaDebugger.StepOut = false
|
||||||
|
|
||||||
end
|
end
|
||||||
local function debugger_loop(server)
|
local function debugger_loop(server)
|
||||||
server = debug_server
|
server = debug_server
|
||||||
|
|
@ -2002,7 +1991,7 @@ local function debugger_loop(server)
|
||||||
while true do
|
while true do
|
||||||
local line, status = server:receive()
|
local line, status = server:receive()
|
||||||
if (status == "closed") then
|
if (status == "closed") then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
|
|
@ -2014,13 +2003,12 @@ local function debugger_loop(server)
|
||||||
local event = netData.event
|
local event = netData.event
|
||||||
local body = netData.data
|
local body = netData.data
|
||||||
if (event == LuaDebugger.event.S2C_DebugClose) then
|
if (event == LuaDebugger.event.S2C_DebugClose) then
|
||||||
if(LuaDebugger.isLaunch) then
|
if (LuaDebugger.isLaunch) then
|
||||||
os.exit()
|
os.exit()
|
||||||
else
|
else
|
||||||
debug.sethook()
|
debug.sethook()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
elseif event == LuaDebugger.event.S2C_SetBreakPoints then
|
||||||
--设置断点信息
|
--设置断点信息
|
||||||
local function setB()
|
local function setB()
|
||||||
|
|
@ -2029,7 +2017,7 @@ local function debugger_loop(server)
|
||||||
xpcall(
|
xpcall(
|
||||||
setB,
|
setB,
|
||||||
function(error)
|
function(error)
|
||||||
print(error)
|
-- print(error)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
elseif event == LuaDebugger.event.S2C_RUN then --开始运行
|
||||||
|
|
@ -2041,7 +2029,7 @@ local function debugger_loop(server)
|
||||||
LuaDebugger.currentDebuggerData = nil
|
LuaDebugger.currentDebuggerData = nil
|
||||||
LuaDebugger.Run = true
|
LuaDebugger.Run = true
|
||||||
LuaDebugger.tempRunFlag = true
|
LuaDebugger.tempRunFlag = true
|
||||||
LuaDebugger.currentLine= nil
|
LuaDebugger.currentLine = nil
|
||||||
local data = coroutine.yield()
|
local data = coroutine.yield()
|
||||||
LuaDebugger.serVarLevel = 4
|
LuaDebugger.serVarLevel = 4
|
||||||
LuaDebugger.currentDebuggerData = data
|
LuaDebugger.currentDebuggerData = data
|
||||||
|
|
@ -2142,42 +2130,37 @@ local function debugger_loop(server)
|
||||||
end
|
end
|
||||||
coro_debugger = coroutine.create(debugger_loop)
|
coro_debugger = coroutine.create(debugger_loop)
|
||||||
debug_hook = function(event, line)
|
debug_hook = function(event, line)
|
||||||
|
if (not LuaDebugger.isHook) then
|
||||||
if(not LuaDebugger.isHook) then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.Run) then
|
if (LuaDebugger.Run) then
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
local isCheck = false
|
local isCheck = false
|
||||||
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
for k, breakInfo in pairs(LuaDebugger.breakInfos) do
|
||||||
|
|
||||||
for bk, linesInfo in pairs(breakInfo) 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
|
isCheck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(isCheck) then
|
if (isCheck) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not isCheck) then
|
if (not isCheck) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local file = nil
|
local file = nil
|
||||||
if(event == "line") then
|
if (event == "line") then
|
||||||
|
|
||||||
local funs = nil
|
local funs = nil
|
||||||
local funlength =0
|
local funlength = 0
|
||||||
if(LuaDebugger.currentDebuggerData) then
|
if (LuaDebugger.currentDebuggerData) then
|
||||||
funs = LuaDebugger.currentDebuggerData.funcs
|
funs = LuaDebugger.currentDebuggerData.funcs
|
||||||
funlength = #funs
|
funlength = #funs
|
||||||
end
|
end
|
||||||
|
|
@ -2185,47 +2168,44 @@ debug_hook = function(event, line)
|
||||||
local tempFunc = stepInfo.func
|
local tempFunc = stepInfo.func
|
||||||
local source = stepInfo.source
|
local source = stepInfo.source
|
||||||
file = getSource(source);
|
file = getSource(source);
|
||||||
if(source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
if (source == "=[C]" or source:find(LuaDebugger.DebugLuaFie)) then return end
|
||||||
if(funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
if (funlength > 0 and funs[1] == tempFunc and LuaDebugger.currentLine ~= line) then
|
||||||
LuaDebugger.runLineCount = LuaDebugger.runLineCount+1
|
LuaDebugger.runLineCount = LuaDebugger.runLineCount + 1
|
||||||
end
|
end
|
||||||
local breakInfo = LuaDebugger.breakInfos[file]
|
local breakInfo = LuaDebugger.breakInfos[file]
|
||||||
local breakData = nil
|
local breakData = nil
|
||||||
local ischeck = false
|
local ischeck = false
|
||||||
if(breakInfo) then
|
if (breakInfo) then
|
||||||
|
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
if(lines and lines[line]) then
|
if (lines and lines[line]) then
|
||||||
ischeck = true
|
ischeck = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local isHit = false
|
local isHit = false
|
||||||
if(ischeck) then
|
if (ischeck) then
|
||||||
|
|
||||||
--并且在断点中
|
--并且在断点中
|
||||||
local info = stepInfo
|
local info = stepInfo
|
||||||
local source = string.lower( info.source )
|
local source = string.lower(info.source)
|
||||||
local fullName,dir,fileName = debugger_getFilePathInfo(source)
|
local fullName, dir, fileName = debugger_getFilePathInfo(source)
|
||||||
local hitPathNames = splitFilePath(fullName)
|
local hitPathNames = splitFilePath(fullName)
|
||||||
|
|
||||||
local hitCounts = {}
|
local hitCounts = {}
|
||||||
local debugHitCounts = nil
|
local debugHitCounts = nil
|
||||||
for k, lineInfo in pairs(breakInfo) do
|
for k, lineInfo in pairs(breakInfo) do
|
||||||
|
|
||||||
local lines = lineInfo.lines
|
local lines = lineInfo.lines
|
||||||
local pathNames = lineInfo.pathNames
|
local pathNames = lineInfo.pathNames
|
||||||
debugHitCounts = lineInfo.hitCounts
|
debugHitCounts = lineInfo.hitCounts
|
||||||
if(lines and lines[line]) then
|
if (lines and lines[line]) then
|
||||||
breakData = lines[line]
|
breakData = lines[line]
|
||||||
--判断路径
|
--判断路径
|
||||||
hitCounts[k] = 0
|
hitCounts[k] = 0
|
||||||
local hitPathNamesCount = #hitPathNames
|
local hitPathNamesCount = #hitPathNames
|
||||||
local pathNamesCount = #pathNames
|
local pathNamesCount = #pathNames
|
||||||
local checkCount = 0;
|
local checkCount = 0;
|
||||||
while(true) do
|
while (true) do
|
||||||
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
if (pathNames[pathNamesCount] ~= hitPathNames[hitPathNamesCount]) then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|
@ -2233,57 +2213,55 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
pathNamesCount = pathNamesCount - 1
|
pathNamesCount = pathNamesCount - 1
|
||||||
hitPathNamesCount = hitPathNamesCount - 1
|
hitPathNamesCount = hitPathNamesCount - 1
|
||||||
checkCount = checkCount+1
|
checkCount = checkCount + 1
|
||||||
if(pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
if (pathNamesCount <= 0 or hitPathNamesCount <= 0) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(checkCount>0) then
|
if (checkCount > 0) then
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
breakData = nil
|
breakData = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(breakData) then
|
if (breakData) then
|
||||||
local hitFieName = ""
|
local hitFieName = ""
|
||||||
local maxCount = 0
|
local maxCount = 0
|
||||||
for k, v in pairs(hitCounts) do
|
for k, v in pairs(hitCounts) do
|
||||||
if(v > maxCount) then
|
if (v > maxCount) then
|
||||||
maxCount = v
|
maxCount = v
|
||||||
hitFieName = k;
|
hitFieName = k;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local hitPathNamesLength = #hitPathNames
|
local hitPathNamesLength = #hitPathNames
|
||||||
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
if (hitPathNamesLength == 1 or (hitPathNamesLength > 1 and maxCount > 1)) then
|
||||||
if(hitFieName ~= "") then
|
if (hitFieName ~= "") then
|
||||||
|
|
||||||
local hitCount = breakData.hitCondition
|
local hitCount = breakData.hitCondition
|
||||||
local clientHitCount = debugHitCounts[breakData.line]
|
local clientHitCount = debugHitCounts[breakData.line]
|
||||||
clientHitCount = clientHitCount + 1
|
clientHitCount = clientHitCount + 1
|
||||||
debugHitCounts[breakData.line] = clientHitCount
|
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
|
LuaDebugger.runLineCount = 0
|
||||||
elseif(LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
elseif (LuaDebugger.tempRunFlag and LuaDebugger.currentLine == line) then
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.tempRunFlag = nil
|
LuaDebugger.tempRunFlag = nil
|
||||||
elseif(clientHitCount >= hitCount) then
|
elseif (clientHitCount >= hitCount) then
|
||||||
isHit = true
|
isHit = true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(LuaDebugger.StepOut) then
|
if (LuaDebugger.StepOut) then
|
||||||
if(funlength == 1) then
|
if (funlength == 1) then
|
||||||
ResetDebugInfo();
|
ResetDebugInfo();
|
||||||
LuaDebugger.Run = true
|
LuaDebugger.Run = true
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if(funs[2] == tempFunc) then
|
if (funs[2] == tempFunc) then
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||||
-- print("StepIn 挂起")
|
-- -- print("StepIn 挂起")
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
|
|
@ -2292,35 +2270,34 @@ debug_hook = function(event, line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.StepIn) then
|
if (LuaDebugger.StepIn) then
|
||||||
if(funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
if (funs[1] == tempFunc and LuaDebugger.runLineCount == 0) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_StepInResponse)
|
||||||
-- print("StepIn 挂起")
|
-- -- print("StepIn 挂起")
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(LuaDebugger.StepNext ) then
|
if (LuaDebugger.StepNext) then
|
||||||
local isNext = false
|
local isNext = false
|
||||||
if(funs) then
|
if (funs) then
|
||||||
for i,f in ipairs(funs) do
|
for i, f in ipairs(funs) do
|
||||||
if(tempFunc == f) then
|
if (tempFunc == f) then
|
||||||
if(LuaDebugger.currentLine == line) then
|
if (LuaDebugger.currentLine == line) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
isNext =true
|
isNext = true
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
isNext = true
|
||||||
isNext =true
|
|
||||||
end
|
end
|
||||||
if(isNext) then
|
if (isNext) then
|
||||||
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
local data = debugger_stackInfo(3, LuaDebugger.event.C2S_NextResponse)
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.currentLine = line
|
LuaDebugger.currentLine = line
|
||||||
|
|
@ -2335,17 +2312,15 @@ debug_hook = function(event, line)
|
||||||
|
|
||||||
|
|
||||||
--断点判断
|
--断点判断
|
||||||
if(isHit) then
|
if (isHit) then
|
||||||
|
|
||||||
|
|
||||||
LuaDebugger.runLineCount = 0
|
LuaDebugger.runLineCount = 0
|
||||||
LuaDebugger.currentLine = line
|
LuaDebugger.currentLine = line
|
||||||
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
sevent = LuaDebugger.event.C2S_HITBreakPoint
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(3, sevent)
|
local data = debugger_stackInfo(3, sevent)
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
if(breakData and breakData.condition) then
|
if (breakData and breakData.condition) then
|
||||||
debugger_conditionStr(breakData.condition,data.vars,function()
|
debugger_conditionStr(breakData.condition, data.vars, function()
|
||||||
_resume(coro_debugger, data)
|
_resume(coro_debugger, data)
|
||||||
checkSetVar()
|
checkSetVar()
|
||||||
end)
|
end)
|
||||||
|
|
@ -2362,7 +2337,7 @@ end
|
||||||
local function debugger_xpcall()
|
local function debugger_xpcall()
|
||||||
--调用 coro_debugger 并传入 参数
|
--调用 coro_debugger 并传入 参数
|
||||||
local data = debugger_stackInfo(4, LuaDebugger.event.C2S_HITBreakPoint)
|
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
|
data.stack[1].isXpCall = true
|
||||||
end
|
end
|
||||||
--挂起等待调试器作出反应
|
--挂起等待调试器作出反应
|
||||||
|
|
@ -2371,12 +2346,11 @@ local function debugger_xpcall()
|
||||||
end
|
end
|
||||||
--调试开始
|
--调试开始
|
||||||
local function start()
|
local function start()
|
||||||
|
|
||||||
local socket = createSocket()
|
local socket = createSocket()
|
||||||
print(controller_host)
|
-- print(controller_host)
|
||||||
print(controller_port)
|
-- print(controller_port)
|
||||||
|
|
||||||
local fullName,dirName,fileName = debugger_getFilePathInfo(getinfo(1).source)
|
local fullName, dirName, fileName = debugger_getFilePathInfo(getinfo(1).source)
|
||||||
LuaDebugger.DebugLuaFie = fileName
|
LuaDebugger.DebugLuaFie = fileName
|
||||||
local server = socket.connect(controller_host, controller_port)
|
local server = socket.connect(controller_host, controller_port)
|
||||||
debug_server = server;
|
debug_server = server;
|
||||||
|
|
@ -2384,7 +2358,7 @@ local function start()
|
||||||
--创建breakInfo socket
|
--创建breakInfo socket
|
||||||
socket = createSocket()
|
socket = createSocket()
|
||||||
breakInfoSocket = socket.connect(controller_host, controller_port)
|
breakInfoSocket = socket.connect(controller_host, controller_port)
|
||||||
if(breakInfoSocket) then
|
if (breakInfoSocket) then
|
||||||
breakInfoSocket:settimeout(0)
|
breakInfoSocket:settimeout(0)
|
||||||
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
debugger_sendMsg(breakInfoSocket, LuaDebugger.event.C2S_SetSocketName, {
|
||||||
name = "breakPointSocket"
|
name = "breakPointSocket"
|
||||||
|
|
@ -2399,46 +2373,41 @@ local function start()
|
||||||
xpcall(function()
|
xpcall(function()
|
||||||
sethook(debug_hook, "lrc")
|
sethook(debug_hook, "lrc")
|
||||||
end, function(error)
|
end, function(error)
|
||||||
print("error:", error)
|
-- print("error:", error)
|
||||||
end)
|
end)
|
||||||
if(not jit) then
|
if (not jit) then
|
||||||
if(_VERSION)then
|
if (_VERSION) then
|
||||||
print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
-- print("当前lua版本为: ".._VERSION.." 请使用LuaDebug 进行调试!")
|
||||||
else
|
else
|
||||||
print("当前为lua版本,请使用LuaDebug 进行调试!")
|
-- print("当前为lua版本,请使用LuaDebug 进行调试!")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
_resume(coro_debugger, server)
|
_resume(coro_debugger, server)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function StartDebug(host, port)
|
function StartDebug(host, port)
|
||||||
|
if (not host) then
|
||||||
|
-- print("error host nil")
|
||||||
if(not host) then
|
|
||||||
print("error host nil")
|
|
||||||
end
|
end
|
||||||
if(not port) then
|
if (not port) then
|
||||||
print("error prot nil")
|
-- print("error prot nil")
|
||||||
end
|
end
|
||||||
if(type(host) ~= "string") then
|
if (type(host) ~= "string") then
|
||||||
print("error host not string")
|
-- print("error host not string")
|
||||||
end
|
end
|
||||||
if(type(port) ~= "number") then
|
if (type(port) ~= "number") then
|
||||||
print("error host not number")
|
-- print("error host not number")
|
||||||
end
|
end
|
||||||
controller_host = host
|
controller_host = host
|
||||||
controller_port = port
|
controller_port = port
|
||||||
xpcall(start, function(error)
|
xpcall(start, function(error)
|
||||||
-- body
|
-- body
|
||||||
print(error)
|
-- print(error)
|
||||||
end)
|
end)
|
||||||
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
return debugger_receiveDebugBreakInfo, debugger_xpcall
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--base64
|
--base64
|
||||||
|
|
||||||
local string = string
|
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',
|
'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',
|
'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', '+', '/',
|
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||||
};
|
};
|
||||||
ZZBase64.__decode = {}
|
ZZBase64.__decode = {}
|
||||||
for k,v in pairs(ZZBase64.__code) do
|
for k, v in pairs(ZZBase64.__code) do
|
||||||
ZZBase64.__decode[string.byte(v,1)] = k - 1
|
ZZBase64.__decode[string.byte(v, 1)] = k - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.encode(text)
|
function ZZBase64.encode(text)
|
||||||
|
|
@ -2461,14 +2430,14 @@ function ZZBase64.encode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for i = 1, len, 3 do
|
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 b = string.byte(text, i + 1)
|
||||||
local c = string.byte(text, i + 2)
|
local c = string.byte(text, i + 2)
|
||||||
-- num = a<<16 + b<<8 + c
|
-- num = a<<16 + b<<8 + c
|
||||||
local num = a * 65536 + b * 256 + c
|
local num = a * 65536 + b * 256 + c
|
||||||
for j = 1, 4 do
|
for j = 1, 4 do
|
||||||
--tmp = num >> ((4 -j) * 6)
|
--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
|
--curPos = tmp&0x3f
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2505,13 +2474,13 @@ function ZZBase64.__left2(res, index, text, len)
|
||||||
res[index + 3] = "="
|
res[index + 3] = "="
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZZBase64.__left1(res, index,text, len)
|
function ZZBase64.__left1(res, index, text, len)
|
||||||
local num = string.byte(text, len + 1)
|
local num = string.byte(text, len + 1)
|
||||||
num = num * 16
|
num = num * 16
|
||||||
|
|
||||||
local tmp = math.floor(num / 64)
|
local tmp = math.floor(num / 64)
|
||||||
local curPos = tmp % 64 + 1
|
local curPos = tmp % 64 + 1
|
||||||
res[index ] = ZZBase64.__code[curPos]
|
res[index] = ZZBase64.__code[curPos]
|
||||||
|
|
||||||
curPos = num % 64 + 1
|
curPos = num % 64 + 1
|
||||||
res[index + 1] = ZZBase64.__code[curPos]
|
res[index + 1] = ZZBase64.__code[curPos]
|
||||||
|
|
@ -2534,11 +2503,11 @@ function ZZBase64.decode(text)
|
||||||
local res = {}
|
local res = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
local decode = ZZBase64.__decode
|
local decode = ZZBase64.__decode
|
||||||
for i =1, len, 4 do
|
for i = 1, len, 4 do
|
||||||
local a = decode[string.byte(text,i )]
|
local a = decode[string.byte(text, i)]
|
||||||
local b = decode[string.byte(text,i + 1)]
|
local b = decode[string.byte(text, i + 1)]
|
||||||
local c = decode[string.byte(text,i + 2)]
|
local c = decode[string.byte(text, i + 2)]
|
||||||
local d = decode[string.byte(text,i + 3)]
|
local d = decode[string.byte(text, i + 3)]
|
||||||
|
|
||||||
--num = a<<18 + b<<12 + c<<6 + d
|
--num = a<<18 + b<<12 + c<<6 + d
|
||||||
local num = a * 262144 + b * 4096 + c * 64 + d
|
local num = a * 262144 + b * 4096 + c * 64 + d
|
||||||
|
|
@ -2547,7 +2516,7 @@ function ZZBase64.decode(text)
|
||||||
num = math.floor(num / 256)
|
num = math.floor(num / 256)
|
||||||
local f = string.char(num % 256)
|
local f = string.char(num % 256)
|
||||||
num = math.floor(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 + 1] = f
|
||||||
res[index + 2] = e
|
res[index + 2] = e
|
||||||
index = index + 3
|
index = index + 3
|
||||||
|
|
@ -2583,7 +2552,4 @@ function ZZBase64.__decodeLeft2(res, index, text, len)
|
||||||
res[index] = string.char(num)
|
res[index] = string.char(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return StartDebug
|
return StartDebug
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "100Zhang_MJ"
|
self.asset_group = "100Zhang_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/100zhang/ui/Extend_MJ_100Zhang")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
--print(beforeLaiziID)
|
---- print(beforeLaiziID)
|
||||||
--print(currentLaizi1ID)
|
---- print(currentLaizi1ID)
|
||||||
--print(currentLaizi2ID)
|
---- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
local weight = arg[2]
|
local weight = arg[2]
|
||||||
self:__FangziTip(_tip, weight)
|
self:__FangziTip(_tip, weight)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("100Zhang_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("100Zhang_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -319,16 +311,15 @@ function M:EventInit()
|
||||||
he_list:Dispose()
|
he_list:Dispose()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
--ViewUtil.PlaySound("100Zhang_MJ", "extend/majiang/100zhang/sound/zhuaniao.mp3")
|
--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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -444,7 +435,7 @@ end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
if card ~= 0 then
|
if card ~= 0 then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -453,12 +444,12 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
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:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -476,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
||||||
|
|
||||||
local tip_hu = false
|
local tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not (tonumber(weight) >= 16) then
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
||||||
local item_choose = list_choose:AddItemFromPool()
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
item_choose:GetController("type").selectedIndex = 0
|
item_choose:GetController("type").selectedIndex = 0
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
item_choose.onClick:Add(function()
|
item_choose.onClick:Add(function()
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
||||||
local pNode = info._mask_liangpai
|
local pNode = info._mask_liangpai
|
||||||
local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect")
|
local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect")
|
||||||
if fz.type == FZType.Peng then
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
else
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
|
@ -605,7 +596,7 @@ end
|
||||||
function M:RunNiao(list, start_seat)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -700,7 +691,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -718,7 +709,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCardBefore)
|
printlog(_tableInfo.laiziCardBefore)
|
||||||
printlog(_tableInfo.laiziCard2Before)
|
printlog(_tableInfo.laiziCard2Before)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCardBefore>0 then
|
if _tableInfo.laiziCardBefore > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -6,8 +6,8 @@ local CS_ClearingView = {}
|
||||||
local M = CS_ClearingView
|
local M = CS_ClearingView
|
||||||
|
|
||||||
function CS_ClearingView.new(blur_view)
|
function CS_ClearingView.new(blur_view)
|
||||||
setmetatable(M, {__index = ResultView})
|
setmetatable(M, { __index = ResultView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self._full = true
|
self._full = true
|
||||||
ResultView.init(self, "ui://Main_Majiang/clearing")
|
ResultView.init(self, "ui://Main_Majiang/clearing")
|
||||||
|
|
||||||
|
|
@ -16,70 +16,63 @@ function CS_ClearingView.new(blur_view)
|
||||||
self._close_zone = false
|
self._close_zone = false
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
|
|
||||||
self.xiPaiCtr=self._view:GetController("xipai")
|
self.xiPaiCtr = self._view:GetController("xipai")
|
||||||
|
|
||||||
self:InitMaPai()
|
self:InitMaPai()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:InitMaPai()
|
function M:InitMaPai()
|
||||||
self.maPaiCtr=self._view:GetController("mapai")
|
self.maPaiCtr = self._view:GetController("mapai")
|
||||||
self.maPaiCtr.selectedIndex=0
|
self.maPaiCtr.selectedIndex = 0
|
||||||
|
|
||||||
self.maPaiList={}
|
self.maPaiList = {}
|
||||||
|
|
||||||
for i=1,10 do
|
for i = 1, 10 do
|
||||||
local tempMP=self._view:GetChild("niao"..i)
|
local tempMP = self._view:GetChild("niao" .. i)
|
||||||
table.insert(self.maPaiList,tempMP)
|
table.insert(self.maPaiList, tempMP)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsMapaiShow(niao, isShow)
|
||||||
function M:IsMapaiShow(niao,isShow)
|
|
||||||
if niao then
|
if niao then
|
||||||
niao.visible=isShow
|
niao.visible = isShow
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetMaPaiValue(niao, value)
|
||||||
function M:SetMaPaiValue(niao,value)
|
|
||||||
if niao then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetMaPaiColor(niao,num)
|
function M:SetMaPaiColor(niao, num)
|
||||||
niao:GetController("color").selectedIndex=num
|
niao:GetController("color").selectedIndex = num
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:HideAllMapai()
|
function M:HideAllMapai()
|
||||||
for i=1,#self.maPaiList do
|
for i = 1, #self.maPaiList do
|
||||||
self:IsMapaiShow(self.maPaiList[i],false)
|
self:IsMapaiShow(self.maPaiList[i], false)
|
||||||
self:SetMaPaiColor(self.maPaiList[i],0)
|
self:SetMaPaiColor(self.maPaiList[i], 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:ShowSelectMaPai(niaoList)
|
function M:ShowSelectMaPai(niaoList)
|
||||||
if niaoList and #niaoList>0 then
|
if niaoList and #niaoList > 0 then
|
||||||
self.maPaiCtr.selectedIndex=1
|
self.maPaiCtr.selectedIndex = 1
|
||||||
self:HideAllMapai()
|
self:HideAllMapai()
|
||||||
for i=1,#niaoList do
|
for i = 1, #niaoList do
|
||||||
self:IsMapaiShow(self.maPaiList[i],true)
|
self:IsMapaiShow(self.maPaiList[i], true)
|
||||||
self:SetMaPaiValue(self.maPaiList[i],niaoList[i].card)
|
self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
|
||||||
if niaoList[i].score>0 then
|
if niaoList[i].score > 0 then
|
||||||
self:SetMaPaiColor(self.maPaiList[i],2)
|
self:SetMaPaiColor(self.maPaiList[i], 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.maPaiCtr.selectedIndex=0
|
self.maPaiCtr.selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:InitData(over, room, result, total_result, callback)
|
function M:InitData(over, room, result, total_result, callback)
|
||||||
self._callback = callback
|
self._callback = callback
|
||||||
local _overCtr = self._view:GetController("over")
|
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 _btnCtr = self._view:GetController("button")
|
||||||
local _sdkCtr = self._view:GetController("sdk")
|
local _sdkCtr = self._view:GetController("sdk")
|
||||||
local ctr_type = self._view:GetController("type")
|
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_gameinfo").text = string.gsub(room.room_config:GetDes(), "\r", "")
|
||||||
-- self._view:GetChild("tex_roomnum").text = room.room_id
|
-- 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_data").text = os.date("%Y-%m-%d %H:%M", os.time())
|
||||||
-- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time())
|
-- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time())
|
||||||
|
|
||||||
local paixingxiangqing=self._view:GetChild("btn_detal")
|
local paixingxiangqing = self._view:GetChild("btn_detal")
|
||||||
paixingxiangqing.visible=false
|
paixingxiangqing.visible = false
|
||||||
local fanhuipaixing=self._view:GetChild("btn_fanhuipaixing")
|
local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
|
||||||
fanhuipaixing.visible=false
|
fanhuipaixing.visible = false
|
||||||
|
|
||||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||||
if xpconfig and round>1 then
|
if xpconfig and round > 1 then
|
||||||
self.xiPaiCtr.selectedIndex=1
|
self.xiPaiCtr.selectedIndex = 1
|
||||||
else
|
else
|
||||||
self.xiPaiCtr.selectedIndex=0
|
self.xiPaiCtr.selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -115,13 +109,13 @@ function M:InitData(over, room, result, total_result, callback)
|
||||||
|
|
||||||
|
|
||||||
if over ~= 2 then
|
if over ~= 2 then
|
||||||
local xipai=self._view:GetChild("btn_xipai")
|
local xipai = self._view:GetChild("btn_xipai")
|
||||||
xipai.touchable=true
|
xipai.touchable = true
|
||||||
xipai.onClick:Add(function()
|
xipai.onClick:Add(function()
|
||||||
local xiPaiCallBack=function ()
|
local xiPaiCallBack = function()
|
||||||
xipai.touchable=false
|
xipai.touchable = false
|
||||||
self.xiPaiCtr.selectedIndex=0
|
self.xiPaiCtr.selectedIndex = 0
|
||||||
ViewUtil.ErrorTip(1000000,"申请洗牌成功")
|
ViewUtil.ErrorTip(1000000, "申请洗牌成功")
|
||||||
end
|
end
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:SendXiPaiAction(xiPaiCallBack)
|
_gamectr:SendXiPaiAction(xiPaiCallBack)
|
||||||
|
|
@ -155,14 +149,14 @@ function M:InitData(over, room, result, total_result, callback)
|
||||||
end)
|
end)
|
||||||
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
||||||
elseif over == 1 then
|
elseif over == 1 then
|
||||||
self.xiPaiCtr.selectedIndex=0
|
self.xiPaiCtr.selectedIndex = 0
|
||||||
_btnCtr.selectedIndex = 1
|
_btnCtr.selectedIndex = 1
|
||||||
_sdkCtr.selectedIndex = 1
|
_sdkCtr.selectedIndex = 1
|
||||||
btn_result.onClick:Add(function()
|
btn_result.onClick:Add(function()
|
||||||
_overCtr.selectedIndex = 1
|
_overCtr.selectedIndex = 1
|
||||||
_btnCtr.selectedIndex = 0
|
_btnCtr.selectedIndex = 0
|
||||||
_sdkCtr.selectedIndex = 0
|
_sdkCtr.selectedIndex = 0
|
||||||
self.maPaiCtr.selectedIndex=0
|
self.maPaiCtr.selectedIndex = 0
|
||||||
if self._qsinfo_view then
|
if self._qsinfo_view then
|
||||||
self._qsinfo_view:Dispose()
|
self._qsinfo_view:Dispose()
|
||||||
end
|
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)
|
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.xiPaiCtr.selectedIndex=0
|
self.xiPaiCtr.selectedIndex = 0
|
||||||
_overCtr.selectedIndex = 1
|
_overCtr.selectedIndex = 1
|
||||||
self.maPaiCtr.selectedIndex=0
|
self.maPaiCtr.selectedIndex = 0
|
||||||
btn_close.onClick:Add(function()
|
btn_close.onClick:Add(function()
|
||||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
end)
|
end)
|
||||||
|
|
@ -183,7 +177,7 @@ function M:InitData(over, room, result, total_result, callback)
|
||||||
end
|
end
|
||||||
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 n = over + 1
|
||||||
local list_view1 = self._view:GetChild("player_list_1")
|
local list_view1 = self._view:GetChild("player_list_1")
|
||||||
local list_view2 = self._view:GetChild("player_list_2")
|
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
|
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()
|
list_view1:RemoveChildrenToPool()
|
||||||
for i=1,#data do
|
for i = 1, #data do
|
||||||
local item = list_view1:AddItemFromPool()
|
local item = list_view1:AddItemFromPool()
|
||||||
self:FillItemData(room, data[i], item, active_player, niao)
|
self:FillItemData(room, data[i], item, active_player, niao)
|
||||||
end
|
end
|
||||||
|
|
@ -244,14 +238,14 @@ function M:FillItemData(room, data, item, active_player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local sp = " "
|
local sp = " "
|
||||||
local str = "胡:"..huadd.."分"
|
local str = "胡:" .. huadd .. "分"
|
||||||
str = str..sp.."扎鸟:"..birdadd.."分"
|
str = str .. sp .. "扎鸟:" .. birdadd .. "分"
|
||||||
str = str..sp.."起手胡:"..qsadd.."分"
|
str = str .. sp .. "起手胡:" .. qsadd .. "分"
|
||||||
-- if #qs_niao_list > 0 then
|
-- if #qs_niao_list > 0 then
|
||||||
-- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. ")"
|
-- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. ")"
|
||||||
-- end
|
-- end
|
||||||
if data["piao_niao_score"] then
|
if data["piao_niao_score"] then
|
||||||
str = str..sp.."飘鸟:"..data["piao_niao_score"].."分"
|
str = str .. sp .. "飘鸟:" .. data["piao_niao_score"] .. "分"
|
||||||
end
|
end
|
||||||
item:GetChild("score1").text = str
|
item:GetChild("score1").text = str
|
||||||
local win_list = data["win_list"]
|
local win_list = data["win_list"]
|
||||||
|
|
@ -271,7 +265,7 @@ function M:FillItemData(room, data, item, active_player)
|
||||||
end
|
end
|
||||||
str2 = CS_Win_Type[win_list[i].type]
|
str2 = CS_Win_Type[win_list[i].type]
|
||||||
end
|
end
|
||||||
str1 = str1..str2..sp
|
str1 = str1 .. str2 .. sp
|
||||||
end
|
end
|
||||||
item:GetChild("score3").text = str1
|
item:GetChild("score3").text = str1
|
||||||
end
|
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
|
if data["is_win"] and active_player == p.self_user.account_id and remove_win_card then
|
||||||
list_remove(hand_cards, data["win_card"])
|
list_remove(hand_cards, data["win_card"])
|
||||||
end
|
end
|
||||||
for i=1,#hand_cards do
|
for i = 1, #hand_cards do
|
||||||
local card = hand_list_view:AddItemFromPool()
|
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
|
end
|
||||||
hand_list_view.width = 52 * #hand_cards
|
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")
|
local fz_card_list = item:GetChild("fz_card_list")
|
||||||
fz_card_list.width = 157 * #fz_card * 0.8
|
fz_card_list.width = 157 * #fz_card * 0.8
|
||||||
fz_card_list:RemoveChildrenToPool()
|
fz_card_list:RemoveChildrenToPool()
|
||||||
for i=1,#fz_card do
|
for i = 1, #fz_card do
|
||||||
if fz_card[i].type == FZType.Peng then
|
if fz_card[i].type == FZType.Peng then
|
||||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
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)
|
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
|
end
|
||||||
elseif fz_card[i].type == FZType.Chi then
|
elseif fz_card[i].type == FZType.Chi then
|
||||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
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)
|
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
|
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
|
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")
|
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)
|
local card = item:GetChild("card_" .. j)
|
||||||
if fz_card[i].type == FZType.Gang_An and j == 4 then
|
if fz_card[i].type == FZType.Gang_An and j == 4 then
|
||||||
card.icon = "ui://Main_Majiang/202_00"
|
card.icon = "ui://Main_Majiang/202_00"
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -322,7 +316,7 @@ function M:FillItemData(room, data, item, active_player)
|
||||||
|
|
||||||
-- local total_score = data["total_score"]
|
-- local total_score = data["total_score"]
|
||||||
if total >= 0 then
|
if total >= 0 then
|
||||||
item:GetChild("score2").text = "+"..total
|
item:GetChild("score2").text = "+" .. total
|
||||||
item:GetChild("score2").grayed = false
|
item:GetChild("score2").grayed = false
|
||||||
else
|
else
|
||||||
item:GetChild("score2").text = total
|
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
|
local is_win = data["is_win"] or false
|
||||||
item:GetController("win").selectedIndex = is_win and 0 or 1
|
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
|
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
|
||||||
item:GetController("win").selectedIndex = 2
|
item:GetController("win").selectedIndex = 2
|
||||||
end
|
end
|
||||||
local win_card = item:GetChild("win_card")
|
local win_card = item:GetChild("win_card")
|
||||||
if is_win then
|
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
|
end
|
||||||
if data.niao then
|
if data.niao then
|
||||||
item:GetController("niao").selectedIndex = 1
|
item:GetController("niao").selectedIndex = 1
|
||||||
|
|
@ -384,22 +378,22 @@ function M:FillItemData2(room, data, list)
|
||||||
|
|
||||||
local settle_log = data[i].settle_log
|
local settle_log = data[i].settle_log
|
||||||
player_list[i].param = {}
|
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].key = "大胡自摸:"
|
||||||
player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo)
|
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].key = "小胡自摸:"
|
||||||
player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo)
|
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].key = "大胡接炮:"
|
||||||
player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao)
|
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].key = "小胡接炮:"
|
||||||
player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao)
|
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].key = "大胡点炮:"
|
||||||
player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao)
|
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].key = "小胡点炮:"
|
||||||
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
|
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
|
||||||
end
|
end
|
||||||
|
|
@ -408,7 +402,8 @@ function M:FillItemData2(room, data, list)
|
||||||
-- self:SetGSListlineGap(-10)
|
-- self:SetGSListlineGap(-10)
|
||||||
|
|
||||||
local big_result = self._view:GetChild("big_result")
|
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")
|
local lst_p = big_result:GetChild("player_list")
|
||||||
if #player_list == 3 then
|
if #player_list == 3 then
|
||||||
lst_p.columnGap = 108
|
lst_p.columnGap = 108
|
||||||
|
|
@ -472,7 +467,7 @@ function M:__AddQSInfo(data, nick, room)
|
||||||
cards[card] = 1
|
cards[card] = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for k,v in pairs(cards) do
|
for k, v in pairs(cards) do
|
||||||
local card = k
|
local card = k
|
||||||
if card_map[card] then
|
if card_map[card] then
|
||||||
if card_map[card] < cards[card] then
|
if card_map[card] < cards[card] then
|
||||||
|
|
@ -484,7 +479,7 @@ function M:__AddQSInfo(data, nick, room)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local all_cards = {}
|
local all_cards = {}
|
||||||
for j,v in pairs(card_map) do
|
for j, v in pairs(card_map) do
|
||||||
for k = 1, v do
|
for k = 1, v do
|
||||||
table.insert(all_cards, j)
|
table.insert(all_cards, j)
|
||||||
end
|
end
|
||||||
|
|
@ -493,7 +488,7 @@ function M:__AddQSInfo(data, nick, room)
|
||||||
for j = 1, #all_cards do
|
for j = 1, #all_cards do
|
||||||
local citem = lst_card:AddItemFromPool()
|
local citem = lst_card:AddItemFromPool()
|
||||||
citem.touchable = false
|
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
|
end
|
||||||
local cs_zhua_niao = room.room_config.niao_type == 2
|
local cs_zhua_niao = room.room_config.niao_type == 2
|
||||||
qsinfo:GetController("niao").selectedIndex = cs_zhua_niao and 1 or 0
|
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))
|
_touch_start_pos = self._view:GlobalToLocal(Vector2(context.inputEvent.x, context.inputEvent.y))
|
||||||
end)
|
end)
|
||||||
btn_di.onTouchMove:Add(function(context)
|
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 dist = Vector2(xy.x - _touch_start_pos.x, xy.y - _touch_start_pos.y)
|
||||||
local posx = _view_start_pos.x + dist.x
|
local posx = _view_start_pos.x + dist.x
|
||||||
local posy = _view_start_pos.y + dist.y
|
local posy = _view_start_pos.y + dist.y
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new CS_MainView
|
--- Create a new CS_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "CS_MainView"
|
self.class = "CS_MainView"
|
||||||
self.asset_group = "ChangSha_MJ"
|
self.asset_group = "ChangSha_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -47,7 +47,7 @@ function M:InitView(url)
|
||||||
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
||||||
|
|
||||||
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
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._hu_tip = HuTipView.new(self)
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
||||||
--print("CS_MainView")
|
---- print("CS_MainView")
|
||||||
if (room.playing or room.curren_round > 0) or room.status == 1 then
|
if (room.playing or room.curren_round > 0) or room.status == 1 then
|
||||||
self:ReloadRoom()
|
self:ReloadRoom()
|
||||||
end
|
end
|
||||||
|
|
@ -111,8 +111,8 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(CS_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._tex_LeftCard.text = arg[1]
|
self._tex_LeftCard.text = arg[1]
|
||||||
local info = self._player_card_info[1]
|
local info = self._player_card_info[1]
|
||||||
info._player.auto_out_card = false
|
info._player.auto_out_card = false
|
||||||
|
|
@ -454,7 +454,7 @@ function M:EventInit()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._tex_LeftCard.text = "0"
|
self._tex_LeftCard.text = "0"
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
if oldGameVersion==1 then
|
if oldGameVersion == 1 then
|
||||||
self:__PiaoNiaoTip()
|
self:__PiaoNiaoTip()
|
||||||
else
|
else
|
||||||
self:__PiaoNiaoTip1()
|
self:__PiaoNiaoTip1()
|
||||||
|
|
@ -535,7 +535,7 @@ function M:OutCard(card)
|
||||||
-- 防止同一帧内执行两次OutCard事件
|
-- 防止同一帧内执行两次OutCard事件
|
||||||
local last_discard_frame = discard_frame
|
local last_discard_frame = discard_frame
|
||||||
discard_frame = Time.frameCount
|
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
|
if discard_frame == last_discard_frame then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
||||||
local outcard_list = self._mask_data["outcard_list"]
|
local outcard_list = self._mask_data["outcard_list"]
|
||||||
local comp = handcard_list["comp"]
|
local comp = handcard_list["comp"]
|
||||||
local card = outcard_list["card"]
|
local card = outcard_list["card"]
|
||||||
--print("comp"..comp)
|
---- print("comp"..comp)
|
||||||
-- print(vardump(_player.card_list))
|
-- -- print(vardump(_player.card_list))
|
||||||
|
|
||||||
if self._current_card_type == 2 then
|
if self._current_card_type == 2 then
|
||||||
comp = comp .. "_3d"
|
comp = comp .. "_3d"
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -36,7 +36,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -112,7 +113,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -162,8 +163,8 @@ function M:__OnDragEnd(context, offset)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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)
|
||||||
-- print(button.y - card.old_postion.y)
|
-- -- 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 < -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
|
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
|
|
@ -184,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "ChaoShan_MJ"
|
self.asset_group = "ChaoShan_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/chaoshan/ui/Extend_MJ_ChaoShan")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
print(beforeLaiziID)
|
-- print(beforeLaiziID)
|
||||||
print(currentLaizi1ID)
|
-- print(currentLaizi1ID)
|
||||||
print(currentLaizi2ID)
|
-- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
local weight = arg[2]
|
local weight = arg[2]
|
||||||
self:__FangziTip(_tip, weight)
|
self:__FangziTip(_tip, weight)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("ChaoShan_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("ChaoShan_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -319,16 +311,15 @@ function M:EventInit()
|
||||||
he_list:Dispose()
|
he_list:Dispose()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
-- 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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -444,7 +435,7 @@ end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
if card ~= 0 then
|
if card ~= 0 then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -453,12 +444,12 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
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:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -476,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
||||||
|
|
||||||
local tip_hu = false
|
local tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not (tonumber(weight) >= 16) then
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
||||||
local item_choose = list_choose:AddItemFromPool()
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
item_choose:GetController("type").selectedIndex = 0
|
item_choose:GetController("type").selectedIndex = 0
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
item_choose.onClick:Add(function()
|
item_choose.onClick:Add(function()
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
||||||
local pNode = info._mask_liangpai
|
local pNode = info._mask_liangpai
|
||||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect")
|
local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect")
|
||||||
if fz.type == FZType.Peng then
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
else
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
|
@ -605,7 +596,7 @@ end
|
||||||
function M:RunNiao(list, start_seat)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -700,7 +691,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -718,7 +709,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCardBefore)
|
printlog(_tableInfo.laiziCardBefore)
|
||||||
printlog(_tableInfo.laiziCard2Before)
|
printlog(_tableInfo.laiziCard2Before)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCardBefore>0 then
|
if _tableInfo.laiziCardBefore > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "ChaoZhou_MJ"
|
self.asset_group = "ChaoZhou_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/chaozhou/ui/Extend_MJ_ChaoZhou")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
print(beforeLaiziID)
|
-- print(beforeLaiziID)
|
||||||
print(currentLaizi1ID)
|
-- print(currentLaizi1ID)
|
||||||
print(currentLaizi2ID)
|
-- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
local weight = arg[2]
|
local weight = arg[2]
|
||||||
self:__FangziTip(_tip, weight)
|
self:__FangziTip(_tip, weight)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("ChaoZhou_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -319,26 +311,25 @@ function M:EventInit()
|
||||||
he_list:Dispose()
|
he_list:Dispose()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
--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)
|
end)
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
--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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -454,7 +445,7 @@ end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
if card ~= 0 then
|
if card ~= 0 then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -463,12 +454,12 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
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:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -484,42 +475,39 @@ function M:__FangziTip(tip, weight)
|
||||||
_lit_fanzi:RemoveChildrenToPool()
|
_lit_fanzi:RemoveChildrenToPool()
|
||||||
local _tlist = table.keys(tip.tip_map_type)
|
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 tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
|
|
||||||
for i=1,count do
|
for i = 1, count do
|
||||||
if tip.tip_map_id[i].type==6 then
|
if tip.tip_map_id[i].type == 6 then
|
||||||
tip_hu=true
|
tip_hu = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
|
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
if tip_hu==true then
|
if tip_hu == true then
|
||||||
if td.type==6 then
|
if td.type == 6 then
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
|
end
|
||||||
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 = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||||
_btn_pass.onClick:Set(function()
|
_btn_pass.onClick:Set(function()
|
||||||
|
|
@ -539,20 +527,19 @@ function M:__FangziTip(tip, weight)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local tip_hu = false
|
local tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not (tonumber(weight) >= 16) then
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
|
@ -575,8 +562,6 @@ function M:__FangziTip(tip, weight)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
||||||
local item_choose = list_choose:AddItemFromPool()
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
item_choose:GetController("type").selectedIndex = 0
|
item_choose:GetController("type").selectedIndex = 0
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
item_choose.onClick:Add(function()
|
item_choose.onClick:Add(function()
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
||||||
local pNode = info._mask_liangpai
|
local pNode = info._mask_liangpai
|
||||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect")
|
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect")
|
||||||
if fz.type == FZType.Peng then
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
else
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
|
@ -676,7 +661,7 @@ end
|
||||||
function M:RunNiao(list, start_seat)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -771,7 +756,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -789,7 +774,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCardBefore)
|
printlog(_tableInfo.laiziCardBefore)
|
||||||
printlog(_tableInfo.laiziCard2Before)
|
printlog(_tableInfo.laiziCard2Before)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCardBefore>0 then
|
if _tableInfo.laiziCardBefore > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "ChaoZhouGui_MJ"
|
self.asset_group = "ChaoZhouGui_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/chaozhougui/ui/Extend_MJ_ChaoZhouGui")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
print(beforeLaiziID)
|
-- print(beforeLaiziID)
|
||||||
print(currentLaizi1ID)
|
-- print(currentLaizi1ID)
|
||||||
print(currentLaizi2ID)
|
-- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
local weight = arg[2]
|
local weight = arg[2]
|
||||||
self:__FangziTip(_tip, weight)
|
self:__FangziTip(_tip, weight)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("ChaoZhouGui_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -319,26 +311,25 @@ function M:EventInit()
|
||||||
he_list:Dispose()
|
he_list:Dispose()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
--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)
|
end)
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
--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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -454,7 +445,7 @@ end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
if card ~= 0 then
|
if card ~= 0 then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -463,12 +454,12 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
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:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -484,42 +475,39 @@ function M:__FangziTip(tip, weight)
|
||||||
_lit_fanzi:RemoveChildrenToPool()
|
_lit_fanzi:RemoveChildrenToPool()
|
||||||
local _tlist = table.keys(tip.tip_map_type)
|
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 tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
|
|
||||||
for i=1,count do
|
for i = 1, count do
|
||||||
if tip.tip_map_id[i].type==6 then
|
if tip.tip_map_id[i].type == 6 then
|
||||||
tip_hu=true
|
tip_hu = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
|
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
if tip_hu==true then
|
if tip_hu == true then
|
||||||
if td.type==6 then
|
if td.type == 6 then
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
|
end
|
||||||
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 = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||||
_btn_pass.onClick:Set(function()
|
_btn_pass.onClick:Set(function()
|
||||||
|
|
@ -539,20 +527,19 @@ function M:__FangziTip(tip, weight)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local tip_hu = false
|
local tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not (tonumber(weight) >= 16) then
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
|
@ -575,8 +562,6 @@ function M:__FangziTip(tip, weight)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
||||||
local item_choose = list_choose:AddItemFromPool()
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
item_choose:GetController("type").selectedIndex = 0
|
item_choose:GetController("type").selectedIndex = 0
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
item_choose.onClick:Add(function()
|
item_choose.onClick:Add(function()
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
||||||
local pNode = info._mask_liangpai
|
local pNode = info._mask_liangpai
|
||||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect")
|
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect")
|
||||||
if fz.type == FZType.Peng then
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
else
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
|
@ -676,7 +661,7 @@ end
|
||||||
function M:RunNiao(list, start_seat)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -771,7 +756,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -789,7 +774,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCardBefore)
|
printlog(_tableInfo.laiziCardBefore)
|
||||||
printlog(_tableInfo.laiziCard2Before)
|
printlog(_tableInfo.laiziCard2Before)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCardBefore>0 then
|
if _tableInfo.laiziCardBefore > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -17,16 +17,16 @@ end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
function M:ShowHuTip(card_list)
|
||||||
printlog("ShowHuTip")
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 33
|
self.extend_id = 33
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -101,12 +101,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -131,7 +131,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -17,16 +17,16 @@ end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
function M:ShowHuTip(card_list)
|
||||||
printlog("ShowHuTip")
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -98,12 +98,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -137,7 +137,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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
|
if #tingList > 0 then
|
||||||
table.insert(tingList, 412)
|
table.insert(tingList, 412)
|
||||||
end
|
end
|
||||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -81,7 +83,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -134,7 +136,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -17,16 +17,16 @@ end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
function M:ShowHuTip(card_list)
|
||||||
printlog("ShowHuTip")
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -35,29 +35,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -117,7 +113,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -170,7 +166,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -121,7 +121,7 @@ function M:OnEventSendCards(evt_data)
|
||||||
_room.jing = jing
|
_room.jing = jing
|
||||||
self._cacheEvent:Enqueue(function()
|
self._cacheEvent:Enqueue(function()
|
||||||
_room.banker_seat = seat
|
_room.banker_seat = seat
|
||||||
print("========================fuzhijing")
|
-- print("========================fuzhijing")
|
||||||
for i = 1, #_room.player_list do
|
for i = 1, #_room.player_list do
|
||||||
_room.player_list[i].hand_left_count = 13
|
_room.player_list[i].hand_left_count = 13
|
||||||
_room.player_list[i].fz_list = {}
|
_room.player_list[i].fz_list = {}
|
||||||
|
|
@ -275,7 +275,7 @@ function M:OnEventFzAction(evt_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnEventHu(evt_data)
|
function M:OnEventHu(evt_data)
|
||||||
print("===========================OnEventHu")
|
-- print("===========================OnEventHu")
|
||||||
local cards = evt_data["card"]
|
local cards = evt_data["card"]
|
||||||
local win_p = self._room:GetPlayerBySeat(evt_data["seat"])
|
local win_p = self._room:GetPlayerBySeat(evt_data["seat"])
|
||||||
local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"])
|
local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"])
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ function M:EventInit()
|
||||||
local tem = win_list[i]
|
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 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)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ function M:FillRoomData(s2croom)
|
||||||
p.fz_list[#p.fz_list + 1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
print("=======================在此进入")
|
-- print("=======================在此进入")
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -141,7 +141,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
print("==========================__OnClickHandCard")
|
-- print("==========================__OnClickHandCard")
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
|
|
@ -168,7 +168,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,6 @@ function M:FillRoomData(s2croom)
|
||||||
p.fz_list[#p.fz_list + 1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
print("=======================================自动开始")
|
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -141,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "QiZhiBa_MJ"
|
self.asset_group = "QiZhiBa_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/qizhiba/ui/Extend_MJ_QiZhiBa")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3])>0 then
|
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3]) > 0 then
|
||||||
self:SetShowLaiZiProcess(room.laiziInfo[3],room.laiziInfo[3],0,false)
|
self:SetShowLaiZiProcess(room.laiziInfo[3], room.laiziInfo[3], 0, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_PokeMaJiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_PokeMaJiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
print(beforeLaiziID)
|
-- print(beforeLaiziID)
|
||||||
print(currentLaizi1ID)
|
-- print(currentLaizi1ID)
|
||||||
print(currentLaizi2ID)
|
-- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID>0 then
|
if currentLaizi2ID > 0 then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID>0 then
|
if currentLaizi2ID > 0 then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID>0 then
|
if currentLaizi2ID > 0 then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,8 +143,8 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
|
||||||
|
|
@ -159,12 +152,12 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -175,7 +168,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -189,11 +182,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -202,7 +195,7 @@ function M:EventInit()
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
||||||
info:UpdateOutCardList(outcard, card, self._cursor)
|
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:PlaySound("QiZhiBa_MJ", p.self_user.sex, tostring(cardAudio))
|
||||||
self:PlayMJSound("chupai.mp3")
|
self:PlayMJSound("chupai.mp3")
|
||||||
if seat == _room.self_player.seat then
|
if seat == _room.self_player.seat then
|
||||||
|
|
@ -211,7 +204,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -222,19 +215,19 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
arg={...}
|
arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
self:__FangziTip(_tip)
|
self:__FangziTip(_tip)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -268,7 +261,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -291,11 +284,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("QiZhiBa_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("QiZhiBa_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -305,14 +298,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -321,16 +313,15 @@ function M:EventInit()
|
||||||
he_list:Dispose()
|
he_list:Dispose()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
-- 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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -339,7 +330,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -405,7 +396,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -426,7 +417,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -445,9 +436,9 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
local isOut=IsHasDictionary(card,DataManager.CurrenRoom.laiziInfo)
|
local isOut = IsHasDictionary(card, DataManager.CurrenRoom.laiziInfo)
|
||||||
if isOut==false then
|
if isOut == false then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -456,13 +447,13 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
info:UpdateOutCardList(nil, card, self._cursor)
|
||||||
local cardAudio=string.sub(card,2)
|
local cardAudio = string.sub(card, 2)
|
||||||
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex,tostring(cardAudio))
|
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex, tostring(cardAudio))
|
||||||
self:PlayMJSound("chupai.mp3")
|
self:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -483,19 +474,16 @@ function M:__FangziTip(tip, weight)
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
table.sort(_tlist)
|
table.sort(_tlist)
|
||||||
local isHu = false
|
local isHu = false
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
|
|
||||||
|
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_PokeMaJiang/Btn_fztip"
|
local url = "ui://Main_PokeMaJiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
|
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
|
||||||
|
|
@ -520,9 +508,6 @@ function M:__FangziTip(tip, weight)
|
||||||
_chipeng_tip:Center()
|
_chipeng_tip:Center()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:__TipAction(context)
|
function M:__TipAction(context)
|
||||||
local data = context.sender.data
|
local data = context.sender.data
|
||||||
local _gamectr = self._gamectr
|
local _gamectr = self._gamectr
|
||||||
|
|
@ -544,14 +529,14 @@ function M:__TipAction(context)
|
||||||
self._chipeng_tip = nil
|
self._chipeng_tip = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:_ChiView(tiplist, callback)
|
function M:_ChiView(tiplist, callback)
|
||||||
self._chipeng_tip.visible = false
|
self._chipeng_tip.visible = false
|
||||||
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
|
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
|
||||||
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
||||||
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
||||||
local crossCtr = _pop_tip_choice:GetController("state")
|
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:GetChild("Btn_cross").onClick:Add(function()
|
||||||
_pop_tip_choice:Dispose()
|
_pop_tip_choice:Dispose()
|
||||||
self._chipeng_tip.visible = true
|
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
|
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
||||||
if tiplist[i].weight ~= 1 then
|
if tiplist[i].weight ~= 1 then
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
else
|
else
|
||||||
local tem = {}
|
local tem = {}
|
||||||
|
|
@ -575,9 +561,12 @@ function M:_ChiView(tiplist, callback)
|
||||||
table.sort(tem, function(a, b)
|
table.sort(tem, function(a, b)
|
||||||
return a < b
|
return a < b
|
||||||
end)
|
end)
|
||||||
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[1])
|
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||||
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[2])
|
self:GetPrefix() .. "201_" .. tem[1])
|
||||||
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[3])
|
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)
|
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
||||||
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
@ -585,14 +574,15 @@ function M:_ChiView(tiplist, callback)
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -619,20 +609,20 @@ function M:OnFangziAction(...)
|
||||||
local fz_sound = ""
|
local fz_sound = ""
|
||||||
if fz.type == FZType.Peng then
|
if fz.type == FZType.Peng then
|
||||||
fangzi = "碰"
|
fangzi = "碰"
|
||||||
fz_sound = "peng"..math.random(1, 3)
|
fz_sound = "peng" .. math.random(1, 3)
|
||||||
elseif fz.type == FZType.Chi then
|
elseif fz.type == FZType.Chi then
|
||||||
fangzi = "吃"
|
fangzi = "吃"
|
||||||
fz_sound = "chi"..math.random(1, 3)
|
fz_sound = "chi" .. math.random(1, 3)
|
||||||
else
|
else
|
||||||
if fz.opengang then
|
if fz.opengang then
|
||||||
fangzi = "杠"
|
fangzi = "杠"
|
||||||
fz_sound = "gang"..math.random(1, 2)
|
fz_sound = "gang" .. math.random(1, 2)
|
||||||
else
|
else
|
||||||
fangzi = "补"
|
fangzi = "补"
|
||||||
fz_sound = "buzhang"
|
fz_sound = "buzhang"
|
||||||
end
|
end
|
||||||
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("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||||
effect:GetChild("word2").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)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -680,7 +670,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -757,7 +747,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -775,7 +765,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = import(".main.MJRoom")
|
local MJRoom = import(".main.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -71,19 +71,19 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCard2)
|
printlog(_tableInfo.laiziCard2)
|
||||||
printlog(_tableInfo.laiziCard3)
|
printlog(_tableInfo.laiziCard3)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
if _tableInfo.laiziCard3>0 then
|
if _tableInfo.laiziCard3 > 0 then
|
||||||
local str=string.sub(_tableInfo.laiziCard3,2)
|
local str = string.sub(_tableInfo.laiziCard3, 2)
|
||||||
for i=1,4 do
|
for i = 1, 4 do
|
||||||
table.insert(room.laiziInfo,tonumber(i..str))
|
table.insert(room.laiziInfo, tonumber(i .. str))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCard3
|
room.beforelaiziCardId = _tableInfo.laiziCard3
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
--pt(room.laiziInfo)
|
--pt(room.laiziInfo)
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -110,7 +110,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -120,13 +120,13 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
fz.allCard=op["opcard"]
|
fz.allCard = op["opcard"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -151,7 +151,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -160,7 +160,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -15,52 +15,46 @@ function M.new(view,mainView)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list,currentOnclickCard)
|
function M:ShowHuTip(card_list, currentOnclickCard)
|
||||||
if currentOnclickCard then
|
if currentOnclickCard then
|
||||||
if DataManager.CurrenRoom.self_player.CardTingList then
|
if DataManager.CurrenRoom.self_player.CardTingList then
|
||||||
local tempV=DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
local tempV = DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
||||||
if tempV and #tempV>0 then
|
if tempV and #tempV > 0 then
|
||||||
self._mainView._hu_tip:FillData(tempV)
|
self._mainView._hu_tip:FillData(tempV)
|
||||||
else
|
else
|
||||||
self._mainView._hu_tip:HideHuTipsPanel()
|
self._mainView._hu_tip:HideHuTipsPanel()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
|
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
|
||||||
self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList)
|
self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList)
|
||||||
end--]]
|
end--]]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,27 +62,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
self:ShowHuTip(card_list)
|
self:ShowHuTip(card_list)
|
||||||
if getcard then
|
if getcard then
|
||||||
self._out_card = true
|
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
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
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
|
if isTing then
|
||||||
--printlog("听牌提示===》》》",curIndex)
|
--printlog("听牌提示===》》》",curIndex)
|
||||||
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
|
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
|
||||||
local value=#DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
local value = #DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
||||||
if tonumber(value)>1 then
|
if tonumber(value) > 1 then
|
||||||
btn:GetController("mark_ting").selectedIndex=2
|
btn:GetController("mark_ting").selectedIndex = 2
|
||||||
else
|
else
|
||||||
btn:GetController("mark_ting").selectedIndex=1
|
btn:GetController("mark_ting").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--DataManager.CurrenRoom.self_player.tingPaiList=nil
|
--DataManager.CurrenRoom.self_player.tingPaiList=nil
|
||||||
|
|
||||||
else
|
else
|
||||||
for i = 1, #_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
|
|
@ -98,18 +90,14 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -127,7 +115,7 @@ function M:__OnClickHandCard(context)
|
||||||
|
|
||||||
if self._out_card then
|
if self._out_card then
|
||||||
printlog("点击开始出牌===>>>")
|
printlog("点击开始出牌===>>>")
|
||||||
self:ShowHuTip(card_list,button.data.card_item)
|
self:ShowHuTip(card_list, button.data.card_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 标记出牌
|
-- 标记出牌
|
||||||
|
|
@ -163,9 +151,9 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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)
|
||||||
local isOut=IsHasDictionary(card.card_item,DataManager.CurrenRoom.laiziInfo)
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
self.outcard_button = button
|
self.outcard_button = button
|
||||||
|
|
@ -184,6 +172,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -4,15 +4,15 @@ local TableBG = require("Game.Data.TableBG")
|
||||||
local MJSettingView = import(".MJSettingViewNew")
|
local MJSettingView = import(".MJSettingViewNew")
|
||||||
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
||||||
|
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01"},
|
{ 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 = 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"}
|
{ id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03" }
|
||||||
}
|
}
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
setmetatable(M,{__index = MainView})
|
setmetatable(M, { __index = MainView })
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
function M:InitView(url, use_custom_bg)
|
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")
|
UIPackage.AddPackage("base/main_pokemajiang/ui/Main_PokeMaJiang")
|
||||||
|
|
||||||
MainView.InitView(self,url)
|
MainView.InitView(self, url)
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj")
|
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj")
|
||||||
if not use_custom_bg then
|
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")
|
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||||
|
|
||||||
--print("2222222222222222222222")
|
---- print("2222222222222222222222")
|
||||||
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
---- print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||||
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
||||||
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
||||||
--temp111:SetActive(false)
|
--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
|
if self.dismiss_room_cd_time > 0 then
|
||||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||||
else
|
else
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:AskDismissRoom()
|
_gamectr:AskDismissRoom()
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -82,11 +81,11 @@ function M:InitView(url, use_custom_bg)
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
for i = 1, _room.room_config.people_num do
|
for i = 1, _room.room_config.people_num do
|
||||||
local tem = _view:GetChild("player_card_info" .. i)
|
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
|
end
|
||||||
|
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = _player_card_info[self:GetPos(p.seat)]
|
local info = _player_card_info[self:GetPos(p.seat)]
|
||||||
info:SetPlayer(p)
|
info:SetPlayer(p)
|
||||||
|
|
@ -95,20 +94,19 @@ function M:InitView(url, use_custom_bg)
|
||||||
|
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
local readyNum = 0
|
local readyNum = 0
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
if p.ready then readyNum = readyNum + 1 end
|
if p.ready then readyNum = readyNum + 1 end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#_room.player_list do
|
for i = 1, #_room.player_list do
|
||||||
|
|
||||||
local p = _room.player_list[i]
|
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
|
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
|
end
|
||||||
|
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
end
|
end
|
||||||
|
|
||||||
self._ctr_action = _view:GetController("action")
|
self._ctr_action = _view:GetController("action")
|
||||||
|
|
@ -126,27 +124,24 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Change3d(flag)
|
function M:Change3d(flag)
|
||||||
|
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
|
|
||||||
local _cardbox = _view:GetChild("cardbox")
|
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 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
|
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
|
end
|
||||||
|
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
||||||
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
||||||
if flag == true then
|
if flag == true then
|
||||||
|
|
||||||
if _view:GetController("3d") ~= nil then
|
if _view:GetController("3d") ~= nil then
|
||||||
_view:GetController("3d").selectedIndex = 1
|
_view:GetController("3d").selectedIndex = 1
|
||||||
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
||||||
|
|
@ -199,7 +194,7 @@ function M:NewSettingView()
|
||||||
-- gear:Apply()
|
-- gear:Apply()
|
||||||
-- settingView.Change3d = function() end
|
-- settingView.Change3d = function() end
|
||||||
|
|
||||||
settingView:FillBgSection(function(url,index)
|
settingView:FillBgSection(function(url, index)
|
||||||
printlog("NewSettingView")
|
printlog("NewSettingView")
|
||||||
LoadGameBg(url, self._root_view)
|
LoadGameBg(url, self._root_view)
|
||||||
end, self._room.game_id, 1, bg_config)
|
end, self._room.game_id, 1, bg_config)
|
||||||
|
|
@ -230,30 +225,29 @@ function M:GetIndex(seat)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetPosString(seat)
|
function M:GetPosString(seat)
|
||||||
|
|
||||||
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "南","dir_2"
|
return "南", "dir_2"
|
||||||
elseif seat == 3 then
|
elseif seat == 3 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
elseif seat == 4 then
|
elseif seat == 4 then
|
||||||
return "北","dir_4"
|
return "北", "dir_4"
|
||||||
end
|
end
|
||||||
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "南","dir_2"
|
return "南", "dir_2"
|
||||||
elseif seat == 3 then
|
elseif seat == 3 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
end
|
end
|
||||||
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -261,7 +255,7 @@ end
|
||||||
function M:SetCardBoxPosition()
|
function M:SetCardBoxPosition()
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
for i = 1, _room.room_config.people_num do
|
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
|
local index = _room.self_player.seat + i - 1
|
||||||
index = index > 4 and index - 4 or index
|
index = index > 4 and index - 4 or index
|
||||||
tex.text = self._gamectr:GetPosString(index)
|
tex.text = self._gamectr:GetPosString(index)
|
||||||
|
|
@ -287,16 +281,16 @@ function M:markOutCards(showTip, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerEnter(...)
|
function M:OnPlayerEnter(...)
|
||||||
MainView.OnPlayerEnter(self,...)
|
MainView.OnPlayerEnter(self, ...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = self._player_card_info[self:GetPos(p.seat)]
|
local info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
info:SetPlayer(p)
|
info:SetPlayer(p)
|
||||||
info:FillData()
|
info:FillData()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerReady( ... )
|
function M:OnPlayerReady(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
|
|
@ -316,12 +310,11 @@ function M:OnPlayerReady( ... )
|
||||||
|
|
||||||
if readyNum == _room.room_config.people_num then
|
if readyNum == _room.room_config.people_num then
|
||||||
local _cardbox = _view:GetChild("cardbox")
|
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 p = _room.player_list[i]
|
||||||
local zi,icon = self:GetPosString(p.seat)
|
local zi, icon = self:GetPosString(p.seat)
|
||||||
_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
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -376,7 +369,7 @@ function M:CountCardLeftNum(card)
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerLeave( ... )
|
function M:OnPlayerLeave(...)
|
||||||
MainView.OnPlayerLeave(self, ...)
|
MainView.OnPlayerLeave(self, ...)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
if _room.banker_seat == _room.self_player.seat then
|
if _room.banker_seat == _room.self_player.seat then
|
||||||
|
|
@ -387,7 +380,7 @@ end
|
||||||
function M:PlayerChangeLineState()
|
function M:PlayerChangeLineState()
|
||||||
local isOutCard = true
|
local isOutCard = true
|
||||||
local str = "玩家 "
|
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
|
if player.line_state == 0 then
|
||||||
isOutCard = false
|
isOutCard = false
|
||||||
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
||||||
|
|
@ -407,11 +400,11 @@ function M:PlayerChangeLineState()
|
||||||
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:RemoveCursor()
|
function M:RemoveCursor()
|
||||||
|
|
@ -436,10 +429,10 @@ function M:PlayMJMusic(path)
|
||||||
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:PlaySound(group,sex,path)
|
function M:PlaySound(group, sex, path)
|
||||||
local sex_path = ViewUtil.Sex_Chat[sex]
|
local sex_path = ViewUtil.Sex_Chat[sex]
|
||||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3",sex_path,path)
|
local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
|
||||||
ViewUtil.PlaySound(group,path1)
|
ViewUtil.PlaySound(group, path1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetPrefix()
|
function M:GetPrefix()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ local M = PlayerCardInfoView
|
||||||
--- Create a new PlayerCardInfoView
|
--- Create a new PlayerCardInfoView
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self, {__index = M})
|
setmetatable(self, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -126,10 +126,10 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local handcard_list = self._mask_data['handcard_list']
|
local handcard_list = self._mask_data['handcard_list']
|
||||||
local oder = handcard_list['oder']
|
local oder = handcard_list['oder']
|
||||||
local _player = self._player
|
local _player = self._player
|
||||||
-- print(vardump(self._player))
|
-- -- print(vardump(self._player))
|
||||||
|
|
||||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||||
-- print(vardump(_player.card_list))
|
-- -- print(vardump(_player.card_list))
|
||||||
if (not mp) then
|
if (not mp) then
|
||||||
local comp_back = handcard_list['comp_back']
|
local comp_back = handcard_list['comp_back']
|
||||||
if self._current_card_type == 2 then
|
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 outcard_list = self._mask_data['outcard_list']
|
||||||
local comp = handcard_list['comp']
|
local comp = handcard_list['comp']
|
||||||
local card = outcard_list['card']
|
local card = outcard_list['card']
|
||||||
--print("comp"..comp)
|
---- print("comp"..comp)
|
||||||
-- print(vardump(_player.card_list))
|
-- -- print(vardump(_player.card_list))
|
||||||
|
|
||||||
if self._current_card_type == 2 then
|
if self._current_card_type == 2 then
|
||||||
comp = comp .. '_3d'
|
comp = comp .. '_3d'
|
||||||
|
|
@ -296,8 +296,8 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col,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)
|
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, 0, true)
|
||||||
|
|
||||||
if self._current_card_type == 2 then
|
if self._current_card_type == 2 then
|
||||||
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
||||||
|
|
@ -358,8 +358,8 @@ end
|
||||||
|
|
||||||
function M:UpdateFzList(fz, index, show_card)
|
function M:UpdateFzList(fz, index, show_card)
|
||||||
printlog("UpdateFzList=====》》》")
|
printlog("UpdateFzList=====》》》")
|
||||||
printlog("index===",index)
|
printlog("index===", index)
|
||||||
printlog("show_card===",show_card)
|
printlog("show_card===", show_card)
|
||||||
local gn = 3
|
local gn = 3
|
||||||
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
||||||
gn = 4
|
gn = 4
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ function M:setHandCardPos(btn_card, i, getcard)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
print("======================onthisUpdateHandCard")
|
-- print("======================onthisUpdateHandCard")
|
||||||
if self.outcard_button then
|
if self.outcard_button then
|
||||||
self.outcard_button:Dispose()
|
self.outcard_button:Dispose()
|
||||||
self.outcard_button = nil
|
self.outcard_button = nil
|
||||||
|
|
@ -154,7 +154,7 @@ function M:__OnDragEnd(context)
|
||||||
local _room = DataManager.CurrenRoom
|
local _room = DataManager.CurrenRoom
|
||||||
if not _room or _room:GetReloadStatus() then return end
|
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
|
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ local MJTableBG = {}
|
||||||
|
|
||||||
local M = MJTableBG
|
local M = MJTableBG
|
||||||
local mj_bg_config = {
|
local mj_bg_config = {
|
||||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
{ 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 = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01" },
|
||||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local function GetBG(data, game_id)
|
local function GetBG(data, game_id)
|
||||||
|
|
@ -52,7 +52,7 @@ function MJTableBG.GetTableBG(game_id)
|
||||||
local id = -1
|
local id = -1
|
||||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
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
|
if json_data ~= nil then
|
||||||
local config_data = json.decode(json_data)
|
local config_data = json.decode(json_data)
|
||||||
id = GetBG(config_data, game_id)
|
id = GetBG(config_data, game_id)
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
||||||
|
|
||||||
--- Create a new ZZ_MainView
|
--- Create a new ZZ_MainView
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M,{__index = MJMainView})
|
setmetatable(M, { __index = MJMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "MainView"
|
self.class = "MainView"
|
||||||
self.asset_group = "TuiDaoHu_MJ"
|
self.asset_group = "TuiDaoHu_MJ"
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -25,20 +25,20 @@ function M:InitView(url)
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self._full = true
|
self._full = true
|
||||||
UIPackage.AddPackage("extend/majiang/tuidaohu/ui/Extend_MJ_TuiDaoHu")
|
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._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 = self._view:GetChild('n103')
|
||||||
self.LaiziBG.text="鬼牌"
|
self.LaiziBG.text = "鬼牌"
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self:SetReconnentLaiziTips()
|
self:SetReconnentLaiziTips()
|
||||||
|
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
@ -48,74 +48,67 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:SetReconnentLaiziTips()
|
function M:SetReconnentLaiziTips()
|
||||||
local room=DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:SetLaiZiCard(btn, cardId)
|
||||||
function M:SetLaiZiCard(btn,cardId)
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:IsShowLaiZi(btn, isShow)
|
||||||
function M:IsShowLaiZi(btn,isShow)
|
btn.visible = isShow
|
||||||
btn.visible=isShow
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:HideAllLaiZiCard()
|
function M:HideAllLaiZiCard()
|
||||||
self.Laizi1Btn.visible=false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible=false
|
self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible=false
|
self.selectLaiziBtn.visible = false
|
||||||
self.LaiziBG.visible=false
|
self.LaiziBG.visible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||||
--zhongid=currentLaizi1ID
|
--zhongid=currentLaizi1ID
|
||||||
if isShowAnim==nil then isShowAnim=false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
printlog("当前赋值结果为====>>>")
|
printlog("当前赋值结果为====>>>")
|
||||||
print(beforeLaiziID)
|
-- print(beforeLaiziID)
|
||||||
print(currentLaizi1ID)
|
-- print(currentLaizi1ID)
|
||||||
print(currentLaizi2ID)
|
-- print(currentLaizi2ID)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if isShowAnim==true then
|
if isShowAnim == true then
|
||||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self:HideAllLaiZiCard()
|
self:HideAllLaiZiCard()
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||||
if currentLaizi2ID then
|
if currentLaizi2ID then
|
||||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.LaiziBG.visible=true
|
self.LaiziBG.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound()
|
function M:UpdateRound()
|
||||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||||
self._view:GetChild("tex_round2").text = self._room.room_config.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
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild("player_info" .. i)
|
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
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
|
|
@ -150,19 +143,19 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info:FillData(p)
|
info:FillData(p)
|
||||||
|
|
@ -173,7 +166,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._left_time = 15
|
self._left_time = 15
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
local seat = p.seat
|
local seat = p.seat
|
||||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local card = arg[2]
|
local card = arg[2]
|
||||||
-- self._tex_leftTime.text = arg[3]
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
|
@ -219,20 +212,20 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _tip = arg[1]
|
local _tip = arg[1]
|
||||||
local weight = arg[2]
|
local weight = arg[2]
|
||||||
self:__FangziTip(_tip, weight)
|
self:__FangziTip(_tip, weight)
|
||||||
end)
|
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(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local win_seat = arg[1]
|
local win_seat = arg[1]
|
||||||
local lose_seat = arg[2]
|
local lose_seat = arg[2]
|
||||||
local win_card = arg[3]
|
local win_card = arg[3]
|
||||||
|
|
@ -266,7 +259,7 @@ function M:EventInit()
|
||||||
pNode:AddChild(he)
|
pNode:AddChild(he)
|
||||||
he:GetTransition("t2"):Play()
|
he:GetTransition("t2"):Play()
|
||||||
he:Center()
|
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
|
if win_seat ~= _room.self_player.seat then
|
||||||
he.scaleY = 0.4
|
he.scaleY = 0.4
|
||||||
he.scaleX = 0.4
|
he.scaleX = 0.4
|
||||||
|
|
@ -289,11 +282,11 @@ function M:EventInit()
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
local isZiMo=win_seat==lose_seat
|
local isZiMo = win_seat == lose_seat
|
||||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
printlog("声音====>>>",hu_sound)
|
printlog("声音====>>>", hu_sound)
|
||||||
self:PlaySound("TuiDaoHu_MJ",player.self_user.sex, hu_sound)
|
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
local pNode = info._view
|
local pNode = info._view
|
||||||
local url = "eff_list1"
|
local url = "eff_list1"
|
||||||
|
|
@ -303,14 +296,13 @@ function M:EventInit()
|
||||||
he_list:Center()
|
he_list:Center()
|
||||||
|
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
for i = 1 ,#win_list do
|
for i = 1, #win_list do
|
||||||
local tem = win_list[i]
|
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 com_name = "he" .. tem.type
|
||||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
coroutine.wait(2)
|
coroutine.wait(2)
|
||||||
|
|
@ -322,12 +314,12 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local list = arg[1]
|
local list = arg[1]
|
||||||
local start_seat = arg[2]
|
local start_seat = arg[2]
|
||||||
-- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
-- 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)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
|
@ -336,7 +328,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local liuju = result.liuju
|
local liuju = result.liuju
|
||||||
local data = result.info_list
|
local data = result.info_list
|
||||||
|
|
@ -402,7 +394,7 @@ function M:EventInit()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local total_result = arg[2]
|
local total_result = arg[2]
|
||||||
local result = arg[1]
|
local result = arg[1]
|
||||||
local over = arg[3]
|
local over = arg[3]
|
||||||
|
|
@ -423,7 +415,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local num = arg[2]
|
local num = arg[2]
|
||||||
if num > 0 then
|
if num > 0 then
|
||||||
|
|
@ -443,7 +435,7 @@ end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
if card ~= 0 then
|
if card ~= 0 then
|
||||||
printlog("当前出牌为===>>>"..card)
|
printlog("当前出牌为===>>>" .. card)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.curren_outcard_seat = -1
|
self._room.curren_outcard_seat = -1
|
||||||
_gamectr:SendOutCard(card, function()
|
_gamectr:SendOutCard(card, function()
|
||||||
|
|
@ -452,12 +444,12 @@ function M:OutCard(card)
|
||||||
info:UpdateHandCard()
|
info:UpdateHandCard()
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, card, self._cursor)
|
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:PlayMJSound("chupai.mp3")
|
||||||
-- self:ShowHuTip()
|
-- self:ShowHuTip()
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
printlog("鬼牌不能出===>>>"..card)
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -475,16 +467,16 @@ function M:__FangziTip(tip, weight)
|
||||||
|
|
||||||
local tip_hu = false
|
local tip_hu = false
|
||||||
local count = #_tlist
|
local count = #_tlist
|
||||||
for k=1,#_tlist do
|
for k = 1, #_tlist do
|
||||||
local td = tip.tip_map_type[_tlist[k]][1]
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
local url = "ui://Main_Majiang/Btn_fztip"
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
local td_weight = td.weight
|
local td_weight = td.weight
|
||||||
if td_weight == 16 then td_weight = 8 end
|
if td_weight == 16 then td_weight = 8 end
|
||||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
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.data = { tip, td }
|
||||||
btn_t.onClick:Add(self.__TipAction,self)
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not (tonumber(weight) >= 16) then
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
|
@ -548,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
||||||
local item_choose = list_choose:AddItemFromPool()
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
item_choose:GetController("type").selectedIndex = 0
|
item_choose:GetController("type").selectedIndex = 0
|
||||||
for j = 1, 4 do
|
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
|
end
|
||||||
item_choose.onClick:Add(function()
|
item_choose.onClick:Add(function()
|
||||||
callback(tiplist[i].id)
|
callback(tiplist[i].id)
|
||||||
end)
|
end)
|
||||||
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._view:AddChild(_pop_tip_choice)
|
||||||
self._pop_tip_choice = _pop_tip_choice
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnFangziAction(...)
|
function M:OnFangziAction(...)
|
||||||
self:__CloseTip()
|
self:__CloseTip()
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
local fz = arg[1]
|
local fz = arg[1]
|
||||||
local player = arg[2]
|
local player = arg[2]
|
||||||
|
|
@ -571,12 +564,12 @@ function M:OnFangziAction(...)
|
||||||
local pNode = info._mask_liangpai
|
local pNode = info._mask_liangpai
|
||||||
local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect")
|
local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect")
|
||||||
if fz.type == FZType.Peng then
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
else
|
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("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
|
@ -603,7 +596,7 @@ end
|
||||||
function M:RunNiao(list, start_seat)
|
function M:RunNiao(list, start_seat)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
--local _niao_View = self._niao_View
|
--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._view:AddChild(self._niao_View)
|
||||||
self._niao_View:Center()
|
self._niao_View:Center()
|
||||||
local _niao_View = self._niao_View
|
local _niao_View = self._niao_View
|
||||||
|
|
@ -621,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
||||||
local card = list[i].card
|
local card = list[i].card
|
||||||
coroutine.wait(0.3)
|
coroutine.wait(0.3)
|
||||||
item:GetTransition("appear"):Play()
|
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
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
end
|
end
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
|
|
@ -698,7 +691,7 @@ function M:ReloadRoom(bskip)
|
||||||
|
|
||||||
if p.seat == room.last_outcard_seat then
|
if p.seat == room.last_outcard_seat then
|
||||||
local card = p.outcard_list[#p.outcard_list]
|
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
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
info:UpdateHandCard(true)
|
info:UpdateHandCard(true)
|
||||||
info:UpdateOutCardList()
|
info:UpdateOutCardList()
|
||||||
|
|
@ -716,7 +709,7 @@ function M:ReloadRoom(bskip)
|
||||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
end
|
end
|
||||||
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -72,15 +72,15 @@ function M:FillRoomData(s2croom)
|
||||||
printlog(_tableInfo.laiziCardBefore)
|
printlog(_tableInfo.laiziCardBefore)
|
||||||
printlog(_tableInfo.laiziCard2Before)
|
printlog(_tableInfo.laiziCard2Before)
|
||||||
|
|
||||||
room.laiziInfo={}
|
room.laiziInfo = {}
|
||||||
if _tableInfo.laiziCardBefore>0 then
|
if _tableInfo.laiziCardBefore > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||||
if _tableInfo.laiziCard2>0 then
|
if _tableInfo.laiziCard2 > 0 then
|
||||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||||
end
|
end
|
||||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||||
else
|
else
|
||||||
room.laiziInfo=nil
|
room.laiziInfo = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
@ -107,7 +107,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -117,12 +117,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -156,7 +156,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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 #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -34,29 +34,25 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
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 then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") 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
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -116,7 +112,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -169,7 +165,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,8 +13,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 22
|
self.extend_id = 22
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -55,7 +55,7 @@ function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
|
|
@ -98,12 +98,12 @@ function M:FillRoomData(s2croom)
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -137,7 +137,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.ready = _jp["ready"] == 1 and true or false
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
local pid = _jp["aid"]
|
local pid = _jp["aid"]
|
||||||
p.piao_niao = _jp["piao_niao"]
|
p.piao_niao = _jp["piao_niao"]
|
||||||
-- print(DataManager.SelfUser.account_id,pid)
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
-- if (278 == pid) then
|
-- if (278 == pid) then
|
||||||
-- room.self_player = p
|
-- room.self_player = p
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
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
|
--if #tingList > 0 then
|
||||||
-- table.insert(tingList, 412)
|
-- table.insert(tingList, 412)
|
||||||
--end
|
--end
|
||||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
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
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -81,7 +83,7 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
|
|
@ -134,7 +136,7 @@ function M:__OnDragEnd(context)
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
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
|
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)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
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)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -12,8 +12,8 @@ local PlayerInfoView = import(".EXPlayerInfoView")
|
||||||
local TableBG = import('Game.Data.TableBG')
|
local TableBG = import('Game.Data.TableBG')
|
||||||
local M = {}
|
local M = {}
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M, {__index = PKMainView})
|
setmetatable(M, { __index = PKMainView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ChunTian_MainView"
|
self.class = "ChunTian_MainView"
|
||||||
self:init()
|
self:init()
|
||||||
self._gamectr = ControllerManager.GetController(GameController)
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
|
|
@ -22,19 +22,20 @@ end
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'},
|
{ 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 = 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 = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
|
||||||
}
|
}
|
||||||
|
|
||||||
function M:InitView(url)
|
function M:InitView(url)
|
||||||
local room = self._room
|
local room = self._room
|
||||||
UIPackage.AddPackage("extend/poker/chuntian/ui/Extend_Poker_ChunTian")
|
UIPackage.AddPackage("extend/poker/chuntian/ui/Extend_Poker_ChunTian")
|
||||||
printlog(room.room_config.people_num)
|
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 _room = DataManager.CurrenRoom
|
||||||
local user_id = DataManager.SelfUser.account_id
|
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
|
if json_data == nil then
|
||||||
local _gamectr = self._gamectr
|
local _gamectr = self._gamectr
|
||||||
self._room.pai = 0
|
self._room.pai = 0
|
||||||
|
|
@ -44,7 +45,7 @@ function M:InitView(url)
|
||||||
self._room.pai = pai
|
self._room.pai = pai
|
||||||
end
|
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
|
if json_data == nil then
|
||||||
local _gamectr = self._gamectr
|
local _gamectr = self._gamectr
|
||||||
self._room.cardsize = 1
|
self._room.cardsize = 1
|
||||||
|
|
@ -63,7 +64,7 @@ function M:InitView(url)
|
||||||
tem.visible = false
|
tem.visible = false
|
||||||
end
|
end
|
||||||
local list = self._room.player_list
|
local list = self._room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = _player_info[self:GetPos(p.seat)]
|
local info = _player_info[self:GetPos(p.seat)]
|
||||||
info._view.visible = true
|
info._view.visible = true
|
||||||
|
|
@ -77,9 +78,8 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
|
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
|
||||||
for i=1,#self._room.player_list do
|
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
|
||||||
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
|
-- body
|
||||||
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
||||||
local _action = self._view:AddChild(ErrorMsgTip)
|
local _action = self._view:AddChild(ErrorMsgTip)
|
||||||
|
|
@ -88,9 +88,9 @@ function M:InitView(url)
|
||||||
local btn1 = _action:GetChild("btn_connect")
|
local btn1 = _action:GetChild("btn_connect")
|
||||||
local btn2 = _action:GetChild("btn_back")
|
local btn2 = _action:GetChild("btn_back")
|
||||||
text.text = "您来晚了,座位有人,请重新进牌桌"
|
text.text = "您来晚了,座位有人,请重新进牌桌"
|
||||||
btn1.visible=false
|
btn1.visible = false
|
||||||
btn2:Center()
|
btn2:Center()
|
||||||
btn2.y=btn2.y+50
|
btn2.y = btn2.y + 50
|
||||||
btn2.onClick:Set(function()
|
btn2.onClick:Set(function()
|
||||||
-- body
|
-- body
|
||||||
ErrorMsgTip:Destroy()
|
ErrorMsgTip:Destroy()
|
||||||
|
|
@ -107,9 +107,9 @@ function M:InitView(url)
|
||||||
|
|
||||||
if self._room.hpOnOff == 1 and self._room.score_times ~= 1 then
|
if self._room.hpOnOff == 1 and self._room.score_times ~= 1 then
|
||||||
-- body
|
-- 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
|
else
|
||||||
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text=""
|
self._view:GetChild("roominfo_panel1"):GetChild("tex_beishu").text = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
self.ctr_state = self._view:GetController("state")
|
self.ctr_state = self._view:GetController("state")
|
||||||
|
|
@ -128,15 +128,14 @@ function M:InitView(url)
|
||||||
|
|
||||||
local list = room.player_list
|
local list = room.player_list
|
||||||
if not room.self_player.ready then
|
if not room.self_player.ready then
|
||||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||||
if xpconfig then
|
if xpconfig then
|
||||||
if round>1 then
|
if round > 1 then
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 2
|
self._ctr_action.selectedIndex = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
@ -153,20 +152,17 @@ function M:InitView(url)
|
||||||
self:ReConnectForStart()
|
self:ReConnectForStart()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
self._state.selectedIndex = StateType.Palying
|
self._state.selectedIndex = StateType.Palying
|
||||||
self:ReconnectForClearing()
|
self:ReconnectForClearing()
|
||||||
|
|
||||||
end
|
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
|
if self.dismiss_room_cd_time > 0 then
|
||||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||||
else
|
else
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:AskDismissRoom()
|
_gamectr:AskDismissRoom()
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||||
|
|
@ -184,20 +180,19 @@ function M:InitView(url)
|
||||||
if room.room_config.people_num == 2 then
|
if room.room_config.people_num == 2 then
|
||||||
self._view:GetChild('wanfa_text').text = '二人春天' .. room.score_times .. '倍'
|
self._view:GetChild('wanfa_text').text = '二人春天' .. room.score_times .. '倍'
|
||||||
else
|
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 .. '倍'
|
self._view:GetChild('wanfa_text').text = '三人春天' .. room.score_times .. '倍'
|
||||||
else
|
else
|
||||||
self._view:GetChild('wanfa_text').text = '四人春天' .. room.score_times .. '倍'
|
self._view:GetChild('wanfa_text').text = '四人春天' .. room.score_times .. '倍'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
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]
|
local card_info = self._player_card_info[1]
|
||||||
-- for i=1,#self._room.player_list do
|
-- for i=1,#self._room.player_list do
|
||||||
-- print(i)
|
-- -- print(i)
|
||||||
-- end
|
-- end
|
||||||
card_info:updatePoker()
|
card_info:updatePoker()
|
||||||
for _, player in ipairs(self._room.player_list) do
|
for _, player in ipairs(self._room.player_list) do
|
||||||
|
|
@ -211,11 +206,11 @@ function M:UpdateCard( index )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.caozuo==1 then
|
if self.caozuo == 1 then
|
||||||
local ctr_number = self.pass == nil and 2 or 1
|
local ctr_number = self.pass == nil and 2 or 1
|
||||||
local lastCardList = self._gamectr:GetLastCardList(self._room.self_player.seat)
|
local lastCardList = self._gamectr:GetLastCardList(self._room.self_player.seat)
|
||||||
local cardType, cardNum, cardLength = self._gamectr:GetCardListInfo(lastCardList)
|
local cardType, cardNum, cardLength = self._gamectr:GetCardListInfo(lastCardList)
|
||||||
printlog("caozuo",cardType)
|
printlog("caozuo", cardType)
|
||||||
local m = false
|
local m = false
|
||||||
local next_seat = self._room.self_player.seat + 1
|
local next_seat = self._room.self_player.seat + 1
|
||||||
if next_seat > self._room.room_config.people_num then
|
if next_seat > self._room.room_config.people_num then
|
||||||
|
|
@ -225,12 +220,12 @@ function M:UpdateCard( index )
|
||||||
m = true
|
m = true
|
||||||
end
|
end
|
||||||
local zdts = self._view:GetController("zidongtishi").selectedIndex
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateCardSize(index)
|
function M:UpdateCardSize(index)
|
||||||
self._room.cardsize=index
|
self._room.cardsize = index
|
||||||
local card_info = self._player_card_info[1]
|
local card_info = self._player_card_info[1]
|
||||||
card_info:updatePoker()
|
card_info:updatePoker()
|
||||||
end
|
end
|
||||||
|
|
@ -244,7 +239,7 @@ end
|
||||||
|
|
||||||
function M:OnPlayerEnter(...)
|
function M:OnPlayerEnter(...)
|
||||||
MainView.OnPlayerEnter(self, ...)
|
MainView.OnPlayerEnter(self, ...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local index = self:GetPos(p.seat)
|
local index = self:GetPos(p.seat)
|
||||||
local info = self._player_info[index]
|
local info = self._player_info[index]
|
||||||
|
|
@ -259,7 +254,7 @@ function M:OnPlayerEnter(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerReady(...)
|
function M:OnPlayerReady(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _player_info = self._player_info
|
local _player_info = self._player_info
|
||||||
|
|
@ -275,15 +270,14 @@ function M:OnPlayerLeave(...)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
if not _room.self_player.ready then
|
if not _room.self_player.ready then
|
||||||
--self._ctr_action.selectedIndex = 1
|
--self._ctr_action.selectedIndex = 1
|
||||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||||
if xpconfig then
|
if xpconfig then
|
||||||
if round>1 then
|
if round > 1 then
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 2
|
self._ctr_action.selectedIndex = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
|
@ -292,7 +286,6 @@ function M:OnPlayerLeave(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
MainView.EventInit(self)
|
MainView.EventInit(self)
|
||||||
|
|
@ -301,8 +294,7 @@ function M:EventInit()
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.EventXiPai,function( ... )
|
_gamectr:AddEventListener(ChunTian_GameEvent.EventXiPai, function(...)
|
||||||
|
|
||||||
if self.result_view ~= nil then
|
if self.result_view ~= nil then
|
||||||
self.result_view:Destroy()
|
self.result_view:Destroy()
|
||||||
self.result_view = nil
|
self.result_view = nil
|
||||||
|
|
@ -310,7 +302,7 @@ function M:EventInit()
|
||||||
|
|
||||||
self._player_card_info[1]:HidePiao()
|
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
|
-- body
|
||||||
self.MypokerList = cardlist
|
self.MypokerList = cardlist
|
||||||
end
|
end
|
||||||
|
|
@ -318,7 +310,7 @@ function M:EventInit()
|
||||||
|
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list.visible=false
|
otherpoker_list.visible = false
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
end
|
end
|
||||||
self.ctr_state.selectedIndex = 1
|
self.ctr_state.selectedIndex = 1
|
||||||
|
|
@ -332,28 +324,24 @@ function M:EventInit()
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
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
|
-- body
|
||||||
|
|
||||||
if self._room.room_config.showlength==1 then
|
if self._room.room_config.showlength == 1 then
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetController("shengyu").selectedIndex=1
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||||
else
|
else
|
||||||
head_info._view:GetController("shengyu").selectedIndex=0
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..p.hand_count.."张"
|
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
p:Clear()
|
p:Clear()
|
||||||
head_info:FillData(p)
|
head_info:FillData(p)
|
||||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
card_info:Clear()
|
card_info:Clear()
|
||||||
head_info:Ready(false)
|
head_info:Ready(false)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -374,34 +362,29 @@ function M:EventInit()
|
||||||
end--]]
|
end--]]
|
||||||
|
|
||||||
|
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local currentPlayer1=arg[1]
|
local currentPlayer1 = arg[1]
|
||||||
local currentPlayer2=arg[2]
|
local currentPlayer2 = arg[2]
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
if ( currentPlayer1 ) then
|
if (currentPlayer1) then
|
||||||
|
local xipaiCB = function()
|
||||||
local xipaiCB=function ()
|
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end
|
end
|
||||||
self:PlayXiPai(xipaiCB)
|
self:PlayXiPai(xipaiCB)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if ( currentPlayer2 ) then
|
if (currentPlayer2) then
|
||||||
--self._popEvent = false
|
--self._popEvent = false
|
||||||
local xipaiCB2=function ()
|
local xipaiCB2 = function()
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end
|
end
|
||||||
self:PlayXiPai1(xipaiCB2)
|
self:PlayXiPai1(xipaiCB2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnMingCard, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnMingCard, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local card = arg[1]
|
local card = arg[1]
|
||||||
self.ctr_state.selectedIndex = 1
|
self.ctr_state.selectedIndex = 1
|
||||||
self.ctr_card_eff.selectedIndex = 1
|
self.ctr_card_eff.selectedIndex = 1
|
||||||
|
|
@ -409,7 +392,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnInitCard, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnInitCard, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local round = arg[1]
|
local round = arg[1]
|
||||||
local cardlist = arg[2]
|
local cardlist = arg[2]
|
||||||
|
|
||||||
|
|
@ -421,7 +404,7 @@ function M:EventInit()
|
||||||
|
|
||||||
self._player_card_info[1]:HidePiao()
|
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
|
-- body
|
||||||
self.MypokerList = cardlist
|
self.MypokerList = cardlist
|
||||||
end
|
end
|
||||||
|
|
@ -429,7 +412,7 @@ function M:EventInit()
|
||||||
|
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list.visible=false
|
otherpoker_list.visible = false
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
end
|
end
|
||||||
self.ctr_state.selectedIndex = 1
|
self.ctr_state.selectedIndex = 1
|
||||||
|
|
@ -444,21 +427,18 @@ function M:EventInit()
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
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
|
-- body
|
||||||
|
|
||||||
if self._room.room_config.showlength==1 then
|
if self._room.room_config.showlength == 1 then
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetController("shengyu").selectedIndex=1
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||||
else
|
else
|
||||||
head_info._view:GetController("shengyu").selectedIndex=0
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..p.hand_count.."张"
|
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
p:Clear()
|
p:Clear()
|
||||||
head_info:FillData(p)
|
head_info:FillData(p)
|
||||||
|
|
@ -467,13 +447,12 @@ function M:EventInit()
|
||||||
head_info:Ready(false)
|
head_info:Ready(false)
|
||||||
|
|
||||||
if p.seat == self._room.self_player.seat then
|
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
|
-- body
|
||||||
card_info:InitPoker(cardlist,true,1)
|
card_info:InitPoker(cardlist, true, 1)
|
||||||
else
|
else
|
||||||
card_info:InitPoker(cardlist,true)
|
card_info:InitPoker(cardlist, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
--card_info:UpdateHandPoker(#cardlist,true,false) --todo
|
--card_info:UpdateHandPoker(#cardlist,true,false) --todo
|
||||||
--card_info:UpdateRemainCard(#cardlist,true)
|
--card_info:UpdateRemainCard(#cardlist,true)
|
||||||
|
|
@ -489,7 +468,7 @@ function M:EventInit()
|
||||||
-- head_info._view:GetController("Oener").selectedIndex=1
|
-- head_info._view:GetController("Oener").selectedIndex=1
|
||||||
-- end)
|
-- end)
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnIndexMove, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnIndexMove, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local isNewBout = arg[2]
|
local isNewBout = arg[2]
|
||||||
local index = self:GetPos(seat)
|
local index = self:GetPos(seat)
|
||||||
|
|
@ -528,7 +507,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnBombScore, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnBombScore, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local scoreList = arg[1]
|
local scoreList = arg[1]
|
||||||
-- for i = 1, #scoreList do
|
-- for i = 1, #scoreList do
|
||||||
-- local player = self._room:GetPlayerBySeat(i)
|
-- local player = self._room:GetPlayerBySeat(i)
|
||||||
|
|
@ -540,7 +519,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPlaySucc, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnPlaySucc, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local card_number = arg[2]
|
local card_number = arg[2]
|
||||||
local cardstype = arg[3]
|
local cardstype = arg[3]
|
||||||
|
|
@ -550,19 +529,17 @@ function M:EventInit()
|
||||||
self.ctr_time.selectedIndex = 0
|
self.ctr_time.selectedIndex = 0
|
||||||
|
|
||||||
local index = self:GetPos(p.seat)
|
local index = self:GetPos(p.seat)
|
||||||
if index==1 then
|
if index == 1 then
|
||||||
self.caozuo=0
|
self.caozuo = 0
|
||||||
end
|
end
|
||||||
local head_info = self._player_info[index]
|
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
|
||||||
-- body
|
-- body
|
||||||
if card_number~=nil then
|
if card_number ~= nil then
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..card_number.."张"
|
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. card_number .. "张"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
local card_info = self._player_card_info[index]
|
local card_info = self._player_card_info[index]
|
||||||
card_info:SetOutCardInfo(p.out_card_list, false, true)
|
card_info:SetOutCardInfo(p.out_card_list, false, true)
|
||||||
|
|
@ -613,9 +590,8 @@ function M:EventInit()
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
self:_Effect(cardstype, p)
|
self:_Effect(cardstype, p)
|
||||||
|
|
||||||
else
|
else
|
||||||
if cardstype == 11 and cardstype~=12 then
|
if cardstype == 11 and cardstype ~= 12 then
|
||||||
self:_Effect(cardstype, p)
|
self:_Effect(cardstype, p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -632,13 +608,12 @@ function M:EventInit()
|
||||||
self:PlaySound(p.self_user.sex, "card_1")
|
self:PlaySound(p.self_user.sex, "card_1")
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSuccCheckCard, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSuccCheckCard, function(...)
|
||||||
self._popEvent = false
|
self._popEvent = false
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local cards = arg[2]
|
local cards = arg[2]
|
||||||
--self.MypokerList=cards
|
--self.MypokerList=cards
|
||||||
|
|
@ -657,11 +632,10 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
|
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSucc, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnPassSucc, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
|
|
||||||
self.ctr_time.selectedIndex = 0
|
self.ctr_time.selectedIndex = 0
|
||||||
|
|
@ -679,19 +653,18 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnErrorTip, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnErrorTip, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local error_str = arg[1]
|
local error_str = arg[1]
|
||||||
self._player_card_info[1]:ErrorTip(error_str)
|
self._player_card_info[1]:ErrorTip(error_str)
|
||||||
-- self._player_card_info[1]:ResetPoker()
|
-- self._player_card_info[1]:ResetPoker()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoTips, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoTips, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local piao = arg[1]
|
local piao = arg[1]
|
||||||
local reload = arg[2]
|
local reload = arg[2]
|
||||||
if reload == 0 then
|
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
|
-- body
|
||||||
self.MypokerList = cardlist
|
self.MypokerList = cardlist
|
||||||
end
|
end
|
||||||
|
|
@ -699,7 +672,7 @@ function M:EventInit()
|
||||||
|
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list.visible=false
|
otherpoker_list.visible = false
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
end
|
end
|
||||||
self.ctr_state.selectedIndex = 1
|
self.ctr_state.selectedIndex = 1
|
||||||
|
|
@ -728,7 +701,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoAction, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnPiaoAction, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
local piao = arg[2]
|
local piao = arg[2]
|
||||||
local head_info = self._player_info[self:GetPos(seat)]
|
local head_info = self._player_info[self:GetPos(seat)]
|
||||||
|
|
@ -736,15 +709,15 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnOptions, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnOptions, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local play = arg[1]
|
local play = arg[1]
|
||||||
local pass = arg[5]
|
local pass = arg[5]
|
||||||
local card_type = arg[2]
|
local card_type = arg[2]
|
||||||
local card_number = arg[3]
|
local card_number = arg[3]
|
||||||
local card_length = arg[4]
|
local card_length = arg[4]
|
||||||
local ctr_number = pass == nil and 2 or 1
|
local ctr_number = pass == nil and 2 or 1
|
||||||
self.caozuo=1 --记录是否是自己出牌的阶段
|
self.caozuo = 1 --记录是否是自己出牌的阶段
|
||||||
self.pass=pass
|
self.pass = pass
|
||||||
local m = false
|
local m = false
|
||||||
local next_seat = self._room.self_player.seat + 1
|
local next_seat = self._room.self_player.seat + 1
|
||||||
local card_info = self._player_card_info[1]
|
local card_info = self._player_card_info[1]
|
||||||
|
|
@ -763,11 +736,11 @@ function M:EventInit()
|
||||||
m = true
|
m = true
|
||||||
end
|
end
|
||||||
local zdts = self._view:GetController("zidongtishi").selectedIndex
|
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)
|
end)
|
||||||
-- 托管
|
-- 托管
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.Game_TuoGuan, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.Game_TuoGuan, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local tuoguan = arg[1]
|
local tuoguan = arg[1]
|
||||||
local seat = arg[2]
|
local seat = arg[2]
|
||||||
|
|
||||||
|
|
@ -775,7 +748,7 @@ function M:EventInit()
|
||||||
local zhezhao = self._view:GetChild("n109")
|
local zhezhao = self._view:GetChild("n109")
|
||||||
local head_info = self._player_info[self:GetPos(seat)]
|
local head_info = self._player_info[self:GetPos(seat)]
|
||||||
if (tuoguan == 1) then
|
if (tuoguan == 1) then
|
||||||
if (seat == self._room.self_player.seat ) then
|
if (seat == self._room.self_player.seat) then
|
||||||
tuoguanzhong.visible = true
|
tuoguanzhong.visible = true
|
||||||
-- tuoguanzhong.sortingOrder = 2
|
-- tuoguanzhong.sortingOrder = 2
|
||||||
zhezhao.visible = true
|
zhezhao.visible = true
|
||||||
|
|
@ -804,7 +777,7 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnResult, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnResult, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local over = arg[1]
|
local over = arg[1]
|
||||||
local info = arg[2]
|
local info = arg[2]
|
||||||
local win_seat = arg[3]
|
local win_seat = arg[3]
|
||||||
|
|
@ -825,12 +798,12 @@ function M:EventInit()
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
otherpoker_list.visible=true
|
otherpoker_list.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if remaincards then
|
if remaincards then
|
||||||
-- body
|
-- body
|
||||||
local newremaincards = _gamectr:ChangeCodeByFrom(remaincards,true)
|
local newremaincards = _gamectr:ChangeCodeByFrom(remaincards, true)
|
||||||
table.sort(remaincards)
|
table.sort(remaincards)
|
||||||
for i = #newremaincards, 1, -1 do
|
for i = #newremaincards, 1, -1 do
|
||||||
coroutine.start(function()
|
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://Extend_Poker_ChunTian/" .. card_n)
|
||||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||||
local card_code_obj = nil
|
local card_code_obj = nil
|
||||||
if DataManager.CurrenRoom.pai==0 then
|
if DataManager.CurrenRoom.pai == 0 then
|
||||||
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
|
-- 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
|
else
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n)
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
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
|
-- 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
|
else
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
if card_code_obj ~= nil then
|
if card_code_obj ~= nil then
|
||||||
card_code_obj:SetScale(0.6, 0.6)
|
card_code_obj:SetScale(0.6, 0.6)
|
||||||
|
|
@ -868,14 +839,9 @@ function M:EventInit()
|
||||||
poker_item:AddChild(card_code_obj)
|
poker_item:AddChild(card_code_obj)
|
||||||
otherpoker_list:AddChild(poker_item)
|
otherpoker_list:AddChild(poker_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -963,7 +929,8 @@ function M:EventInit()
|
||||||
self:ChangeBgmMusic(1)
|
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()
|
self.result_view:Show()
|
||||||
if self.WinItem_view ~= nil then
|
if self.WinItem_view ~= nil then
|
||||||
self.WinItem_view:Dispose()
|
self.WinItem_view:Dispose()
|
||||||
|
|
@ -980,26 +947,22 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if over==1 then
|
if over == 1 then
|
||||||
-- body
|
-- body
|
||||||
self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
ControllerManager.ChangeController(LoddyController)
|
ControllerManager.ChangeController(LoddyController)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnResultByDissolve, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnResultByDissolve, function(...)
|
||||||
|
local arg = { ... }
|
||||||
local arg = {...}
|
|
||||||
local over = arg[1]
|
local over = arg[1]
|
||||||
local info = arg[2]
|
local info = arg[2]
|
||||||
local winseat = arg[3]
|
local winseat = arg[3]
|
||||||
local dissolve = arg[4]
|
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()
|
self.result_view:Show()
|
||||||
ControllerManager.ChangeController(LoddyController)
|
ControllerManager.ChangeController(LoddyController)
|
||||||
self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
|
|
@ -1007,7 +970,7 @@ function M:EventInit()
|
||||||
|
|
||||||
-- 确定开始下一局 成功
|
-- 确定开始下一局 成功
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnConfrimToNextGameSucc, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnConfrimToNextGameSucc, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local aid = arg[1]
|
local aid = arg[1]
|
||||||
local p = self._room:GetPlayerById(aid)
|
local p = self._room:GetPlayerById(aid)
|
||||||
if p.seat == self._room.self_player.seat then
|
if p.seat == self._room.self_player.seat then
|
||||||
|
|
@ -1026,7 +989,7 @@ function M:EventInit()
|
||||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list.visible=false
|
otherpoker_list.visible = false
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
end
|
end
|
||||||
--player_head._view:GetController("Oener").selectedIndex=0
|
--player_head._view:GetController("Oener").selectedIndex=0
|
||||||
|
|
@ -1038,23 +1001,21 @@ function M:EventInit()
|
||||||
|
|
||||||
-------------------报春提示----------------------------
|
-------------------报春提示----------------------------
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertBaoChun, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertBaoChun, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
printlog("报春自己座位号+++++++++++++++++")
|
printlog("报春自己座位号+++++++++++++++++")
|
||||||
self._player_card_info[1]:ShowBaoChun(1)
|
self._player_card_info[1]:ShowBaoChun(1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertTongYiBaoChun, function(...)
|
_gamectr:AddEventListener(ChunTian_GameEvent.OnAlertTongYiBaoChun, function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
printlog("同意报春座位号+++++++++++++++++")
|
printlog("同意报春座位号+++++++++++++++++")
|
||||||
self._player_card_info[1]:ShowTongYiBaoChun(2)
|
self._player_card_info[1]:ShowTongYiBaoChun(2)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ReConnectForStart()
|
function M:ReConnectForStart()
|
||||||
|
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room.is_new_bout = _gamectr:GetIsNewBout(self._room.curren_turn_seat)
|
self._room.is_new_bout = _gamectr:GetIsNewBout(self._room.curren_turn_seat)
|
||||||
self._state.selectedIndex = 1
|
self._state.selectedIndex = 1
|
||||||
|
|
@ -1089,36 +1050,29 @@ function M:ReConnectForStart()
|
||||||
head_info:UpdateLineState(player.line_state)
|
head_info:UpdateLineState(player.line_state)
|
||||||
head_info:UpdatePiao(player.piao)
|
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
|
-- body
|
||||||
|
|
||||||
|
|
||||||
if self._room.room_config.showlength==1 then
|
if self._room.room_config.showlength == 1 then
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetController("shengyu").selectedIndex=1
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||||
else
|
else
|
||||||
head_info._view:GetController("shengyu").selectedIndex=0
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..player.hand_count.."张"
|
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. player.hand_count .. "张"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
if player.seat == self._room.self_player.seat then
|
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
|
-- body
|
||||||
self.MypokerList = player.hand_list
|
self.MypokerList = player.hand_list
|
||||||
player_card_info:InitPoker(player.hand_list, false, 1)
|
player_card_info:InitPoker(player.hand_list, false, 1)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
player_card_info:InitPoker(player.hand_list, false)
|
player_card_info:InitPoker(player.hand_list, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
player_card_info:SetRemainCardNumber(player.hand_count == 1)
|
player_card_info:SetRemainCardNumber(player.hand_count == 1)
|
||||||
if player.hand_count == 1 then
|
if player.hand_count == 1 then
|
||||||
self.bgm_index = 2
|
self.bgm_index = 2
|
||||||
|
|
@ -1170,54 +1124,49 @@ function M:ReconnectForClearing()
|
||||||
head_info:UpdateLineState(player.line_state)
|
head_info:UpdateLineState(player.line_state)
|
||||||
--head_info._view:GetController("Oener").selectedIndex=0
|
--head_info._view:GetController("Oener").selectedIndex=0
|
||||||
head_info:UpdatePiao(player.piao)
|
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
|
-- body
|
||||||
|
|
||||||
if self._room.room_config.showlength==1 then
|
if self._room.room_config.showlength == 1 then
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetController("shengyu").selectedIndex=1
|
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||||
else
|
else
|
||||||
head_info._view:GetController("shengyu").selectedIndex=0
|
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text="剩"..player.hand_count.."张"
|
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. player.hand_count .. "张"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if player.seat == self._room.self_player.seat then
|
if player.seat == self._room.self_player.seat then
|
||||||
|
|
||||||
player_card_info:InitPoker(player.hand_list, false)
|
player_card_info:InitPoker(player.hand_list, false)
|
||||||
else
|
else
|
||||||
player_card_info:UpdateHandPoker(player.hand_list, false, true)
|
player_card_info:UpdateHandPoker(player.hand_list, false, true)
|
||||||
end
|
end
|
||||||
if player.out_card_list[1] == 0 then
|
if player.out_card_list[1] == 0 then
|
||||||
|
|
||||||
player_card_info:SetOutCardInfo(nil, false)
|
player_card_info:SetOutCardInfo(nil, false)
|
||||||
else
|
else
|
||||||
player_card_info:SetOutCardInfo(player.out_card_list, false)
|
player_card_info:SetOutCardInfo(player.out_card_list, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
win_seat=self._room.winseat
|
win_seat = self._room.winseat
|
||||||
self._room.winseat = nil
|
self._room.winseat = nil
|
||||||
|
|
||||||
local remaincards = self._room.remaincards
|
local remaincards = self._room.remaincards
|
||||||
if self._room.game_status==1 then
|
if self._room.game_status == 1 then
|
||||||
|
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
coroutine.wait(0.3)
|
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()
|
self.result_view:Show()
|
||||||
local card_info = self._player_card_info[1]
|
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)
|
end)
|
||||||
if remaincards then
|
if remaincards then
|
||||||
|
local newremaincards = self._gamectr:ChangeCodeByFrom(remaincards, true)
|
||||||
local newremaincards = self._gamectr:ChangeCodeByFrom(remaincards,true)
|
|
||||||
|
|
||||||
-- body
|
-- body
|
||||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||||
|
|
@ -1225,7 +1174,7 @@ function M:ReconnectForClearing()
|
||||||
if otherpoker_list ~= nil then
|
if otherpoker_list ~= nil then
|
||||||
-- body
|
-- body
|
||||||
otherpoker_list:RemoveChildrenToPool()
|
otherpoker_list:RemoveChildrenToPool()
|
||||||
otherpoker_list.visible=true
|
otherpoker_list.visible = true
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = #newremaincards, 1, -1 do
|
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://Extend_Poker_ChunTian/" .. card_n)
|
||||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||||
local card_code_obj
|
local card_code_obj
|
||||||
if DataManager.CurrenRoom.pai==0 then
|
if DataManager.CurrenRoom.pai == 0 then
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card_n)
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card_n)
|
||||||
else
|
else
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||||
end
|
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
|
-- 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
|
end
|
||||||
card_code_obj:SetScale(0.6, 0.6)
|
card_code_obj:SetScale(0.6, 0.6)
|
||||||
poker_item:AddChild(card_code_obj)
|
poker_item:AddChild(card_code_obj)
|
||||||
|
|
@ -1267,13 +1216,13 @@ function M:CreateRankEff()
|
||||||
self.rank_view:GetTransition("t0"):Play()
|
self.rank_view:GetTransition("t0"):Play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:_Effect( type1 ,player)
|
function M:_Effect(type1, player)
|
||||||
-- body
|
-- body
|
||||||
|
|
||||||
if type1 > 11 or type1 < 3 then
|
if type1 > 11 or type1 < 3 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
printlog("effect ",type1)
|
printlog("effect ", type1)
|
||||||
local eff_code = 0
|
local eff_code = 0
|
||||||
if type1 == 3 then
|
if type1 == 3 then
|
||||||
eff_code = 2
|
eff_code = 2
|
||||||
|
|
@ -1282,7 +1231,7 @@ function M:_Effect( type1 ,player)
|
||||||
elseif type1 == 5 then
|
elseif type1 == 5 then
|
||||||
eff_code = 5
|
eff_code = 5
|
||||||
elseif type1 == 6 then
|
elseif type1 == 6 then
|
||||||
eff_code=1
|
eff_code = 1
|
||||||
elseif type1 == 7 then
|
elseif type1 == 7 then
|
||||||
return
|
return
|
||||||
elseif type1 == 8 then
|
elseif type1 == 8 then
|
||||||
|
|
@ -1298,31 +1247,31 @@ function M:_Effect( type1 ,player)
|
||||||
end
|
end
|
||||||
local info = self._player_card_info[self:GetPos(player.seat)]
|
local info = self._player_card_info[self:GetPos(player.seat)]
|
||||||
local pNode = info._mask_liangpai
|
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.touchable = false
|
||||||
effect:GetTransition("t0"):Play()
|
effect:GetTransition("t0"):Play()
|
||||||
-- effect:SetXY((self._view.width - effect.width) / 2,(self._view.hight - effect.hight) / 2)
|
-- 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)
|
self._view:AddChild(effect)
|
||||||
else
|
else
|
||||||
pNode:AddChild(effect)
|
pNode:AddChild(effect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if eff_code==1 then
|
if eff_code == 1 then
|
||||||
self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/eff_feiji")
|
self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/eff_feiji")
|
||||||
self._view:AddChild(self.eff_feiji)
|
self._view:AddChild(self.eff_feiji)
|
||||||
self.eff_feiji:Center()
|
self.eff_feiji:Center()
|
||||||
self.eff_feiji:GetTransition("t0"):Play()
|
self.eff_feiji:GetTransition("t0"):Play()
|
||||||
end
|
end
|
||||||
if eff_code==3 then
|
if eff_code == 3 then
|
||||||
effect:Center()
|
effect:Center()
|
||||||
else
|
else
|
||||||
if self:GetPos(player.seat)== 1 then
|
if self:GetPos(player.seat) == 1 then
|
||||||
effect.x,effect.y = 0,24
|
effect.x, effect.y = 0, 24
|
||||||
else
|
else
|
||||||
effect.x,effect.y = 24,67
|
effect.x, effect.y = 24, 67
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1336,7 +1285,7 @@ function M:_Effect( type1 ,player)
|
||||||
-- else
|
-- else
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
if self.eff_feiji~=nil then
|
if self.eff_feiji ~= nil then
|
||||||
self.eff_feiji:Dispose()
|
self.eff_feiji:Dispose()
|
||||||
end
|
end
|
||||||
effect:Dispose()
|
effect:Dispose()
|
||||||
|
|
@ -1344,11 +1293,9 @@ function M:_Effect( type1 ,player)
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:UpdateRound(round)
|
function M:UpdateRound(round)
|
||||||
local total_round = self._room.room_config.Times
|
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)
|
self._text_round.text = string.format("%d / %d 局", round, total_round)
|
||||||
end
|
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://Extend_Poker_ChunTian/" .. card)
|
||||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||||
local card_code_obj
|
local card_code_obj
|
||||||
if DataManager.CurrenRoom.pai==0 then
|
if DataManager.CurrenRoom.pai == 0 then
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/"..card)
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_ChunTian/" .. card)
|
||||||
else
|
else
|
||||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||||
end
|
end
|
||||||
|
|
@ -1434,7 +1381,6 @@ function M:PlayCardEff(card)
|
||||||
coroutine.wait(1)
|
coroutine.wait(1)
|
||||||
self._popEvent = true
|
self._popEvent = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ResetPoker()
|
function M:ResetPoker()
|
||||||
|
|
@ -1445,8 +1391,7 @@ function M:ResetPoker()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:PlaySound(sex, path)
|
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)
|
local sound_path = string.format("extend/poker/chuntian/sound/%s/%s.mp3", sex_path, path)
|
||||||
ViewUtil.PlaySound("ChunTianNew_PK", sound_path)
|
ViewUtil.PlaySound("ChunTianNew_PK", sound_path)
|
||||||
end
|
end
|
||||||
|
|
@ -1459,11 +1404,12 @@ function M:ChangeBgmMusic(bgm_index)
|
||||||
end
|
end
|
||||||
ViewUtil.PlayMuisc("ChunTianNew_PK", string.format("extend/poker/chuntian/sound/bgm%d.mp3", 1))
|
ViewUtil.PlayMuisc("ChunTianNew_PK", string.format("extend/poker/chuntian/sound/bgm%d.mp3", 1))
|
||||||
end
|
end
|
||||||
function M:OnPlayerEnter( ... )
|
|
||||||
local arg = {...}
|
function M:OnPlayerEnter(...)
|
||||||
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
for i=1,#self._room.player_list do
|
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
|
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
|
-- body
|
||||||
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
local ErrorMsgTip = UIPackage.CreateObject("Common", "Win_ConnectTip")
|
||||||
local _action = self._view:AddChild(ErrorMsgTip)
|
local _action = self._view:AddChild(ErrorMsgTip)
|
||||||
|
|
@ -1472,9 +1418,9 @@ function M:OnPlayerEnter( ... )
|
||||||
local btn1 = _action:GetChild("btn_connect")
|
local btn1 = _action:GetChild("btn_connect")
|
||||||
local btn2 = _action:GetChild("btn_back")
|
local btn2 = _action:GetChild("btn_back")
|
||||||
text.text = "您来晚了,座位有人,请重新进牌桌"
|
text.text = "您来晚了,座位有人,请重新进牌桌"
|
||||||
btn1.visible=false
|
btn1.visible = false
|
||||||
btn2:Center()
|
btn2:Center()
|
||||||
btn2.y=btn2.y+50
|
btn2.y = btn2.y + 50
|
||||||
btn2.onClick:Set(function()
|
btn2.onClick:Set(function()
|
||||||
-- body
|
-- body
|
||||||
ErrorMsgTip:Destroy()
|
ErrorMsgTip:Destroy()
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@ local ChunTian_Record_Event = {
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'},
|
{ 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 = 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 = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Create a new
|
--- Create a new
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M, {__index = PKPlayBackView})
|
setmetatable(M, { __index = PKPlayBackView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = 'ChunTian_PlayBackView'
|
self.class = 'ChunTian_PlayBackView'
|
||||||
self:init()
|
self:init()
|
||||||
|
|
||||||
|
|
@ -42,7 +42,8 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
self._gamectr = ControllerManager.GetController(GameController)
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
UIPackage.AddPackage('extend/poker/chuntian/ui/Extend_Poker_ChunTian')
|
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._tex_round = self._view:GetChild('round')
|
||||||
self._player_card_info = {}
|
self._player_card_info = {}
|
||||||
local _player_card_info = 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)
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||||
end
|
end
|
||||||
local list = self._room.player_list
|
local list = self._room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = _player_info[self:GetPos(p.seat)]
|
local info = _player_info[self:GetPos(p.seat)]
|
||||||
info._view.visible = true
|
info._view.visible = true
|
||||||
|
|
@ -94,7 +95,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomData(data)
|
function M:FillRoomData(data)
|
||||||
print("hidezhanji 1111")
|
-- print("hidezhanji 1111")
|
||||||
self._currentStep = 1
|
self._currentStep = 1
|
||||||
local room = DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
local _player_card_info = self._player_card_info
|
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
|
||||||
if p.total_hp then
|
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
|
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)
|
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -125,7 +126,6 @@ function M:FillRoomData(data)
|
||||||
card_info:UpdateHandPoker(p.hand_list, false, true)
|
card_info:UpdateHandPoker(p.hand_list, false, true)
|
||||||
end
|
end
|
||||||
head_info:UpdatePiao(p.piao)
|
head_info:UpdatePiao(p.piao)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self:UpdateRound()
|
self:UpdateRound()
|
||||||
|
|
@ -136,7 +136,7 @@ end
|
||||||
|
|
||||||
function M:ShowStep(index)
|
function M:ShowStep(index)
|
||||||
local step = self._step[index]
|
local step = self._step[index]
|
||||||
if step==nil then
|
if step == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i = 1, #step.player_card_data do
|
for i = 1, #step.player_card_data do
|
||||||
|
|
@ -152,7 +152,6 @@ function M:ShowStep(index)
|
||||||
else
|
else
|
||||||
info:InitPoker(p.hand_list, false)
|
info:InitPoker(p.hand_list, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if step.cmd == ChunTian_Record_Event.Evt_OutCard then
|
if step.cmd == ChunTian_Record_Event.Evt_OutCard then
|
||||||
|
|
@ -194,7 +193,8 @@ function M:ShowStep(index)
|
||||||
end
|
end
|
||||||
if step.cmd == ChunTian_Record_Event.Evt_Result then
|
if step.cmd == ChunTian_Record_Event.Evt_Result then
|
||||||
local Result = step.Result
|
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"))
|
local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
|
||||||
self._view:AddChildAt(self.result_view._view, num)
|
self._view:AddChildAt(self.result_view._view, num)
|
||||||
else
|
else
|
||||||
|
|
@ -257,6 +257,7 @@ function M:CmdPass(cmd, index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.current_out_seat = cmd.seat
|
data.current_out_seat = cmd.seat
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Cmdresult(cmd, index)
|
function M:Cmdresult(cmd, index)
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
||||||
|
|
||||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self, {__index = CardView})
|
setmetatable(self, { __index = CardView })
|
||||||
self.btn_card = card
|
self.btn_card = card
|
||||||
self.card_code_number = cardcodenum
|
self.card_code_number = cardcodenum
|
||||||
self.card_code_flower = cardcodeflower
|
self.card_code_flower = cardcodeflower
|
||||||
|
|
@ -38,8 +38,8 @@ local ChunTian_PlayerSelfPokerInfoView = {
|
||||||
local M = ChunTian_PlayerSelfPokerInfoView
|
local M = ChunTian_PlayerSelfPokerInfoView
|
||||||
|
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(M, {__index = ChunTian_PlayerPokerInfoView})
|
setmetatable(M, { __index = ChunTian_PlayerPokerInfoView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
self.gameCtr = ControllerManager.GetController(GameController)
|
self.gameCtr = ControllerManager.GetController(GameController)
|
||||||
|
|
@ -91,7 +91,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
||||||
-- self.zhizhanplay=0
|
-- self.zhizhanplay=0
|
||||||
-- self.zhizhanzdts=0
|
-- self.zhizhanzdts=0
|
||||||
local cs = 1.25
|
local cs = 1.25
|
||||||
if DataManager.CurrenRoom.cardsize==0 then
|
if DataManager.CurrenRoom.cardsize == 0 then
|
||||||
cs = 1.35
|
cs = 1.35
|
||||||
elseif DataManager.CurrenRoom.cardsize == 1 then
|
elseif DataManager.CurrenRoom.cardsize == 1 then
|
||||||
cs = 1.25
|
cs = 1.25
|
||||||
|
|
@ -102,7 +102,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
||||||
if self.cor_init_poker ~= nil then
|
if self.cor_init_poker ~= nil then
|
||||||
coroutine.stop(self.cor_init_poker)
|
coroutine.stop(self.cor_init_poker)
|
||||||
end
|
end
|
||||||
-- print(vardump(self.card_list))
|
-- -- print(vardump(self.card_list))
|
||||||
self.cor_init_poker = nil
|
self.cor_init_poker = nil
|
||||||
self.card_list = {}
|
self.card_list = {}
|
||||||
|
|
||||||
|
|
@ -176,7 +176,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
|
||||||
for i = 1, #pokerList do
|
for i = 1, #pokerList do
|
||||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||||
local card_flower_code = pokerList[i]
|
local card_flower_code = pokerList[i]
|
||||||
|
|
@ -200,7 +199,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:updatePoker()
|
function M:updatePoker()
|
||||||
|
|
||||||
local templist = {}
|
local templist = {}
|
||||||
for i = 1, #self.card_list do
|
for i = 1, #self.card_list do
|
||||||
templist[#templist + 1] = self.card_list[i].card_code_flower
|
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
|
if card.btn_card.touchable == true then
|
||||||
send_card[#send_card + 1] = card
|
send_card[#send_card + 1] = card
|
||||||
self:SetBtnCardColor(card, 1)
|
self:SetBtnCardColor(card, 1)
|
||||||
--print(vardump(card))
|
---- print(vardump(card))
|
||||||
if k == #self.card_list then
|
if k == #self.card_list then
|
||||||
if
|
if
|
||||||
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
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
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:zhizhanxuanpai() --智障选牌
|
function M:zhizhanxuanpai() --智障选牌
|
||||||
printlog("zhizhanxuanpai")
|
printlog("zhizhanxuanpai")
|
||||||
-- body
|
-- 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 + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
||||||
card.btn_card.x < max_x
|
card.btn_card.x < max_x
|
||||||
then
|
then
|
||||||
|
|
||||||
self:SetBtnCardColor(card, 0.8)
|
self:SetBtnCardColor(card, 0.8)
|
||||||
if #send_card1 == 0 then
|
if #send_card1 == 0 then
|
||||||
-- body
|
-- body
|
||||||
|
|
@ -470,7 +468,7 @@ function M:TouchMoving(context)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--print(vardump(send_card1))
|
---- print(vardump(send_card1))
|
||||||
-- local send_card = {}
|
-- local send_card = {}
|
||||||
-- self.send_card = {}
|
-- self.send_card = {}
|
||||||
-- for i = 1, #self.card_list do
|
-- 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
|
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)
|
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -785,10 +782,10 @@ function M:BtnEvent()
|
||||||
end
|
end
|
||||||
local send_card = {}
|
local send_card = {}
|
||||||
self.send_card = {}
|
self.send_card = {}
|
||||||
local currentCard={}
|
local currentCard = {}
|
||||||
for i = 1, #self.card_list do
|
for i = 1, #self.card_list do
|
||||||
local card = self.card_list[i]
|
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
|
if card.btn_card.selected then
|
||||||
send_card[#send_card + 1] = card.card_code_flower
|
send_card[#send_card + 1] = card.card_code_flower
|
||||||
self.send_card[#self.send_card + 1] = card
|
self.send_card[#self.send_card + 1] = card
|
||||||
|
|
@ -798,7 +795,7 @@ function M:BtnEvent()
|
||||||
if #send_card == 0 then
|
if #send_card == 0 then
|
||||||
self:ErrorTip('请选择要出的牌 ')
|
self:ErrorTip('请选择要出的牌 ')
|
||||||
else
|
else
|
||||||
self.gameCtr:SendCard(send_card,currentCard)
|
self.gameCtr:SendCard(send_card, currentCard)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -851,7 +848,7 @@ function M:BtnEvent()
|
||||||
|
|
||||||
local function click_tongyibaochun(sindex)
|
local function click_tongyibaochun(sindex)
|
||||||
self.ctr_baochun.selectedIndex = 0
|
self.ctr_baochun.selectedIndex = 0
|
||||||
printlog("jefe:",sindex)
|
printlog("jefe:", sindex)
|
||||||
self.gameCtr:SendTongYiBaoChun(sindex)
|
self.gameCtr:SendTongYiBaoChun(sindex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -875,8 +872,6 @@ function M:BtnEvent()
|
||||||
btn_tongyi.onClick:Set(function()
|
btn_tongyi.onClick:Set(function()
|
||||||
click_tongyibaochun(1)
|
click_tongyibaochun(1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowTipsCard(index)
|
function M:ShowTipsCard(index)
|
||||||
|
|
@ -897,7 +892,7 @@ function M:ShowTipsCard(index)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetHandCardOffset(count)
|
function M:GetHandCardOffset(count)
|
||||||
local start = -70---54
|
local start = -70 ---54
|
||||||
|
|
||||||
local offset = 0
|
local offset = 0
|
||||||
if count > 10 then
|
if count > 10 then
|
||||||
|
|
@ -916,6 +911,7 @@ function M:GetHandCardPos(index, card_count)
|
||||||
x = start_x + (self.card_width + offset) * (index - 1)
|
x = start_x + (self.card_width + offset) * (index - 1)
|
||||||
return Vector2.New(x, y)
|
return Vector2.New(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetHandCardPos1(index, card_count)
|
function M:GetHandCardPos1(index, card_count)
|
||||||
local x, y = 0, -18
|
local x, y = 0, -18
|
||||||
local offset = self:GetHandCardOffset(card_count)
|
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)
|
x = start_x + (self.card_width + offset) * (index - 1)
|
||||||
return x, y
|
return x, y
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ChangeOneCodeByFrom(card)
|
function M:ChangeOneCodeByFrom(card)
|
||||||
local flower = math.floor(card / 100)
|
local flower = math.floor(card / 100)
|
||||||
local number = card % 100
|
local number = card % 100
|
||||||
|
|
@ -969,13 +966,13 @@ end
|
||||||
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
||||||
local tip_list = {}
|
local tip_list = {}
|
||||||
local sidaisan = false
|
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")
|
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
|
||||||
--pt(self.card_list)
|
--pt(self.card_list)
|
||||||
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
||||||
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
|
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
|
||||||
--pt(card_map)
|
--pt(card_map)
|
||||||
printlog("TIP type:",type)
|
printlog("TIP type:", type)
|
||||||
if type == ChunTian_CardType.None then
|
if type == ChunTian_CardType.None then
|
||||||
if DataManager.CurrenRoom.is_new_bout then
|
if DataManager.CurrenRoom.is_new_bout then
|
||||||
tip_list = self:NewBoutTips(card_map)
|
tip_list = self:NewBoutTips(card_map)
|
||||||
|
|
@ -1057,7 +1054,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
||||||
-- body
|
-- body
|
||||||
sidaisan = true
|
sidaisan = true
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif type == ChunTian_CardType.TuiTuJI then
|
elseif type == ChunTian_CardType.TuiTuJI then
|
||||||
list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4)
|
list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4)
|
||||||
|
|
||||||
|
|
@ -1085,8 +1081,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
||||||
-- body
|
-- body
|
||||||
tip_list = self:GetMergeAllList(tip_list, tip_templist2)
|
tip_list = self:GetMergeAllList(tip_list, tip_templist2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
|
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
|
||||||
|
|
@ -1099,7 +1093,7 @@ end
|
||||||
|
|
||||||
-- 合并多个list
|
-- 合并多个list
|
||||||
function M:GetMergeAllList(...)
|
function M:GetMergeAllList(...)
|
||||||
local lists = {...}
|
local lists = { ... }
|
||||||
local merge_list = {}
|
local merge_list = {}
|
||||||
for i = 1, #lists do
|
for i = 1, #lists do
|
||||||
local list_item = lists[i]
|
local list_item = lists[i]
|
||||||
|
|
@ -1127,13 +1121,13 @@ function M:CheckOneCard(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do
|
for k, v in pairs(pokerMap) do
|
||||||
if k > num and #v == 1 then
|
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
|
touch_key_list[#touch_key_list + 1] = k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do
|
for k, v in pairs(pokerMap) do
|
||||||
if k > num and #v ~= 1 then
|
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
|
touch_key_list[#touch_key_list + 1] = k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1148,7 +1142,7 @@ function M:CheckOnePair(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
|
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
|
||||||
if #v > 1 and k > num then
|
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
|
touch_key_list[#touch_key_list + 1] = k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1163,7 +1157,7 @@ function M:CheckThree(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do
|
for k, v in pairs(pokerMap) do
|
||||||
if #v > 2 and k > num then
|
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
|
touch_key_list[#touch_key_list + 1] = k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1210,8 +1204,8 @@ function M:CheckThreeAndOne(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do
|
for k, v in pairs(pokerMap) do
|
||||||
if #v >= 3 and k > num then
|
if #v >= 3 and k > num then
|
||||||
three_and_one_list[#three_and_one_list + 1] = {v[1], v[2], v[3]}
|
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}
|
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return three_and_one_list, touch_key_list
|
return three_and_one_list, touch_key_list
|
||||||
|
|
@ -1225,8 +1219,8 @@ function M:CheckThreeAndTwo(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
for k, v in pairs(pokerMap) do
|
for k, v in pairs(pokerMap) do
|
||||||
if #v >= 3 and k > num then
|
if #v >= 3 and k > num then
|
||||||
three_and_two_list[#three_and_two_list + 1] = {v[1], v[2], v[3]}
|
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}
|
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return three_and_two_list, touch_key_list
|
return three_and_two_list, touch_key_list
|
||||||
|
|
@ -1343,7 +1337,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
||||||
end
|
end
|
||||||
if j == i + pair_length - 1 then
|
if j == i + pair_length - 1 then
|
||||||
plane_list[#plane_list + 1] = item_all_list
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1351,7 +1345,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetNotTouchCard(touch_key_list, card_map)
|
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
|
for i = 1, #all_key_list do
|
||||||
local key = all_key_list[i]
|
local key = all_key_list[i]
|
||||||
local isExsit = self:IsExistByList(touch_key_list, key)
|
local isExsit = self:IsExistByList(touch_key_list, key)
|
||||||
|
|
@ -1394,13 +1388,14 @@ function M:GetCardMapAndMaxKey(pokerList)
|
||||||
max_key = number
|
max_key = number
|
||||||
end
|
end
|
||||||
if map[number] == nil then
|
if map[number] == nil then
|
||||||
map[number] = {pokerList[i]}
|
map[number] = { pokerList[i] }
|
||||||
else
|
else
|
||||||
map[number][#map[number] + 1] = pokerList[i]
|
map[number][#map[number] + 1] = pokerList[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return map, max_key
|
return map, max_key
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CheckOnes(pokerMap, num, length)
|
function M:CheckOnes(pokerMap, num, length)
|
||||||
local one_card_list = {}
|
local one_card_list = {}
|
||||||
local touch_key_list = {}
|
local touch_key_list = {}
|
||||||
|
|
@ -1418,7 +1413,7 @@ function M:CheckOnes(pokerMap, num, length)
|
||||||
for i = 0, length - 1 do
|
for i = 0, length - 1 do
|
||||||
if l == k + i and l ~= 15 and l ~= 16 then
|
if l == k + i and l ~= 15 and l ~= 16 then
|
||||||
-- body
|
-- body
|
||||||
text[#text + 1] = {p[1]}
|
text[#text + 1] = { p[1] }
|
||||||
text2[#text2 + 1] = l
|
text2[#text2 + 1] = l
|
||||||
if #text >= length then
|
if #text >= length then
|
||||||
-- body
|
-- body
|
||||||
|
|
@ -1446,6 +1441,7 @@ function M:CheckOnes(pokerMap, num, length)
|
||||||
end
|
end
|
||||||
return one_card_list, touch_key_list, length
|
return one_card_list, touch_key_list, length
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear()
|
function M:Clear()
|
||||||
self:PlayScore(nil)
|
self:PlayScore(nil)
|
||||||
self:SetOutCardInfo(nil, false)
|
self:SetOutCardInfo(nil, false)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
||||||
local ChunTian_RightPanelView = {}
|
local ChunTian_RightPanelView = {}
|
||||||
local M = ChunTian_RightPanelView
|
local M = ChunTian_RightPanelView
|
||||||
local function __init(self,mainView,view)
|
local function __init(self, mainView, view)
|
||||||
local right_panel = view
|
local right_panel = view
|
||||||
|
|
||||||
local btn_setting = right_panel:GetChild("btn_setting")
|
local btn_setting = right_panel:GetChild("btn_setting")
|
||||||
|
|
@ -22,7 +22,7 @@ local function __init(self,mainView,view)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
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
|
if mainView.dismiss_room_cd_time > 0 then
|
||||||
GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
|
GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
|
||||||
else
|
else
|
||||||
|
|
@ -54,13 +54,14 @@ local function __init(self,mainView,view)
|
||||||
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
||||||
-- self._timer:Start()
|
-- self._timer:Start()
|
||||||
end
|
end
|
||||||
function ChunTian_RightPanelView.new(mainView,view)
|
function ChunTian_RightPanelView.new(mainView, view)
|
||||||
setmetatable(M, {__index = MainRightPanelView})
|
setmetatable(M, { __index = MainRightPanelView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ChunTian_RightPanelView"
|
self.class = "ChunTian_RightPanelView"
|
||||||
__init(self,mainView,view)
|
__init(self, mainView, view)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__UpdateTime()
|
function M:__UpdateTime()
|
||||||
self._tex_data.text = os.date("%Y-%m-%d")
|
self._tex_data.text = os.date("%Y-%m-%d")
|
||||||
self._tex_time.text = os.date("%H:%M")
|
self._tex_time.text = os.date("%H:%M")
|
||||||
|
|
@ -74,7 +75,7 @@ function M:__UpdateTime()
|
||||||
local ping = _client:getAveragePingTime()
|
local ping = _client:getAveragePingTime()
|
||||||
if not ping then return end
|
if not ping then return end
|
||||||
ping = math.floor(ping / 2)
|
ping = math.floor(ping / 2)
|
||||||
if ping > 300 then ping =300 end
|
if ping > 300 then ping = 300 end
|
||||||
if ping <= 100 then
|
if ping <= 100 then
|
||||||
self.ctr_xh.selectedIndex = 0
|
self.ctr_xh.selectedIndex = 0
|
||||||
elseif ping <= 300 then
|
elseif ping <= 300 then
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 14
|
self.extend_id = 14
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
|
|
@ -41,10 +41,10 @@ end
|
||||||
|
|
||||||
local _gameInfo = nil
|
local _gameInfo = nil
|
||||||
function M:GetGameInfo()
|
function M:GetGameInfo()
|
||||||
if not _gameInfo then
|
if not _gameInfo then
|
||||||
_gameInfo = EXGameInfo.new()
|
_gameInfo = EXGameInfo.new()
|
||||||
end
|
end
|
||||||
return _gameInfo
|
return _gameInfo
|
||||||
end
|
end
|
||||||
|
|
||||||
local _ctr_game = nil
|
local _ctr_game = nil
|
||||||
|
|
@ -59,13 +59,12 @@ function M:NewRoom()
|
||||||
return ChunTian_Room.new()
|
return ChunTian_Room.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:GetIconUrl()
|
function M:GetIconUrl()
|
||||||
return "ui://Extend_Poker_ChunTian/icon"
|
return "ui://Extend_Poker_ChunTian/icon"
|
||||||
--
|
--
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -79,7 +78,7 @@ function M:FillRoomData(s2croom)
|
||||||
|
|
||||||
local _tableInfo = s2croom["tableInfo"]
|
local _tableInfo = s2croom["tableInfo"]
|
||||||
|
|
||||||
room.xipaiScore=_tableInfo["xipai_score"]
|
room.xipaiScore = _tableInfo["xipai_score"]
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||||
|
|
@ -91,7 +90,7 @@ function M:FillRoomData(s2croom)
|
||||||
end
|
end
|
||||||
|
|
||||||
local playerList = _tableInfo["playerData"]
|
local playerList = _tableInfo["playerData"]
|
||||||
for i = 1,#playerList do
|
for i = 1, #playerList do
|
||||||
local _jp = playerList[i]
|
local _jp = playerList[i]
|
||||||
|
|
||||||
local p = ChunTian_Player.new()
|
local p = ChunTian_Player.new()
|
||||||
|
|
@ -131,7 +130,6 @@ function M:FillRoomData(s2croom)
|
||||||
room.owner_id = owner
|
room.owner_id = owner
|
||||||
room.game_status = 0
|
room.game_status = 0
|
||||||
if reload then
|
if reload then
|
||||||
|
|
||||||
local reloadInfo = s2croom["reloadInfo"]
|
local reloadInfo = s2croom["reloadInfo"]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -141,10 +139,8 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_turn_seat = reloadInfo["active_seat"]
|
room.curren_turn_seat = reloadInfo["active_seat"]
|
||||||
local info_list = reloadInfo["info_list"]
|
local info_list = reloadInfo["info_list"]
|
||||||
if playing == true then
|
if playing == true then
|
||||||
|
|
||||||
|
|
||||||
room.CurnrenState = StateType.Palying
|
room.CurnrenState = StateType.Palying
|
||||||
room.game_status=1
|
room.game_status = 1
|
||||||
|
|
||||||
|
|
||||||
for i = 1, #info_list do
|
for i = 1, #info_list do
|
||||||
|
|
@ -152,7 +148,7 @@ function M:FillRoomData(s2croom)
|
||||||
|
|
||||||
if p == room.self_player then
|
if p == room.self_player then
|
||||||
p.hand_list = reloadInfo["hand_card"]
|
p.hand_list = reloadInfo["hand_card"]
|
||||||
p.open= reloadInfo["open"]
|
p.open = reloadInfo["open"]
|
||||||
end
|
end
|
||||||
|
|
||||||
p.hand_count = info_list[i]["card_size"]
|
p.hand_count = info_list[i]["card_size"]
|
||||||
|
|
@ -160,17 +156,17 @@ function M:FillRoomData(s2croom)
|
||||||
p.outCards = info_list[i]["outCards"]
|
p.outCards = info_list[i]["outCards"]
|
||||||
local last_outcard = info_list[i]["last_outcard"]
|
local last_outcard = info_list[i]["last_outcard"]
|
||||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true)
|
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)
|
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)
|
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||||
else
|
else
|
||||||
p.out_card_list = {0}
|
p.out_card_list = { 0 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||||
--pt(s2croom)
|
--pt(s2croom)
|
||||||
room.game_status=1
|
room.game_status = 1
|
||||||
|
|
||||||
room.CurnrenState = StateType.PalyingWait
|
room.CurnrenState = StateType.PalyingWait
|
||||||
|
|
||||||
|
|
@ -185,19 +181,18 @@ function M:FillRoomData(s2croom)
|
||||||
|
|
||||||
local last_outcard = info_list[i]["last_outcard"]
|
local last_outcard = info_list[i]["last_outcard"]
|
||||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||||
|
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||||
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)
|
||||||
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)
|
||||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
|
|
||||||
else
|
else
|
||||||
p.out_card_list = {0}
|
p.out_card_list = { 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
p.hand_list = info_list[i]["cards"]
|
p.hand_list = info_list[i]["cards"]
|
||||||
p.winscore = info_list[i]["winscore"]
|
p.winscore = info_list[i]["winscore"]
|
||||||
p.hand_count = info_list[i]["card_size"]
|
p.hand_count = info_list[i]["card_size"]
|
||||||
p.thisboomnum=info_list[i]["thisboomnum"]
|
p.thisboomnum = info_list[i]["thisboomnum"]
|
||||||
p.open= info_list[i]["open"]
|
p.open = info_list[i]["open"]
|
||||||
|
|
||||||
p.handCards = info_list[i]["handCards"]
|
p.handCards = info_list[i]["handCards"]
|
||||||
p.outCards = info_list[i]["outCards"]
|
p.outCards = info_list[i]["outCards"]
|
||||||
|
|
@ -208,8 +203,6 @@ function M:FillRoomData(s2croom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:FillPlayBackData(pd_data)
|
function M:FillPlayBackData(pd_data)
|
||||||
local room = DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
local _tableInfo = pd_data["info"]
|
local _tableInfo = pd_data["info"]
|
||||||
|
|
@ -224,7 +217,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_turn_seat = active_seat
|
room.curren_turn_seat = active_seat
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = ChunTian_Player.new()
|
local p = ChunTian_Player.new()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -245,7 +238,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
p.hand_list = _hand_card
|
p.hand_list = _hand_card
|
||||||
p.hand_count = #_hand_card
|
p.hand_count = #_hand_card
|
||||||
p.total_score = _jp["score"]
|
p.total_score = _jp["score"]
|
||||||
p.open= _jp["open"]
|
p.open = _jp["open"]
|
||||||
p.hp_info = _jp["hp_info"]
|
p.hp_info = _jp["hp_info"]
|
||||||
if _jp['hp_info'] then
|
if _jp['hp_info'] then
|
||||||
p.cur_hp = _jp.hp_info.cur_hp
|
p.cur_hp = _jp.hp_info.cur_hp
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ local MuShi_GameController = {}
|
||||||
local M = MuShi_GameController
|
local M = MuShi_GameController
|
||||||
|
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M, {__index = GameController})
|
setmetatable(M, { __index = GameController })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self:init("木虱")
|
self:init("木虱")
|
||||||
self.class = "MuShi_GameController"
|
self.class = "MuShi_GameController"
|
||||||
return self
|
return self
|
||||||
|
|
@ -62,7 +62,6 @@ function M:RegisterEvt()
|
||||||
|
|
||||||
|
|
||||||
-- self._eventmap[Protocol.GAME_EVT_READY] = self.OnExTendPlayerReady
|
-- self._eventmap[Protocol.GAME_EVT_READY] = self.OnExTendPlayerReady
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnExTendPlayerReady(evt_data)
|
function M:OnExTendPlayerReady(evt_data)
|
||||||
|
|
@ -110,7 +109,7 @@ function M:SendBuPai(bupai)
|
||||||
_client:send(MuShi_Protocol.MuShi_Send_Piao, _data)
|
_client:send(MuShi_Protocol.MuShi_Send_Piao, _data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SendCard(cards,currentCard)
|
function M:SendCard(cards, currentCard)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["card"] = cards
|
_data["card"] = cards
|
||||||
_data["all_card"] = currentCard
|
_data["all_card"] = currentCard
|
||||||
|
|
@ -150,12 +149,12 @@ function M:StarQiangZhuang()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FinishCuoPai(evt_data)
|
function M:FinishCuoPai(evt_data)
|
||||||
print("上报搓牌返回==================")
|
-- print("上报搓牌返回==================")
|
||||||
local seat = evt_data["seat"]
|
local seat = evt_data["seat"]
|
||||||
local card = evt_data["card"]
|
local card = evt_data["card"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai,seat,card)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai, seat, card)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -167,7 +166,7 @@ function M:OtherQiangZhuang(evt_data)
|
||||||
local index = evt_data["index"]
|
local index = evt_data["index"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang,seat,index)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang, seat, index)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -179,17 +178,17 @@ function M:DingZhuang(evt_data)
|
||||||
local score = evt_data["score"]
|
local score = evt_data["score"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat,index,score)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat, index, score)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:StarBet(evt_data)
|
function M:StarBet(evt_data)
|
||||||
printlog("开始下注 ====================================",evt_data["seat"])
|
printlog("开始下注 ====================================", evt_data["seat"])
|
||||||
local seat = evt_data["seat"]
|
local seat = evt_data["seat"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet,seat)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet, seat)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -202,7 +201,7 @@ function M:OtherBet(evt_data)
|
||||||
local score = evt_data["mul"]
|
local score = evt_data["mul"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat,index,score)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat, index, score)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -213,7 +212,7 @@ function M:TiQianStar(evt_data)
|
||||||
local agree = evt_data["agree"]
|
local agree = evt_data["agree"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat,agree)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat, agree)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -224,7 +223,7 @@ function M:OnAgreeGame(evt_data)
|
||||||
local agree = evt_data["agree"]
|
local agree = evt_data["agree"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat,agree)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat, agree)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -282,7 +281,7 @@ function M:OnInitCard(evt_data)
|
||||||
self._room.curren_round = round
|
self._room.curren_round = round
|
||||||
--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, cardlist,cardtype,seat,cardopen)
|
||||||
DispatchEvent(self._dispatcher,MuShi_GameEvent.OnInitCard,round,playerAry)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, playerAry)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -314,7 +313,8 @@ function M:OnPlaySucc(evt_data)
|
||||||
player.hand_count = remain
|
player.hand_count = remain
|
||||||
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
|
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)
|
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
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -324,7 +324,7 @@ function M:OnPassSucc(evt_data)
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
local p = self._room:GetPlayerBySeat(seat)
|
local p = self._room:GetPlayerBySeat(seat)
|
||||||
p.out_card_list = {0}
|
p.out_card_list = { 0 }
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -339,6 +339,7 @@ function M:OnPutError(evt_data)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:TuoGuan(isTuo)
|
function M:TuoGuan(isTuo)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["tuoguan"] = isTuo
|
_data["tuoguan"] = isTuo
|
||||||
|
|
@ -353,6 +354,7 @@ function M:Game_TuoGuan(evt_data)
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnIndexMove(evt_data)
|
function M:OnIndexMove(evt_data)
|
||||||
local seat = evt_data["index"]
|
local seat = evt_data["index"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
|
|
@ -389,7 +391,6 @@ function M:OnPiaoTip(evt_data)
|
||||||
--local reload = evt_data["reload"]
|
--local reload = evt_data["reload"]
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
|
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -407,7 +408,7 @@ function M:OnPiaoAction(evt_data)
|
||||||
|
|
||||||
self._cacheEvent:Enqueue(
|
self._cacheEvent:Enqueue(
|
||||||
function()
|
function()
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat,piao,card)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat, piao, card)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
@ -468,6 +469,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Game_TuoGuan(evt_data)
|
function M:Game_TuoGuan(evt_data)
|
||||||
local tuoguan = evt_data["tuoguan"]
|
local tuoguan = evt_data["tuoguan"]
|
||||||
local seat = evt_data["seat"]
|
local seat = evt_data["seat"]
|
||||||
|
|
@ -475,6 +477,7 @@ function M:Game_TuoGuan(evt_data)
|
||||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ChangeCodeByFrom(cardList, isSort)
|
function M:ChangeCodeByFrom(cardList, isSort)
|
||||||
isSort = isSort or false
|
isSort = isSort or false
|
||||||
local new_card_list = {}
|
local new_card_list = {}
|
||||||
|
|
@ -595,7 +598,6 @@ end
|
||||||
--Bomb = 11
|
--Bomb = 11
|
||||||
-- 牌型,大小, 长度
|
-- 牌型,大小, 长度
|
||||||
function M:GetCardListInfo(cardlist)
|
function M:GetCardListInfo(cardlist)
|
||||||
|
|
||||||
if #cardlist == 0 then
|
if #cardlist == 0 then
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0, 0
|
||||||
end
|
end
|
||||||
|
|
@ -611,14 +613,12 @@ function M:GetCardListInfo(cardlist)
|
||||||
card_num = math.floor(cardlist[1] / 10)
|
card_num = math.floor(cardlist[1] / 10)
|
||||||
elseif #cardlist == 3 then
|
elseif #cardlist == 3 then
|
||||||
card_num = math.floor(cardlist[1] / 10)
|
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
|
-- body
|
||||||
card_type = MuShi_CardType.Bomb
|
card_type = MuShi_CardType.Bomb
|
||||||
else
|
else
|
||||||
card_type = MuShi_CardType.Three
|
card_type = MuShi_CardType.Three
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif #cardlist == 4 then
|
elseif #cardlist == 4 then
|
||||||
local max_key = 0
|
local max_key = 0
|
||||||
for k, v in pairs(card_map) do
|
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
|
local max_one_key, max_two_key, max_three_key = 0, 0, 0
|
||||||
|
|
||||||
for k, v in pairs(card_map) do
|
for k, v in pairs(card_map) do
|
||||||
|
|
||||||
if #v == 2 then
|
if #v == 2 then
|
||||||
|
|
||||||
if k > max_two_key then
|
if k > max_two_key then
|
||||||
max_two_key = k
|
max_two_key = k
|
||||||
end
|
end
|
||||||
|
|
@ -687,7 +685,6 @@ function M:GetCardListInfo(cardlist)
|
||||||
card_num = max_two_key
|
card_num = max_two_key
|
||||||
end
|
end
|
||||||
elseif #v == 1 then
|
elseif #v == 1 then
|
||||||
|
|
||||||
if k > max_one_key then
|
if k > max_one_key then
|
||||||
max_one_key = k
|
max_one_key = k
|
||||||
end
|
end
|
||||||
|
|
@ -697,7 +694,6 @@ function M:GetCardListInfo(cardlist)
|
||||||
card_num = max_one_key
|
card_num = max_one_key
|
||||||
end
|
end
|
||||||
elseif #v == 3 then
|
elseif #v == 3 then
|
||||||
|
|
||||||
if max_three_key == 0 then
|
if max_three_key == 0 then
|
||||||
max_three_key = k
|
max_three_key = k
|
||||||
three_count = three_count + 1
|
three_count = three_count + 1
|
||||||
|
|
@ -730,21 +726,13 @@ function M:GetCardListInfo(cardlist)
|
||||||
if three_count * 3 == #cardlist then
|
if three_count * 3 == #cardlist then
|
||||||
card_type = MuShi_CardType.Plane
|
card_type = MuShi_CardType.Plane
|
||||||
card_num = max_three_key
|
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_type = MuShi_CardType.PlaneAndOne
|
||||||
card_num = max_three_key
|
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_type = MuShi_CardType.PlaneAndTwo
|
||||||
card_num = max_three_key
|
card_num = max_three_key
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return card_type, card_num, card_length, plan_three_count
|
return card_type, card_num, card_length, plan_three_count
|
||||||
|
|
@ -756,7 +744,7 @@ function M:GetCardMapByList(cardlist)
|
||||||
local card = cardlist[i]
|
local card = cardlist[i]
|
||||||
local card_num = math.floor(cardlist[i] / 10)
|
local card_num = math.floor(cardlist[i] / 10)
|
||||||
if card_map[card_num] == nil then
|
if card_map[card_num] == nil then
|
||||||
card_map[card_num] = {card}
|
card_map[card_num] = { card }
|
||||||
else
|
else
|
||||||
card_map[card_num][#card_map[card_num] + 1] = card
|
card_map[card_num][#card_map[card_num] + 1] = card
|
||||||
end
|
end
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -29,15 +29,15 @@ local MuShi_Record_Event = {
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, 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 = 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 = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' }
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Create a new
|
--- Create a new
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M, {__index = PKPlayBackView})
|
setmetatable(M, { __index = PKPlayBackView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = 'MuShi_PlayBackView'
|
self.class = 'MuShi_PlayBackView'
|
||||||
self:init()
|
self:init()
|
||||||
|
|
||||||
|
|
@ -51,7 +51,8 @@ function M:InitView(url)
|
||||||
end
|
end
|
||||||
self._gamectr = ControllerManager.GetController(GameController)
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
UIPackage.AddPackage('extend/poker/mushi/ui/Extend_Poker_MuShi')
|
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._tex_round = self._view:GetChild('round')
|
||||||
self._player_card_info = {}
|
self._player_card_info = {}
|
||||||
local _player_card_info = 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)
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||||
end
|
end
|
||||||
local list = self._room.player_list
|
local list = self._room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = _player_info[self:GetPos(p.seat)]
|
local info = _player_info[self:GetPos(p.seat)]
|
||||||
info._view.visible = true
|
info._view.visible = true
|
||||||
|
|
@ -111,13 +112,12 @@ function M:InitView(url)
|
||||||
self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong
|
self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong
|
||||||
|
|
||||||
self:CuoPai()
|
self:CuoPai()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CuoPai()
|
function M:CuoPai()
|
||||||
self.cuopai = self._view:GetChild("cuopai")
|
self.cuopai = self._view:GetChild("cuopai")
|
||||||
self.cuopai.visible = false
|
self.cuopai.visible = false
|
||||||
-- print("self.btnY ",self.btnY)
|
-- -- print("self.btnY ",self.btnY)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Wuyong()
|
function M:Wuyong()
|
||||||
|
|
@ -132,7 +132,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomData(data)
|
function M:FillRoomData(data)
|
||||||
--print("hidezhanji 1111")
|
---- print("hidezhanji 1111")
|
||||||
self._currentStep = 1
|
self._currentStep = 1
|
||||||
local room = DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
local _player_card_info = self._player_card_info
|
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)]
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
|
||||||
if p.total_hp then
|
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
|
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)
|
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -172,7 +172,7 @@ end
|
||||||
|
|
||||||
function M:ShowStep(index)
|
function M:ShowStep(index)
|
||||||
local step = self._step[index]
|
local step = self._step[index]
|
||||||
if step==nil then
|
if step == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- for i = 1, #step.player_card_data do
|
-- for i = 1, #step.player_card_data do
|
||||||
|
|
@ -183,18 +183,18 @@ function M:ShowStep(index)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- Evt_alertQiangZhuang = 'alertQiangZhuang',
|
-- Evt_alertQiangZhuang = 'alertQiangZhuang',
|
||||||
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
||||||
-- Evt_zhuangInfo = 'zhuangInfo',
|
-- Evt_zhuangInfo = 'zhuangInfo',
|
||||||
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
||||||
-- Evt_userXiaZhu = 'userXiaZhu',
|
-- Evt_userXiaZhu = 'userXiaZhu',
|
||||||
-- Evt_alertBuPai = 'alertBuPai',
|
-- Evt_alertBuPai = 'alertBuPai',
|
||||||
-- Evt_playerBuPai = 'playerBuPai'
|
-- Evt_playerBuPai = 'playerBuPai'
|
||||||
|
|
||||||
if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then
|
if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then
|
||||||
for _, player in ipairs(self._room.player_list) do
|
for _, player in ipairs(self._room.player_list) do
|
||||||
local player_head = self._player_info[self:GetPos(player.seat)]
|
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||||
player_head:MarkBank(false)
|
player_head:MarkBank(false)
|
||||||
player_head:UpdateFen(-1,0)
|
player_head:UpdateFen(-1, 0)
|
||||||
end
|
end
|
||||||
self._player_card_info[1]:StarQiangZhuang(1)
|
self._player_card_info[1]:StarQiangZhuang(1)
|
||||||
end
|
end
|
||||||
|
|
@ -206,7 +206,7 @@ function M:ShowStep(index)
|
||||||
self._player_card_info[1]:StarQiangZhuang(0)
|
self._player_card_info[1]:StarQiangZhuang(0)
|
||||||
end
|
end
|
||||||
local head_info = self._player_info[self:GetPos(seat)]
|
local head_info = self._player_info[self:GetPos(seat)]
|
||||||
head_info:UpdateFen(0,index)
|
head_info:UpdateFen(0, index)
|
||||||
end
|
end
|
||||||
|
|
||||||
if step.cmd == MuShi_Record_Event.Evt_zhuangInfo then
|
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)]
|
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||||
player_head:MarkBank(false)
|
player_head:MarkBank(false)
|
||||||
end
|
end
|
||||||
head_info:UpdateFen(1,score)
|
head_info:UpdateFen(1, score)
|
||||||
head_info:MarkBank(true)
|
head_info:MarkBank(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@ function M:ShowStep(index)
|
||||||
local seat = step.seat
|
local seat = step.seat
|
||||||
local index = step.index
|
local index = step.index
|
||||||
local head_info = self._player_info[self:GetPos(seat)]
|
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
|
if (seat == self._room.self_player.seat) then
|
||||||
self._player_card_info[1]:StarBet(0)
|
self._player_card_info[1]:StarBet(0)
|
||||||
|
|
@ -241,7 +241,7 @@ function M:ShowStep(index)
|
||||||
|
|
||||||
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||||
local seat = step.seat
|
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)
|
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -253,7 +253,7 @@ function M:ShowStep(index)
|
||||||
--printlog("补牌================",bupai,card)
|
--printlog("补牌================",bupai,card)
|
||||||
if (bupai == 1) then
|
if (bupai == 1) then
|
||||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||||
card_info:AddPoker(card,1)
|
card_info:AddPoker(card, 1)
|
||||||
end
|
end
|
||||||
if self._room.self_player.seat == seat then
|
if self._room.self_player.seat == seat then
|
||||||
local player_card_info = self._player_card_info[1]
|
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
|
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||||
local seat = step.seat
|
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)
|
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -277,16 +277,15 @@ function M:ShowStep(index)
|
||||||
|
|
||||||
if step.cmd == MuShi_Record_Event.Evt_result then
|
if step.cmd == MuShi_Record_Event.Evt_result then
|
||||||
local result = step.result
|
local result = step.result
|
||||||
for i = 1,#result do
|
for i = 1, #result do
|
||||||
local seat = result[i].seat
|
local seat = result[i].seat
|
||||||
local cardType = result[i].cardType
|
local cardType = result[i].cardType
|
||||||
local cardPoint = result[i].cardPoint
|
local cardPoint = result[i].cardPoint
|
||||||
|
|
||||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||||
card_info:SetCarType(cardType,cardPoint)
|
card_info:SetCarType(cardType, cardPoint)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GenerateAllStepData(data)
|
function M:GenerateAllStepData(data)
|
||||||
|
|
@ -314,14 +313,12 @@ function M:GenerateAllStepData(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:CmdAlertQiangZhuang(cmd, index) --通知抢庄
|
||||||
|
|
||||||
function M:CmdAlertQiangZhuang(cmd,index) --通知抢庄
|
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
function M:CmdUserQiangZhuang(cmd, index) --玩家抢庄
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
|
|
@ -329,7 +326,7 @@ function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
||||||
data.score = cmd.data.score
|
data.score = cmd.data.score
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdZhuangInfo(cmd,index) --定庄
|
function M:CmdZhuangInfo(cmd, index) --定庄
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
|
|
@ -337,47 +334,45 @@ function M:CmdZhuangInfo(cmd,index) --定庄
|
||||||
data.score = cmd.data.score
|
data.score = cmd.data.score
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdAlertXiaZhu(cmd,index) --通知下注
|
function M:CmdAlertXiaZhu(cmd, index) --通知下注
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.data.cmd
|
data.cmd = cmd.data.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdUserXiaZhu(cmd,index) --玩家下注
|
function M:CmdUserXiaZhu(cmd, index) --玩家下注
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
data.index = cmd.data.index
|
data.index = cmd.data.index
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdAlertBuPai(cmd,index) --通知补牌
|
function M:CmdAlertBuPai(cmd, index) --通知补牌
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.data.cmd
|
data.cmd = cmd.data.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdPlayerBuPai(cmd,index) --玩家补牌
|
function M:CmdPlayerBuPai(cmd, index) --玩家补牌
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.bupai = cmd.data.bupai
|
data.bupai = cmd.data.bupai
|
||||||
data.card = cmd.data.card
|
data.card = cmd.data.card
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdPlayerSendCards(cmd,index)
|
function M:CmdPlayerSendCards(cmd, index)
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.seat = cmd.data.seat
|
data.seat = cmd.data.seat
|
||||||
data.cards = cmd.data.cards
|
data.cards = cmd.data.cards
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CmdResult(cmd,index)
|
function M:CmdResult(cmd, index)
|
||||||
local data = self:CopyLastStep(index)
|
local data = self:CopyLastStep(index)
|
||||||
data.cmd = cmd.cmd
|
data.cmd = cmd.cmd
|
||||||
data.result = cmd.data.result
|
data.result = cmd.data.result
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:CopyLastStep(index)
|
function M:CopyLastStep(index)
|
||||||
local step = {}
|
local step = {}
|
||||||
local last_step = self._step[index]
|
local last_step = self._step[index]
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
||||||
|
|
||||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self, {__index = CardView})
|
setmetatable(self, { __index = CardView })
|
||||||
self.btn_card = card
|
self.btn_card = card
|
||||||
self.card_code_number = cardcodenum
|
self.card_code_number = cardcodenum
|
||||||
self.card_code_flower = cardcodeflower
|
self.card_code_flower = cardcodeflower
|
||||||
|
|
@ -38,8 +38,8 @@ local MuShi_PlayerSelfPokerInfoView = {
|
||||||
local M = MuShi_PlayerSelfPokerInfoView
|
local M = MuShi_PlayerSelfPokerInfoView
|
||||||
|
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(M, {__index = MuShi_PlayerPokerInfoView})
|
setmetatable(M, { __index = MuShi_PlayerPokerInfoView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
self.gameCtr = ControllerManager.GetController(GameController)
|
self.gameCtr = ControllerManager.GetController(GameController)
|
||||||
|
|
@ -113,8 +113,6 @@ function M:init()
|
||||||
self:BtnEvent()
|
self:BtnEvent()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:BtnEvent()
|
function M:BtnEvent()
|
||||||
self.btnBuPai.onClick:Set(function()
|
self.btnBuPai.onClick:Set(function()
|
||||||
--printlog("点击补牌=================================")
|
--printlog("点击补牌=================================")
|
||||||
|
|
@ -198,7 +196,7 @@ function M:ChangeCtrBuPai(b)
|
||||||
self.ctr_bupai.selectedIndex = b
|
self.ctr_bupai.selectedIndex = b
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitPoker(pokerList,cardtype,cardopen)
|
function M:InitPoker(pokerList, cardtype, cardopen)
|
||||||
self.cardopen = cardopen
|
self.cardopen = cardopen
|
||||||
for i = 1, #pokerList do
|
for i = 1, #pokerList do
|
||||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||||
|
|
@ -236,10 +234,8 @@ function M:InitPoker2(pokerList)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function M:AddPoker(poker)
|
function M:AddPoker(poker)
|
||||||
--print("玩家自己加牌===========================================")
|
---- print("玩家自己加牌===========================================")
|
||||||
local card_number_code = self:ChangeOneCodeByFrom(poker)
|
local card_number_code = self:ChangeOneCodeByFrom(poker)
|
||||||
local card_flower_code = poker
|
local card_flower_code = poker
|
||||||
local btn_card = self:CreatPoker(poker, 1, 0)
|
local btn_card = self:CreatPoker(poker, 1, 0)
|
||||||
|
|
@ -260,12 +256,12 @@ function M:GetHandCardPos(index, card_count)
|
||||||
local x, y = 0, -18
|
local x, y = 0, -18
|
||||||
local offset = 40
|
local offset = 40
|
||||||
|
|
||||||
x = offset*index
|
x = offset * index
|
||||||
return Vector2.New(x, y)
|
return Vector2.New(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ChangeOneCodeByFrom(card)
|
function M:ChangeOneCodeByFrom(card)
|
||||||
if(card > 500) then
|
if (card > 500) then
|
||||||
return card
|
return card
|
||||||
end
|
end
|
||||||
local flower = math.floor(card / 100)
|
local flower = math.floor(card / 100)
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ function M:FillRoomData(s2croom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||||
--pt(s2croom)
|
--pt(s2croom)
|
||||||
room.game_status = 1
|
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