全部放大
parent
944b9ed164
commit
9e830c82b5
|
|
@ -67,7 +67,7 @@ function NetClient.new(host, game, protocol)
|
|||
-- self.responseMap = {}
|
||||
self.onevent = event("onevent", false)
|
||||
self.onconnect = event("onconnect", false)
|
||||
--print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol)
|
||||
---- print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol)
|
||||
|
||||
self.c__netClient = LuaNetClient(host, game, self, self.protocol)
|
||||
self.c__netClient:SetCallBackListener(R.c__ondata)
|
||||
|
|
@ -92,7 +92,7 @@ local NULL_JSON = "{}"
|
|||
--- send
|
||||
function R.send(self, cmd, data, callback)
|
||||
if (debug_print) then
|
||||
print("send host:" .. self.host)
|
||||
-- print("send host:" .. self.host)
|
||||
end
|
||||
if self.c__netClient == nil then
|
||||
return
|
||||
|
|
@ -170,7 +170,7 @@ end
|
|||
---c#网络层回调函数
|
||||
function R.c__onconnect(self, code)
|
||||
if (debug_print) then
|
||||
print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||
-- print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
|
||||
end
|
||||
self.onconnect(code)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ Queue = {}
|
|||
|
||||
|
||||
function Queue.new(capacity)
|
||||
local self = {}
|
||||
setmetatable(self,{__index = Queue})
|
||||
local self = {}
|
||||
setmetatable(self, { __index = Queue })
|
||||
self.capacity = capacity
|
||||
self.queue = {}
|
||||
self.size_ = 0
|
||||
|
|
@ -20,11 +20,11 @@ function Queue:Enqueue(element)
|
|||
self.queue[self.rear] = element
|
||||
else
|
||||
local temp = (self.rear + 1) % self.capacity
|
||||
--print("1111111111111111111====>>>>")
|
||||
--print(temp)
|
||||
---- print("1111111111111111111====>>>>")
|
||||
---- print(temp)
|
||||
if temp == self.head then
|
||||
error("Error: capacity is full.")
|
||||
ViewUtil.ErrorTip(10001,"Error: capacity is full.")
|
||||
ViewUtil.ErrorTip(10001, "Error: capacity is full.")
|
||||
return
|
||||
else
|
||||
self.rear = temp
|
||||
|
|
@ -33,12 +33,11 @@ function Queue:Enqueue(element)
|
|||
self.queue[self.rear] = element
|
||||
self.size_ = self.size_ + 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Queue:Dequeue()
|
||||
if self:IsEmpty() then
|
||||
ViewUtil.ErrorTip(10002,"Error: The Queue is empty.")
|
||||
ViewUtil.ErrorTip(10002, "Error: The Queue is empty.")
|
||||
error("Error: The Queue is empty.")
|
||||
return
|
||||
end
|
||||
|
|
@ -74,16 +73,16 @@ function Queue:dump()
|
|||
local first_flag = true
|
||||
while h ~= r do
|
||||
if first_flag == true then
|
||||
str = "{"..self.queue[h]
|
||||
str = "{" .. self.queue[h]
|
||||
h = (h + 1) % self.capacity
|
||||
first_flag = false
|
||||
else
|
||||
str = str..","..self.queue[h]
|
||||
str = str .. "," .. self.queue[h]
|
||||
h = (h + 1) % self.capacity
|
||||
end
|
||||
end
|
||||
str = str..","..self.queue[r].."}"
|
||||
if(debug_print) then
|
||||
print(str)
|
||||
end
|
||||
str = str .. "," .. self.queue[r] .. "}"
|
||||
if (debug_print) then
|
||||
-- print(str)
|
||||
end
|
||||
end
|
||||
|
|
@ -5,132 +5,131 @@
|
|||
bit = bit or {}
|
||||
function bit.init32()
|
||||
bit.data32 = {}
|
||||
for i=1,32 do
|
||||
bit.data32[i]=2^(32-i)
|
||||
for i = 1, 32 do
|
||||
bit.data32[i] = 2 ^ (32 - i)
|
||||
end
|
||||
end
|
||||
|
||||
bit.init32()
|
||||
|
||||
function bit:d2b(arg) --bit:d2b
|
||||
local tr={}
|
||||
for i=1,32 do
|
||||
function bit:d2b(arg) --bit:d2b
|
||||
local tr = {}
|
||||
for i = 1, 32 do
|
||||
if arg >= self.data32[i] then
|
||||
tr[i]=1
|
||||
arg=arg-self.data32[i]
|
||||
tr[i] = 1
|
||||
arg = arg - self.data32[i]
|
||||
else
|
||||
tr[i]=0
|
||||
tr[i] = 0
|
||||
end
|
||||
end
|
||||
return tr
|
||||
return tr
|
||||
end
|
||||
|
||||
function bit:b2d(arg) --bit:b2d
|
||||
local nr=0
|
||||
for i=1,32 do
|
||||
if arg[i] ==1 then
|
||||
nr=nr+2^(32-i)
|
||||
function bit:b2d(arg) --bit:b2d
|
||||
local nr = 0
|
||||
for i = 1, 32 do
|
||||
if arg[i] == 1 then
|
||||
nr = nr + 2 ^ (32 - i)
|
||||
end
|
||||
end
|
||||
return nr
|
||||
return nr
|
||||
end
|
||||
|
||||
function bit:_xor(a,b) --bit:xor
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_xor(a, b) --bit:xor
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==op2[i] then
|
||||
r[i]=0
|
||||
for i = 1, 32 do
|
||||
if op1[i] == op2[i] then
|
||||
r[i] = 0
|
||||
else
|
||||
r[i]=1
|
||||
r[i] = 1
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_and(a,b) --bit:_and
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_and(a, b) --bit:_and
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 and op2[i]==1 then
|
||||
r[i]=1
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 and op2[i] == 1 then
|
||||
r[i] = 1
|
||||
else
|
||||
r[i]=0
|
||||
r[i] = 0
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_or(a,b) --bit:_or
|
||||
local op1=self:d2b(a)
|
||||
local op2=self:d2b(b)
|
||||
local r={}
|
||||
function bit:_or(a, b) --bit:_or
|
||||
local op1 = self:d2b(a)
|
||||
local op2 = self:d2b(b)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 or op2[i]==1 then
|
||||
r[i]=1
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 or op2[i] == 1 then
|
||||
r[i] = 1
|
||||
else
|
||||
r[i]=0
|
||||
r[i] = 0
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_not(a) --bit:_not
|
||||
local op1=self:d2b(a)
|
||||
local r={}
|
||||
function bit:_not(a) --bit:_not
|
||||
local op1 = self:d2b(a)
|
||||
local r = {}
|
||||
|
||||
for i=1,32 do
|
||||
if op1[i]==1 then
|
||||
r[i]=0
|
||||
for i = 1, 32 do
|
||||
if op1[i] == 1 then
|
||||
r[i] = 0
|
||||
else
|
||||
r[i]=1
|
||||
r[i] = 1
|
||||
end
|
||||
end
|
||||
return self:b2d(r)
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_rshift(a,n) --bit:_rshift
|
||||
local op1=self:d2b(a)
|
||||
local r=self:d2b(0)
|
||||
function bit:_rshift(a, n) --bit:_rshift
|
||||
local op1 = self:d2b(a)
|
||||
local r = self:d2b(0)
|
||||
|
||||
if n < 32 and n > 0 then
|
||||
for i=1,n do
|
||||
for i=31,1,-1 do
|
||||
op1[i+1]=op1[i]
|
||||
for i = 1, n do
|
||||
for i = 31, 1, -1 do
|
||||
op1[i + 1] = op1[i]
|
||||
end
|
||||
op1[1]=0
|
||||
op1[1] = 0
|
||||
end
|
||||
r=op1
|
||||
r = op1
|
||||
end
|
||||
return self:b2d(r)
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
function bit:_lshift(a,n) --bit:_lshift
|
||||
local op1=self:d2b(a)
|
||||
local r=self:d2b(0)
|
||||
function bit:_lshift(a, n) --bit:_lshift
|
||||
local op1 = self:d2b(a)
|
||||
local r = self:d2b(0)
|
||||
|
||||
if n < 32 and n > 0 then
|
||||
for i=1,n do
|
||||
for i=1,31 do
|
||||
op1[i]=op1[i+1]
|
||||
for i = 1, n do
|
||||
for i = 1, 31 do
|
||||
op1[i] = op1[i + 1]
|
||||
end
|
||||
op1[32]=0
|
||||
op1[32] = 0
|
||||
end
|
||||
r=op1
|
||||
r = op1
|
||||
end
|
||||
return self:b2d(r)
|
||||
return self:b2d(r)
|
||||
end
|
||||
|
||||
|
||||
function bit:print(ta)
|
||||
local sr=""
|
||||
for i=1,32 do
|
||||
sr=sr..ta[i]
|
||||
local sr = ""
|
||||
for i = 1, 32 do
|
||||
sr = sr .. ta[i]
|
||||
end
|
||||
print(sr)
|
||||
-- print(sr)
|
||||
end
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
string._htmlspecialchars_set = {}
|
||||
string._htmlspecialchars_set["&"] = "&"
|
||||
string._htmlspecialchars_set["\""] = """
|
||||
|
|
@ -10,7 +8,7 @@ string._htmlspecialchars_set[">"] = ">"
|
|||
--[[--
|
||||
将特殊字符转为 HTML 转义符
|
||||
~~~ lua
|
||||
print(string.htmlspecialchars("<ABC>"))
|
||||
-- print(string.htmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -26,7 +24,7 @@ end
|
|||
--[[--
|
||||
将 HTML 转义符还原为特殊字符,功能与 string.htmlspecialchars() 正好相反
|
||||
~~~ lua
|
||||
print(string.restorehtmlspecialchars("<ABC>"))
|
||||
-- print(string.restorehtmlspecialchars("<ABC>"))
|
||||
-- 输出 <ABC>
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -42,7 +40,7 @@ end
|
|||
--[[--
|
||||
将字符串中的 \n 换行符转换为 HTML 标记
|
||||
~~~ lua
|
||||
print(string.nl2br("Hello\nWorld"))
|
||||
-- print(string.nl2br("Hello\nWorld"))
|
||||
-- 输出
|
||||
-- Hello<br />World
|
||||
~~~
|
||||
|
|
@ -56,7 +54,7 @@ end
|
|||
--[[--
|
||||
将字符串中的特殊字符和 \n 换行符转换为 HTML 转移符和标记
|
||||
~~~ lua
|
||||
print(string.nl2br("<Hello>\nWorld"))
|
||||
-- print(string.nl2br("<Hello>\nWorld"))
|
||||
-- 输出
|
||||
-- <Hello><br />World
|
||||
~~~
|
||||
|
|
@ -88,10 +86,10 @@ local res = string.split(input, "-+-")
|
|||
function string.split(input, delimiter)
|
||||
input = tostring(input)
|
||||
delimiter = tostring(delimiter)
|
||||
if (delimiter=='') then return false end
|
||||
local pos,arr = 0, {}
|
||||
if (delimiter == '') then return false end
|
||||
local pos, arr = 0, {}
|
||||
-- for each divider found
|
||||
for st,sp in function() return string.find(input, delimiter, pos, true) end do
|
||||
for st, sp in function() return string.find(input, delimiter, pos, true) end do
|
||||
table.insert(arr, string.sub(input, pos, st - 1))
|
||||
pos = sp + 1
|
||||
end
|
||||
|
|
@ -103,7 +101,7 @@ end
|
|||
去除输入字符串头部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = " ABC"
|
||||
print(string.ltrim(input))
|
||||
-- print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串前面的两个空格被去掉了
|
||||
~~~
|
||||
空白字符包括:
|
||||
|
|
@ -123,7 +121,7 @@ end
|
|||
去除输入字符串尾部的空白字符,返回结果
|
||||
~~~ lua
|
||||
local input = "ABC "
|
||||
print(string.ltrim(input))
|
||||
-- print(string.ltrim(input))
|
||||
-- 输出 ABC,输入字符串最后的两个空格被去掉了
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -149,7 +147,7 @@ end
|
|||
将字符串的第一个字符转为大写,返回结果
|
||||
~~~ lua
|
||||
local input = "hello"
|
||||
print(string.ucfirst(input))
|
||||
-- print(string.ucfirst(input))
|
||||
-- 输出 Hello
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -167,7 +165,7 @@ end
|
|||
将字符串转换为符合 URL 传递要求的格式,并返回转换结果
|
||||
~~~ lua
|
||||
local input = "hello world"
|
||||
print(string.urlencode(input))
|
||||
-- print(string.urlencode(input))
|
||||
-- 输出
|
||||
-- hello%20world
|
||||
~~~
|
||||
|
|
@ -188,7 +186,7 @@ end
|
|||
将 URL 中的特殊字符还原,并返回结果
|
||||
~~~ lua
|
||||
local input = "hello%20world"
|
||||
print(string.urldecode(input))
|
||||
-- print(string.urldecode(input))
|
||||
-- 输出
|
||||
-- hello world
|
||||
~~~
|
||||
|
|
@ -197,9 +195,9 @@ print(string.urldecode(input))
|
|||
@see string.urlencode
|
||||
]]
|
||||
function string.urldecode(input)
|
||||
input = string.gsub (input, "+", " ")
|
||||
input = string.gsub (input, "%%(%x%x)", function(h) return string.char(checknumber(h,16)) end)
|
||||
input = string.gsub (input, "\r\n", "\n")
|
||||
input = string.gsub(input, "+", " ")
|
||||
input = string.gsub(input, "%%(%x%x)", function(h) return string.char(checknumber(h, 16)) end)
|
||||
input = string.gsub(input, "\r\n", "\n")
|
||||
return input
|
||||
end
|
||||
|
||||
|
|
@ -207,7 +205,7 @@ end
|
|||
计算 UTF8 字符串的长度,每一个中文算一个字符
|
||||
~~~ lua
|
||||
local input = "你好World"
|
||||
print(string.utf8len(input))
|
||||
-- print(string.utf8len(input))
|
||||
-- 输出 7
|
||||
~~~
|
||||
@param string input 输入字符串
|
||||
|
|
@ -219,7 +217,7 @@ function string.utf8len(input)
|
|||
local len = string.len(input)
|
||||
local left = len
|
||||
local cnt = 0
|
||||
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}
|
||||
local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
|
||||
while left ~= 0 do
|
||||
local tmp = string.byte(input, -left)
|
||||
local i = #arr
|
||||
|
|
@ -247,11 +245,11 @@ function string.utf8sub(input, index, endIndex)
|
|||
endIndex = index
|
||||
index = 1
|
||||
end
|
||||
local len = string.len(input)
|
||||
local left = len
|
||||
local cnt = 0
|
||||
local len = string.len(input)
|
||||
local left = len
|
||||
local cnt = 0
|
||||
local head, tail = 0, 0
|
||||
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}
|
||||
local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
|
||||
while left ~= 0 do
|
||||
if cnt + 1 == index then
|
||||
head = len - left + 1
|
||||
|
|
@ -278,7 +276,7 @@ end
|
|||
--[[--
|
||||
将数值格式化为包含千分位分隔符的字符串
|
||||
~~~ lua
|
||||
print(string.formatnumberthousands(1924235))
|
||||
-- print(string.formatnumberthousands(1924235))
|
||||
-- 输出 1,924,235
|
||||
~~~
|
||||
@param number num 数值
|
||||
|
|
@ -294,12 +292,11 @@ function string.formatnumberthousands(num)
|
|||
return formatted
|
||||
end
|
||||
|
||||
|
||||
function string.concat( ... )
|
||||
function string.concat(...)
|
||||
local str = {}
|
||||
local tem = {...}
|
||||
for _,v in ipairs(tem) do
|
||||
local tem = { ... }
|
||||
for _, v in ipairs(tem) do
|
||||
str[#str + 1] = v
|
||||
end
|
||||
return table.concat(str , "")
|
||||
return table.concat(str, "")
|
||||
end
|
||||
|
|
@ -1,46 +1,46 @@
|
|||
EventContext = FairyGUI.EventContext
|
||||
EventListener = FairyGUI.EventListener
|
||||
EventContext = FairyGUI.EventContext
|
||||
EventListener = FairyGUI.EventListener
|
||||
EventDispatcher = FairyGUI.EventDispatcher
|
||||
InputEvent = FairyGUI.InputEvent
|
||||
NTexture = FairyGUI.NTexture
|
||||
Container = FairyGUI.Container
|
||||
Image = FairyGUI.Image
|
||||
Stage = FairyGUI.Stage
|
||||
Controller = FairyGUI.Controller
|
||||
GObject = FairyGUI.GObject
|
||||
GGraph = FairyGUI.GGraph
|
||||
GGroup = FairyGUI.GGroup
|
||||
GImage = FairyGUI.GImage
|
||||
GLoader = FairyGUI.GLoader
|
||||
GMovieClip = FairyGUI.GMovieClip
|
||||
TextFormat = FairyGUI.TextFormat
|
||||
GTextField = FairyGUI.GTextField
|
||||
GRichTextField = FairyGUI.GRichTextField
|
||||
GTextInput = FairyGUI.GTextInput
|
||||
GComponent = FairyGUI.GComponent
|
||||
GList = FairyGUI.GList
|
||||
GRoot = FairyGUI.GRoot
|
||||
GLabel = FairyGUI.GLabel
|
||||
GButton = FairyGUI.GButton
|
||||
GComboBox = FairyGUI.GComboBox
|
||||
GProgressBar = FairyGUI.GProgressBar
|
||||
GSlider = FairyGUI.GSlider
|
||||
PopupMenu = FairyGUI.PopupMenu
|
||||
ScrollPane = FairyGUI.ScrollPane
|
||||
Transition = FairyGUI.Transition
|
||||
UIPackage = FairyGUI.UIPackage
|
||||
Window = FairyGUI.Window
|
||||
GObjectPool = FairyGUI.GObjectPool
|
||||
Relations = FairyGUI.Relations
|
||||
RelationType = FairyGUI.RelationType
|
||||
UIPanel = FairyGUI.UIPanel
|
||||
UIPainter = FairyGUI.UIPainter
|
||||
TypingEffect = FairyGUI.TypingEffect
|
||||
GTween = FairyGUI.GTween
|
||||
GTweener = FairyGUI.GTweener
|
||||
EaseType = FairyGUI.EaseType
|
||||
InputEvent = FairyGUI.InputEvent
|
||||
NTexture = FairyGUI.NTexture
|
||||
Container = FairyGUI.Container
|
||||
Image = FairyGUI.Image
|
||||
Stage = FairyGUI.Stage
|
||||
Controller = FairyGUI.Controller
|
||||
GObject = FairyGUI.GObject
|
||||
GGraph = FairyGUI.GGraph
|
||||
GGroup = FairyGUI.GGroup
|
||||
GImage = FairyGUI.GImage
|
||||
GLoader = FairyGUI.GLoader
|
||||
GMovieClip = FairyGUI.GMovieClip
|
||||
TextFormat = FairyGUI.TextFormat
|
||||
GTextField = FairyGUI.GTextField
|
||||
GRichTextField = FairyGUI.GRichTextField
|
||||
GTextInput = FairyGUI.GTextInput
|
||||
GComponent = FairyGUI.GComponent
|
||||
GList = FairyGUI.GList
|
||||
GRoot = FairyGUI.GRoot
|
||||
GLabel = FairyGUI.GLabel
|
||||
GButton = FairyGUI.GButton
|
||||
GComboBox = FairyGUI.GComboBox
|
||||
GProgressBar = FairyGUI.GProgressBar
|
||||
GSlider = FairyGUI.GSlider
|
||||
PopupMenu = FairyGUI.PopupMenu
|
||||
ScrollPane = FairyGUI.ScrollPane
|
||||
Transition = FairyGUI.Transition
|
||||
UIPackage = FairyGUI.UIPackage
|
||||
Window = FairyGUI.Window
|
||||
GObjectPool = FairyGUI.GObjectPool
|
||||
Relations = FairyGUI.Relations
|
||||
RelationType = FairyGUI.RelationType
|
||||
UIPanel = FairyGUI.UIPanel
|
||||
UIPainter = FairyGUI.UIPainter
|
||||
TypingEffect = FairyGUI.TypingEffect
|
||||
GTween = FairyGUI.GTween
|
||||
GTweener = FairyGUI.GTweener
|
||||
EaseType = FairyGUI.EaseType
|
||||
|
||||
fgui = {}
|
||||
fgui = {}
|
||||
|
||||
--[[
|
||||
用于继承FairyGUI的Window类,同时派生的Window类可以继续被继承。可以重写的方法有(与Window类里的同名方法含义完全相同)
|
||||
|
|
@ -48,11 +48,11 @@ OnInit、DoHideAnimation、DoShowAnimation、OnShown、OnHide。
|
|||
例子:
|
||||
MyWinClass = fgui.window_class()
|
||||
function MyWinClass:ctor()
|
||||
print('MyWinClass-ctor')
|
||||
-- print('MyWinClass-ctor')
|
||||
self.contentPane = UIPackage.CreateObject("Basics", "WindowA")
|
||||
end
|
||||
function MyWinClass:OnShown()
|
||||
print('MyWinClass-onShown')
|
||||
-- print('MyWinClass-onShown')
|
||||
end
|
||||
local win = MyWinClass.New()
|
||||
win:Show()
|
||||
|
|
@ -74,7 +74,7 @@ function fgui.window_class(base)
|
|||
tolua.setpeer(ins, t)
|
||||
ins:SetLuaPeer(t)
|
||||
if t.ctor then
|
||||
t.ctor(ins,...)
|
||||
t.ctor(ins, ...)
|
||||
end
|
||||
|
||||
return ins
|
||||
|
|
@ -92,12 +92,12 @@ MyButton = fgui.extension_class(GButton)
|
|||
fgui.register_extension("ui://包名/我的按钮", MyButton)
|
||||
|
||||
function MyButton:ctor() --当组件构建完成时此方法被调用
|
||||
print(self:GetChild("n1"))
|
||||
-- print(self:GetChild("n1"))
|
||||
end
|
||||
|
||||
--添加自定义的方法和字段
|
||||
function MyButton:Test()
|
||||
print('test')
|
||||
-- print('test')
|
||||
end
|
||||
|
||||
local get = tolua.initget(MyButton)
|
||||
|
|
@ -133,7 +133,7 @@ function fgui.extension_class(base)
|
|||
o.Extend = function(ins)
|
||||
local t = {}
|
||||
setmetatable(t, o)
|
||||
tolua.setpeer(ins,t)
|
||||
tolua.setpeer(ins, t)
|
||||
return t
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ GameEvent = {
|
|||
-- 更新玩家信息
|
||||
OnUpdateInfo = 'OnUpdateInfo',
|
||||
|
||||
--打开托管
|
||||
TupGuanOpen='TupGuanOpen',
|
||||
--关闭托管
|
||||
TupGuanClose='TupGuanClose',
|
||||
--打开托管
|
||||
TupGuanOpen = 'TupGuanOpen',
|
||||
--关闭托管
|
||||
TupGuanClose = 'TupGuanClose',
|
||||
|
||||
--麻将修改牌大小
|
||||
MJModifySzie='MJModifySzie',
|
||||
--麻将修改牌大小
|
||||
MJModifySzie = 'MJModifySzie',
|
||||
}
|
||||
|
||||
--- Base GameController
|
||||
|
|
@ -40,7 +40,7 @@ GameController = {
|
|||
|
||||
local M = GameController
|
||||
|
||||
setmetatable(M, {__index = IController})
|
||||
setmetatable(M, { __index = IController })
|
||||
|
||||
function M:init(name)
|
||||
self._name = name
|
||||
|
|
@ -48,13 +48,13 @@ function M:init(name)
|
|||
self._cacheEvent = Queue.new(1000)
|
||||
self._eventmap = {}
|
||||
self._dispatcher = {}
|
||||
self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT]=self.ResetConnect
|
||||
self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT] = self.ResetConnect
|
||||
|
||||
self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter
|
||||
self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState
|
||||
self._eventmap[Protocol.GAME_EVT_PLAYER_EXIT] = self.OnEventPlayerLeave
|
||||
self._eventmap[Protocol.GAME_EVT_READY] = self.OnEventPlayerReady
|
||||
self._eventmap[Protocol.GAME_EVT_READY_AND_XIPAI] = self.OnEventPlayerXiPaiReady
|
||||
self._eventmap[Protocol.GAME_EVT_READY_AND_XIPAI] = self.OnEventPlayerXiPaiReady
|
||||
|
||||
self._eventmap[Protocol.GAME_EVT_EXIT_ROOM_DISMISS] = self.OnEventExitRoomDismiss
|
||||
self._eventmap[Protocol.GAME_EVT_DISMISS_ROOM] = self.OnEventDismissRoom
|
||||
|
|
@ -67,12 +67,10 @@ function M:init(name)
|
|||
self._eventmap[Protocol.GAME_EVT_KICKED] = self.OnEventKicked
|
||||
self._eventmap[Protocol.GAME_EVT_UPDATE_PLAYERINFO] = self.OnEvtUpdateInfo
|
||||
|
||||
self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips
|
||||
self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips
|
||||
|
||||
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
||||
|
||||
self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips
|
||||
self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips
|
||||
|
||||
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
||||
end
|
||||
|
||||
function DispatchEvent(_dispatcher, evt_name, ...)
|
||||
|
|
@ -86,11 +84,10 @@ function M:AddEventListener(evt_name, func)
|
|||
self._dispatcher[evt_name] = func
|
||||
end
|
||||
|
||||
|
||||
function M:ResetConnect()
|
||||
-- print("断线重连================")
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
-- -- print("断线重连================")
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
end
|
||||
|
||||
----------------------请求------------------------------------
|
||||
|
|
@ -101,11 +98,12 @@ function M:PlayerReady()
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
print("====================================1发送准备")
|
||||
_client:send(Protocol.GAME_READY)
|
||||
end
|
||||
|
||||
function M:PlayerXiPai()
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
if not _client then
|
||||
return
|
||||
end
|
||||
|
|
@ -163,9 +161,9 @@ function M:AskDismissRoom()
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
_client:send(Protocol.GAME_ASK_DISMISS_ROOM,nil,function (res)
|
||||
_client:send(Protocol.GAME_ASK_DISMISS_ROOM, nil, function(res)
|
||||
if res.ReturnCode == 84 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"解散失败")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "解散失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -178,7 +176,7 @@ function M:DismissRoomVote(agree)
|
|||
if not _client then
|
||||
return
|
||||
end
|
||||
-- print(agree)
|
||||
-- -- print(agree)
|
||||
local _data = {}
|
||||
_data['result'] = agree
|
||||
_client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data)
|
||||
|
|
@ -261,7 +259,7 @@ end
|
|||
|
||||
-- 玩家进
|
||||
function M:OnEventPlayerEnter(evt_data)
|
||||
--print("进入房间++++++++++++++++++++++++++++++++++++++")
|
||||
---- print("进入房间++++++++++++++++++++++++++++++++++++++")
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local p = self._room:NewPlayer()
|
||||
|
|
@ -280,13 +278,12 @@ function M:OnEventPlayerEnter(evt_data)
|
|||
-- p.total_hp = evt_data["total_hp"] or 0
|
||||
if evt_data['hp_info'] then
|
||||
p.cur_hp = evt_data.hp_info.cur_hp
|
||||
-- p.total_hp = evt_data.hp_info.total_hp
|
||||
-- p.total_hp = evt_data.hp_info.total_hp
|
||||
end
|
||||
p.self_user = _user
|
||||
p.line_state = 1
|
||||
DataManager.CurrenRoom:AddPlayer(p)
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p)
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -325,47 +322,42 @@ function M:OnEventPlayerReady(evt_data)
|
|||
local pid = evt_data['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
p.ready = true
|
||||
if evt_data.start~=nil then
|
||||
if evt_data.start==1 then
|
||||
p.isSendCardState=true
|
||||
else
|
||||
p.isSendCardState=false
|
||||
end
|
||||
|
||||
else
|
||||
p.isSendCardState=false
|
||||
end
|
||||
if evt_data.start ~= nil then
|
||||
if evt_data.start == 1 then
|
||||
p.isSendCardState = true
|
||||
else
|
||||
p.isSendCardState = false
|
||||
end
|
||||
else
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEventPlayerXiPaiReady(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local pid = evt_data['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
p.ready = true
|
||||
if evt_data.start~=nil then
|
||||
if evt_data.start==1 then
|
||||
p.isSendCardState=true
|
||||
else
|
||||
p.isSendCardState=false
|
||||
end
|
||||
|
||||
else
|
||||
p.isSendCardState=false
|
||||
end
|
||||
if evt_data.start ~= nil then
|
||||
if evt_data.start == 1 then
|
||||
p.isSendCardState = true
|
||||
else
|
||||
p.isSendCardState = false
|
||||
end
|
||||
else
|
||||
p.isSendCardState = false
|
||||
end
|
||||
|
||||
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 聊天事件
|
||||
function M:OnEventInteraction(evt_data)
|
||||
if self._room.ban_chat1 == false or self._room.ban_chat2 == false then
|
||||
|
|
@ -396,7 +388,6 @@ function M:OnEventUpdateGPS(evt_data)
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
-- 被踢出房间事件
|
||||
function M:OnEventKicked()
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
|
|
@ -544,7 +535,7 @@ end
|
|||
|
||||
function M:OnEnter()
|
||||
if (debug_print) then
|
||||
print(self._name .. '进入Game控制器')
|
||||
-- print(self._name .. '进入Game控制器')
|
||||
end
|
||||
self._room = DataManager.CurrenRoom
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
|
|
@ -555,14 +546,14 @@ end
|
|||
|
||||
function M:OnExit()
|
||||
if (debug_print) then
|
||||
print(self._name .. ' 离开Game控制器')
|
||||
-- print(self._name .. ' 离开Game控制器')
|
||||
end
|
||||
ControllerManager.SetGameNetClient(nil)
|
||||
self._cacheEvent:Clear()
|
||||
end
|
||||
|
||||
function M:__OnNetEvent(msg)
|
||||
--print("Game消息ID===>>"..msg.Command)
|
||||
---- print("Game消息ID===>>"..msg.Command)
|
||||
local func = self._eventmap[msg.Command]
|
||||
if (func ~= nil) then
|
||||
func(self, msg.Data)
|
||||
|
|
@ -586,38 +577,32 @@ function M:ReturnToRoom()
|
|||
end,
|
||||
self.tmpGroupID
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:OnEvtOpenTupGTips(msg)
|
||||
--print("显示托管倒计时=====================")
|
||||
pt(msg)
|
||||
local pid = msg['aid']
|
||||
---- print("显示托管倒计时=====================")
|
||||
pt(msg)
|
||||
local pid = msg['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
local t=msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,true, t)
|
||||
local t = msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, true, t)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEvtCloseTupGTips(msg)
|
||||
--print("关闭托管倒计时=================")
|
||||
--pt(msg)
|
||||
local pid = msg['aid']
|
||||
---- print("关闭托管倒计时=================")
|
||||
--pt(msg)
|
||||
local pid = msg['aid']
|
||||
local p = self._room:GetPlayerById(pid)
|
||||
local t=msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,false, t)
|
||||
local t = msg['time']
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t)
|
||||
end
|
||||
|
||||
|
||||
function M:DispatchEventTuoGuan(p,isShow,t)
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,isShow, t)
|
||||
function M:DispatchEventTuoGuan(p, isShow, t)
|
||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:OnEvtOpenGameHuTuoGtips(isAuto)
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
if not _client then
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ function M:connect(host, groupId, callback)
|
|||
self._mgr_client:destroy()
|
||||
self._mgr_client = nil
|
||||
end
|
||||
print("666666666666666666666666666 ", host)
|
||||
-- print("666666666666666666666666666 ", host)
|
||||
local _mgr_client = NetClient.new(self.host, "mgr_group")
|
||||
self._mgr_client = _mgr_client
|
||||
_mgr_client:connect()
|
||||
|
|
@ -186,7 +186,7 @@ end
|
|||
|
||||
-- 更新玩法
|
||||
function M:OnEvtUpdatePlay(evt_data)
|
||||
--print("更新玩法=============》》》")
|
||||
---- print("更新玩法=============》》》")
|
||||
--pt(evt_data)
|
||||
local pid = evt_data.pid
|
||||
local group = DataManager.groups:get(self.groupId)
|
||||
|
|
@ -354,7 +354,7 @@ function M:OnExit()
|
|||
end
|
||||
|
||||
function M:__OnNetEvent(msg)
|
||||
--print("消息ID===>>"..msg.Command)
|
||||
---- print("消息ID===>>"..msg.Command)
|
||||
local func = self._eventmap[msg.Command]
|
||||
if (func ~= nil) then func(self, msg.Data) end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
LoddyController = {}
|
||||
|
||||
local M = {}
|
||||
|
||||
--- Create a new LoddyController
|
||||
function LoddyController.new()
|
||||
setmetatable(M, {__index = IController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.baseType = LoddyController
|
||||
self.class = "Loddy"
|
||||
self.recordList = {}
|
||||
|
|
@ -14,11 +13,11 @@ function LoddyController.new()
|
|||
end
|
||||
|
||||
function M.OnEnter(self)
|
||||
--print(vardump(self,"loddy controller enter"))
|
||||
---- print(vardump(self,"loddy controller enter"))
|
||||
end
|
||||
|
||||
function M.OnExit(self)
|
||||
--print(vardump(self,"loddy controller exit"))
|
||||
---- print(vardump(self,"loddy controller exit"))
|
||||
end
|
||||
|
||||
local function __FillRoomData(s2croom)
|
||||
|
|
@ -27,7 +26,7 @@ local function __FillRoomData(s2croom)
|
|||
extend:FillRoomData(s2croom)
|
||||
end
|
||||
|
||||
local function __ConntectGameServer(cmd,room, host, _data,callback)
|
||||
local function __ConntectGameServer(cmd, room, host, _data, callback)
|
||||
-- local _data = {}
|
||||
_data["session"] = room.session
|
||||
local _game_client = NetClient.new(host, "game")
|
||||
|
|
@ -35,7 +34,7 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
|||
ControllerManager.SetGameNetClient(_game_client)
|
||||
_game_client.onconnect:Add(function(code)
|
||||
if (code == SocketCode.Connect) then
|
||||
_game_client:send(cmd, _data, function (response)
|
||||
_game_client:send(cmd, _data, function(response)
|
||||
if (response.ReturnCode == 0) then
|
||||
_game_client.onconnect:Clear()
|
||||
_game_client.onconnect:Add(ControllerManager.OnConnect)
|
||||
|
|
@ -44,39 +43,38 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
|
|||
end
|
||||
_game_client:destroy()
|
||||
if ControllerManager.GameNetClinet == _game_client then
|
||||
ControllerManager.GameNetClinet =nil
|
||||
ControllerManager.GameNetClinet = nil
|
||||
end
|
||||
callback(response)
|
||||
end)
|
||||
|
||||
else
|
||||
if ControllerManager.GameNetClinet == _game_client then
|
||||
ControllerManager.GameNetClinet =nil
|
||||
ControllerManager.GameNetClinet = nil
|
||||
end
|
||||
_game_client:destroy()
|
||||
callback({ReturnCode = 101})
|
||||
callback({ ReturnCode = 101 })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:CreateRoom(game_id, _data, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local data = {}
|
||||
data.game_id = game_id
|
||||
local _client = ControllerManager.WebClient
|
||||
local data = {}
|
||||
data.game_id = game_id
|
||||
data["platform"] = GetPlatform()
|
||||
data.config_data = _data
|
||||
-- local runtime = os.clock()
|
||||
_client:send(Protocol.WEB_CREATE_ROOM, data, function(res)
|
||||
if ( res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
|
||||
self:JoinRoom("000000",callback)
|
||||
if (res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
|
||||
self:JoinRoom("000000", callback)
|
||||
return
|
||||
end
|
||||
if (res.ReturnCode == 0) then
|
||||
local json = res.Data
|
||||
local game_info = json["game_info"]
|
||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
res.ReturnCode = -2
|
||||
callback(res)
|
||||
end)
|
||||
|
|
@ -87,7 +85,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local server_ip = json["server_ip"]
|
||||
local server_port = json["server_port"]
|
||||
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
room.game_id = game_id
|
||||
room.room_id = room_id
|
||||
room.server_host = string.concat(server_ip, ":", server_port)
|
||||
|
|
@ -99,12 +97,12 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local j_data = {}
|
||||
j_data["session"] = room.session
|
||||
if not DataManager.SelfUser.location then
|
||||
DataManager.SelfUser.location = Location.new()
|
||||
DataManager.SelfUser.location = Location.new()
|
||||
end
|
||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||
|
||||
-- game_net =
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data, function (response)
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(response)
|
||||
if (response.ReturnCode == 0) then
|
||||
-- game_net:clearEvent()
|
||||
local _s2croom = response.Data
|
||||
|
|
@ -118,7 +116,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
ControllerManager.ChangeController(GameController)
|
||||
-- print("create room:"..(os.clock()-runtime))
|
||||
-- -- print("create room:"..(os.clock()-runtime))
|
||||
callback(response)
|
||||
return
|
||||
end
|
||||
|
|
@ -126,13 +124,13 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
callback(response)
|
||||
end)
|
||||
else
|
||||
if callback then callback(res) end
|
||||
if callback then callback(res) end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local join_room_frame = 0
|
||||
function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
||||
function M:PublicJoinRoom(cmd, room_id, callback, group_id, group_layer)
|
||||
-- 同一帧不重复调用
|
||||
local last_frame = join_room_frame
|
||||
join_room_frame = Time.frameCount
|
||||
|
|
@ -147,12 +145,12 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
_data["floor"] = group_layer
|
||||
_data["platform"] = GetPlatform()
|
||||
local _client = ControllerManager.WebClient;
|
||||
_client:send(cmd, _data, function( res)
|
||||
_client:send(cmd, _data, function(res)
|
||||
if (res.ReturnCode == 0) then
|
||||
local json = res.Data
|
||||
local game_info = json["game_info"]
|
||||
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
res.ReturnCode = -2
|
||||
callback(res)
|
||||
end)
|
||||
|
|
@ -162,7 +160,7 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
local server_ip = json["server_ip"]
|
||||
local server_port = json["server_port"]
|
||||
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
room.lev = json["lev"] -- 自己在当前房间所在圈子的职位,1盟主,2管理员,3用户,非圈子房间就是3
|
||||
room.room_id = json["room_id"]
|
||||
room.game_id = game_id
|
||||
|
|
@ -178,14 +176,14 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
DataManager.CurrenRoom = room
|
||||
local j_data = {}
|
||||
if not DataManager.SelfUser.location then
|
||||
DataManager.SelfUser.location = Location.new()
|
||||
DataManager.SelfUser.location = Location.new()
|
||||
end
|
||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||
-- local game_net = nil
|
||||
--print(vardump(room))
|
||||
---- print(vardump(room))
|
||||
-- game_net =
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1)
|
||||
if (res1.ReturnCode ~= 0 ) then
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
|
||||
if (res1.ReturnCode ~= 0) then
|
||||
if (callback) then callback(res1) end
|
||||
else
|
||||
local _s2croom = res1.Data
|
||||
|
|
@ -198,7 +196,7 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
end
|
||||
room.agent = _s2croom.agent == 1 and true or false
|
||||
-- ControllerManager.SetGameNetClient(game_net)
|
||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
ControllerManager.ChangeController(GameController)
|
||||
if callback then callback(res1) end
|
||||
|
|
@ -206,16 +204,15 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
|
|||
end)
|
||||
-- callback(res)
|
||||
else
|
||||
if callback then callback(res) end
|
||||
if callback then callback(res) end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function M:JoinRoom(room_id,callback,group_id,group_layer)
|
||||
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM,room_id,callback,group_id,group_layer)
|
||||
function M:JoinRoom(room_id, callback, group_id, group_layer)
|
||||
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM, room_id, callback, group_id, group_layer)
|
||||
end
|
||||
|
||||
|
||||
function M:ResetJionRoom(callback)
|
||||
local _game = ControllerManager.GetController(GameController)
|
||||
local o_room = DataManager.CurrenRoom
|
||||
|
|
@ -224,7 +221,7 @@ function M:ResetJionRoom(callback)
|
|||
DataManager.SelfUser.location = Location.new()
|
||||
end
|
||||
j_data["pos"] = DataManager.SelfUser.location:Location2String()
|
||||
local room = ExtendManager.GetExtendConfig(o_room.game_id):NewRoom()
|
||||
local room = ExtendManager.GetExtendConfig(o_room.game_id):NewRoom()
|
||||
room.lev = o_room.lev
|
||||
room.room_id = o_room.room_id
|
||||
room.game_id = o_room.game_id
|
||||
|
|
@ -241,14 +238,14 @@ function M:ResetJionRoom(callback)
|
|||
room.create_time = o_room.create_time
|
||||
room:SetReloadStatus(true)
|
||||
DataManager.CurrenRoom = room
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1)
|
||||
__ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
|
||||
room:SetReloadStatus(false)
|
||||
if (res1.ReturnCode ~= 0 ) then
|
||||
if (res1.ReturnCode ~= 0) then
|
||||
if (callback) then callback(res1) end
|
||||
else
|
||||
printlog("ResetJionRoom==>>>")
|
||||
pt(res1)
|
||||
ControllerManager.enterPlayerData=res1.Data.tableInfo.playerData
|
||||
ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
|
||||
local _s2croom = res1.Data
|
||||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
|
|
@ -259,8 +256,8 @@ function M:ResetJionRoom(callback)
|
|||
end
|
||||
|
||||
function M:UpdatePlayerInfo(callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_UPDATE_INFO, nil, function (res)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_UPDATE_INFO, nil, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
DataManager.SelfUser.diamo = res.Data.diamo
|
||||
DataManager.SelfUser.invited = res.Data.invitation
|
||||
|
|
@ -272,12 +269,12 @@ function M:UpdatePlayerInfo(callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:UpdateNotice(id,callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local _data = {}
|
||||
function M:UpdateNotice(id, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local _data = {}
|
||||
_data.id = id
|
||||
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function (res)
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
||||
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function(res)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 and #res.Data.notice_list > 0 then
|
||||
callback(true, res.Data)
|
||||
|
|
@ -298,10 +295,10 @@ function M:RequestRecordList(callback, roomid)
|
|||
proto = Protocol.WEB_GET_MILITARY_BY_ROOMID
|
||||
_data.roomId = roomid
|
||||
end
|
||||
_client:send(proto, _data, function (res)
|
||||
_client:send(proto, _data, function(res)
|
||||
self.recordList = nil
|
||||
-- print(vardump(res))
|
||||
if (res.ReturnCode == 0 or res.ReturnCode == 19 ) then
|
||||
-- -- print(vardump(res))
|
||||
if (res.ReturnCode == 0 or res.ReturnCode == 19) then
|
||||
--self:RequestRankList(callback)
|
||||
self.recordList = {}
|
||||
if res.ReturnCode == 19 then return end
|
||||
|
|
@ -335,8 +332,8 @@ function M:RequestRecordList(callback, roomid)
|
|||
end
|
||||
local round_count = record_list_item["round"]
|
||||
|
||||
for j = 1,round_count do
|
||||
local round_score_str = record_list_item["round_"..j]
|
||||
for j = 1, round_count do
|
||||
local round_score_str = record_list_item["round_" .. j]
|
||||
local m_round_game = MGameTimes.new()
|
||||
if round_score_str then
|
||||
local round_score_item = json.decode(round_score_str)
|
||||
|
|
@ -359,50 +356,45 @@ function M:RequestRecordList(callback, roomid)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:RequestPlayBack(_data,callback,game_info)
|
||||
function M:RequestPlayBack(_data, callback, game_info)
|
||||
if game_info and ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
|
||||
ExtendHotupdate.UpdateGame(game_info,function()
|
||||
self:RequestPlayBack(_data,callback)
|
||||
ExtendHotupdate.UpdateGame(game_info, function()
|
||||
self:RequestPlayBack(_data, callback)
|
||||
end)
|
||||
return
|
||||
else
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_GET_PLAY_BACK , _data , function (res)
|
||||
_client:send(Protocol.WEB_GET_PLAY_BACK, _data, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local data = json.decode(res.Data.playback)
|
||||
local cmdList = data.cmdList
|
||||
local info = data.info
|
||||
local extend = ExtendManager.GetExtendConfig(info.game_id)
|
||||
local room = extend:NewRoom()
|
||||
local room = extend:NewRoom()
|
||||
room.game_id = info.game_id
|
||||
DataManager.CurrenRoom = room
|
||||
extend:FillPlayBackData(data)
|
||||
if not room.self_player then
|
||||
room.self_player = room:GetPlayerBySeat(1)
|
||||
end
|
||||
callback(res.ReturnCode,data)
|
||||
callback(res.ReturnCode, data)
|
||||
else
|
||||
callback(res.ReturnCode,nil)
|
||||
callback(res.ReturnCode, nil)
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--获取手机验证码
|
||||
function M:GetPhoneCode(phone,callback)
|
||||
function M:GetPhoneCode(phone, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
local _data = {}
|
||||
_data["phone"]=phone
|
||||
_data["phone"] = phone
|
||||
_client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res)
|
||||
callback(res)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:GetUserInfo(callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_GET_USER_INFO, nil, function(res)
|
||||
|
|
@ -419,7 +411,7 @@ function M:GetUserInfo(callback)
|
|||
end)
|
||||
end
|
||||
|
||||
function M:UpdateUserInfo(_data,callback)
|
||||
function M:UpdateUserInfo(_data, callback)
|
||||
local _client = ControllerManager.WebClient
|
||||
_client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res)
|
||||
callback(res)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ local function __Login(cmd, _data, callBack)
|
|||
end
|
||||
|
||||
_client:setSession(data["session_id"] .. "," .. data["token"])
|
||||
print("11111111111111111111111111111111")
|
||||
-- print("11111111111111111111111111111111")
|
||||
pt(data)
|
||||
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web)
|
||||
ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"]))
|
||||
|
|
@ -129,11 +129,11 @@ function M:QuickLogin(session_id, callback)
|
|||
end
|
||||
|
||||
function M.OnEnter(self)
|
||||
--print("login controller enter")
|
||||
---- print("login controller enter")
|
||||
end
|
||||
|
||||
function M.OnExit(self)
|
||||
--print("login controller exit")
|
||||
---- print("login controller exit")
|
||||
end
|
||||
|
||||
--字符串类json格式转化为表
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -102,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
|
|||
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||
extend:FillRoomData(_s2croom)
|
||||
ControllerManager.ChangeController(GameController)
|
||||
-- print("create room:"..(os.clock()-runtime))
|
||||
-- -- print("create room:"..(os.clock()-runtime))
|
||||
callback(response)
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function ControllerManager.Init()
|
|||
|
||||
local hostIp = GetGameInfo("login_url")
|
||||
if (debug_print) then
|
||||
print("hostIp:::" .. hostIp)
|
||||
-- print("hostIp:::" .. hostIp)
|
||||
end
|
||||
ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web)
|
||||
--ControllerManager.GroupClient = nil--NetClient.new("http://192.168.0.1:8081/", "web_group", ConnectionProtocol.Web)
|
||||
|
|
@ -76,7 +76,7 @@ function ControllerManager.SetGameNetClient(client)
|
|||
end
|
||||
|
||||
function ControllerManager.OnConnect(code)
|
||||
print("=======================================ControllerManager", code)
|
||||
-- print("=======================================ControllerManager", code)
|
||||
if (code ~= SocketCode.Connect) then
|
||||
ControllerManager.SetGameNetClient(nil)
|
||||
if code ~= SocketCode.DisconnectByServer then
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ local TableBG = {}
|
|||
|
||||
local M = TableBG
|
||||
local bg_config = {
|
||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
||||
{id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01"},
|
||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
||||
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||
{ id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
|
||||
{ id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01" },
|
||||
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||
}
|
||||
|
||||
function TableBG.GetBGConfig(config)
|
||||
|
|
@ -49,12 +49,12 @@ end
|
|||
function TableBG.GetTableBG(game_id)
|
||||
local id = -1
|
||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
||||
-- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
if json_data ~= nil then
|
||||
local config_data = json.decode(json_data)
|
||||
id = GetBG(config_data, game_id)
|
||||
end
|
||||
return id
|
||||
-- -- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
if json_data ~= nil then
|
||||
local config_data = json.decode(json_data)
|
||||
id = GetBG(config_data, game_id)
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
function TableBG.LoadTableBG(id, game_id, main_view, config)
|
||||
|
|
@ -80,11 +80,11 @@ end
|
|||
function TableBG.SaveTableBG(game_id, bg_id)
|
||||
local config_data
|
||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
||||
if json_data ~= nil then
|
||||
config_data = json.decode(json_data)
|
||||
else
|
||||
config_data = {}
|
||||
end
|
||||
if json_data ~= nil then
|
||||
config_data = json.decode(json_data)
|
||||
else
|
||||
config_data = {}
|
||||
end
|
||||
SetBG(config_data, game_id, bg_id)
|
||||
Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ local function __ShowTip(_version_view, text, callback)
|
|||
end
|
||||
|
||||
local function __update_check(data, onback, _version_view)
|
||||
print("===================updateCheck")
|
||||
-- print("===================updateCheck")
|
||||
local tex_tip = _version_view:GetChild("tex_info")
|
||||
for k, game_data in ipairs(data) do
|
||||
local asset_path = game_data["bundle"]:gsub("\r\n", "")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ local _isInit = false
|
|||
|
||||
local function __new_config(data)
|
||||
local ec = reimport(data.bundle .. ".ExtendConfig")
|
||||
print("初始化ExtendManager===>>>" .. data.bundle)
|
||||
-- print("初始化ExtendManager===>>>" .. data.bundle)
|
||||
--pt(data)
|
||||
local config = ec.new()
|
||||
ec.game_data = data
|
||||
|
|
|
|||
|
|
@ -2,31 +2,31 @@
|
|||
--author:--
|
||||
|
||||
BaseWindow = {
|
||||
--view description
|
||||
_view = nil,
|
||||
--view description
|
||||
_view = nil,
|
||||
|
||||
--View 是否被销毁
|
||||
_is_destroy = false,
|
||||
--是否播放动画
|
||||
_animation = true,
|
||||
--弹出动画,0关闭,1左边,2右边
|
||||
_anim_pop = 0,
|
||||
--关闭摧毁
|
||||
_close_destroy = false,
|
||||
--View 是否被销毁
|
||||
_is_destroy = false,
|
||||
--是否播放动画
|
||||
_animation = true,
|
||||
--弹出动画,0关闭,1左边,2右边
|
||||
_anim_pop = 0,
|
||||
--关闭摧毁
|
||||
_close_destroy = false,
|
||||
|
||||
--点击窗口以外关闭
|
||||
_close_zone = true,
|
||||
--点击窗口以外关闭
|
||||
_close_zone = true,
|
||||
|
||||
--队列
|
||||
_queue = true,
|
||||
--全屏
|
||||
_full = false,
|
||||
--全屏偏移
|
||||
_full_offset = true,
|
||||
--新窗口隐藏队列
|
||||
_new_hide = true,
|
||||
--模糊组件对象
|
||||
_put_map = true
|
||||
--队列
|
||||
_queue = true,
|
||||
--全屏
|
||||
_full = false,
|
||||
--全屏偏移
|
||||
_full_offset = true,
|
||||
--新窗口隐藏队列
|
||||
_new_hide = true,
|
||||
--模糊组件对象
|
||||
_put_map = true
|
||||
}
|
||||
|
||||
--window 列表
|
||||
|
|
@ -34,14 +34,14 @@ local WindowMap = {
|
|||
|
||||
}
|
||||
|
||||
local WindowQueue= {
|
||||
local WindowQueue = {
|
||||
|
||||
}
|
||||
|
||||
local M = BaseWindow
|
||||
|
||||
function BaseWindow.new(url,blur_view)
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function BaseWindow.new(url, blur_view)
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "BaseWindow"
|
||||
-- self._blur_view = blur_view
|
||||
self:init(url)
|
||||
|
|
@ -68,10 +68,10 @@ function M:init(url)
|
|||
printlog(self._view)
|
||||
-- self._view.fairyBatching = true
|
||||
local btn_close = self._view:GetChild("btn_close")
|
||||
if(btn_close) then
|
||||
if (btn_close) then
|
||||
btn_close.onClick:Set(function()
|
||||
self:CloseEvent()
|
||||
end)
|
||||
self:CloseEvent()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -83,29 +83,29 @@ function M:init(url)
|
|||
win_mode.touchable = false
|
||||
self:CloseEvent()
|
||||
end)
|
||||
printlog("======================================",self._full)
|
||||
printlog("======================================", self._full)
|
||||
if self._full then
|
||||
local offset = get_offset(self._full_offset)
|
||||
if self._anim_pop == 0 then
|
||||
self._view:AddRelation(contentPane, RelationType.Size)
|
||||
contentPane:AddChild(self._view)
|
||||
else
|
||||
contentPane:RemoveRelation(self._root_view, RelationType.Center_Center)
|
||||
contentPane:AddRelation(self._root_view, RelationType.Middle_Middle)
|
||||
contentPane:AddChild(self._view)
|
||||
else
|
||||
contentPane:RemoveRelation(self._root_view, RelationType.Center_Center)
|
||||
contentPane:AddRelation(self._root_view, RelationType.Middle_Middle)
|
||||
PopPanel:AddChild(self._view)
|
||||
local click_item = PopPanel:GetChild("click_item")
|
||||
if self._anim_pop == 1 then
|
||||
contentPane:AddRelation(self._root_view, RelationType.Left_Left)
|
||||
self._view.x = 0
|
||||
elseif self._anim_pop == 2 then
|
||||
contentPane:AddRelation(self._root_view, RelationType.Right_Right)
|
||||
self._view.x = GRoot.inst.width - self._view.width - offset
|
||||
end
|
||||
self._view.y = (PopPanel.height - self._view.height) * 0.5
|
||||
if self._anim_pop == 1 then
|
||||
contentPane:AddRelation(self._root_view, RelationType.Left_Left)
|
||||
self._view.x = 0
|
||||
elseif self._anim_pop == 2 then
|
||||
contentPane:AddRelation(self._root_view, RelationType.Right_Right)
|
||||
self._view.x = GRoot.inst.width - self._view.width - offset
|
||||
end
|
||||
self._view.y = (PopPanel.height - self._view.height) * 0.5
|
||||
click_item.xy = self._view.xy
|
||||
click_item.width = self._view.width
|
||||
click_item.height = self._view.height
|
||||
end
|
||||
end
|
||||
else
|
||||
contentPane:AddChild(self._view)
|
||||
contentPane.height = self._view.height
|
||||
|
|
@ -114,13 +114,13 @@ function M:init(url)
|
|||
end
|
||||
self._contentPane = contentPane
|
||||
if self._put_map then
|
||||
WindowMap[#WindowMap + 1] = self
|
||||
WindowMap[#WindowMap + 1] = self
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示窗口
|
||||
function M:Show()
|
||||
print("===========================================entershow",M.class)
|
||||
-- print("===========================================entershow",M.class)
|
||||
local contentPane = self._root_view:GetChild("contentPane")
|
||||
if self._anim_pop == 1 then
|
||||
contentPane:GetTransition("left_pop"):Play()
|
||||
|
|
@ -140,7 +140,7 @@ function M:Show()
|
|||
local _inQueue = false
|
||||
|
||||
if self._new_hide then
|
||||
for i=1,#WindowQueue do
|
||||
for i = 1, #WindowQueue do
|
||||
local win = WindowQueue[i]
|
||||
if win == self then
|
||||
_inQueue = true
|
||||
|
|
@ -159,7 +159,7 @@ function M:Show()
|
|||
self._contentPane.width = GRoot.inst.width - 2 * offset
|
||||
self._contentPane.height = GRoot.inst.height
|
||||
self._contentPane.x = offset
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 关闭窗口
|
||||
|
|
@ -168,9 +168,9 @@ function M:Close()
|
|||
-- BlurView(self._blur_view,false)
|
||||
-- end
|
||||
if self._queue then
|
||||
for i,v in ipairs(WindowQueue) do
|
||||
for i, v in ipairs(WindowQueue) do
|
||||
if v == self then
|
||||
table.remove(WindowQueue,i)
|
||||
table.remove(WindowQueue, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -194,9 +194,9 @@ function M:Destroy()
|
|||
if not _destroy_all then
|
||||
self:Close()
|
||||
if self._put_map then
|
||||
for i,v in ipairs(WindowMap) do
|
||||
for i, v in ipairs(WindowMap) do
|
||||
if v == self then
|
||||
table.remove(WindowMap,i)
|
||||
table.remove(WindowMap, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
@ -212,16 +212,16 @@ function M:CloseEvent()
|
|||
if self._close_destroy then
|
||||
self:Destroy()
|
||||
else
|
||||
self:Close()
|
||||
win_mode.touchable = true
|
||||
self:Close()
|
||||
win_mode.touchable = true
|
||||
end
|
||||
else
|
||||
self:ActionWithAnim(function()
|
||||
if self._close_destroy then
|
||||
self:Destroy()
|
||||
else
|
||||
self:Close()
|
||||
win_mode.touchable = true
|
||||
self:Close()
|
||||
win_mode.touchable = true
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -245,7 +245,7 @@ end
|
|||
function BaseWindow.DestroyAll()
|
||||
_destroy_all = true
|
||||
local list = WindowMap
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local win = list[i]
|
||||
win:Destroy()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ function M:init(url)
|
|||
list_playName.onClickItem:Add(function()
|
||||
self.showView.visible = false
|
||||
local index = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
|
||||
local playDetail = view:GetChild(string.format("Label_Detail_%d",index))
|
||||
local playDetail = view:GetChild(string.format("Label_Detail_%d", index))
|
||||
local playView
|
||||
if not playDetail then
|
||||
playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d",index))
|
||||
playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d", index))
|
||||
if playDetail then
|
||||
playView = view:AddChild(playDetail)
|
||||
playView.name = string.format("Label_Detail_%d",index)
|
||||
playView.name = string.format("Label_Detail_%d", index)
|
||||
end
|
||||
end
|
||||
if not playDetail then
|
||||
|
|
@ -74,23 +74,23 @@ function M:init(url)
|
|||
self.showView = view:GetChild(string.format("Label_Detail_%d",
|
||||
PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId))
|
||||
-----------创建玩法----------
|
||||
view:GetChild('btn_Create').onClick:Add(function()
|
||||
self:CreatePlay()
|
||||
end)
|
||||
view:GetChild('btn_Create').onClick:Add(function()
|
||||
self:CreatePlay()
|
||||
end)
|
||||
end
|
||||
|
||||
function M:CreatePlay()
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在创建房间...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在创建房间...")
|
||||
local loddyCtr = ControllerManager.GetController(LoddyController)
|
||||
local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex+1].playeId
|
||||
local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
|
||||
local config = ExtendManager.GetExtendConfig(gameId)
|
||||
print("==============================config")
|
||||
-- print("==============================config")
|
||||
pt(config)
|
||||
local mode = config:GetGameInfo()
|
||||
print("==============================mode")
|
||||
-- print("==============================mode")
|
||||
pt(mode)
|
||||
local _data = mode:SelectedConfigData()
|
||||
print("==============================_data")
|
||||
-- print("==============================_data")
|
||||
pt(_data)
|
||||
-- loddyCtr:CreateRoom(gameId,_data, function (res)
|
||||
-- self:__OnCreateRoomAction(res)
|
||||
|
|
@ -111,7 +111,7 @@ function M:initePlayInfo()
|
|||
local games = DataManager.SelfUser.games
|
||||
for i = 1, #games do
|
||||
if PlayInfo[1].playListInfo[games[i].game_id] then
|
||||
table.insert(PlayInfo[1].playList,PlayInfo[1].playListInfo[games[i].game_id])
|
||||
table.insert(PlayInfo[1].playList, PlayInfo[1].playListInfo[games[i].game_id])
|
||||
end
|
||||
end
|
||||
pt(PlayInfo)
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
|||
list_familyNumber:SetVirtual()
|
||||
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
||||
local members = res.Data.members
|
||||
print("==========================res.Data.members")
|
||||
-- print("==========================res.Data.members")
|
||||
pt(res.Data.members)
|
||||
ViewUtil:CloseModalWait()
|
||||
if res.ReturnCode ~= 0 then
|
||||
|
|
@ -303,7 +303,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
}
|
||||
end
|
||||
local roomList = self._group.rooms
|
||||
print("=========================playList,rooms")
|
||||
-- print("=========================playList,rooms")
|
||||
pt(playList)
|
||||
pt(roomList)
|
||||
local roomCtr = ControllerManager.GetController(RoomController)
|
||||
|
|
@ -405,7 +405,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
end)
|
||||
end
|
||||
local all_num = #playList + #roomList
|
||||
print("=================================================list_room", list_room, list_room.numItems, all_num)
|
||||
-- print("=================================================list_room", list_room, list_room.numItems, all_num)
|
||||
pt(list_room)
|
||||
list_room.numItems = all_num
|
||||
list_gamePlay.numItems = #playList + 1
|
||||
|
|
@ -418,7 +418,7 @@ function M:ConnetFamily(index, groups, isCreate)
|
|||
local list_family = self._view:GetChild('list_family')
|
||||
list_family:SetVirtual()
|
||||
self._group = DataManager.groups:get(groups[index].id)
|
||||
print("===================================self._group")
|
||||
-- print("===================================self._group")
|
||||
pt(self._group)
|
||||
self._roomNum = self._group.room_num
|
||||
|
||||
|
|
@ -533,7 +533,7 @@ function M:OnUpdate()
|
|||
self._group.update_room = false
|
||||
self._fristRoom = true
|
||||
end
|
||||
print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||
-- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
|
||||
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ function M:OnCreateRoom(mode_data)
|
|||
local mode = mode_data.data
|
||||
--点击建房按钮后保存当前游戏的config
|
||||
local _data = mode:SelectedConfigData()
|
||||
--print("OnCreateRoom================")
|
||||
---- print("OnCreateRoom================")
|
||||
--pt(_data)
|
||||
if not _data["stamina"] then _data["stamina"] = 0 end
|
||||
local user_id = DataManager.SelfUser.account_id
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
--进入房间View对象
|
||||
|
||||
|
||||
|
|
@ -9,8 +8,8 @@ local KEY_DEL = "del"
|
|||
local KEY_CLEAR = "reset"
|
||||
|
||||
function JoinRoomView.new()
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "JoinRoomView"
|
||||
self._currenIndex = 0
|
||||
self._close_destroy = true
|
||||
|
|
@ -19,45 +18,45 @@ function JoinRoomView.new()
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
self.tex_num = self._view:GetChild("show_text")
|
||||
self:ClearNumTex()
|
||||
|
||||
for i = 0 , 9 do
|
||||
local obj = self._view:GetChild("btn_num_"..i)
|
||||
obj.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
for i = 0, 9 do
|
||||
local obj = self._view:GetChild("btn_num_" .. i)
|
||||
obj.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
i = i + 1
|
||||
end
|
||||
local btn_reset = self._view:GetChild("btn_reset")
|
||||
btn_reset.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
btn_reset.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
local btn_del = self._view:GetChild("btn_del")
|
||||
btn_del.onClick:Add(handler(self , self.OnNumButtonAction))
|
||||
btn_del.onClick:Add(handler(self, self.OnNumButtonAction))
|
||||
end
|
||||
|
||||
function M:OnNumButtonAction(context)
|
||||
local typer = string.sub(context.sender.name ,5)
|
||||
local typer = string.sub(context.sender.name, 5)
|
||||
printlog("==========================OnNumButtonAction==============================")
|
||||
printlog(typer)
|
||||
if typer == KEY_DEL then
|
||||
if (self._currenIndex > 0) then
|
||||
self._currenIndex = self._currenIndex - 1
|
||||
printlog("==================test=================")
|
||||
print("ok")
|
||||
-- print("ok")
|
||||
printlog(#self._texnum_str)
|
||||
printlog(self._currenIndex)
|
||||
printlog("==================test=================")
|
||||
self._texnum_str = string.sub(self._texnum_str,0,self._currenIndex)
|
||||
self._texnum_str = string.sub(self._texnum_str, 0, self._currenIndex)
|
||||
self.tex_num.text = self._texnum_str
|
||||
end
|
||||
elseif typer == KEY_CLEAR then
|
||||
self:ClearNumTex()
|
||||
self:ClearNumTex()
|
||||
else
|
||||
if (self._currenIndex < 6) then
|
||||
self._currenIndex = self._currenIndex + 1
|
||||
self._texnum_str = self._texnum_str .. string.sub(typer,-1)
|
||||
self._texnum_str = self._texnum_str .. string.sub(typer, -1)
|
||||
self.tex_num.text = self._texnum_str
|
||||
if(self._currenIndex == 6) then
|
||||
if (self._currenIndex == 6) then
|
||||
self:JoinRoom(self._texnum_str)
|
||||
end
|
||||
end
|
||||
|
|
@ -65,19 +64,19 @@ function M:OnNumButtonAction(context)
|
|||
end
|
||||
|
||||
function M:JoinRoom(str)
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在加入房间...")
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在加入房间...")
|
||||
local boddyCtr = ControllerManager.GetController(LoddyController)
|
||||
boddyCtr:JoinRoom(str, function (response)
|
||||
boddyCtr:JoinRoom(str, function(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if response.ReturnCode == -2 then
|
||||
self:JoinRoom(str)
|
||||
return
|
||||
elseif response.ReturnCode ~=0 then
|
||||
ViewUtil.ErrorTip(response.ReturnCode,"进入房间失败")
|
||||
elseif response.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(response.ReturnCode, "进入房间失败")
|
||||
return
|
||||
end
|
||||
self:Destroy()
|
||||
ViewManager.ChangeView(ViewManager.View_Main,DataManager.CurrenRoom.game_id)
|
||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ function M:init(url)
|
|||
local view = self._view
|
||||
local user = self.user;
|
||||
|
||||
print("================phone=====================")
|
||||
-- print("================phone=====================")
|
||||
for k, v in pairs(user) do
|
||||
print(string.format("k:%s|v:%s", k, v))
|
||||
-- print(string.format("k:%s|v:%s", k, v))
|
||||
end
|
||||
|
||||
--show
|
||||
|
|
|
|||
|
|
@ -3,25 +3,25 @@
|
|||
local LobbyShopView = {}
|
||||
|
||||
local M = LobbyShopView
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
|
||||
local SHOP_LIST = {
|
||||
{
|
||||
num=2000,
|
||||
price=300
|
||||
num = 2000,
|
||||
price = 300
|
||||
},
|
||||
{
|
||||
num=1000,
|
||||
price=165
|
||||
num = 1000,
|
||||
price = 165
|
||||
},
|
||||
{
|
||||
num=300,
|
||||
price=50
|
||||
num = 300,
|
||||
price = 50
|
||||
},
|
||||
}
|
||||
|
||||
function LobbyShopView.new(Fct_UpdateDiamo)
|
||||
local self = setmetatable({}, {__index = M})
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'ShopView'
|
||||
self._close_destroy = true
|
||||
self:init('ui://Lobby/Shop')
|
||||
|
|
@ -37,28 +37,25 @@ function M:init(url)
|
|||
|
||||
for i = 1, #SHOP_LIST do
|
||||
local shopChild = UIPackage.CreateObjectFromURL('ui://Lobby/c_shop_child')
|
||||
shopChild:GetChild('num').text = string.format("%s 张",SHOP_LIST[i].num)
|
||||
shopChild:GetChild('num').text = string.format("%s 张", SHOP_LIST[i].num)
|
||||
local shopBuyBtn = shopChild:GetChild('btn_buy')
|
||||
shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s",SHOP_LIST[i].price)
|
||||
shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s", SHOP_LIST[i].price)
|
||||
shopBuyBtn.onClick:Set(function()
|
||||
local index = i;
|
||||
if false then
|
||||
--发送购买给后端
|
||||
--发送购买给后端
|
||||
else
|
||||
--假数据
|
||||
print("===================shop====================")
|
||||
print(SHOP_LIST[index].num)
|
||||
print(DataManager.SelfUser.diamo)
|
||||
-- print("===================shop====================")
|
||||
-- print(SHOP_LIST[index].num)
|
||||
-- print(DataManager.SelfUser.diamo)
|
||||
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num
|
||||
print(DataManager.SelfUser.diamo)
|
||||
-- print(DataManager.SelfUser.diamo)
|
||||
self.UpdateDiamo()
|
||||
end
|
||||
|
||||
end)
|
||||
shopList:AddChild(shopChild)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ local NoticeView = {}
|
|||
local M = NoticeView
|
||||
|
||||
function NoticeView.new(blur_view)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "NoticeView"
|
||||
-- self._blur_view = blur_view
|
||||
self:init("ui://Lobby/pop_notice")
|
||||
|
|
@ -12,7 +12,7 @@ function NoticeView.new(blur_view)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self._close_destroy = true
|
||||
self._close_zone = true
|
||||
end
|
||||
|
|
@ -40,7 +40,6 @@ function M:FillData(data)
|
|||
end
|
||||
list.selectedIndex = 0
|
||||
self:ShowIndex(1)
|
||||
|
||||
end
|
||||
|
||||
function M:ShowIndex(index)
|
||||
|
|
@ -56,9 +55,7 @@ function M:ShowIndex(index)
|
|||
|
||||
-- pic.text = "<img src=\""..notices[index].picture.."\"></img>"
|
||||
-- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>"
|
||||
-- print(pic.text)
|
||||
|
||||
|
||||
-- -- print(pic.text)
|
||||
end
|
||||
|
||||
function M:Destroy(flag)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ local PhonePasswordView = {}
|
|||
local M = PhonePasswordView
|
||||
|
||||
function PhonePasswordView.new(callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PhonePasswordView"
|
||||
self._callback = callback
|
||||
self._close_destroy = true
|
||||
|
|
@ -14,11 +14,11 @@ function PhonePasswordView.new(callback)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self.ctr_update = self._view:GetController("update")
|
||||
if DataManager.SelfUser.password then
|
||||
--self.ctr_update.selectedIndex = 1
|
||||
--print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id)
|
||||
---- print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id)
|
||||
--self._view:GetChild("tex_phone").text = DataManager.SelfUser.account_id--ViewUtil.phone_hide(DataManager.SelfUser.phone)
|
||||
end
|
||||
|
||||
|
|
@ -41,8 +41,8 @@ function M:GetCode()
|
|||
if not phone then
|
||||
return
|
||||
end
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
loddyctr:GetPhoneCode(phone,function( res)
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
loddyctr:GetPhoneCode(phone, function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
self._view:GetController("code").selectedIndex = 1
|
||||
self._left_time = 120
|
||||
|
|
@ -60,10 +60,10 @@ function M:OnUpdate()
|
|||
_left_time = _left_time - deltaTime
|
||||
_left_time = math.max(0, _left_time)
|
||||
local leftTime = math.floor(_left_time)
|
||||
self._view:GetChild("tex_time").text = tostring(leftTime).."后重新发送"
|
||||
self._view:GetChild("tex_time").text = tostring(leftTime) .. "后重新发送"
|
||||
self._left_time = _left_time
|
||||
else
|
||||
self._view:GetController("code").selectedIndex=0
|
||||
self._view:GetController("code").selectedIndex = 0
|
||||
UpdateBeat:Remove(self.OnUpdate, self)
|
||||
end
|
||||
end
|
||||
|
|
@ -75,10 +75,9 @@ end
|
|||
|
||||
--绑定
|
||||
function M:Bind()
|
||||
|
||||
local tex_passwd = self._view:GetChild("tex_passwd")
|
||||
local password = tex_passwd.text
|
||||
if string.len(password) <6 then
|
||||
if string.len(password) < 6 then
|
||||
ViewUtil.ShowTips("请输入5位以上的密码")
|
||||
return
|
||||
end
|
||||
|
|
@ -93,24 +92,23 @@ function M:Bind()
|
|||
-- _data.phone = DataManager.SelfUser.phone
|
||||
-- _data.code = code
|
||||
-- end
|
||||
ViewUtil.ShowModalWait(self._root_view,"正在提交...")
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在提交...")
|
||||
local loddyctr = ControllerManager.GetController(LoddyController)
|
||||
_data.password = password
|
||||
_data.type =3
|
||||
_data.type = 3
|
||||
|
||||
loddyctr:UpdateUserInfo(_data,function( res)
|
||||
loddyctr:UpdateUserInfo(_data, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (res.ReturnCode ==0) then
|
||||
if (res.ReturnCode == 0) then
|
||||
DataManager.SelfUser.password = "123"
|
||||
if self._callback then self._callback() end
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"提交失败")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提交失败")
|
||||
end
|
||||
self:Close()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:CheckInputCode()
|
||||
local code = self._view:GetChild("tex_code").text
|
||||
if not (string.len(code) == 6) then
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ RankView = {}
|
|||
|
||||
local M = RankView
|
||||
|
||||
function RankView.new( main_view,video )
|
||||
function RankView.new(main_view, video)
|
||||
UIPackage.AddPackage("base/rank/ui/Rank")
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "RankView"
|
||||
self._animation = false
|
||||
self._full = true
|
||||
|
|
@ -24,9 +24,8 @@ function RankView.new( main_view,video )
|
|||
return self
|
||||
end
|
||||
|
||||
function M:init( url )
|
||||
|
||||
BaseWindow.init(self,url)
|
||||
function M:init(url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
self._view:GetController("tab").selectedIndex = self._video and 1 or 0
|
||||
self._curren_tex = ""
|
||||
|
|
@ -37,30 +36,27 @@ function M:init( url )
|
|||
for i = 0, 9 do
|
||||
local btn = develop_panel:GetChild("btn_" .. i)
|
||||
btn.onClick:Add(function()
|
||||
|
||||
if self._curren_len < 6 then
|
||||
|
||||
self._curren_tex = self._curren_tex .. i
|
||||
self._curren_len = self._curren_len + 1
|
||||
self.tex_roomid.text = self._curren_tex
|
||||
|
||||
if self._curren_len == 6 then
|
||||
|
||||
ViewUtil.ShowModalWait(self._root_view)
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestRecordList(function (result)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if result == Table_Error_code.ERR_TIMEOUT then
|
||||
self:readData()
|
||||
return
|
||||
end
|
||||
if result == 0 then
|
||||
self:InitRecord1(loddyCtr1.recordList, true)
|
||||
end
|
||||
end, self._curren_tex)
|
||||
loddyCtr1:RequestRecordList(function(result)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if result == Table_Error_code.ERR_TIMEOUT then
|
||||
self:readData()
|
||||
return
|
||||
end
|
||||
if result == 0 then
|
||||
self:InitRecord1(loddyCtr1.recordList, true)
|
||||
end
|
||||
end, self._curren_tex)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
@ -79,8 +75,6 @@ function M:init( url )
|
|||
self._curren_len = 0
|
||||
self.tex_roomid.text = self._curren_tex
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function M:readData()
|
||||
|
|
@ -90,19 +84,18 @@ function M:readData()
|
|||
record_list_1:RemoveChildrenToPool()
|
||||
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestRecordList(function (result)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if result == Table_Error_code.ERR_TIMEOUT then
|
||||
self:readData()
|
||||
return
|
||||
end
|
||||
loddyCtr1:RequestRecordList(function(result)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if result == Table_Error_code.ERR_TIMEOUT then
|
||||
self:readData()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
self:InitRecord1(loddyCtr1.recordList)
|
||||
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:Show()
|
||||
|
|
@ -118,21 +111,18 @@ end
|
|||
|
||||
local load_head_num = 0
|
||||
function M:InitRecord1(recordList, develop_tool)
|
||||
|
||||
--print("InitRecord1=========")
|
||||
---- print("InitRecord1=========")
|
||||
pt(recordList)
|
||||
local main_view = self._view
|
||||
-- 战绩 list
|
||||
local record_list_1, ctr_recored, ctr_no_record
|
||||
if develop_tool then
|
||||
|
||||
ctr_recored = main_view:GetController("developer")
|
||||
ctr_recored.selectedIndex = 1
|
||||
|
||||
record_list_1 = main_view:GetChild("lst_record")
|
||||
local btn_backto_search = main_view:GetChild("btn_backto_search")
|
||||
btn_backto_search.onClick:Set(function()
|
||||
|
||||
ctr_recored.selectedIndex = 0
|
||||
|
||||
self._curren_tex = ""
|
||||
|
|
@ -146,10 +136,9 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
end
|
||||
record_list_1:RemoveChildrenToPool()
|
||||
ctr_no_record.selectedIndex = #recordList == 0 and 1 or 0
|
||||
for i=1, #recordList do
|
||||
|
||||
for i = 1, #recordList do
|
||||
local record_list_item = recordList[i]
|
||||
local total_score_list = record_list_item.TotalScoreList
|
||||
local total_score_list = record_list_item.TotalScoreList
|
||||
local item = record_list_1:AddItemFromPool()
|
||||
|
||||
local player_item_list = item:GetChild("big_round")
|
||||
|
|
@ -165,9 +154,9 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
local game_data = ExtendManager.GetGameData(game_id)
|
||||
local room_type_str = record_list_item.GameInfo.name
|
||||
local room_id_str = record_list_item.RoomId
|
||||
local time =tonumber(record_list_item.Time)
|
||||
local time = tonumber(record_list_item.Time)
|
||||
local room_time_str = os.date("%Y-%m-%d %H:%M", time)
|
||||
local item_score_list = record_list_item.GameTimes
|
||||
local item_score_list = record_list_item.GameTimes
|
||||
local play_back_id = record_list_item.PlayBackId
|
||||
-- 显示 房间号 房间类型 时间
|
||||
item:GetChild("RoomType").asTextField.text = room_type_str
|
||||
|
|
@ -184,22 +173,22 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
-- 显示 每个玩家的 名字和 分数
|
||||
-- player_list 是聊天室数据
|
||||
local player_list = {}
|
||||
for j=1,#total_score_list do
|
||||
for j = 1, #total_score_list do
|
||||
local player_list_item = total_score_list[j]
|
||||
local player_item = player_item_list:AddItemFromPool()
|
||||
player_item:GetChild("n0").text = player_list_item.Name
|
||||
local player_score = player_item:GetChild("n1")
|
||||
local score = player_list_item.Score
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
if score < 0 then
|
||||
player_item:GetController("num_color").selectedIndex = 1
|
||||
else
|
||||
player_item:GetController("num_color").selectedIndex = 0
|
||||
end
|
||||
|
||||
player_score.text = score >= 0 and "+"..score or score
|
||||
player_score.text = score >= 0 and "+" .. score or score
|
||||
player_list[j] = {}
|
||||
player_list[j].id = player_list_item.Id
|
||||
player_list[j].score = score
|
||||
|
|
@ -207,9 +196,9 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
player_list[j].nick = player_list_item.Name
|
||||
end
|
||||
-- 点击事件
|
||||
item.onClick:Add(function ()
|
||||
|
||||
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str,item_score_list, game_id, develop_tool, record_list_item)
|
||||
item.onClick:Add(function()
|
||||
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str, item_score_list, game_id,
|
||||
develop_tool, record_list_item)
|
||||
end)
|
||||
-- 分享
|
||||
item:GetChild("btn_screenshot").onClick:Set(function()
|
||||
|
|
@ -234,20 +223,20 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
end
|
||||
item:GetChild("name").text = p.Name
|
||||
local score = p.Score
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
item:GetChild("score").text = score
|
||||
if score < 0 then item:GetController("di").selectedIndex = 1 end
|
||||
if p.Portrait and p.Portrait ~= "" then
|
||||
ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function( ... )
|
||||
ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function(...)
|
||||
load_head_num = load_head_num - 1
|
||||
end)
|
||||
else
|
||||
load_head_num = load_head_num - 1
|
||||
end
|
||||
end
|
||||
coroutine.start(function ( ... )
|
||||
coroutine.start(function(...)
|
||||
local left_time = 4
|
||||
while (true) do
|
||||
if load_head_num == 0 or left_time == 0 then
|
||||
|
|
@ -266,7 +255,8 @@ function M:InitRecord1(recordList, develop_tool)
|
|||
end)
|
||||
item:GetChild("btn_link").onClick:Set(function()
|
||||
local group_id = record_list_item.group_id and tonumber(record_list_item.group_id) or 0
|
||||
ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id, player_list, self._root_view)
|
||||
ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id,
|
||||
player_list, self._root_view)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -285,7 +275,7 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
local hpType = record_item.GameInfo.hpType
|
||||
|
||||
record_list_2:RemoveChildrenToPool()
|
||||
for i=1,#item_score do
|
||||
for i = 1, #item_score do
|
||||
local item_player_info = item_score[i]
|
||||
local play_back_id = item_player_info.PlayBackId
|
||||
local player_score = item_player_info.PlayerList
|
||||
|
|
@ -307,29 +297,27 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
record_item_2:GetChild("Number").text = tostring(i)
|
||||
|
||||
player_item_list:RemoveChildrenToPool()
|
||||
for j=1,#player_score do
|
||||
|
||||
for j = 1, #player_score do
|
||||
local player_item = player_item_list:AddItemFromPool()
|
||||
player_item:GetChild("n0").text = player_score[j].Name
|
||||
local player_score_text = player_item:GetChild("n1")
|
||||
local score = player_score[j].Score
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
if hpOnOff == 1 and hpType > 1 then
|
||||
score = score / 10
|
||||
end
|
||||
if score < 0 then
|
||||
player_item:GetController("num_color").selectedIndex = 1
|
||||
else
|
||||
player_item:GetController("num_color").selectedIndex = 0
|
||||
end
|
||||
player_score_text.text = score >= 0 and "+"..score or score
|
||||
|
||||
player_score_text.text = score >= 0 and "+" .. score or score
|
||||
end
|
||||
local btn_play_back = record_item_2:GetChild("btn_play_back")
|
||||
btn_play_back.onClick:Set(function()
|
||||
--print("点击进入回放=====")
|
||||
---- print("点击进入回放=====")
|
||||
if DataManager.SelfUser.playback[playback_id] ~= nil and DataManager.SelfUser.playback[playback_id][i] ~= nil then
|
||||
--print("1111111111111111")
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
---- print("1111111111111111")
|
||||
local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
|
||||
DataManager.CurrenRoom = room
|
||||
room.game_id = game_id
|
||||
local extend = ExtendManager.GetExtendConfig(game_id)
|
||||
|
|
@ -343,13 +331,13 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
main._totalRound = #item_score
|
||||
main:FillRoomData(DataManager.SelfUser.playback[playback_id][i])
|
||||
else
|
||||
--print("2222222222222")
|
||||
---- print("2222222222222")
|
||||
ViewUtil.ShowModalWait(self._view)
|
||||
local _data = {}
|
||||
_data["military_id"] = playback_id
|
||||
_data["round"] = tostring(i)
|
||||
local loddyCtr1 = ControllerManager.GetController(LoddyController)
|
||||
loddyCtr1:RequestPlayBack(_data,function(code,data)
|
||||
loddyCtr1:RequestPlayBack(_data, function(code, data)
|
||||
ViewUtil.CloseModalWait()
|
||||
if code == 0 then
|
||||
if DataManager.SelfUser.playback[playback_id] ~= nil then
|
||||
|
|
@ -364,31 +352,30 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
|
|||
main._currentId = playback_id
|
||||
main._currentRound = i
|
||||
main._totalRound = #item_score
|
||||
--print(main)
|
||||
---- print(main)
|
||||
main:FillRoomData(data)
|
||||
elseif code == 25 then
|
||||
ViewUtil.ErrorTip(code, "回放未找到!")
|
||||
btn_play_back.grayed = true
|
||||
end
|
||||
end, record_item.GameInfo)
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M:GenaratePlayBack(id, game_id, ...)
|
||||
local tem =nil
|
||||
local dview_class = nil
|
||||
if not dview_class then
|
||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||
dview_class = exconfig:GetView(id)
|
||||
--print(dview_class)
|
||||
end
|
||||
if not dview_class then
|
||||
return
|
||||
end
|
||||
local arg = {...}
|
||||
local tem = nil
|
||||
local dview_class = nil
|
||||
if not dview_class then
|
||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||
dview_class = exconfig:GetView(id)
|
||||
---- print(dview_class)
|
||||
end
|
||||
if not dview_class then
|
||||
return
|
||||
end
|
||||
local arg = { ... }
|
||||
tem = dview_class.new(...)
|
||||
tem.Id = id
|
||||
tem:Show()
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ local UserEditView = {}
|
|||
local M = UserEditView
|
||||
|
||||
function UserEditView.new(callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "UserEditView"
|
||||
self._callback = callback
|
||||
self._close_destroy = true
|
||||
|
|
@ -18,7 +18,7 @@ function UserEditView.new(callback)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local btn_head = self._view:GetChild("btn_head")
|
||||
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
|
|
@ -32,20 +32,20 @@ function M:init(url)
|
|||
local btn_edit_nick = self._view:GetChild("btn_edit_nick")
|
||||
btn_edit_nick.onClick:Set(function()
|
||||
local edit_nick_view = EditNickView.new(function()
|
||||
tex_nick.text = DataManager.SelfUser.nick_name
|
||||
self._callback()
|
||||
tex_nick.text = DataManager.SelfUser.nick_name
|
||||
self._callback()
|
||||
end)
|
||||
edit_nick_view:Show()
|
||||
end)
|
||||
|
||||
local btn_edit_portrait = self._view:GetChild("btn_edit_portrait")
|
||||
btn_edit_portrait.onClick:Set(function()
|
||||
-- local edit_portrait_view = EditPortraitView.new(function()
|
||||
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
-- --print(DataManager.SelfUser.head_url)
|
||||
-- self._callback()
|
||||
-- end)
|
||||
-- edit_portrait_view:Show()
|
||||
-- local edit_portrait_view = EditPortraitView.new(function()
|
||||
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
-- ---- print(DataManager.SelfUser.head_url)
|
||||
-- self._callback()
|
||||
-- end)
|
||||
-- edit_portrait_view:Show()
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ LobbyView = {}
|
|||
local M = {}
|
||||
|
||||
function LobbyView.new()
|
||||
-- print("new lobbyView!!!!")
|
||||
-- -- print("new lobbyView!!!!")
|
||||
setmetatable(M, { __index = BaseView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "LobbyView"
|
||||
|
|
@ -38,7 +38,7 @@ function LobbyView.new()
|
|||
end
|
||||
|
||||
function M:InitView(url)
|
||||
-- print("init lobbyView!!!!")
|
||||
-- -- print("init lobbyView!!!!")
|
||||
BaseView.InitView(self, url)
|
||||
self._full_offset = false
|
||||
local view = self._view
|
||||
|
|
@ -338,7 +338,7 @@ function M:__show_service()
|
|||
end
|
||||
|
||||
function M:__GetMessage(data)
|
||||
-- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
||||
-- -- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
|
||||
if not data or not data.notice_list then
|
||||
self._mesList = ""
|
||||
else
|
||||
|
|
@ -364,7 +364,7 @@ function M:__PopMsg(index)
|
|||
end
|
||||
|
||||
function M:__moveMsg(index)
|
||||
-- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
-- -- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
if not self._tex_message then return end
|
||||
index, self._tex_message.text = self:__PopMsg(index)
|
||||
self._tex_message.x = self._message.width
|
||||
|
|
@ -392,8 +392,8 @@ end
|
|||
function M:__ShowShare()
|
||||
local pop_share = self._view:GetChild("pop_share")
|
||||
local shareUrl = GetGameInfo("invite_link") .. "?uid=" .. DataManager.SelfUser.account_id
|
||||
--print("shareUrl=================")
|
||||
--print(shareUrl)
|
||||
---- print("shareUrl=================")
|
||||
---- print(shareUrl)
|
||||
local btn_wx_session = pop_share:GetChild("btn_wx_session")
|
||||
btn_wx_session.onClick:Add(function()
|
||||
shareQRCodePicture(shareUrl, 0)
|
||||
|
|
@ -437,7 +437,7 @@ function M:Destroy()
|
|||
end
|
||||
|
||||
function M:Show()
|
||||
--print("on lobbyView show~~~~~~")
|
||||
---- print("on lobbyView show~~~~~~")
|
||||
BaseView.Show(self)
|
||||
ViewUtil.PlaySoundBg()
|
||||
UpdateBeat:Add(self.OnUpdate, self)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function M:init()
|
|||
|
||||
local view = self._view
|
||||
-- view:GetChild("tex_version").text = "Version:" .. GetGameInfoPlatform("version")
|
||||
-- print(GameApplication.Instance.accountTest and 1 or 0)
|
||||
-- -- print(GameApplication.Instance.accountTest and 1 or 0)
|
||||
view:GetController("test").selectedIndex = GameApplication.Instance.accountTest and 1 or 0
|
||||
self.agree = view:GetController("agree");
|
||||
-- Utils.LoadBg("loginbg", view)
|
||||
|
|
@ -70,7 +70,7 @@ function M:init()
|
|||
Utils.SaveLocalFile(key, json.encode(_data))
|
||||
end)
|
||||
if not s then
|
||||
print("Error:" .. e)
|
||||
-- print("Error:" .. e)
|
||||
end
|
||||
|
||||
DataManager.SelfUser.acc = utez
|
||||
|
|
@ -218,7 +218,7 @@ end
|
|||
function M:QuickLogin()
|
||||
if (not GameApplication.Instance.accountTest) then
|
||||
local session_id = PlayerPrefs.GetString("session_id")
|
||||
print("session_id:" .. session_id)
|
||||
-- print("session_id:" .. session_id)
|
||||
if session_id and string.len(session_id) > 3 then
|
||||
ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...")
|
||||
local loginCtr = ControllerManager.GetController(LoginController)
|
||||
|
|
@ -231,8 +231,8 @@ end
|
|||
|
||||
function M:LoginCallBack(result, data)
|
||||
self.isWXCallBackMark = true
|
||||
--print("微信登录返回================================================================")
|
||||
--print("result===>"..result)
|
||||
---- print("微信登录返回================================================================")
|
||||
---- print("result===>"..result)
|
||||
--pt(data)
|
||||
if (not result) or result ~= 0 then
|
||||
if result == 10 then
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ function M:SetTuoGuanState()
|
|||
end
|
||||
|
||||
function M:InitView(url, isHideIpAdds)
|
||||
--print("url===>>>")
|
||||
--print(url)
|
||||
--print(debug.traceback())
|
||||
---- print("url===>>>")
|
||||
---- print(url)
|
||||
---- print(debug.traceback())
|
||||
BaseView.InitView(self, url)
|
||||
--
|
||||
|
||||
|
|
@ -668,7 +668,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.TupGuanOpen,
|
||||
function(...)
|
||||
--print("刷新托管数据=====")
|
||||
---- print("刷新托管数据=====")
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
|
|
@ -802,17 +802,17 @@ function M:OnPlayerReady(...)
|
|||
if p.isSendCardState ~= nil and p.isSendCardState == true then
|
||||
p.isSendCardState = false
|
||||
ControllerManager.IsSendCard = false
|
||||
--print("进入设置计时器控制==========")
|
||||
---- print("进入设置计时器控制==========")
|
||||
coroutine.start(function()
|
||||
--print("计时器倒计时5s=============")
|
||||
---- print("计时器倒计时5s=============")
|
||||
coroutine.wait(5)
|
||||
--print("当前状态==============")
|
||||
--print(ControllerManager.IsSendCard)
|
||||
---- print("当前状态==============")
|
||||
---- print(ControllerManager.IsSendCard)
|
||||
if ControllerManager.IsSendCard == true then
|
||||
--print("以发送开牌======================")
|
||||
---- print("以发送开牌======================")
|
||||
return
|
||||
else
|
||||
--print("开始断线重连")
|
||||
---- print("开始断线重连")
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
end
|
||||
|
|
@ -1097,7 +1097,7 @@ end
|
|||
|
||||
--游戏激活
|
||||
function M:OnApplicationActive()
|
||||
--print("游戏激活================")
|
||||
---- print("游戏激活================")
|
||||
if os.time() - last_pause_time > 15 then
|
||||
last_pause_time = os.time()
|
||||
ControllerManager.WebClient:clearActionQueue()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -8,9 +8,9 @@ local GroupMainView = {}
|
|||
|
||||
local M = GroupMainView
|
||||
|
||||
function GroupMainView.new(main_view, root_view,par_veiw)
|
||||
--print(debug.traceback())
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function GroupMainView.new(main_view, root_view, par_veiw)
|
||||
---- print(debug.traceback())
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'GroupMainView'
|
||||
UIPackage.AddPackage('base/newgroup/ui/NewGroup')
|
||||
self._view = main_view
|
||||
|
|
@ -21,7 +21,7 @@ function GroupMainView.new(main_view, root_view,par_veiw)
|
|||
end
|
||||
|
||||
function M:InitView(url)
|
||||
--print(url)
|
||||
---- print(url)
|
||||
-- BlurView(self._view:GetChild("bg"),true)
|
||||
if DataManager.SelfUser.agent > 0 then
|
||||
self._view:GetController('agent').selectedIndex = 1
|
||||
|
|
@ -37,7 +37,7 @@ function M:InitView(url)
|
|||
cgv:Show()
|
||||
cgv:SetCallback(function(name, pay_type, fg_type)
|
||||
ViewUtil.ShowModalWait(cgv._root_view)
|
||||
fgCtr:FG_CreateGroup(name,pay_type,fg_type,function(res)
|
||||
fgCtr:FG_CreateGroup(name, pay_type, fg_type, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
|
|
@ -53,7 +53,7 @@ function M:InitView(url)
|
|||
end)
|
||||
|
||||
self.btn_joingroup = self._par_veiw:GetChild('btn_join_group')
|
||||
self.btn_joingroup.displayObject.gameObject:SetActive(false)
|
||||
self.btn_joingroup.displayObject.gameObject:SetActive(false)
|
||||
--[[self.btn_joingroup.onClick:Set(function()
|
||||
local groups = DataManager.groups.groupList
|
||||
if #groups == 0 then
|
||||
|
|
@ -131,23 +131,22 @@ end
|
|||
|
||||
function M:DEnterGroup()
|
||||
local groups = DataManager.groups.groupList
|
||||
if #groups == 0 then
|
||||
--local jgv = JoinGroupView.new(self._root_view)
|
||||
--jgv:Show()
|
||||
else
|
||||
local info = GroupInfoView.new(groups[1], self.fg_info)
|
||||
self._groupInfoView = info
|
||||
info:SetCallBack(function()
|
||||
self._groupInfoView = nil
|
||||
self:Show()
|
||||
self._view.visible = true
|
||||
end)
|
||||
--info:Show()
|
||||
--self._view.visible = false
|
||||
end
|
||||
if #groups == 0 then
|
||||
--local jgv = JoinGroupView.new(self._root_view)
|
||||
--jgv:Show()
|
||||
else
|
||||
local info = GroupInfoView.new(groups[1], self.fg_info)
|
||||
self._groupInfoView = info
|
||||
info:SetCallBack(function()
|
||||
self._groupInfoView = nil
|
||||
self:Show()
|
||||
self._view.visible = true
|
||||
end)
|
||||
--info:Show()
|
||||
--self._view.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function SortGroups(a, b)
|
||||
local sort_a = 0
|
||||
local sort_b = 0
|
||||
|
|
@ -157,13 +156,13 @@ local function SortGroups(a, b)
|
|||
return sort_a > sort_b
|
||||
end
|
||||
|
||||
function M:__fill_item(item,group)
|
||||
function M:__fill_item(item, group)
|
||||
item:GetChild('tex_name').text = group.name
|
||||
item:GetChild('tex_id').text = "ID:".. group.id
|
||||
item:GetChild('tex_id').text = "ID:" .. group.id
|
||||
local p_num = group.total_member_num
|
||||
item:GetChild('tex_p_num').text = p_num > 99 and '99+' or p_num
|
||||
|
||||
if group.lev < 3 then
|
||||
if group.lev < 3 then
|
||||
if group.lev == 1 then
|
||||
item:GetChild('tex_room_num').text = group.room_num
|
||||
else
|
||||
|
|
@ -171,7 +170,7 @@ function M:__fill_item(item,group)
|
|||
end
|
||||
else
|
||||
if group.show_num > 0 and group.room_num > group.show_num then
|
||||
item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num--group.show_num
|
||||
item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num --group.show_num
|
||||
else
|
||||
item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num
|
||||
end
|
||||
|
|
@ -192,7 +191,7 @@ function M:FillData()
|
|||
local new_info = {}
|
||||
for i = 1, #groups do
|
||||
local key = tostring(groups[i].id)
|
||||
local key1 = tostring(groups[i].id).."vip"
|
||||
local key1 = tostring(groups[i].id) .. "vip"
|
||||
if not fg_info[key] then
|
||||
new_info[key] = 0
|
||||
if not fg_info_changed then
|
||||
|
|
@ -220,7 +219,7 @@ function M:FillData()
|
|||
else
|
||||
self.btn_joingroup:GetController("info").selectedIndex = 1
|
||||
ctr_empty_group.selectedIndex = 0
|
||||
self:__fill_item(self.btn_joingroup,groups[1])
|
||||
self:__fill_item(self.btn_joingroup, groups[1])
|
||||
end
|
||||
|
||||
local lst_group = self._view:GetChild('lst_group')
|
||||
|
|
@ -230,7 +229,7 @@ function M:FillData()
|
|||
|
||||
local item = lst_group:AddItemFromPool()
|
||||
item.data = group
|
||||
self:__fill_item(item,group)
|
||||
self:__fill_item(item, group)
|
||||
|
||||
local btn_top = item:GetChild('btn_top')
|
||||
local ctr_select = btn_top:GetController('select')
|
||||
|
|
@ -240,7 +239,7 @@ function M:FillData()
|
|||
context:StopPropagation()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
ViewUtil.ShowModalWait(self._root_view)
|
||||
fgCtr:FG_TopGroup(group.id,ctr_select.selectedIndex == 0,function(res)
|
||||
fgCtr:FG_TopGroup(group.id, ctr_select.selectedIndex == 0, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
|
|
@ -274,7 +273,7 @@ function M:EnterGroup(fg_id)
|
|||
--self._view.visible = false
|
||||
end
|
||||
|
||||
function M:Show(fg_id,callback)
|
||||
function M:Show(fg_id, callback)
|
||||
local fgCtr1 = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr1:FG_GroupList(function(res)
|
||||
if self._is_destroy then
|
||||
|
|
@ -284,17 +283,16 @@ function M:Show(fg_id,callback)
|
|||
self:FillData()
|
||||
if fg_id then
|
||||
self:EnterGroup(fg_id)
|
||||
else
|
||||
if callback then
|
||||
callback(0)
|
||||
end
|
||||
else
|
||||
if callback then
|
||||
callback(0)
|
||||
end
|
||||
end
|
||||
else
|
||||
if callback then
|
||||
callback(-1)
|
||||
end
|
||||
else
|
||||
if callback then
|
||||
callback(-1)
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ local GroupManagerView = {}
|
|||
local M = GroupManagerView
|
||||
|
||||
function GroupManagerView.new(blur_view, gid, btn_type, callback)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupManagerView"
|
||||
-- self._close_destroy = true
|
||||
self._put_map = false
|
||||
|
|
@ -25,8 +25,8 @@ end
|
|||
|
||||
-- 获取界面配置
|
||||
local function getPageConfig(id)
|
||||
--pt(MngPageConfig.PageList)
|
||||
for i=1,#MngPageConfig.PageList do
|
||||
--pt(MngPageConfig.PageList)
|
||||
for i = 1, #MngPageConfig.PageList do
|
||||
local tem = MngPageConfig.PageList[i]
|
||||
if tem.id == id then
|
||||
return tem
|
||||
|
|
@ -35,7 +35,7 @@ local function getPageConfig(id)
|
|||
end
|
||||
|
||||
function M:init(url, btn_type)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
self.titleTxt = self._view:GetChild("n79")
|
||||
-- if btn_type == 2 then
|
||||
-- self._view:GetChild("n0"):GetChild("icon").url = "ui://m7iejg46p41ohx8"
|
||||
|
|
@ -57,7 +57,7 @@ function M:init(url, btn_type)
|
|||
|
||||
-- 初始化标题列表
|
||||
for i = 1, #self.page_config do
|
||||
-- print("page_config:"..self.page_config[i])
|
||||
-- -- print("page_config:"..self.page_config[i])
|
||||
local page = getPageConfig(self.page_config[i])
|
||||
--如果界面无show_key,或圈子中对应的key为true才显示界面
|
||||
if not page.show_key or (page.show_key and group[page.show_key]) then
|
||||
|
|
@ -91,7 +91,7 @@ function M:init(url, btn_type)
|
|||
-- gmsv._view.x = offset
|
||||
|
||||
-- end)
|
||||
-- 所有子界面加载点
|
||||
-- 所有子界面加载点
|
||||
local anchor = self._view:GetChild("anchor")
|
||||
-- 初始界面
|
||||
local first_page_config = getPageConfig(self.page_config[1])
|
||||
|
|
@ -104,8 +104,8 @@ function M:init(url, btn_type)
|
|||
--gmsv._view:AddRelation(anchor, RelationType.Size)
|
||||
local offset = get_offset(self._full_offset)
|
||||
gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset
|
||||
gmsv._view.height = GRoot.inst.height
|
||||
gmsv._view.x = 0--offset
|
||||
gmsv._view.height = GRoot.inst.height
|
||||
gmsv._view.x = 0 --offset
|
||||
|
||||
-- first_page_config = getPageConfig(self.page_config[2])
|
||||
-- gmsv = first_page_config.view.new(self.group_id, self._root_view)
|
||||
|
|
@ -138,28 +138,27 @@ function M:init(url, btn_type)
|
|||
local index = self.ctr_index.selectedIndex
|
||||
local page_info = getPageConfig(self.page_config[index + 1])
|
||||
if not self._view_map[index + 1] then
|
||||
|
||||
local tem = page_info.view.new(self.group_id, self._root_view)
|
||||
|
||||
-- anchor:AddRelation(self._root_view, RelationType.Size,true)
|
||||
--tem._view:Center(true)
|
||||
-- anchor:AddRelation(self._root_view, RelationType.Size,true)
|
||||
--tem._view:Center(true)
|
||||
|
||||
--print("222222222222222",anchor._view)
|
||||
anchor:AddChild(tem._view)
|
||||
---- print("222222222222222",anchor._view)
|
||||
anchor:AddChild(tem._view)
|
||||
-- tem._view.parent = anchor
|
||||
|
||||
local offset = get_offset(self._full_offset)
|
||||
tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset
|
||||
tem._view.height = GRoot.inst.height
|
||||
tem._view.x = 0--offset
|
||||
tem._view.height = GRoot.inst.height
|
||||
tem._view.x = 0 --offset
|
||||
--tem._view:AddRelation(self._root_view, RelationType.Size)
|
||||
-- tem._view:MakeFullScreen()
|
||||
|
||||
tem.id = page_info.id
|
||||
self._view_map[index + 1] = tem
|
||||
--
|
||||
-- anchor:SetBoundsChangedFlag()
|
||||
-- anchor:EnsureBoundsCorrect()
|
||||
-- anchor:SetBoundsChangedFlag()
|
||||
-- anchor:EnsureBoundsCorrect()
|
||||
-- tem._view:RemoveRelation(anchor, RelationType.Size)
|
||||
--tem._view:AddRelation(anchor, RelationType.Size)
|
||||
else
|
||||
|
|
@ -176,12 +175,10 @@ function M:init(url, btn_type)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack)
|
||||
self.groupInfoViewCallBack=groupInfoViewCallBack
|
||||
self.groupInfoViewCallBack = groupInfoViewCallBack
|
||||
end
|
||||
|
||||
|
||||
-- 获取指定ID的页面
|
||||
function M:GetPageByID(id)
|
||||
for i, v in pairs(self._view_map) do
|
||||
|
|
@ -221,7 +218,7 @@ end
|
|||
-- quick_access_id 是快速访问标志,打开对应id的页面
|
||||
function M:Show(quick_access_id)
|
||||
local index = self.ctr_index.selectedIndex
|
||||
printlog("index+1index+1index+1index+1 ",index+1)
|
||||
printlog("index+1index+1index+1index+1 ", index + 1)
|
||||
if not quick_access_id then
|
||||
local page_info = getPageConfig(self.page_config[index + 1])
|
||||
if page_info.refresh then self._view_map[index + 1]:initData() end
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ function M:FillFagData()
|
|||
|
||||
local tex_name = self._view:GetChild("tex_name")
|
||||
local name = tex_name.text
|
||||
print("jefe:")
|
||||
-- print("jefe:")
|
||||
pt(self.hpData)
|
||||
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
|
|
@ -469,7 +469,7 @@ function M:FillFagData()
|
|||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
--print("======新增玩法=============")
|
||||
---- print("======新增玩法=============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local play = {}
|
||||
|
|
@ -510,7 +510,7 @@ function M:FillFagData()
|
|||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
--print("======修改玩法=============")
|
||||
---- print("======修改玩法=============")
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local play = {}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ local GroupMemberFagLogView = {}
|
|||
local M = GroupMemberFagLogView
|
||||
|
||||
function GroupMemberFagLogView.new(group_id, member, not_manager)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupMemberFagLogView"
|
||||
self._close_destroy = true
|
||||
-- self._blur_view = blur_view
|
||||
|
|
@ -15,7 +15,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
|
|||
self._full = true
|
||||
self._animation = false
|
||||
self.group_id = group_id
|
||||
self.hp_log = {}
|
||||
self.hp_log = {}
|
||||
self.daily_count = {}
|
||||
self.not_manager = not_manager
|
||||
self._full = true
|
||||
|
|
@ -25,7 +25,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local btn_close = self._view:GetChild("btn_close")
|
||||
btn_close.onClick:Set(function()
|
||||
|
|
@ -33,26 +33,25 @@ function M:init(url)
|
|||
end)
|
||||
|
||||
for i = 1, 8 do
|
||||
local tem = math.pow(2, i - 1)
|
||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||
if btn_filter then
|
||||
btn_filter.onClick:Set(function()
|
||||
self.hp_log = {}
|
||||
local tem = math.pow(2, i - 1)
|
||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||
if btn_filter then
|
||||
btn_filter.onClick:Set(function()
|
||||
self.hp_log = {}
|
||||
self.m_index = 0
|
||||
self.lst_fag.numItems = 0
|
||||
self:GetData(0)
|
||||
end)
|
||||
end
|
||||
self.lst_fag.numItems = 0
|
||||
self:GetData(0)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
self.lst_fag = self._view:GetChild("lst_fag")
|
||||
self.lst_fag:SetVirtual()
|
||||
self.lst_fag.itemRenderer = function(index, obj)
|
||||
self:OnRenderItem(index, obj)
|
||||
self:OnRenderItem(index, obj)
|
||||
end
|
||||
self.lst_fag.scrollPane.onPullUpRelease:Set(function()
|
||||
self:GetData(self.lst_fag.numItems+self.m_index)
|
||||
|
||||
self:GetData(self.lst_fag.numItems + self.m_index)
|
||||
end)
|
||||
if not self.not_manager then
|
||||
self._view:GetController("manager").selectedIndex = 1
|
||||
|
|
@ -75,7 +74,8 @@ function M:init(url)
|
|||
end
|
||||
end)
|
||||
|
||||
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"), -308, 0)
|
||||
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"),
|
||||
-308, 0)
|
||||
self.begin_time, self.end_time = self.time_panel:GetDate()
|
||||
|
||||
self._view:GetChild("btn_search").onClick:Set(function()
|
||||
|
|
@ -90,21 +90,21 @@ end
|
|||
|
||||
-- 获取过滤值,根据多选框计算
|
||||
function M:GetFilter()
|
||||
local filter = 0
|
||||
local filter = 0
|
||||
for i = 1, 8 do
|
||||
local tem = math.pow(2, i - 1)
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||
if btn_filter and btn_filter.selected then
|
||||
filter = filter + tem
|
||||
end
|
||||
local tem = math.pow(2, i - 1)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
|
||||
local btn_filter = self._view:GetChild("btn_filter" .. tem)
|
||||
if btn_filter and btn_filter.selected then
|
||||
filter = filter + tem
|
||||
end
|
||||
end
|
||||
return filter
|
||||
end
|
||||
|
||||
-- 显示原因文本
|
||||
local function __getReason(data)
|
||||
-- return "玩家操作"
|
||||
-- return "玩家操作"
|
||||
local s_nick = string.utf8sub(data.m_nick, 6)
|
||||
if data.reason == 6 then
|
||||
return data.info
|
||||
|
|
@ -121,7 +121,7 @@ local function __getReason(data)
|
|||
return string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作减少")
|
||||
-- return "每日提取"
|
||||
elseif data.reason == 12 then
|
||||
return "推广奖励"
|
||||
return "推广奖励"
|
||||
elseif data.reason == 13 then
|
||||
if data.hp < 0 then
|
||||
return string.format("转账给 [color=#FF6600]%s(%s)[/color]", s_nick, data.mgr_id)
|
||||
|
|
@ -146,56 +146,57 @@ end
|
|||
|
||||
-- 获取体力值详情数据
|
||||
function M:GetData(index)
|
||||
local filter = self:GetFilter()
|
||||
if filter == 0 then return end
|
||||
ViewUtil.ShowModalWait()
|
||||
local filter = self:GetFilter()
|
||||
if filter == 0 then return end
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time, function(res)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取积分详情失败")
|
||||
else
|
||||
local data = res.Data.hp_logs
|
||||
if #data == 0 then return end
|
||||
-- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
-- pt(data)
|
||||
-- pt(self.member)
|
||||
for i = 1, #data do
|
||||
self.hp_log[#self.hp_log + 1] = data[i]
|
||||
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time,
|
||||
function(res)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
--self:GuoLv(data)
|
||||
ViewUtil.CloseModalWait()
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取积分详情失败")
|
||||
else
|
||||
local data = res.Data.hp_logs
|
||||
if #data == 0 then return end
|
||||
-- -- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
-- pt(data)
|
||||
-- pt(self.member)
|
||||
for i = 1, #data do
|
||||
self.hp_log[#self.hp_log + 1] = data[i]
|
||||
end
|
||||
--self:GuoLv(data)
|
||||
|
||||
self.lst_fag.numItems = #self.hp_log
|
||||
end
|
||||
end)
|
||||
self.lst_fag.numItems = #self.hp_log
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function M:GuoLv(data)
|
||||
if self.member.lev == 1 then
|
||||
if self.member.lev == 1 then
|
||||
local m_data_other = {}
|
||||
local m_data_my = {}
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
if self.member.uid ~= data[i].mgr_id then
|
||||
table.insert(m_data_other,data[i])
|
||||
table.insert(m_data_other, data[i])
|
||||
else
|
||||
table.insert(m_data_my,data[i])
|
||||
table.insert(m_data_my, data[i])
|
||||
end
|
||||
end
|
||||
-- printlog("比较计算=========m_data_my>>>",#m_data_my)
|
||||
-- printlog("比较计算=========m_data_other>>>",#m_data_other)
|
||||
|
||||
|
||||
if #m_data_my>0 and #m_data_other==0 then
|
||||
if #m_data_my > 0 and #m_data_other == 0 then
|
||||
for i = 1, #m_data_my do
|
||||
self.hp_log[#self.hp_log + 1] = m_data_my[i]
|
||||
self.hp_log[#self.hp_log + 1] = m_data_my[i]
|
||||
end
|
||||
self.m_index = #data - #m_data_my + self.m_index
|
||||
else
|
||||
for i = 1, #m_data_other do
|
||||
self.hp_log[#self.hp_log + 1] = m_data_other[i]
|
||||
self.hp_log[#self.hp_log + 1] = m_data_other[i]
|
||||
end
|
||||
self.m_index = #data - #m_data_other + self.m_index
|
||||
end
|
||||
|
|
@ -203,9 +204,9 @@ function M:GuoLv(data)
|
|||
local m_data_other = {}
|
||||
local m_data_my = {}
|
||||
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
if self.member.uid ~= data[i].mgr_id then
|
||||
table.insert(m_data_other,data[i])
|
||||
table.insert(m_data_other, data[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -217,13 +218,12 @@ function M:GuoLv(data)
|
|||
end
|
||||
self.m_index = #data - #m_data_other + self.m_index
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function fillItem(data, obj)
|
||||
local num = d2ad(data.hp)
|
||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
|
||||
obj:GetChild("tex_reason").text = __getReason(data)
|
||||
end
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ function M:OnRenderItem(index, obj)
|
|||
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
|
||||
obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
|
||||
obj:GetChild("tex_reason").text = __getReason(data)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time)
|
||||
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
|
||||
local btn_head = obj:GetChild("btn_head")
|
||||
btn_head.icon = "ui://Common/Head0"
|
||||
ImageLoad.Load(self.member.portrait, btn_head._iconObject)
|
||||
|
|
@ -261,7 +261,7 @@ function M:OnRenderItem(index, obj)
|
|||
local item = lst:AddItemFromPool()
|
||||
fillItem(data.detail[i], item)
|
||||
end
|
||||
obj.height =95 * (#data.detail+1)
|
||||
obj.height = 95 * (#data.detail + 1)
|
||||
self.lst_fag:RefreshVirtualList()
|
||||
self.lst_fag:ScrollToView(index)
|
||||
else
|
||||
|
|
@ -281,7 +281,7 @@ function M:OnRenderItem(index, obj)
|
|||
local item = lst:AddItemFromPool()
|
||||
fillItem(data.detail[i], item)
|
||||
end
|
||||
obj.height =95 * (#data.detail+1)
|
||||
obj.height = 95 * (#data.detail + 1)
|
||||
self.lst_fag:RefreshVirtualList()
|
||||
self.lst_fag:ScrollToView(index)
|
||||
end
|
||||
|
|
@ -311,7 +311,7 @@ end
|
|||
-- 填充日统计对象
|
||||
function M:OnRenderDailyItem(index, obj)
|
||||
local data = self.daily_count[#self.daily_count - index]
|
||||
obj:GetChild("tex_date").text = os.date("%Y-%m-%d",data.time)
|
||||
obj:GetChild("tex_date").text = os.date("%Y-%m-%d", data.time)
|
||||
local num = d2ad(data.num)
|
||||
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupSetPermissionView = import(".GroupSetPermissionView")
|
|||
local GroupBanSameTableView = import(".GroupBanSameTableView")
|
||||
local MngPermission = import(".MngPermission")
|
||||
local GroupSetTagView = import("../GroupSetTagView")
|
||||
local GroupSetMemberInfoDiaoduView=import('.GroupSetMemberInfoDiaoduView')
|
||||
local GroupSetMemberInfoDiaoduView = import('.GroupSetMemberInfoDiaoduView')
|
||||
local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView")
|
||||
|
||||
-- 牌友圈成员体力值记录
|
||||
|
|
@ -12,14 +12,14 @@ local GroupMemberOperateView = {}
|
|||
|
||||
local M = GroupMemberOperateView
|
||||
|
||||
function GroupMemberOperateView.new(group_id, member, callBack,callBack1)
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
function GroupMemberOperateView.new(group_id, member, callBack, callBack1)
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "GroupMemberOperateView"
|
||||
self._close_destroy = true
|
||||
-- self._blur_view = blur_view
|
||||
--print("GroupMemberOperateView==============")
|
||||
--pt(member)
|
||||
---- print("GroupMemberOperateView==============")
|
||||
--pt(member)
|
||||
self.member = member
|
||||
self.group_id = group_id
|
||||
self.callBack = callBack
|
||||
|
|
@ -30,11 +30,11 @@ end
|
|||
|
||||
-- 管理员权限
|
||||
local MngPermissionList = {
|
||||
DeleteMember = 1,-- 删除成员
|
||||
AddMember = 2,--添加成员
|
||||
SetFag = 3,--设置体力值
|
||||
BanPlaying = 4,--禁止游戏
|
||||
BanSameTable = 5--禁止同桌
|
||||
DeleteMember = 1, -- 删除成员
|
||||
AddMember = 2, --添加成员
|
||||
SetFag = 3, --设置体力值
|
||||
BanPlaying = 4, --禁止游戏
|
||||
BanSameTable = 5 --禁止同桌
|
||||
}
|
||||
|
||||
local function CheckPermission(lev, permission)
|
||||
|
|
@ -46,13 +46,13 @@ local function CheckPermission(lev, permission)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
BaseWindow.init(self,url)
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local member = self.member
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
--print("DataManager.groups:get(self.group_id)")
|
||||
--pt(group)
|
||||
local perm_array = MngPermission.getPermData(group.permission)
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
---- print("DataManager.groups:get(self.group_id)")
|
||||
--pt(group)
|
||||
local perm_array = MngPermission.getPermData(group.permission)
|
||||
|
||||
local btn_close = self._view:GetChild("btn_close")
|
||||
btn_close.onClick:Set(function()
|
||||
|
|
@ -105,7 +105,6 @@ function M:init(url)
|
|||
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
self._view:GetChild("btn_deploy").onClick:Set(function()
|
||||
|
||||
local gniv = GroupNumberInputView.new(nil, function(num)
|
||||
ViewUtil.ShowModalWait()
|
||||
local parent_id = tonumber(num)
|
||||
|
|
@ -128,7 +127,7 @@ function M:init(url)
|
|||
ctr_superior.selectedIndex = 1
|
||||
ViewUtil.ShowBannerOnScreenCenter("调配玩家成功")
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"调配玩家失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "调配玩家失败")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -138,14 +137,14 @@ function M:init(url)
|
|||
end)
|
||||
local vipbtn = self._view:GetChild("btn_vip")
|
||||
if vipbtn ~= nil then
|
||||
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id ) then
|
||||
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id) then
|
||||
vipbtn.visible = true
|
||||
vipbtn.selected = member.isvip == 1 and true or false
|
||||
vipbtn.onClick:Set(function()
|
||||
local selected = vipbtn.selected and 1 or 0
|
||||
fgCtr:FG_GroupSetVip(self.group_id, member.uid, selected, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
|
|
@ -153,7 +152,7 @@ function M:init(url)
|
|||
self.callBack()
|
||||
else
|
||||
vipbtn.selected = not vipbtn.selected
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置vip失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置vip失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -162,12 +161,12 @@ function M:init(url)
|
|||
end
|
||||
end
|
||||
|
||||
-- 管理功能列表
|
||||
-- 管理功能列表
|
||||
local lst_mng = self._view:GetChild("lst_mng")
|
||||
lst_mng:RemoveChildrenToPool()
|
||||
-- 删除按钮
|
||||
local option = group.option or 0
|
||||
if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option,1) == 1) or group.lev < member.lev then
|
||||
if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option, 1) == 1) or group.lev < member.lev then
|
||||
local btn_del = lst_mng:AddItemFromPool()
|
||||
btn_del.icon = "ui://NewGroup/mng_del"
|
||||
btn_del.onClick:Set(function()
|
||||
|
|
@ -179,7 +178,7 @@ function M:init(url)
|
|||
ViewUtil.ShowModalWait()
|
||||
fgCtr:FG_GroupRemoveMember(self.group_id, member.uid, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
|
|
@ -187,22 +186,21 @@ function M:init(url)
|
|||
ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家")
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"删除成员失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "删除成员失败")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
_curren_msg:Show()
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
-- 禁止游戏
|
||||
--
|
||||
if (group.lev < member.lev) or (group.lev == 3 and group.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 group.lev == 1 and member.lev > 1 and member.partnerLev >0 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
local btn_ban = lst_mng:AddItemFromPool()
|
||||
local pic = member.ban == 1 and "mng_del_ban" or "mng_ban"
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
btn_ban.onClick:Set(function()
|
||||
if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then
|
||||
return
|
||||
|
|
@ -215,16 +213,16 @@ function M:init(url)
|
|||
local val = 1 - member.ban
|
||||
fgCtr:FG_BanMember(self.group_id, member.uid, val, 1, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
member.ban = val
|
||||
pic = member.ban == 1 and "mng_del_ban" or "mng_ban"
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
self.callBack()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"禁止娱乐失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "禁止娱乐失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -232,44 +230,44 @@ function M:init(url)
|
|||
end)
|
||||
end
|
||||
|
||||
--print("group.type=====================")
|
||||
--print(group.type)
|
||||
--pt(group)
|
||||
---- print("group.type=====================")
|
||||
---- print(group.type)
|
||||
--pt(group)
|
||||
if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
local btn_ban = lst_mng:AddItemFromPool()
|
||||
local pic = member.group_ban == 1 and "mng_del_ban_group" or "mng_ban_group"
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
--printlog("jefe member.partnerLev",member.partnerLev)
|
||||
--if member.partnerLev==1 then
|
||||
btn_ban.onClick:Set(function()
|
||||
-- if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then
|
||||
-- return
|
||||
-- end
|
||||
btn_ban.onClick:Set(function()
|
||||
-- if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
|
||||
local str = member.group_ban == 1 and "确定恢复该合伙人整组娱乐吗?" or "确定禁止该合伙人整组娱乐吗?"
|
||||
local _curren_msg = MsgWindow.new(nil, str, MsgWindow.MsgMode.OkAndCancel)
|
||||
_curren_msg.onOk:Add(function()
|
||||
ViewUtil.ShowModalWait()
|
||||
local val = member.group_ban == 1 and 0 or 1
|
||||
fgCtr:FG_BanMember(self.group_id, member.uid, val, 2, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
member.group_ban = val
|
||||
pic = member.group_ban == 1 and "mng_del_ban_group" or "mng_ban_group"
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
self.callBack()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
||||
end
|
||||
end)
|
||||
local str = member.group_ban == 1 and "确定恢复该合伙人整组娱乐吗?" or "确定禁止该合伙人整组娱乐吗?"
|
||||
local _curren_msg = MsgWindow.new(nil, str, MsgWindow.MsgMode.OkAndCancel)
|
||||
_curren_msg.onOk:Add(function()
|
||||
ViewUtil.ShowModalWait()
|
||||
local val = member.group_ban == 1 and 0 or 1
|
||||
fgCtr:FG_BanMember(self.group_id, member.uid, val, 2, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
member.group_ban = val
|
||||
pic = member.group_ban == 1 and "mng_del_ban_group" or "mng_ban_group"
|
||||
btn_ban.icon = "ui://NewGroup/" .. pic
|
||||
self.callBack()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
|
||||
end
|
||||
end)
|
||||
_curren_msg:Show()
|
||||
end)
|
||||
-- end
|
||||
_curren_msg:Show()
|
||||
end)
|
||||
-- end
|
||||
end
|
||||
-- 禁止同桌
|
||||
if group.lev < 3 then
|
||||
|
|
@ -286,35 +284,32 @@ function M:init(url)
|
|||
local btv = GroupBanSameTableView.new(self.blur_view, self.group_id, member.uid, res.Data)
|
||||
btv:Show()
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"获取禁止同桌列表失败!")
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取禁止同桌列表失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
if group.lev == 1 and member.lev > 1 and member.partnerLev >0 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
--if false then
|
||||
if group.lev == 1 and member.lev > 1 and member.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id then
|
||||
--if false then
|
||||
local btn_set_mng = lst_mng:AddItemFromPool()
|
||||
btn_set_mng.icon = "ui://NewGroup/zhengzu"
|
||||
btn_set_mng.onClick:Set(
|
||||
function()
|
||||
ViewUtil.ShowModalWait()
|
||||
fgCtr:FG_GetBanMemberHB(self.group_id, member.uid, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local diaoduView=GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
||||
diaoduView:SetCurrentState(res.Data.group_black+1,res.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode,"获取整组调度失败!")
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
btn_set_mng.icon = "ui://NewGroup/zhengzu"
|
||||
btn_set_mng.onClick:Set(
|
||||
function()
|
||||
ViewUtil.ShowModalWait()
|
||||
fgCtr:FG_GetBanMemberHB(self.group_id, member.uid, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
--pt(res)
|
||||
if res.ReturnCode == 0 then
|
||||
local diaoduView = GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
|
||||
diaoduView:SetCurrentState(res.Data.group_black + 1, res.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "获取整组调度失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -331,7 +326,7 @@ function M:init(url)
|
|||
local val = 4 - member.lev
|
||||
fgCtr:FG_SetManager(self.group_id, member.uid, val, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
|
|
@ -344,7 +339,7 @@ function M:init(url)
|
|||
end
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置副群主失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置副群主失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -354,7 +349,7 @@ function M:init(url)
|
|||
|
||||
|
||||
if ((group.lev < 3 and member.parentId == 0) or (group.type == 2 and member.parentId == DataManager.SelfUser.account_id)) and member.partnerLev == 0 and member.lev == 3 then
|
||||
local btn_set_partner = lst_mng:AddItemFromPool()
|
||||
local btn_set_partner = lst_mng:AddItemFromPool()
|
||||
local pic = member.partnerLev == 0 and "mng_set_partner" or "mng_del_partner"
|
||||
btn_set_partner.icon = "ui://NewGroup/" .. pic
|
||||
btn_set_partner.onClick:Set(function()
|
||||
|
|
@ -365,7 +360,7 @@ function M:init(url)
|
|||
local val = member.partnerLev > 0 and 2 or 1
|
||||
fgCtr:FG_SetPartner(self.group_id, member.uid, val, function(res1)
|
||||
if self._is_destroy then
|
||||
return
|
||||
return
|
||||
end
|
||||
ViewUtil.CloseModalWait()
|
||||
if res1.ReturnCode == 0 then
|
||||
|
|
@ -376,7 +371,7 @@ function M:init(url)
|
|||
|
||||
self:Destroy()
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"设置合伙人失败失败!")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "设置合伙人失败失败!")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
@ -384,7 +379,7 @@ function M:init(url)
|
|||
end)
|
||||
end
|
||||
|
||||
if ((group.lev < 3 and member.parentId == 0) or (group.type == 2 and member.parentId == DataManager.SelfUser.account_id)) and member.partnerLev == 0 and member.lev == 2 then
|
||||
if ((group.lev < 3 and member.parentId == 0) or (group.type == 2 and member.parentId == DataManager.SelfUser.account_id)) and member.partnerLev == 0 and member.lev == 2 then
|
||||
local btn_set_permission = lst_mng:AddItemFromPool()
|
||||
btn_set_permission.icon = "ui://NewGroup/mng_set_permission"
|
||||
btn_set_permission.onClick:Set(function()
|
||||
|
|
@ -405,35 +400,35 @@ function M:init(url)
|
|||
btn_move.icon = "ui://NewGroup/mng_move"
|
||||
btn_move.onClick:Set(function()
|
||||
local gniv = GroupNumberInputView.new(nil, function(num)
|
||||
local parent_id = tonumber(num)
|
||||
if parent_id == member.parentId then
|
||||
ViewUtil.ErrorTip(nil, "已经在该合伙人名下")
|
||||
return
|
||||
elseif parent_id == member.id then
|
||||
ViewUtil.ErrorTip(nil, "目标的上级不能是自己")
|
||||
return
|
||||
elseif parent_id == DataManager.SelfUser.account_id then
|
||||
self:MovePartner(parent_id, member, self._view)
|
||||
return
|
||||
end
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_FindMember(self.group_id, parent_id, function(res)
|
||||
if self._is_destroy then
|
||||
local parent_id = tonumber(num)
|
||||
if parent_id == member.parentId then
|
||||
ViewUtil.ErrorTip(nil, "已经在该合伙人名下")
|
||||
return
|
||||
elseif parent_id == member.id then
|
||||
ViewUtil.ErrorTip(nil, "目标的上级不能是自己")
|
||||
return
|
||||
elseif parent_id == DataManager.SelfUser.account_id then
|
||||
self:MovePartner(parent_id, member, self._view)
|
||||
return
|
||||
end
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.CloseModalWait()
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "找不到成员")
|
||||
elseif res.Data.partnerLev == 0 then
|
||||
ViewUtil.CloseModalWait()
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "目标不是合伙人")
|
||||
else
|
||||
self:MovePartner(parent_id, member, self._view)
|
||||
end
|
||||
end)
|
||||
end, 0, nil, "ui://NewGroup/Win_AddFriend")
|
||||
gniv:Show()
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_FindMember(self.group_id, parent_id, function(res)
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.CloseModalWait()
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "找不到成员")
|
||||
elseif res.Data.partnerLev == 0 then
|
||||
ViewUtil.CloseModalWait()
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "目标不是合伙人")
|
||||
else
|
||||
self:MovePartner(parent_id, member, self._view)
|
||||
end
|
||||
end)
|
||||
end, 0, nil, "ui://NewGroup/Win_AddFriend")
|
||||
gniv:Show()
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -454,7 +449,7 @@ function M:init(url)
|
|||
local btn_banplays = lst_mng:AddItemFromPool()
|
||||
btn_banplays.icon = "ui://NewGroup/mng_ban_plays"
|
||||
btn_banplays.onClick:Set(function()
|
||||
local banplays = GroupPartnerBanPlaysView.new(self.group_id,member.uid)
|
||||
local banplays = GroupPartnerBanPlaysView.new(self.group_id, member.uid)
|
||||
banplays:Show()
|
||||
end)
|
||||
end
|
||||
|
|
@ -463,26 +458,26 @@ function M:init(url)
|
|||
local btn_qiangzhi = lst_mng:AddItemFromPool()
|
||||
btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi"
|
||||
btn_qiangzhi.onClick:Set(function()
|
||||
local msg_tip = MsgWindow.new(self._root_view,"确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
||||
msg_tip.onOk:Add(function( ... )
|
||||
local msg_tip = MsgWindow.new(self._root_view, "确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
|
||||
msg_tip.onOk:Add(function(...)
|
||||
ViewUtil.ShowModalWait()
|
||||
fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res)
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
ViewUtil.CloseModalWait()
|
||||
if self._is_destroy then
|
||||
return
|
||||
end
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提取失败")
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提取成功")
|
||||
self:Destroy()
|
||||
if self.callBack1 then
|
||||
self.callBack1()
|
||||
end
|
||||
if res.ReturnCode ~= 0 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提取失败")
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "提取成功")
|
||||
self:Destroy()
|
||||
if self.callBack1 then
|
||||
self.callBack1()
|
||||
end
|
||||
end
|
||||
end)
|
||||
msg_tip:Close()
|
||||
end
|
||||
end)
|
||||
msg_tip:Close()
|
||||
end)
|
||||
msg_tip:Show()
|
||||
end)
|
||||
end
|
||||
|
|
@ -499,10 +494,9 @@ function M:MovePartner(parent_id, member, obj)
|
|||
obj:GetController("show_superior").selectedIndex = 1
|
||||
ViewUtil.ShowBannerOnScreenCenter("转移成功")
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode,"转移失败")
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, "转移失败")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
|
@ -65,7 +65,7 @@ function M:OnRenderItem(index, obj)
|
|||
local hpStr
|
||||
local hpData = json.decode(play.hpData)
|
||||
if play.hpOnOff == 1 then
|
||||
-- print(vardump(play))
|
||||
-- -- print(vardump(play))
|
||||
local str_reward_type = play.rewardType == 1 and "赢家返点" or (play.rewardType == 2 and "人头返点")
|
||||
local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点"
|
||||
local str_hp_type = hpData.type == 1 and "固定抽水" or "浮动抽水"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
|
|||
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
||||
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||
|
||||
|
||||
local MngPermission = import('.MngPermission')
|
||||
|
|
@ -62,15 +62,15 @@ function M:FillView()
|
|||
end
|
||||
self.lst_member.scrollPane.onPullUpRelease:Set(
|
||||
function()
|
||||
--print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
||||
---- print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
|
||||
self:GetMemberData(self.lst_member.numItems)
|
||||
end
|
||||
)
|
||||
|
||||
--local n50=self._view:GetChild('n50')
|
||||
--print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
--print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
--local n50=self._view:GetChild('n50')
|
||||
---- print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
---- print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
-- 搜索玩家
|
||||
local ctr_search = self._view:GetController('search')
|
||||
self._view:GetChild('btn_search').onClick:Set(
|
||||
|
|
@ -103,8 +103,8 @@ function M:FillView()
|
|||
item_result:RemoveChildrenToPool()
|
||||
|
||||
for j = 1, #res.Data.members do
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
@ -147,11 +147,11 @@ function M:FillView()
|
|||
self.group_id,
|
||||
tonumber(self._texnum_str),
|
||||
function(response)
|
||||
printlog("响应获取添加玩家==》》》")
|
||||
pt(response)
|
||||
printlog("响应获取添加玩家==》》》")
|
||||
pt(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
||||
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
self:ClearNumTex()
|
||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||
else
|
||||
|
|
@ -174,9 +174,6 @@ function M:FillView()
|
|||
self:initData()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 快速访问
|
||||
|
|
@ -187,8 +184,8 @@ end
|
|||
|
||||
-- 获取成员数据
|
||||
function M:GetMemberData(index)
|
||||
--print("11111111111111111111")
|
||||
--print(debug.traceback())
|
||||
---- print("11111111111111111111")
|
||||
---- print(debug.traceback())
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
if index == 0 then
|
||||
group:clearMember()
|
||||
|
|
@ -222,32 +219,32 @@ end
|
|||
local function __change_fag(gid, pid, is_add, cur_hp, callback)
|
||||
local gniv =
|
||||
GroupNumberInputView.new(
|
||||
nil,
|
||||
function(num)
|
||||
num = ad2d((is_add and num or -num))
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_ChangeFag(
|
||||
gid,
|
||||
pid,
|
||||
num,
|
||||
function(res1)
|
||||
ViewUtil.CloseModalWait()
|
||||
-- if gniv._is_destroy then
|
||||
-- return
|
||||
-- end
|
||||
if (res1.ReturnCode == 0) then
|
||||
callback(res1.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
|
||||
nil,
|
||||
function(num)
|
||||
num = ad2d((is_add and num or -num))
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_ChangeFag(
|
||||
gid,
|
||||
pid,
|
||||
num,
|
||||
function(res1)
|
||||
ViewUtil.CloseModalWait()
|
||||
-- if gniv._is_destroy then
|
||||
-- return
|
||||
-- end
|
||||
if (res1.ReturnCode == 0) then
|
||||
callback(res1.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
|
||||
end,
|
||||
is_add and 1 or 2,
|
||||
cur_hp and d2ad(cur_hp) or nil
|
||||
)
|
||||
)
|
||||
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
|
||||
end,
|
||||
is_add and 1 or 2,
|
||||
cur_hp and d2ad(cur_hp) or nil
|
||||
)
|
||||
gniv:Show()
|
||||
end
|
||||
|
||||
|
|
@ -286,13 +283,13 @@ function M:FillItem(obj, member, refresh)
|
|||
end
|
||||
|
||||
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
||||
if member.parentId==0 then
|
||||
obj:GetChild('tex_shangjiID').text=""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
||||
end
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||
if member.parentId == 0 then
|
||||
obj:GetChild('tex_shangjiID').text = ""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||
end
|
||||
|
||||
|
||||
local perm_array = MngPermission.getPermData(group.permission)
|
||||
|
|
@ -378,22 +375,22 @@ function M:FillItem(obj, member, refresh)
|
|||
function()
|
||||
local mflv =
|
||||
GroupMemberOperateView.new(
|
||||
self.group_id,
|
||||
member,
|
||||
function(delete)
|
||||
if delete ~= nil and delete == true then
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
self.member_data = group.members
|
||||
self.lst_member.numItems = #self.member_data
|
||||
self._view:GetController('search').selectedIndex = 0
|
||||
else
|
||||
self.lst_member.numItems = self.lst_member.numItems
|
||||
if refresh then
|
||||
self:FillItem(obj, member)
|
||||
self.group_id,
|
||||
member,
|
||||
function(delete)
|
||||
if delete ~= nil and delete == true then
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
self.member_data = group.members
|
||||
self.lst_member.numItems = #self.member_data
|
||||
self._view:GetController('search').selectedIndex = 0
|
||||
else
|
||||
self.lst_member.numItems = self.lst_member.numItems
|
||||
if refresh then
|
||||
self:FillItem(obj, member)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
mflv:Show()
|
||||
end
|
||||
)
|
||||
|
|
@ -428,8 +425,8 @@ function M:FillItem(obj, member, refresh)
|
|||
item_result:RemoveChildrenToPool()
|
||||
|
||||
for j = 1, #res.Data.members do
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
|
|||
local GroupSetPermissionView = import('.GroupSetPermissionView')
|
||||
local GroupBanSameTableView = import('.GroupBanSameTableView')
|
||||
local GroupMemberOperateView = import('.GroupMemberOperateView')
|
||||
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView')
|
||||
local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
|
||||
local GroupStatMember = import('.GroupStatMember')
|
||||
local GroupMngFagPackView = import('../GroupMngFagPackView')
|
||||
|
||||
|
|
@ -64,14 +64,13 @@ function M:FillView()
|
|||
local rtype = self._view:GetChild("n132")
|
||||
rtype.visible = false
|
||||
|
||||
rtype.onChanged:Set(function ()
|
||||
rtype.onChanged:Set(function()
|
||||
if tostring(self.online) == rtype.value then
|
||||
return
|
||||
end
|
||||
self.online = tonumber(rtype.value)
|
||||
self:GetMemberData(0)
|
||||
--printlog("aaaaaaaa222222222222222222222222222222")
|
||||
|
||||
end)
|
||||
|
||||
-- 初始化成员列表
|
||||
|
|
@ -87,10 +86,10 @@ function M:FillView()
|
|||
end
|
||||
)
|
||||
|
||||
--local n50=self._view:GetChild('n50')
|
||||
--print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
--print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
--local n50=self._view:GetChild('n50')
|
||||
---- print(n50)
|
||||
--n50.displayObject.gameObject.transform.localPosition.x=214
|
||||
---- print(n50.displayObject.gameObject.transform.localPosition.x)
|
||||
-- 搜索玩家
|
||||
local ctr_search = self._view:GetController('search')
|
||||
self._view:GetChild('btn_search').onClick:Set(
|
||||
|
|
@ -123,8 +122,8 @@ function M:FillView()
|
|||
item_result:RemoveChildrenToPool()
|
||||
|
||||
for j = 1, #res.Data.members do
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
@ -167,11 +166,11 @@ function M:FillView()
|
|||
self.group_id,
|
||||
tonumber(self._texnum_str),
|
||||
function(response)
|
||||
printlog("响应获取添加玩家==》》》")
|
||||
pt(response)
|
||||
printlog("响应获取添加玩家==》》》")
|
||||
pt(response)
|
||||
ViewUtil.CloseModalWait()
|
||||
if (response.ReturnCode and response.ReturnCode == 0) then
|
||||
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
|
||||
self:ClearNumTex()
|
||||
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||
else
|
||||
|
|
@ -200,13 +199,10 @@ function M:FillView()
|
|||
--self._view:GetChild("n50").selected = true
|
||||
ctr_page.onChanged:Set(
|
||||
function()
|
||||
|
||||
self.stype = ctr_page.selectedIndex + 1
|
||||
self:initData()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 快速访问
|
||||
|
|
@ -217,8 +213,8 @@ end
|
|||
|
||||
-- 获取成员数据
|
||||
function M:GetMemberData(index)
|
||||
--print("11111111111111111111")
|
||||
--print(debug.traceback())
|
||||
---- print("11111111111111111111")
|
||||
---- print(debug.traceback())
|
||||
-- local iClear = false
|
||||
-- local rtype = self._view:GetChild("n132").value
|
||||
-- if tostring(self.online) ~= rtype then
|
||||
|
|
@ -258,32 +254,32 @@ end
|
|||
local function __change_fag(gid, pid, is_add, cur_hp, callback)
|
||||
local gniv =
|
||||
GroupNumberInputView.new(
|
||||
nil,
|
||||
function(num)
|
||||
num = ad2d((is_add and num or -num))
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_ChangeFag(
|
||||
gid,
|
||||
pid,
|
||||
num,
|
||||
function(res1)
|
||||
ViewUtil.CloseModalWait()
|
||||
-- if gniv._is_destroy then
|
||||
-- return
|
||||
-- end
|
||||
if (res1.ReturnCode == 0) then
|
||||
callback(res1.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
|
||||
nil,
|
||||
function(num)
|
||||
num = ad2d((is_add and num or -num))
|
||||
ViewUtil.ShowModalWait()
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
fgCtr:FG_ChangeFag(
|
||||
gid,
|
||||
pid,
|
||||
num,
|
||||
function(res1)
|
||||
ViewUtil.CloseModalWait()
|
||||
-- if gniv._is_destroy then
|
||||
-- return
|
||||
-- end
|
||||
if (res1.ReturnCode == 0) then
|
||||
callback(res1.Data)
|
||||
else
|
||||
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
|
||||
end,
|
||||
is_add and 1 or 2,
|
||||
cur_hp and d2ad(cur_hp) or nil
|
||||
)
|
||||
)
|
||||
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
|
||||
end,
|
||||
is_add and 1 or 2,
|
||||
cur_hp and d2ad(cur_hp) or nil
|
||||
)
|
||||
gniv:Show()
|
||||
end
|
||||
|
||||
|
|
@ -313,35 +309,35 @@ function M:FillItem(obj, member, refresh)
|
|||
--obj:GetChild("tex_cost_count").text = d2ad(member.last_hp_cost)
|
||||
|
||||
--if member.online == 1 then
|
||||
-- obj:GetChild('tex_last_login').text = '在线'
|
||||
-- else
|
||||
if member.last_time ~= 0 then
|
||||
-- local now_time = os.date("*t",now)
|
||||
-- local today = os.time({year=now_time.year, month=now_time.month, day=now_time.day, hour=0,min=0,sec=0})
|
||||
-- local cha = math.ceil((today - member.last_time) / (24 * 60 *60))
|
||||
-- if (cha > 0) then
|
||||
-- obj:GetChild('tex_last_login').text = cha.."天前" --'最近登录\n' .. os.date('%Y/%m/%d', member.last_time)
|
||||
-- else
|
||||
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
|
||||
-- end
|
||||
--print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time))
|
||||
obj:GetChild('tex_last_login').text = "最近登录:"..os.date('%Y/%m/%d', member.last_time)
|
||||
else
|
||||
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
|
||||
end
|
||||
-- end
|
||||
-- obj:GetChild('tex_last_login').text = '在线'
|
||||
-- else
|
||||
if member.last_time ~= 0 then
|
||||
-- local now_time = os.date("*t",now)
|
||||
-- local today = os.time({year=now_time.year, month=now_time.month, day=now_time.day, hour=0,min=0,sec=0})
|
||||
-- local cha = math.ceil((today - member.last_time) / (24 * 60 *60))
|
||||
-- if (cha > 0) then
|
||||
-- obj:GetChild('tex_last_login').text = cha.."天前" --'最近登录\n' .. os.date('%Y/%m/%d', member.last_time)
|
||||
-- else
|
||||
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
|
||||
-- end
|
||||
---- print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time))
|
||||
obj:GetChild('tex_last_login').text = "最近登录:" .. os.date('%Y/%m/%d', member.last_time)
|
||||
else
|
||||
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
|
||||
end
|
||||
-- end
|
||||
|
||||
|
||||
obj:GetChild('tex_zongchangci').text = member.total_round
|
||||
obj:GetChild('tex_ruhui').text = os.date('%Y/%m/%d %H:%M:%S', member.join_time)
|
||||
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text=member.parentId_nick or ""
|
||||
if member.parentId==0 then
|
||||
obj:GetChild('tex_shangjiID').text=""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text=member.parentId
|
||||
end
|
||||
--上级
|
||||
obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
|
||||
if member.parentId == 0 then
|
||||
obj:GetChild('tex_shangjiID').text = ""
|
||||
else
|
||||
obj:GetChild('tex_shangjiID').text = member.parentId
|
||||
end
|
||||
|
||||
|
||||
local perm_array = MngPermission.getPermData(group.permission)
|
||||
|
|
@ -427,40 +423,41 @@ function M:FillItem(obj, member, refresh)
|
|||
function()
|
||||
local mflv =
|
||||
GroupMemberOperateView.new(
|
||||
self.group_id,
|
||||
member,
|
||||
function(delete)
|
||||
if delete ~= nil and delete == true then
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
self.member_data = group.members
|
||||
self.lst_member.numItems = #self.member_data
|
||||
self._view:GetController('search').selectedIndex = 0
|
||||
else
|
||||
self.lst_member.numItems = self.lst_member.numItems
|
||||
if refresh then
|
||||
self:FillItem(obj, member)
|
||||
self.group_id,
|
||||
member,
|
||||
function(delete)
|
||||
if delete ~= nil and delete == true then
|
||||
local group = DataManager.groups:get(self.group_id)
|
||||
self.member_data = group.members
|
||||
self.lst_member.numItems = #self.member_data
|
||||
self._view:GetController('search').selectedIndex = 0
|
||||
else
|
||||
self.lst_member.numItems = self.lst_member.numItems
|
||||
if refresh then
|
||||
self:FillItem(obj, member)
|
||||
end
|
||||
end
|
||||
end,
|
||||
function()
|
||||
self:GetMemberData(0)
|
||||
end
|
||||
end,
|
||||
function()
|
||||
self:GetMemberData(0)
|
||||
end
|
||||
)
|
||||
)
|
||||
mflv:Show()
|
||||
end
|
||||
)
|
||||
|
||||
local btnBxx = obj:GetChild('btn_bxx')
|
||||
btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and not (DataManager.SelfUser.account_id == member.uid)
|
||||
btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and
|
||||
not (DataManager.SelfUser.account_id == member.uid)
|
||||
--btnBxx.visible = not (DataManager.SelfUser.account_id == member.uid)
|
||||
obj:GetChild('btn_bxx').onClick:Set(
|
||||
function()
|
||||
local ctrNum=1
|
||||
local ctrNum = 1
|
||||
-- if not (member.lev == 3 and member.partnerLev == 0) then
|
||||
-- ctrNum = 2
|
||||
-- end
|
||||
ctrNum=2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,member.uid)
|
||||
ctrNum = 2
|
||||
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum, member.uid)
|
||||
gmv:SetCallback(
|
||||
function()
|
||||
btnBxx.selected = false
|
||||
|
|
@ -471,7 +468,7 @@ function M:FillItem(obj, member, refresh)
|
|||
)
|
||||
|
||||
local superBtn = obj:GetChild('super_btn')
|
||||
superBtn.visible = group.lev == 1
|
||||
superBtn.visible = group.lev == 1
|
||||
obj:GetChild("super_btn").onClick:Set(
|
||||
function()
|
||||
ViewUtil.ShowModalWait(nil)
|
||||
|
|
@ -502,8 +499,8 @@ function M:FillItem(obj, member, refresh)
|
|||
item_result:RemoveChildrenToPool()
|
||||
|
||||
for j = 1, #res.Data.members do
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
local tem = item_result:AddItemFromPool()
|
||||
self:FillItem(tem, res.Data.members[j], true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ local M = PlayerInfoView
|
|||
|
||||
function M.new(view, main_view, isHideIpAdds)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = PlayerInfoView})
|
||||
setmetatable(self, { __index = PlayerInfoView })
|
||||
self._view = view
|
||||
self._main_view = main_view
|
||||
self._isHideIpAdds = isHideIpAdds
|
||||
self.isShowTGTimer=false
|
||||
self.currentTime=0
|
||||
self.totalTime=0
|
||||
self.isShowTGTimer = false
|
||||
self.currentTime = 0
|
||||
self.totalTime = 0
|
||||
--self.isShow = fasle
|
||||
self:init()
|
||||
return self
|
||||
|
|
@ -41,34 +41,34 @@ function M:init()
|
|||
self._tex_player_name = player_name_score:GetChild('tex_player_name')
|
||||
self._tex_player_id = player_name_score:GetChild('tex_player_id')
|
||||
self._tex_score = player_name_score:GetChild('tex_score')
|
||||
self._tex_score.visible=true
|
||||
self._tex_score.visible = true
|
||||
|
||||
self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
if self._tex_score1 then
|
||||
self._tex_score1.visible=true
|
||||
end
|
||||
self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
if self._tex_score1 then
|
||||
self._tex_score1.visible = true
|
||||
end
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
if self._tex_score2 then
|
||||
self._tex_score2.visible=true
|
||||
end
|
||||
if self._tex_score2 then
|
||||
self._tex_score2.visible = true
|
||||
end
|
||||
|
||||
self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
|
||||
if self._tex_n4 then
|
||||
self._tex_n4.visible=true
|
||||
end
|
||||
self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
|
||||
if self._tex_n4 then
|
||||
self._tex_n4.visible = true
|
||||
end
|
||||
self._tex_n5 = self._view:GetChild("info"):GetChild("n5")
|
||||
if self._tex_n5 then
|
||||
self._tex_n5.visible=true
|
||||
end
|
||||
if self._tex_n5 then
|
||||
self._tex_n5.visible = true
|
||||
end
|
||||
|
||||
self.n3Bg=self._view:GetChild("info"):GetChild("n3")
|
||||
if self.n3Bg then
|
||||
--self.n3Bg:SetSize(138,55)
|
||||
end
|
||||
self.zhanjitext=self._view:GetChild("text_jifen")
|
||||
if self.zhanjitext then
|
||||
self.zhanjitext.text=0
|
||||
end
|
||||
self.n3Bg = self._view:GetChild("info"):GetChild("n3")
|
||||
if self.n3Bg then
|
||||
--self.n3Bg:SetSize(138,55)
|
||||
end
|
||||
self.zhanjitext = self._view:GetChild("text_jifen")
|
||||
if self.zhanjitext then
|
||||
self.zhanjitext.text = 0
|
||||
end
|
||||
|
||||
|
||||
self._biaoqing = view:GetChild('face')
|
||||
|
|
@ -83,68 +83,63 @@ function M:init()
|
|||
self._ctr_mask_voice = view:GetController('mask_voice')
|
||||
self._ctr_dismiss_room = view:GetController('dismiss_room')
|
||||
|
||||
self.PlayerTGTips=view:GetChild('tuoguanTips')
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
self.PlayerTGTips = view:GetChild('tuoguanTips')
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowTGTips(isShow,time)
|
||||
function M:IsShowTGTips(isShow, time)
|
||||
--printlog("isShowisShowisShow==== ",isShow," time ",time)
|
||||
if time==nil then time=0 end
|
||||
if time == nil then time = 0 end
|
||||
|
||||
self.isShowTGTimer = isShow
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
||||
end
|
||||
self.currentTime=0
|
||||
if isShow then
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text="开启托管剩余时间"..time.."s"
|
||||
end
|
||||
self.totalTime=time
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
||||
end
|
||||
self.currentTime = 0
|
||||
if isShow then
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text = "开启托管剩余时间" .. time .. "s"
|
||||
end
|
||||
self.totalTime = time
|
||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||
--UpdateBeat:Add(self.OnUpdate,self)
|
||||
-- printlog("aaaaaaaaa111111111111111111111111111111")
|
||||
--TimerManager.RemoveTimer(self.OnUpdate)
|
||||
TimerManager.AddTimer(self.OnUpdate,self)
|
||||
--printlog(self)
|
||||
else
|
||||
-- printlog("移除IsShowTGTips",self.isShow)
|
||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
||||
end
|
||||
|
||||
--UpdateBeat:Add(self.OnUpdate,self)
|
||||
-- printlog("aaaaaaaaa111111111111111111111111111111")
|
||||
--TimerManager.RemoveTimer(self.OnUpdate)
|
||||
TimerManager.AddTimer(self.OnUpdate, self)
|
||||
--printlog(self)
|
||||
else
|
||||
-- printlog("移除IsShowTGTips",self.isShow)
|
||||
--UpdateBeat:Remove(self.OnUpdate,self)
|
||||
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:OnUpdate()
|
||||
--printlog("OnUpdate=====================")
|
||||
if self.isShowTGTimer then
|
||||
self.currentTime=self.currentTime+Time.deltaTime
|
||||
if self.currentTime>=1 then
|
||||
self.currentTime=0
|
||||
self.totalTime=self.totalTime-1
|
||||
--printlog("当前计时器===>>>",self.totalTime)
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text="开启托管剩余时间"..self.totalTime.."s"
|
||||
end
|
||||
--printlog("OnUpdate=====================")
|
||||
if self.isShowTGTimer then
|
||||
self.currentTime = self.currentTime + Time.deltaTime
|
||||
if self.currentTime >= 1 then
|
||||
self.currentTime = 0
|
||||
self.totalTime = self.totalTime - 1
|
||||
--printlog("当前计时器===>>>",self.totalTime)
|
||||
if self.PlayerTGTips then
|
||||
self.PlayerTGTips.text = "开启托管剩余时间" .. self.totalTime .. "s"
|
||||
end
|
||||
|
||||
if self.totalTime<=0 then
|
||||
self.isShowTGTimer=false
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.muShiPlayerUpdate then
|
||||
self:muShiPlayerUpdate()
|
||||
end
|
||||
end
|
||||
if self.totalTime <= 0 then
|
||||
self.isShowTGTimer = false
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.muShiPlayerUpdate then
|
||||
self:muShiPlayerUpdate()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:FillData(player)
|
||||
|
|
@ -173,12 +168,12 @@ function M:FillData(player)
|
|||
end
|
||||
|
||||
if isHidden
|
||||
--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
|
||||
if player.orgSeat and player.orgSeat > 0 then
|
||||
self._tex_player_name.text = "玩家"..player.orgSeat
|
||||
self._tex_player_name.text = "玩家" .. player.orgSeat
|
||||
else
|
||||
self._tex_player_name.text = "玩家"..player.seat
|
||||
self._tex_player_name.text = "玩家" .. player.seat
|
||||
player.orgSeat = membe_clone(player.seat)
|
||||
end
|
||||
if self._tex_player_id then
|
||||
|
|
@ -187,7 +182,7 @@ function M:FillData(player)
|
|||
else
|
||||
self._tex_player_name.text = player.self_user.nick_name
|
||||
if self._tex_player_id then
|
||||
self._tex_player_id.text = "ID:".. player.self_user.account_id
|
||||
self._tex_player_id.text = "ID:" .. player.self_user.account_id
|
||||
end
|
||||
end
|
||||
self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0
|
||||
|
|
@ -208,12 +203,12 @@ function M:UpdateScore(score)
|
|||
local room = DataManager.CurrenRoom
|
||||
if room:checkHpNonnegative() then
|
||||
if self._player.cur_hp then
|
||||
-- print(self._player.total_hp)
|
||||
-- -- print(self._player.total_hp)
|
||||
-- if self._player.total_hp then
|
||||
-- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp)
|
||||
-- else
|
||||
score = d2ad(self._player.cur_hp)
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -339,9 +334,11 @@ function M:MarkTuoguan()
|
|||
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
|
||||
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
|
||||
end
|
||||
|
||||
function M:UnmarkTuoguan()
|
||||
self:RemoveMarkFromHead('mark_tuoguan')
|
||||
end
|
||||
|
||||
-- 动态的往头像上加载组件
|
||||
function M:AddMarkToHead(com, key)
|
||||
if key then
|
||||
|
|
@ -354,6 +351,7 @@ function M:AddMarkToHead(com, key)
|
|||
com.touchable = false
|
||||
com.xy = self:GetHeadCenter()
|
||||
end
|
||||
|
||||
-- 动态移除组件
|
||||
function M:RemoveMarkFromHead(key)
|
||||
if self[key] then
|
||||
|
|
@ -363,11 +361,10 @@ function M:RemoveMarkFromHead(key)
|
|||
end
|
||||
|
||||
function M:Destroy()
|
||||
self.isShowTGTimer=false
|
||||
TimerManager.RemoveTimer(self.OnUpdate,self)
|
||||
self.OnUpdate=nil
|
||||
self.muShiPlayerUpdate=nil
|
||||
self.isShowTGTimer = false
|
||||
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||
self.OnUpdate = nil
|
||||
self.muShiPlayerUpdate = nil
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ function M:FillData(player)
|
|||
end
|
||||
end
|
||||
|
||||
print("============================playinfoview")
|
||||
-- print("============================playinfoview")
|
||||
pt(player)
|
||||
|
||||
if isHidden
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ end
|
|||
function ViewUtil.HandCardSort2(a, b)
|
||||
a = tonumber(string.sub(a, 2))
|
||||
b = tonumber(string.sub(b, 2))
|
||||
--print(a)
|
||||
--print(b)
|
||||
---- print(a)
|
||||
---- print(b)
|
||||
return a < b
|
||||
end
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ function get_gps(callback)
|
|||
end)
|
||||
end)
|
||||
if not s then
|
||||
--print("Error" .. e)
|
||||
---- print("Error" .. e)
|
||||
end
|
||||
elseif Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then
|
||||
-- DataManager.SelfUser.location = Location.new(string.format("%s,%s", math.random(10,20), math.random(10,20)))
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ local function __NetTip(txt_msg)
|
|||
end
|
||||
|
||||
local function __OnGameConnectAction(state)
|
||||
--print("state:"..state)
|
||||
---- print("state:"..state)
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
if state == SocketCode.Connect then
|
||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||
|
|
@ -150,14 +150,14 @@ function ViewManager.ChangeView(id, game_id, callback)
|
|||
end
|
||||
|
||||
function ViewManager.OnApplicationPause()
|
||||
-- print("game pause")
|
||||
-- -- print("game pause")
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationPause()
|
||||
end
|
||||
end
|
||||
|
||||
function ViewManager.OnApplicationActive()
|
||||
-- print("game active")
|
||||
-- -- print("game active")
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationActive()
|
||||
end
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,14 +1,15 @@
|
|||
local breakSocketHandle,debugXpCall = require("LuaDebugjit")("localhost",7003)
|
||||
local breakSocketHandle, debugXpCall = require("LuaDebugjit")("localhost", 7003)
|
||||
local timer = Timer.New(function()
|
||||
breakSocketHandle() end, 1, -1, false)
|
||||
breakSocketHandle()
|
||||
end, 1, -1, false)
|
||||
timer:Start();
|
||||
|
||||
require "Core.init"
|
||||
json = require 'cjson'
|
||||
require'FairyGUI'
|
||||
require'Game.ControllerManager'
|
||||
require'Game.ViewManager'
|
||||
require'Game.DataManager'
|
||||
require 'FairyGUI'
|
||||
require 'Game.ControllerManager'
|
||||
require 'Game.ViewManager'
|
||||
require 'Game.DataManager'
|
||||
require "Game.ExtendManager"
|
||||
require "Game.ExtendHotupdate"
|
||||
require "TableData"
|
||||
|
|
@ -19,7 +20,7 @@ Utils = Game.Utils
|
|||
PlayerPrefs = UnityEngine.PlayerPrefs
|
||||
RuntimePlatform = UnityEngine.RuntimePlatform
|
||||
Application = UnityEngine.Application
|
||||
Screen=UnityEngine.Screen
|
||||
Screen = UnityEngine.Screen
|
||||
ResourcesManager = taurus.unity.ResourcesManager
|
||||
-- require 'tolua.reflection'
|
||||
-- tolua.loadassembly('Assembly-CSharp')
|
||||
|
|
@ -31,21 +32,22 @@ local _game_info
|
|||
local panel = nil
|
||||
|
||||
|
||||
oldGameVersion=2 --1 原始 2 老游戏新加功能
|
||||
oldGameVersion = 2 --1 原始 2 老游戏新加功能
|
||||
|
||||
--主入口函数。从这里开始lua逻辑
|
||||
function Main()
|
||||
--PlayerPrefs.DeleteKey('session_id')
|
||||
--PlayerPrefs.DeleteKey('session_id')
|
||||
Application.targetFrameRate = 60
|
||||
FairyGUI.UIConfig.buttonSound =FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",typeof(UnityEngine.AudioClip)))
|
||||
FairyGUI.UIConfig.buttonSound = FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",
|
||||
typeof(UnityEngine.AudioClip)))
|
||||
FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S"
|
||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN","base/static/fonts/SIYUAN.TTF"),null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
||||
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
||||
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
||||
--pt(_game_info)
|
||||
debug_print = false--GetGameInfo("debug_print")
|
||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
|
||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
||||
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
||||
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
||||
--pt(_game_info)
|
||||
debug_print = false --GetGameInfo("debug_print")
|
||||
if Application.platform == RuntimePlatform.WindowsEditor then
|
||||
debug_print = true
|
||||
end
|
||||
|
|
@ -62,7 +64,7 @@ function Main()
|
|||
--web网络API版本号
|
||||
NetManager.VERSION = GetGameInfo("net_version")
|
||||
|
||||
TimerManager.New()
|
||||
TimerManager.New()
|
||||
-- test:DynamicInvoke("222")
|
||||
--ExtendManager.Init()
|
||||
ControllerManager.Init()
|
||||
|
|
@ -89,10 +91,8 @@ function Main()
|
|||
end
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function GetGameInfo(key)
|
||||
return _game_info[key]
|
||||
end
|
||||
|
|
@ -102,12 +102,12 @@ function GetPlatform()
|
|||
end
|
||||
|
||||
function GetGameInfoPlatform(key)
|
||||
local p_key = GetPlatform()
|
||||
local p_key = GetPlatform()
|
||||
local _platfrom = _game_info[p_key]
|
||||
return _platfrom[key]
|
||||
end
|
||||
|
||||
function BlurView(view,enabled)
|
||||
function BlurView(view, enabled)
|
||||
if enabled then
|
||||
local bf = FairyGUI.BlurFilter()
|
||||
bf.blurSize = 0.05
|
||||
|
|
@ -135,61 +135,60 @@ end
|
|||
function ShareScreenShot(n, callback)
|
||||
local json_data = {}
|
||||
json_data["title"] = "湘北联赛"
|
||||
local mediaObject = {}
|
||||
local mediaObject = {}
|
||||
mediaObject["path"] = Application.persistentDataPath
|
||||
mediaObject["filename"] = "screenshot"
|
||||
mediaObject["type"] = 1
|
||||
json_data["mediaObject"] = mediaObject
|
||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||
json_data["scene"] = 0
|
||||
local json_str =json.encode(json_data)
|
||||
local json_str = json.encode(json_data)
|
||||
TakeScreenShot.Take(function()
|
||||
-- 1微信 2支付宝
|
||||
GameApplication.Instance:ShareLink(n or 1, json_str, nil)
|
||||
-- 1微信 2支付宝
|
||||
GameApplication.Instance:ShareLink(n or 1, json_str, nil)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function shareQRCodePicture(url,secene)
|
||||
--print(debug.traceback())
|
||||
print(url)
|
||||
print(secene)
|
||||
function shareQRCodePicture(url, secene)
|
||||
---- print(debug.traceback())
|
||||
-- print(url)
|
||||
-- print(secene)
|
||||
local json_data = {}
|
||||
json_data["title"] = "湘北联赛"
|
||||
local mediaObject = {}
|
||||
local filename = "qrcode" .. DataManager.SelfUser.account_id
|
||||
print(Application.persistentDataPath)
|
||||
-- print(Application.persistentDataPath)
|
||||
mediaObject["path"] = Application.persistentDataPath
|
||||
mediaObject["filename"] = filename
|
||||
mediaObject["type"] = 1
|
||||
json_data["mediaObject"] = mediaObject
|
||||
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
|
||||
json_data["scene"] = secene
|
||||
print("json_data==================")
|
||||
-- print("json_data==================")
|
||||
local json_str = json.encode(json_data)
|
||||
pt(json_str)
|
||||
pt(json_str)
|
||||
local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250)
|
||||
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png",typeof(UnityEngine.Texture2D))
|
||||
filename = filename ..".jpg"
|
||||
print("text2==========")
|
||||
print(tex2)
|
||||
print("text1==========")
|
||||
print(tex1)
|
||||
print("filename==========")
|
||||
print(filename)
|
||||
QRCodePicture.CombanitePicture(tex1,tex2,393,1334-802-250,filename)
|
||||
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png", typeof(UnityEngine.Texture2D))
|
||||
filename = filename .. ".jpg"
|
||||
-- print("text2==========")
|
||||
-- print(tex2)
|
||||
-- print("text1==========")
|
||||
-- print(tex1)
|
||||
-- print("filename==========")
|
||||
-- print(filename)
|
||||
QRCodePicture.CombanitePicture(tex1, tex2, 393, 1334 - 802 - 250, filename)
|
||||
|
||||
GameApplication.Instance:ShareLink(1, json_str, nil)
|
||||
end
|
||||
|
||||
|
||||
function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name)
|
||||
|
||||
end
|
||||
|
||||
function UISetController(root,controller_name, gear_display, selectedIndex)
|
||||
function UISetController(root, controller_name, gear_display, selectedIndex)
|
||||
local ctr = root:GetController(controller_name)
|
||||
local gear = gear_display:GetGear(0)
|
||||
|
||||
|
|
@ -202,9 +201,9 @@ local bg_url = nil
|
|||
function LoadGameBg(url, main_view)
|
||||
local win_mode = main_view:GetChild("win_mode")
|
||||
win_mode:RemoveChildren(0, -1, true)
|
||||
local tex_bg = ResourcesManager.LoadObjectByGroup(url..".png",typeof(UnityEngine.Texture), url)
|
||||
print("===========================mainbg")
|
||||
print(url..".png",typeof(UnityEngine.Texture), url)
|
||||
local tex_bg = ResourcesManager.LoadObjectByGroup(url .. ".png", typeof(UnityEngine.Texture), url)
|
||||
-- print("===========================mainbg")
|
||||
-- print(url..".png",typeof(UnityEngine.Texture), url)
|
||||
local bg = GImage()
|
||||
bg.texture = FairyGUI.NTexture(tex_bg)
|
||||
bg.width = win_mode.width
|
||||
|
|
@ -225,7 +224,7 @@ function AddPanel(child)
|
|||
panel:AddChild(child)
|
||||
end
|
||||
|
||||
function AddPanelAt(child,index)
|
||||
function AddPanelAt(child, index)
|
||||
child:MakeFullScreen()
|
||||
child:AddRelation(GRoot.inst, RelationType.Size)
|
||||
panel:AddChildAt(child, index)
|
||||
|
|
@ -247,7 +246,7 @@ end
|
|||
|
||||
--场景切换通知
|
||||
function OnLevelWasLoaded(level)
|
||||
Time.timeSinceLevelLoad = 0
|
||||
Time.timeSinceLevelLoad = 0
|
||||
end
|
||||
|
||||
--程序切到后台
|
||||
|
|
@ -261,118 +260,111 @@ function OnApplicationActive()
|
|||
ViewManager.OnApplicationActive()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function pt(...)
|
||||
if debug_print then
|
||||
local arg={...}
|
||||
local has=false
|
||||
for _,v in pairs(arg) do
|
||||
if v and type(v)=="table" then
|
||||
has=true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not has then
|
||||
print(...)
|
||||
end
|
||||
if debug_print then
|
||||
local arg = { ... }
|
||||
local has = false
|
||||
for _, v in pairs(arg) do
|
||||
if v and type(v) == "table" then
|
||||
has = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not has then
|
||||
-- print(...)
|
||||
end
|
||||
|
||||
local content=""
|
||||
for _,v in pairs(arg) do
|
||||
if v=="table" then
|
||||
content=content..tostring(v).."\n"
|
||||
else
|
||||
content=content.."==>[T]:"..LuaPrint(v,limit),debug.traceback().."\n"
|
||||
end
|
||||
print(content)
|
||||
end
|
||||
|
||||
end
|
||||
local content = ""
|
||||
for _, v in pairs(arg) do
|
||||
if v == "table" then
|
||||
content = content .. tostring(v) .. "\n"
|
||||
else
|
||||
content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n"
|
||||
end
|
||||
-- print(content)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LuaPrint(lua_table, limit, indent, step)
|
||||
step = step or 0
|
||||
indent = indent or 0
|
||||
local content = ""
|
||||
if limit ~= nil then
|
||||
if step > limit then
|
||||
return "..."
|
||||
end
|
||||
end
|
||||
if step > 10 then
|
||||
return content .. "..."
|
||||
end
|
||||
if lua_table == nil then
|
||||
return "nil"
|
||||
end
|
||||
if type(lua_table) == "userdata" or type(lua_table) == "lightuserdata" or type(lua_table) == "thread" then
|
||||
return tostring(lua_table)
|
||||
end
|
||||
|
||||
function LuaPrint(lua_table,limit,indent,step)
|
||||
step=step or 0
|
||||
indent=indent or 0
|
||||
local content=""
|
||||
if limit~=nil then
|
||||
if step>limit then
|
||||
return "..."
|
||||
end
|
||||
end
|
||||
if step>10 then
|
||||
return content.."..."
|
||||
end
|
||||
if lua_table==nil then
|
||||
return "nil"
|
||||
end
|
||||
if type(lua_table)=="userdata" or type(lua_table)=="lightuserdata" or type(lua_table)=="thread" then
|
||||
return tostring(lua_table)
|
||||
end
|
||||
if type(lua_table) == "string" or type(lua_table) == "number" then
|
||||
return "[No-Table]:" .. lua_table
|
||||
end
|
||||
|
||||
if type(lua_table)=="string" or type(lua_table)=="number" then
|
||||
return "[No-Table]:"..lua_table
|
||||
end
|
||||
|
||||
for k,v in pairs(lua_table) do
|
||||
if k~="_class_type" then
|
||||
local szBuffer=""
|
||||
Typev=type(v)
|
||||
if Typev =="table" then
|
||||
szBuffer="{"
|
||||
end
|
||||
local szPrefix=string.rep(" ",indent)
|
||||
if Typev=="table" and v._fields then
|
||||
local kk,vv=next(v._fields)
|
||||
if type(vv)=="table" then
|
||||
content=content.."\n\t"..kk.name.."={"..LuaPrint(vv._fields,5,indent+1,step+1).."}"
|
||||
else
|
||||
content=content.."\n\t"..kk.name.."="..vv
|
||||
end
|
||||
else
|
||||
if type(k)=="table" then
|
||||
if k.name then
|
||||
if type(v)~="table" then
|
||||
content=content.."\n"..k.name.."="..v
|
||||
else
|
||||
content=content.."\n"..k.name.." = list:"
|
||||
local tmp="\n"
|
||||
for ka,va in ipairs(v) do
|
||||
tmp=tmp.."#"..ka.."_"..tostring(va)
|
||||
end
|
||||
content=content..tmp
|
||||
end
|
||||
end
|
||||
|
||||
elseif type(k)=="function" then
|
||||
content=content.."\n fun=function"
|
||||
else
|
||||
formatting=szPrefix..tostring(k).." = "..szBuffer
|
||||
if Typev=="table" then
|
||||
content=content.."\n"..formatting
|
||||
content=content..LuaPrint(v,limit,indent+1,step+1)
|
||||
content=content.."\n"..szPrefix.."},"
|
||||
else
|
||||
local szValue=""
|
||||
if Typev=="string" then
|
||||
szValue=string.format("%q",v)
|
||||
else
|
||||
szValue=tostring(v)
|
||||
end
|
||||
content=content.."\n"..formatting..(szValue or "nil")..","
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return content
|
||||
for k, v in pairs(lua_table) do
|
||||
if k ~= "_class_type" then
|
||||
local szBuffer = ""
|
||||
Typev = type(v)
|
||||
if Typev == "table" then
|
||||
szBuffer = "{"
|
||||
end
|
||||
local szPrefix = string.rep(" ", indent)
|
||||
if Typev == "table" and v._fields then
|
||||
local kk, vv = next(v._fields)
|
||||
if type(vv) == "table" then
|
||||
content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) ..
|
||||
"}"
|
||||
else
|
||||
content = content .. "\n\t" .. kk.name .. "=" .. vv
|
||||
end
|
||||
else
|
||||
if type(k) == "table" then
|
||||
if k.name then
|
||||
if type(v) ~= "table" then
|
||||
content = content .. "\n" .. k.name .. "=" .. v
|
||||
else
|
||||
content = content .. "\n" .. k.name .. " = list:"
|
||||
local tmp = "\n"
|
||||
for ka, va in ipairs(v) do
|
||||
tmp = tmp .. "#" .. ka .. "_" .. tostring(va)
|
||||
end
|
||||
content = content .. tmp
|
||||
end
|
||||
end
|
||||
elseif type(k) == "function" then
|
||||
content = content .. "\n fun=function"
|
||||
else
|
||||
formatting = szPrefix .. tostring(k) .. " = " .. szBuffer
|
||||
if Typev == "table" then
|
||||
content = content .. "\n" .. formatting
|
||||
content = content .. LuaPrint(v, limit, indent + 1, step + 1)
|
||||
content = content .. "\n" .. szPrefix .. "},"
|
||||
else
|
||||
local szValue = ""
|
||||
if Typev == "string" then
|
||||
szValue = string.format("%q", v)
|
||||
else
|
||||
szValue = tostring(v)
|
||||
end
|
||||
content = content .. "\n" .. formatting .. (szValue or "nil") .. ","
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return content
|
||||
end
|
||||
|
||||
|
||||
function printlog(...)
|
||||
if debug_print then
|
||||
print(...)
|
||||
end
|
||||
if debug_print then
|
||||
-- print(...)
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "100Zhang_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,144 +25,137 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/100zhang/ui/Extend_MJ_100Zhang")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人100张 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人100张 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
--print(beforeLaiziID)
|
||||
--print(currentLaizi1ID)
|
||||
--print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
---- print(beforeLaiziID)
|
||||
---- print(currentLaizi1ID)
|
||||
---- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -172,8 +165,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,27 +212,27 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -265,21 +258,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -288,47 +281,45 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("100Zhang_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_100Zhang/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("100Zhang_MJ", "extend/majiang/100zhang/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -355,7 +346,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -377,7 +368,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -444,21 +435,21 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -476,37 +467,37 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("100Zhang_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -605,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -648,17 +639,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -671,12 +662,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -689,18 +680,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -714,11 +705,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -734,14 +725,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,46 +45,46 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -6,8 +6,8 @@ local CS_ClearingView = {}
|
|||
local M = CS_ClearingView
|
||||
|
||||
function CS_ClearingView.new(blur_view)
|
||||
setmetatable(M, {__index = ResultView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = ResultView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._full = true
|
||||
ResultView.init(self, "ui://Main_Majiang/clearing")
|
||||
|
||||
|
|
@ -16,70 +16,63 @@ function CS_ClearingView.new(blur_view)
|
|||
self._close_zone = false
|
||||
self._close_destroy = true
|
||||
|
||||
self.xiPaiCtr=self._view:GetController("xipai")
|
||||
self.xiPaiCtr = self._view:GetController("xipai")
|
||||
|
||||
self:InitMaPai()
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function M:InitMaPai()
|
||||
self.maPaiCtr=self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr = self._view:GetController("mapai")
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
|
||||
self.maPaiList={}
|
||||
self.maPaiList = {}
|
||||
|
||||
for i=1,10 do
|
||||
local tempMP=self._view:GetChild("niao"..i)
|
||||
table.insert(self.maPaiList,tempMP)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:IsMapaiShow(niao,isShow)
|
||||
if niao then
|
||||
niao.visible=isShow
|
||||
for i = 1, 10 do
|
||||
local tempMP = self._view:GetChild("niao" .. i)
|
||||
table.insert(self.maPaiList, tempMP)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetMaPaiValue(niao,value)
|
||||
function M:IsMapaiShow(niao, isShow)
|
||||
if niao then
|
||||
niao.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..value
|
||||
niao.visible = isShow
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiColor(niao,num)
|
||||
niao:GetController("color").selectedIndex=num
|
||||
function M:SetMaPaiValue(niao, value)
|
||||
if niao then
|
||||
niao.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. value
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMaPaiColor(niao, num)
|
||||
niao:GetController("color").selectedIndex = num
|
||||
end
|
||||
|
||||
function M:HideAllMapai()
|
||||
for i=1,#self.maPaiList do
|
||||
self:IsMapaiShow(self.maPaiList[i],false)
|
||||
self:SetMaPaiColor(self.maPaiList[i],0)
|
||||
for i = 1, #self.maPaiList do
|
||||
self:IsMapaiShow(self.maPaiList[i], false)
|
||||
self:SetMaPaiColor(self.maPaiList[i], 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:ShowSelectMaPai(niaoList)
|
||||
if niaoList and #niaoList>0 then
|
||||
self.maPaiCtr.selectedIndex=1
|
||||
if niaoList and #niaoList > 0 then
|
||||
self.maPaiCtr.selectedIndex = 1
|
||||
self:HideAllMapai()
|
||||
for i=1,#niaoList do
|
||||
self:IsMapaiShow(self.maPaiList[i],true)
|
||||
self:SetMaPaiValue(self.maPaiList[i],niaoList[i].card)
|
||||
if niaoList[i].score>0 then
|
||||
self:SetMaPaiColor(self.maPaiList[i],2)
|
||||
for i = 1, #niaoList do
|
||||
self:IsMapaiShow(self.maPaiList[i], true)
|
||||
self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
|
||||
if niaoList[i].score > 0 then
|
||||
self:SetMaPaiColor(self.maPaiList[i], 2)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:InitData(over, room, result, total_result, callback)
|
||||
self._callback = callback
|
||||
local _overCtr = self._view:GetController("over")
|
||||
|
|
@ -89,23 +82,24 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
local _btnCtr = self._view:GetController("button")
|
||||
local _sdkCtr = self._view:GetController("sdk")
|
||||
local ctr_type = self._view:GetController("type")
|
||||
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round, room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
|
||||
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round,
|
||||
room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
|
||||
self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes(), "\r", "")
|
||||
-- self._view:GetChild("tex_roomnum").text = room.room_id
|
||||
-- self._view:GetChild("tex_data").text = os.date("%Y-%m-%d %H:%M", os.time())
|
||||
-- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time())
|
||||
|
||||
local paixingxiangqing=self._view:GetChild("btn_detal")
|
||||
paixingxiangqing.visible=false
|
||||
local fanhuipaixing=self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible=false
|
||||
local paixingxiangqing = self._view:GetChild("btn_detal")
|
||||
paixingxiangqing.visible = false
|
||||
local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
|
||||
fanhuipaixing.visible = false
|
||||
|
||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig and round>1 then
|
||||
self.xiPaiCtr.selectedIndex=1
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig and round > 1 then
|
||||
self.xiPaiCtr.selectedIndex = 1
|
||||
else
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -115,17 +109,17 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
|
||||
|
||||
if over ~= 2 then
|
||||
local xipai=self._view:GetChild("btn_xipai")
|
||||
xipai.touchable=true
|
||||
local xipai = self._view:GetChild("btn_xipai")
|
||||
xipai.touchable = true
|
||||
xipai.onClick:Add(function()
|
||||
local xiPaiCallBack=function ()
|
||||
xipai.touchable=false
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
ViewUtil.ErrorTip(1000000,"申请洗牌成功")
|
||||
end
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:SendXiPaiAction(xiPaiCallBack)
|
||||
end)
|
||||
local xiPaiCallBack = function()
|
||||
xipai.touchable = false
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
ViewUtil.ErrorTip(1000000, "申请洗牌成功")
|
||||
end
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:SendXiPaiAction(xiPaiCallBack)
|
||||
end)
|
||||
if result and result.xipai_score then
|
||||
--xipai.text="洗牌 积分x"..result.xipai_score
|
||||
end
|
||||
|
|
@ -155,14 +149,14 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
end)
|
||||
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
|
||||
elseif over == 1 then
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
_btnCtr.selectedIndex = 1
|
||||
_sdkCtr.selectedIndex = 1
|
||||
btn_result.onClick:Add(function()
|
||||
_overCtr.selectedIndex = 1
|
||||
_btnCtr.selectedIndex = 0
|
||||
_sdkCtr.selectedIndex = 0
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
if self._qsinfo_view then
|
||||
self._qsinfo_view:Dispose()
|
||||
end
|
||||
|
|
@ -173,9 +167,9 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
|
||||
end
|
||||
else
|
||||
self.xiPaiCtr.selectedIndex=0
|
||||
self.xiPaiCtr.selectedIndex = 0
|
||||
_overCtr.selectedIndex = 1
|
||||
self.maPaiCtr.selectedIndex=0
|
||||
self.maPaiCtr.selectedIndex = 0
|
||||
btn_close.onClick:Add(function()
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
|
|
@ -183,7 +177,7 @@ function M:InitData(over, room, result, total_result, callback)
|
|||
end
|
||||
end
|
||||
|
||||
function M:AddClearItem(room, data, total_data,over, niao, active_player)
|
||||
function M:AddClearItem(room, data, total_data, over, niao, active_player)
|
||||
local n = over + 1
|
||||
local list_view1 = self._view:GetChild("player_list_1")
|
||||
local list_view2 = self._view:GetChild("player_list_2")
|
||||
|
|
@ -202,13 +196,13 @@ function M:AddClearItem(room, data, total_data,over, niao, active_player)
|
|||
end
|
||||
end
|
||||
end
|
||||
table.sort(data, function(a,b) return a.seat > b.seat end)
|
||||
table.sort(data, function(a, b) return a.seat > b.seat end)
|
||||
list_view1:RemoveChildrenToPool()
|
||||
for i=1,#data do
|
||||
for i = 1, #data do
|
||||
local item = list_view1:AddItemFromPool()
|
||||
self:FillItemData(room, data[i], item, active_player, niao)
|
||||
end
|
||||
if #data == 3 then
|
||||
if #data == 3 then
|
||||
list_view1.lineGap = 54
|
||||
elseif #data == 2 then
|
||||
list_view1.lineGap = 108
|
||||
|
|
@ -244,14 +238,14 @@ function M:FillItemData(room, data, item, active_player)
|
|||
end
|
||||
|
||||
local sp = " "
|
||||
local str = "胡:"..huadd.."分"
|
||||
str = str..sp.."扎鸟:"..birdadd.."分"
|
||||
str = str..sp.."起手胡:"..qsadd.."分"
|
||||
local str = "胡:" .. huadd .. "分"
|
||||
str = str .. sp .. "扎鸟:" .. birdadd .. "分"
|
||||
str = str .. sp .. "起手胡:" .. qsadd .. "分"
|
||||
-- if #qs_niao_list > 0 then
|
||||
-- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. ")"
|
||||
-- end
|
||||
if data["piao_niao_score"] then
|
||||
str = str..sp.."飘鸟:"..data["piao_niao_score"].."分"
|
||||
str = str .. sp .. "飘鸟:" .. data["piao_niao_score"] .. "分"
|
||||
end
|
||||
item:GetChild("score1").text = str
|
||||
local win_list = data["win_list"]
|
||||
|
|
@ -271,7 +265,7 @@ function M:FillItemData(room, data, item, active_player)
|
|||
end
|
||||
str2 = CS_Win_Type[win_list[i].type]
|
||||
end
|
||||
str1 = str1..str2..sp
|
||||
str1 = str1 .. str2 .. sp
|
||||
end
|
||||
item:GetChild("score3").text = str1
|
||||
end
|
||||
|
|
@ -284,9 +278,9 @@ function M:FillItemData(room, data, item, active_player)
|
|||
if data["is_win"] and active_player == p.self_user.account_id and remove_win_card then
|
||||
list_remove(hand_cards, data["win_card"])
|
||||
end
|
||||
for i=1,#hand_cards do
|
||||
for i = 1, #hand_cards do
|
||||
local card = hand_list_view:AddItemFromPool()
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..hand_cards[i]
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. hand_cards[i]
|
||||
end
|
||||
hand_list_view.width = 52 * #hand_cards
|
||||
|
||||
|
|
@ -294,27 +288,27 @@ function M:FillItemData(room, data, item, active_player)
|
|||
local fz_card_list = item:GetChild("fz_card_list")
|
||||
fz_card_list.width = 157 * #fz_card * 0.8
|
||||
fz_card_list:RemoveChildrenToPool()
|
||||
for i=1,#fz_card do
|
||||
for i = 1, #fz_card do
|
||||
if fz_card[i].type == FZType.Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j=1,3 do
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].card
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].card
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Chi then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
|
||||
for j = 1,3 do
|
||||
for j = 1, 3 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].opcard[j]
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].opcard[j]
|
||||
end
|
||||
elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then
|
||||
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4")
|
||||
for j=1,4 do
|
||||
for j = 1, 4 do
|
||||
local card = item:GetChild("card_" .. j)
|
||||
if fz_card[i].type == FZType.Gang_An and j == 4 then
|
||||
card.icon = "ui://Main_Majiang/202_00"
|
||||
else
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].card
|
||||
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].card
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -322,7 +316,7 @@ function M:FillItemData(room, data, item, active_player)
|
|||
|
||||
-- local total_score = data["total_score"]
|
||||
if total >= 0 then
|
||||
item:GetChild("score2").text = "+"..total
|
||||
item:GetChild("score2").text = "+" .. total
|
||||
item:GetChild("score2").grayed = false
|
||||
else
|
||||
item:GetChild("score2").text = total
|
||||
|
|
@ -342,13 +336,13 @@ function M:FillItemData(room, data, item, active_player)
|
|||
|
||||
local is_win = data["is_win"] or false
|
||||
item:GetController("win").selectedIndex = is_win and 0 or 1
|
||||
--print(p.self_user.account_id, active_player)
|
||||
---- print(p.self_user.account_id, active_player)
|
||||
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
|
||||
item:GetController("win").selectedIndex = 2
|
||||
end
|
||||
local win_card = item:GetChild("win_card")
|
||||
if is_win then
|
||||
win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..data["win_card"]
|
||||
win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. data["win_card"]
|
||||
end
|
||||
if data.niao then
|
||||
item:GetController("niao").selectedIndex = 1
|
||||
|
|
@ -370,75 +364,76 @@ function M:FillItemData(room, data, item, active_player)
|
|||
end
|
||||
|
||||
function M:FillItemData2(room, data, list)
|
||||
-- 赋值result_info,聊天室分享需要
|
||||
local player_list = {}
|
||||
for i = 1, #data do
|
||||
player_list[i] = {}
|
||||
local user = room:GetPlayerBySeat(data[i].seat).self_user
|
||||
player_list[i].id = user.account_id
|
||||
player_list[i].hp_info = data[i].hp_info
|
||||
player_list[i].score = data[i].total_score
|
||||
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
|
||||
player_list[i].nick = user.nick_name
|
||||
player_list[i].head_url = user.head_url
|
||||
-- 赋值result_info,聊天室分享需要
|
||||
local player_list = {}
|
||||
for i = 1, #data do
|
||||
player_list[i] = {}
|
||||
local user = room:GetPlayerBySeat(data[i].seat).self_user
|
||||
player_list[i].id = user.account_id
|
||||
player_list[i].hp_info = data[i].hp_info
|
||||
player_list[i].score = data[i].total_score
|
||||
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
|
||||
player_list[i].nick = user.nick_name
|
||||
player_list[i].head_url = user.head_url
|
||||
|
||||
local settle_log = data[i].settle_log
|
||||
player_list[i].param = {}
|
||||
player_list[i].param[1]={}
|
||||
player_list[i].param[1].key = "大胡自摸:"
|
||||
player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo)
|
||||
player_list[i].param[2]={}
|
||||
player_list[i].param[2].key = "小胡自摸:"
|
||||
player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo)
|
||||
player_list[i].param[3]={}
|
||||
player_list[i].param[3].key = "大胡接炮:"
|
||||
player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao)
|
||||
player_list[i].param[4]={}
|
||||
player_list[i].param[4].key = "小胡接炮:"
|
||||
player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao)
|
||||
player_list[i].param[5]={}
|
||||
player_list[i].param[5].key = "大胡点炮:"
|
||||
player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao)
|
||||
player_list[i].param[6]={}
|
||||
player_list[i].param[6].key = "小胡点炮:"
|
||||
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
|
||||
end
|
||||
local round = room.room_config.round
|
||||
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
|
||||
-- self:SetGSListlineGap(-10)
|
||||
player_list[i].param = {}
|
||||
player_list[i].param[1] = {}
|
||||
player_list[i].param[1].key = "大胡自摸:"
|
||||
player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo)
|
||||
player_list[i].param[2] = {}
|
||||
player_list[i].param[2].key = "小胡自摸:"
|
||||
player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo)
|
||||
player_list[i].param[3] = {}
|
||||
player_list[i].param[3].key = "大胡接炮:"
|
||||
player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao)
|
||||
player_list[i].param[4] = {}
|
||||
player_list[i].param[4].key = "小胡接炮:"
|
||||
player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao)
|
||||
player_list[i].param[5] = {}
|
||||
player_list[i].param[5].key = "大胡点炮:"
|
||||
player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao)
|
||||
player_list[i].param[6] = {}
|
||||
player_list[i].param[6].key = "小胡点炮:"
|
||||
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
|
||||
end
|
||||
local round = room.room_config.round
|
||||
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
|
||||
-- self:SetGSListlineGap(-10)
|
||||
|
||||
local big_result = self._view:GetChild("big_result")
|
||||
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()), room.room_id, room.curren_round, room.room_config.round)
|
||||
local lst_p = big_result:GetChild("player_list")
|
||||
if #player_list == 3 then
|
||||
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()),
|
||||
room.room_id, room.curren_round, room.room_config.round)
|
||||
local lst_p = big_result:GetChild("player_list")
|
||||
if #player_list == 3 then
|
||||
lst_p.columnGap = 108
|
||||
elseif #player_list == 2 then
|
||||
lst_p.columnGap = 208
|
||||
end
|
||||
self:InitBigResult(room, 30)
|
||||
self:InitBigResult(room, 30)
|
||||
local show_detail = room.hpOnOff == 1
|
||||
for i = 1, lst_p.numChildren do
|
||||
local com_p = lst_p:GetChildAt(i - 1)
|
||||
local list_param = com_p:GetChild("list_param")
|
||||
for j = 1, list_param.numChildren do
|
||||
local tem = list_param:GetChildAt(j - 1)
|
||||
tem:GetChild("txt_value").textFormat.size = 30
|
||||
end
|
||||
if show_detail then
|
||||
local score = 0
|
||||
if com_p:GetController("pn").selectedIndex == 0 then
|
||||
score = com_p:GetChild("txt_navigate").text
|
||||
else
|
||||
score = com_p:GetChild("txt_positive").text
|
||||
end
|
||||
score = score / room.score_times
|
||||
com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times)
|
||||
end
|
||||
end
|
||||
if room.group_id ~= 0 then
|
||||
big_result:GetController("group").selectedIndex = 1
|
||||
end
|
||||
DataManager.CurrenRoom = nil
|
||||
for i = 1, lst_p.numChildren do
|
||||
local com_p = lst_p:GetChildAt(i - 1)
|
||||
local list_param = com_p:GetChild("list_param")
|
||||
for j = 1, list_param.numChildren do
|
||||
local tem = list_param:GetChildAt(j - 1)
|
||||
tem:GetChild("txt_value").textFormat.size = 30
|
||||
end
|
||||
if show_detail then
|
||||
local score = 0
|
||||
if com_p:GetController("pn").selectedIndex == 0 then
|
||||
score = com_p:GetChild("txt_navigate").text
|
||||
else
|
||||
score = com_p:GetChild("txt_positive").text
|
||||
end
|
||||
score = score / room.score_times
|
||||
com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times)
|
||||
end
|
||||
end
|
||||
if room.group_id ~= 0 then
|
||||
big_result:GetController("group").selectedIndex = 1
|
||||
end
|
||||
DataManager.CurrenRoom = nil
|
||||
end
|
||||
|
||||
-- 起手胡详情
|
||||
|
|
@ -472,7 +467,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
cards[card] = 1
|
||||
end
|
||||
end
|
||||
for k,v in pairs(cards) do
|
||||
for k, v in pairs(cards) do
|
||||
local card = k
|
||||
if card_map[card] then
|
||||
if card_map[card] < cards[card] then
|
||||
|
|
@ -484,7 +479,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
end
|
||||
end
|
||||
local all_cards = {}
|
||||
for j,v in pairs(card_map) do
|
||||
for j, v in pairs(card_map) do
|
||||
for k = 1, v do
|
||||
table.insert(all_cards, j)
|
||||
end
|
||||
|
|
@ -493,11 +488,11 @@ function M:__AddQSInfo(data, nick, room)
|
|||
for j = 1, #all_cards do
|
||||
local citem = lst_card:AddItemFromPool()
|
||||
citem.touchable = false
|
||||
citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..all_cards[j]
|
||||
citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. all_cards[j]
|
||||
end
|
||||
local cs_zhua_niao = room.room_config.niao_type == 2
|
||||
qsinfo:GetController("niao").selectedIndex = cs_zhua_niao and 1 or 0
|
||||
item:GetChild("tex_touzi").text = cs_zhua_niao and (tem.niao[1].card .. " " .. tem.niao[2].card) or ""
|
||||
item:GetChild("tex_touzi").text = cs_zhua_niao and (tem.niao[1].card .. " " .. tem.niao[2].card) or ""
|
||||
item:GetChild("tex_score").text = tem.score
|
||||
item:GetChild("tex_niao_score").text = cs_zhua_niao and tem.niao_score or ""
|
||||
end
|
||||
|
|
@ -517,7 +512,7 @@ function M:__AddQSInfo(data, nick, room)
|
|||
_touch_start_pos = self._view:GlobalToLocal(Vector2(context.inputEvent.x, context.inputEvent.y))
|
||||
end)
|
||||
btn_di.onTouchMove:Add(function(context)
|
||||
local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y))
|
||||
local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
local dist = Vector2(xy.x - _touch_start_pos.x, xy.y - _touch_start_pos.y)
|
||||
local posx = _view_start_pos.x + dist.x
|
||||
local posy = _view_start_pos.y + dist.y
|
||||
|
|
@ -542,8 +537,8 @@ end
|
|||
local prefix
|
||||
function M:GetPrefix()
|
||||
-- if not prefix then
|
||||
prefix = get_majiang_prefix(10)
|
||||
-- end
|
||||
prefix = get_majiang_prefix(10)
|
||||
-- end
|
||||
return prefix
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ local M = {}
|
|||
|
||||
--- Create a new CS_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "CS_MainView"
|
||||
self.asset_group = "ChangSha_MJ"
|
||||
self:init()
|
||||
|
|
@ -47,7 +47,7 @@ function M:InitView(url)
|
|||
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
||||
|
||||
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
|
||||
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ function M:InitView(url)
|
|||
self._hu_tip = HuTipView.new(self)
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
--print("CS_MainView")
|
||||
---- print("CS_MainView")
|
||||
if (room.playing or room.curren_round > 0) or room.status == 1 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
|
|
@ -111,8 +111,8 @@ function M:EventInit()
|
|||
end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(CS_GameEvent.SendCards,function( ... )
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
|
||||
local arg = { ... }
|
||||
self._tex_LeftCard.text = arg[1]
|
||||
local info = self._player_card_info[1]
|
||||
info._player.auto_out_card = false
|
||||
|
|
@ -451,10 +451,10 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(CS_GameEvent.EvnetPiaoTip, function()
|
||||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self._state.selectedIndex = 1
|
||||
if oldGameVersion==1 then
|
||||
if oldGameVersion == 1 then
|
||||
self:__PiaoNiaoTip()
|
||||
else
|
||||
self:__PiaoNiaoTip1()
|
||||
|
|
@ -516,8 +516,8 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
|
|
@ -535,7 +535,7 @@ function M:OutCard(card)
|
|||
-- 防止同一帧内执行两次OutCard事件
|
||||
local last_discard_frame = discard_frame
|
||||
discard_frame = Time.frameCount
|
||||
--print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
|
||||
---- print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
|
||||
if discard_frame == last_discard_frame then
|
||||
return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ local function CardPos(obj, area, oder, loc, offset)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp, opcard)
|
||||
-- mp 是否明牌
|
||||
-- 如果不明牌,但是有 opcard 表示是起手胡
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
local handcard_list = self._mask_data["handcard_list"]
|
||||
local oder = handcard_list["oder"]
|
||||
local _player = self._player
|
||||
local comp_back = handcard_list["comp_back"]
|
||||
local comp = handcard_list["comp"]
|
||||
local outcard_list = self._mask_data["outcard_list"]
|
||||
local card = outcard_list["card"]
|
||||
-- mp 是否明牌
|
||||
-- 如果不明牌,但是有 opcard 表示是起手胡
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
local handcard_list = self._mask_data["handcard_list"]
|
||||
local oder = handcard_list["oder"]
|
||||
local _player = self._player
|
||||
local comp_back = handcard_list["comp_back"]
|
||||
local comp = handcard_list["comp"]
|
||||
local outcard_list = self._mask_data["outcard_list"]
|
||||
local card = outcard_list["card"]
|
||||
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
local opnum = opcard and #opcard or -1
|
||||
|
|
@ -73,7 +73,7 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
if opnum ~= -1 then
|
||||
loc = CardPos(obj, self._area_handcard_list, oder, loc, offset)
|
||||
else
|
||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||
end
|
||||
--改变左右两边的手牌的x值
|
||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
|
|
@ -89,8 +89,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
local outcard_list = self._mask_data["outcard_list"]
|
||||
local comp = handcard_list["comp"]
|
||||
local card = outcard_list["card"]
|
||||
--print("comp"..comp)
|
||||
-- print(vardump(_player.card_list))
|
||||
---- print("comp"..comp)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. "_3d"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -36,7 +36,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list, DataManager.CurrenRoom.room_config.no_jiang)
|
||||
local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list,
|
||||
DataManager.CurrenRoom.room_config.no_jiang)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -55,7 +56,7 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -112,7 +113,7 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
|
|
@ -152,18 +153,18 @@ function M:__OnClickHandCard(context)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context, offset)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
--
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- print(button.y - card.old_postion.y)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print(button.y - card.old_postion.y)
|
||||
-- if (button.y < -55 and _room.curren_outcard_seat == _room.self_player.seat) and self:CheckPlayerOnlineState() then
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
|
|
@ -184,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -198,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoShan_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,144 +25,137 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaoshan/ui/Extend_MJ_ChaoShan")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮汕 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮汕 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -172,8 +165,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,27 +212,27 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -265,21 +258,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -288,47 +281,45 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoShan_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoShan/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -337,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -355,7 +346,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -377,7 +368,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -403,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -424,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -444,21 +435,21 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -476,37 +467,37 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
|
|
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoShan_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -605,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -648,17 +639,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -671,12 +662,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -689,18 +680,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -714,11 +705,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -734,14 +725,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,46 +45,46 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoZhou_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,144 +25,137 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaozhou/ui/Extend_MJ_ChaoZhou")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮州 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮州 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -172,8 +165,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,27 +212,27 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -265,21 +258,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -288,57 +281,55 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoZhou_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhou/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -365,7 +356,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -387,7 +378,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -454,21 +445,21 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -484,100 +475,94 @@ function M:__FangziTip(tip, weight)
|
|||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
|
||||
for i=1,count do
|
||||
if tip.tip_map_id[i].type==6 then
|
||||
tip_hu=true
|
||||
end
|
||||
end
|
||||
for i = 1, count do
|
||||
if tip.tip_map_id[i].type == 6 then
|
||||
tip_hu = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu == true then
|
||||
if td.type == 6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
end
|
||||
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu==true then
|
||||
if td.type==6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
if tip_hu == false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if tip_hu==false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -676,7 +661,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -719,17 +704,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -742,12 +727,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -760,18 +745,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -785,11 +770,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -805,14 +790,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,46 +45,46 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "ChaoZhouGui_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,144 +25,137 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/chaozhougui/ui/Extend_MJ_ChaoZhouGui")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -172,8 +165,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,27 +212,27 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -265,21 +258,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -288,57 +281,55 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("ChaoZhouGui_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhouGui/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -347,7 +338,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -365,7 +356,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -387,7 +378,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -413,7 +404,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -434,7 +425,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -454,21 +445,21 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -484,100 +475,94 @@ function M:__FangziTip(tip, weight)
|
|||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
|
||||
for i=1,count do
|
||||
if tip.tip_map_id[i].type==6 then
|
||||
tip_hu=true
|
||||
end
|
||||
end
|
||||
for i = 1, count do
|
||||
if tip.tip_map_id[i].type == 6 then
|
||||
tip_hu = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu == true then
|
||||
if td.type == 6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
end
|
||||
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
if tip_hu==true then
|
||||
if td.type==6 then
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
if tip_hu == false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
else
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if tip_hu==false then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
else
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
|
|
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -676,7 +661,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -719,17 +704,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -742,12 +727,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -760,18 +745,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -785,11 +770,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -805,14 +790,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,46 +45,46 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 33
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 33
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,30 +45,30 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -91,23 +91,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -131,7 +131,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -140,18 +140,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,24 +45,24 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -88,23 +88,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -137,18 +137,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
table.insert(tingList, 412)
|
||||
end
|
||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -57,7 +59,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -81,10 +83,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -124,17 +126,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -168,10 +171,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -17,16 +17,16 @@ end
|
|||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -121,7 +121,7 @@ function M:OnEventSendCards(evt_data)
|
|||
_room.jing = jing
|
||||
self._cacheEvent:Enqueue(function()
|
||||
_room.banker_seat = seat
|
||||
print("========================fuzhijing")
|
||||
-- print("========================fuzhijing")
|
||||
for i = 1, #_room.player_list do
|
||||
_room.player_list[i].hand_left_count = 13
|
||||
_room.player_list[i].fz_list = {}
|
||||
|
|
@ -275,7 +275,7 @@ function M:OnEventFzAction(evt_data)
|
|||
end
|
||||
|
||||
function M:OnEventHu(evt_data)
|
||||
print("===========================OnEventHu")
|
||||
-- print("===========================OnEventHu")
|
||||
local cards = evt_data["card"]
|
||||
local win_p = self._room:GetPlayerBySeat(evt_data["seat"])
|
||||
local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"])
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ function M:EventInit()
|
|||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
print("===================================com_name", com_name)
|
||||
-- print("===================================com_name", com_name)
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ function M:FillRoomData(s2croom)
|
|||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
print("=======================在此进入")
|
||||
-- print("=======================在此进入")
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
end
|
||||
|
|
@ -141,7 +141,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
print("==========================__OnClickHandCard")
|
||||
-- print("==========================__OnClickHandCard")
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
|
|
@ -168,7 +168,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ function M:FillRoomData(s2croom)
|
|||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
print("=======================================自动开始")
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
end
|
||||
|
|
@ -141,7 +140,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ function M:__OnDragEnd(context)
|
|||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "QiZhiBa_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,146 +25,139 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/qizhiba/ui/Extend_MJ_QiZhiBa")
|
||||
MJMainView.InitView(self,"ui://Main_PokeMaJiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_PokeMaJiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人七支八 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人七支八 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3])>0 then
|
||||
self:SetShowLaiZiProcess(room.laiziInfo[3],room.laiziInfo[3],0,false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3]) > 0 then
|
||||
self:SetShowLaiZiProcess(room.laiziInfo[3], room.laiziInfo[3], 0, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_PokeMaJiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_PokeMaJiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID>0 then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID>0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID>0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID > 0 then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_PokeMaJiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
|
||||
self._hu_tip:HideHuTipsPanel()
|
||||
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
|
||||
self._hu_tip:HideHuTipsPanel()
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -174,8 +167,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -189,11 +182,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_PokeMaJiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_PokeMaJiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -202,7 +195,7 @@ function M:EventInit()
|
|||
info:UpdateHandCard()
|
||||
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
||||
info:UpdateOutCardList(outcard, card, self._cursor)
|
||||
local cardAudio=string.sub(card,2)
|
||||
local cardAudio = string.sub(card, 2)
|
||||
self:PlaySound("QiZhiBa_MJ", p.self_user.sex, tostring(cardAudio))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
if seat == _room.self_player.seat then
|
||||
|
|
@ -211,7 +204,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -222,26 +215,26 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
arg={...}
|
||||
arg = { ... }
|
||||
local _tip = arg[1]
|
||||
self:__FangziTip(_tip)
|
||||
self:__FangziTip(_tip)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -267,21 +260,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_PokeMaJiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -290,47 +283,45 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("QiZhiBa_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("QiZhiBa_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_QiZhiBa/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -339,7 +330,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -357,7 +348,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -379,7 +370,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -405,7 +396,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -426,7 +417,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -445,61 +436,58 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
function M:OutCard(card)
|
||||
local isOut=IsHasDictionary(card,DataManager.CurrenRoom.laiziInfo)
|
||||
if isOut==false then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
local isOut = IsHasDictionary(card, DataManager.CurrenRoom.laiziInfo)
|
||||
if isOut == false then
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
local cardAudio=string.sub(card,2)
|
||||
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex,tostring(cardAudio))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
local cardAudio = string.sub(card, 2)
|
||||
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex, tostring(cardAudio))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
function M:__FangziTip(tip, weight)
|
||||
local _gamectr = self._gamectr
|
||||
local _chipeng_tip = UIPackage.CreateObject("Main_PokeMaJiang", "Gcm_action_tips")
|
||||
_chipeng_tip:GetController("hide_bg").selectedIndex = 1
|
||||
self._chipeng_tip = _chipeng_tip
|
||||
local p = self._room.self_player
|
||||
-- self._player_card_info[self:GetPos(p.seat)]
|
||||
local _gamectr = self._gamectr
|
||||
local _chipeng_tip = UIPackage.CreateObject("Main_PokeMaJiang", "Gcm_action_tips")
|
||||
_chipeng_tip:GetController("hide_bg").selectedIndex = 1
|
||||
self._chipeng_tip = _chipeng_tip
|
||||
local p = self._room.self_player
|
||||
-- self._player_card_info[self:GetPos(p.seat)]
|
||||
|
||||
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
|
||||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
|
||||
_lit_fanzi:RemoveChildrenToPool()
|
||||
local _tlist = table.keys(tip.tip_map_type)
|
||||
|
||||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
table.sort(_tlist)
|
||||
local isHu = false
|
||||
for k=1,#_tlist do
|
||||
|
||||
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
table.sort(_tlist)
|
||||
local isHu = false
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_PokeMaJiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_PokeMaJiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_PokeMaJiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if isHu then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
|
|
@ -514,29 +502,26 @@ function M:__FangziTip(tip, weight)
|
|||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
_chipeng_tip:Center()
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
_chipeng_tip:Center()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function M:__TipAction(context)
|
||||
local data = context.sender.data
|
||||
local _gamectr = self._gamectr
|
||||
local tip = data[1]
|
||||
local td = data[2]
|
||||
local list = tip.tip_map_type[td.weight]
|
||||
if (#list > 1) then
|
||||
self:_ChiView(list, function(id)
|
||||
_gamectr:SendAction(id)
|
||||
self:__CloseTip()
|
||||
end)
|
||||
self._chipeng_tip.visible = false
|
||||
return
|
||||
end
|
||||
local data = context.sender.data
|
||||
local _gamectr = self._gamectr
|
||||
local tip = data[1]
|
||||
local td = data[2]
|
||||
local list = tip.tip_map_type[td.weight]
|
||||
if (#list > 1) then
|
||||
self:_ChiView(list, function(id)
|
||||
_gamectr:SendAction(id)
|
||||
self:__CloseTip()
|
||||
end)
|
||||
self._chipeng_tip.visible = false
|
||||
return
|
||||
end
|
||||
|
||||
_gamectr:SendAction(td.id)
|
||||
if (self._chipeng_tip == nil) then return end
|
||||
|
|
@ -544,55 +529,60 @@ function M:__TipAction(context)
|
|||
self._chipeng_tip = nil
|
||||
end
|
||||
|
||||
|
||||
function M:_ChiView(tiplist, callback)
|
||||
self._chipeng_tip.visible = false
|
||||
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
|
||||
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
||||
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
||||
local crossCtr = _pop_tip_choice:GetController("state")
|
||||
crossCtr.selectedIndex = #tiplist == 3 and 0 or (#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
||||
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
|
||||
_pop_tip_choice:Dispose()
|
||||
self._chipeng_tip.visible = true
|
||||
end)
|
||||
list_choose1:RemoveChildrenToPool()
|
||||
list_choose2:RemoveChildrenToPool()
|
||||
for i = 1, #tiplist do
|
||||
local list_choose = i <= 3 and list_choose1 or list_choose2
|
||||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
||||
if tiplist[i].weight ~= 1 then
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tiplist[i].card)
|
||||
end
|
||||
else
|
||||
local tem = {}
|
||||
table.insert(tem, tiplist[i].opcard[1])
|
||||
table.insert(tem, tiplist[i].opcard[2])
|
||||
local tcard = tiplist[i].card
|
||||
table.insert(tem, tcard)
|
||||
table.sort(tem, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[1])
|
||||
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[2])
|
||||
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[3])
|
||||
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
||||
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
self._chipeng_tip.visible = false
|
||||
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
|
||||
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
||||
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
||||
local crossCtr = _pop_tip_choice:GetController("state")
|
||||
crossCtr.selectedIndex = #tiplist == 3 and 0 or
|
||||
(#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
||||
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
|
||||
_pop_tip_choice:Dispose()
|
||||
self._chipeng_tip.visible = true
|
||||
end)
|
||||
list_choose1:RemoveChildrenToPool()
|
||||
list_choose2:RemoveChildrenToPool()
|
||||
for i = 1, #tiplist do
|
||||
local list_choose = i <= 3 and list_choose1 or list_choose2
|
||||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
||||
if tiplist[i].weight ~= 1 then
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tiplist[i].card)
|
||||
end
|
||||
else
|
||||
local tem = {}
|
||||
table.insert(tem, tiplist[i].opcard[1])
|
||||
table.insert(tem, tiplist[i].opcard[2])
|
||||
local tcard = tiplist[i].card
|
||||
table.insert(tem, tcard)
|
||||
table.sort(tem, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[1])
|
||||
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[2])
|
||||
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
|
||||
self:GetPrefix() .. "201_" .. tem[3])
|
||||
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
||||
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -614,27 +604,27 @@ function M:OnFangziAction(...)
|
|||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
end--]]
|
||||
|
||||
----
|
||||
local fangzi = ""
|
||||
local fz_sound = ""
|
||||
if fz.type == FZType.Peng then
|
||||
fangzi = "碰"
|
||||
fz_sound = "peng"..math.random(1, 3)
|
||||
elseif fz.type == FZType.Chi then
|
||||
fangzi = "吃"
|
||||
fz_sound = "chi"..math.random(1, 3)
|
||||
else
|
||||
if fz.opengang then
|
||||
fangzi = "杠"
|
||||
fz_sound = "gang"..math.random(1, 2)
|
||||
else
|
||||
fangzi = "补"
|
||||
fz_sound = "buzhang"
|
||||
end
|
||||
end
|
||||
self:PlaySound("QiZhiBa_MJ",player.self_user.sex,fz_sound)
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
----
|
||||
local fangzi = ""
|
||||
local fz_sound = ""
|
||||
if fz.type == FZType.Peng then
|
||||
fangzi = "碰"
|
||||
fz_sound = "peng" .. math.random(1, 3)
|
||||
elseif fz.type == FZType.Chi then
|
||||
fangzi = "吃"
|
||||
fz_sound = "chi" .. math.random(1, 3)
|
||||
else
|
||||
if fz.opengang then
|
||||
fangzi = "杠"
|
||||
fz_sound = "gang" .. math.random(1, 2)
|
||||
else
|
||||
fangzi = "补"
|
||||
fz_sound = "buzhang"
|
||||
end
|
||||
end
|
||||
self:PlaySound("QiZhiBa_MJ", player.self_user.sex, fz_sound)
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
|
||||
|
||||
|
||||
|
||||
|
|
@ -662,7 +652,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -680,7 +670,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -705,17 +695,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_PokeMaJiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_PokeMaJiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -728,12 +718,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -746,18 +736,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -771,11 +761,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -791,14 +781,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = import(".main.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,49 +45,49 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCard3)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCard3)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
if _tableInfo.laiziCard3>0 then
|
||||
local str=string.sub(_tableInfo.laiziCard3,2)
|
||||
for i=1,4 do
|
||||
table.insert(room.laiziInfo,tonumber(i..str))
|
||||
end
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCard3
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
--pt(room.laiziInfo)
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
if _tableInfo.laiziCard3 > 0 then
|
||||
local str = string.sub(_tableInfo.laiziCard3, 2)
|
||||
for i = 1, 4 do
|
||||
table.insert(room.laiziInfo, tonumber(i .. str))
|
||||
end
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCard3
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
--pt(room.laiziInfo)
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -110,24 +110,24 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
fz.allCard=op["opcard"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
fz.allCard = op["opcard"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -151,7 +151,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -160,18 +160,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -15,80 +15,72 @@ function M.new(view,mainView)
|
|||
return self
|
||||
end
|
||||
|
||||
function M:ShowHuTip(card_list,currentOnclickCard)
|
||||
if currentOnclickCard then
|
||||
if DataManager.CurrenRoom.self_player.CardTingList then
|
||||
local tempV=DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
||||
if tempV and #tempV>0 then
|
||||
self._mainView._hu_tip:FillData(tempV)
|
||||
else
|
||||
self._mainView._hu_tip:HideHuTipsPanel()
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
|
||||
function M:ShowHuTip(card_list, currentOnclickCard)
|
||||
if currentOnclickCard then
|
||||
if DataManager.CurrenRoom.self_player.CardTingList then
|
||||
local tempV = DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
|
||||
if tempV and #tempV > 0 then
|
||||
self._mainView._hu_tip:FillData(tempV)
|
||||
else
|
||||
self._mainView._hu_tip:HideHuTipsPanel()
|
||||
end
|
||||
end
|
||||
else
|
||||
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
|
||||
self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList)
|
||||
end--]]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
self:ShowHuTip(card_list)
|
||||
if getcard then
|
||||
self._out_card = true
|
||||
if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList>0 then
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local isTing,curIndex=CheckDictionaryFromContent(_carViewList[i].card_item,DataManager.CurrenRoom.self_player.tingPaiList)
|
||||
if isTing then
|
||||
--printlog("听牌提示===》》》",curIndex)
|
||||
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
|
||||
local value=#DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
||||
if tonumber(value)>1 then
|
||||
btn:GetController("mark_ting").selectedIndex=2
|
||||
else
|
||||
btn:GetController("mark_ting").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--DataManager.CurrenRoom.self_player.tingPaiList=nil
|
||||
if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList > 0 then
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local isTing, curIndex = CheckDictionaryFromContent(_carViewList[i].card_item,
|
||||
DataManager.CurrenRoom.self_player.tingPaiList)
|
||||
if isTing then
|
||||
--printlog("听牌提示===》》》",curIndex)
|
||||
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
|
||||
local value = #DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
|
||||
if tonumber(value) > 1 then
|
||||
btn:GetController("mark_ting").selectedIndex = 2
|
||||
else
|
||||
btn:GetController("mark_ting").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--DataManager.CurrenRoom.self_player.tingPaiList=nil
|
||||
else
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
|
|
@ -98,21 +90,17 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -126,8 +114,8 @@ function M:__OnClickHandCard(context)
|
|||
end
|
||||
|
||||
if self._out_card then
|
||||
printlog("点击开始出牌===>>>")
|
||||
self:ShowHuTip(card_list,button.data.card_item)
|
||||
printlog("点击开始出牌===>>>")
|
||||
self:ShowHuTip(card_list, button.data.card_item)
|
||||
end
|
||||
|
||||
-- 标记出牌
|
||||
|
|
@ -153,19 +141,19 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
local isOut=IsHasDictionary(card.card_item,DataManager.CurrenRoom.laiziInfo)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut==false) then
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
local isOut = IsHasDictionary(card.card_item, DataManager.CurrenRoom.laiziInfo)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut == false) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = button
|
||||
|
|
@ -184,6 +172,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -198,10 +187,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,15 +4,15 @@ local TableBG = require("Game.Data.TableBG")
|
|||
local MJSettingView = import(".MJSettingViewNew")
|
||||
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
||||
|
||||
local bg_config = {
|
||||
{id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01"},
|
||||
{id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02"},
|
||||
{id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03"}
|
||||
local bg_config = {
|
||||
{ id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01" },
|
||||
{ id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02" },
|
||||
{ id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03" }
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
setmetatable(M,{__index = MainView})
|
||||
setmetatable(M, { __index = MainView })
|
||||
|
||||
local default_bg = 1
|
||||
function M:InitView(url, use_custom_bg)
|
||||
|
|
@ -29,7 +29,7 @@ function M:InitView(url, use_custom_bg)
|
|||
|
||||
UIPackage.AddPackage("base/main_pokemajiang/ui/Main_PokeMaJiang")
|
||||
|
||||
MainView.InitView(self,url)
|
||||
MainView.InitView(self, url)
|
||||
local _view = self._view
|
||||
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj")
|
||||
if not use_custom_bg then
|
||||
|
|
@ -51,27 +51,26 @@ function M:InitView(url, use_custom_bg)
|
|||
end
|
||||
|
||||
local rightpanel = self._view:GetChild("com_roominfo")
|
||||
if self._rightPanelView ~= nil then
|
||||
if self._rightPanelView ~= nil then
|
||||
self._rightPanelView:Destroy()
|
||||
end
|
||||
self._rightPanelView = MJMainRightPanelView.new(self, rightpanel)
|
||||
self._rightPanelView = MJMainRightPanelView.new(self, rightpanel)
|
||||
|
||||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||
|
||||
--print("2222222222222222222222")
|
||||
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
||||
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
||||
--temp111:SetActive(false)
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function ()
|
||||
---- print("2222222222222222222222")
|
||||
---- print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
||||
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
||||
--temp111:SetActive(false)
|
||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function()
|
||||
if self.dismiss_room_cd_time > 0 then
|
||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
|
@ -82,11 +81,11 @@ function M:InitView(url, use_custom_bg)
|
|||
local _player_card_info = self._player_card_info
|
||||
for i = 1, _room.room_config.people_num do
|
||||
local tem = _view:GetChild("player_card_info" .. i)
|
||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem,i)
|
||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
||||
end
|
||||
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_card_info[self:GetPos(p.seat)]
|
||||
info:SetPlayer(p)
|
||||
|
|
@ -95,23 +94,22 @@ function M:InitView(url, use_custom_bg)
|
|||
|
||||
local list = _room.player_list
|
||||
local readyNum = 0
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
if p.ready then readyNum = readyNum + 1 end
|
||||
end
|
||||
|
||||
for i=1,#_room.player_list do
|
||||
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
if self._room.card_type == 2 then
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
end
|
||||
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
|
||||
self._ctr_action = _view:GetController("action")
|
||||
self._ctr_action = _view:GetController("action")
|
||||
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
||||
--self._ctr_action.selectedIndex = 2
|
||||
elseif not _room.self_player.ready then
|
||||
|
|
@ -122,31 +120,28 @@ function M:InitView(url, use_custom_bg)
|
|||
end
|
||||
|
||||
function M:EventInit()
|
||||
MainView.EventInit(self)
|
||||
MainView.EventInit(self)
|
||||
end
|
||||
|
||||
function M:Change3d(flag)
|
||||
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
|
||||
local _cardbox = _view:GetChild("cardbox")
|
||||
|
||||
for i=1,#_room.player_list do
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
if self._room.card_type == 2 then
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
end
|
||||
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
if self._room.card_type == 2 then
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
end
|
||||
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
|
||||
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
||||
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
||||
if flag == true then
|
||||
|
||||
if _view:GetController("3d") ~= nil then
|
||||
_view:GetController("3d").selectedIndex = 1
|
||||
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
||||
|
|
@ -199,8 +194,8 @@ function M:NewSettingView()
|
|||
-- gear:Apply()
|
||||
-- settingView.Change3d = function() end
|
||||
|
||||
settingView:FillBgSection(function(url,index)
|
||||
printlog("NewSettingView")
|
||||
settingView:FillBgSection(function(url, index)
|
||||
printlog("NewSettingView")
|
||||
LoadGameBg(url, self._root_view)
|
||||
end, self._room.game_id, 1, bg_config)
|
||||
|
||||
|
|
@ -230,30 +225,29 @@ function M:GetIndex(seat)
|
|||
end
|
||||
|
||||
function M:GetPosString(seat)
|
||||
|
||||
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "南","dir_2"
|
||||
return "南", "dir_2"
|
||||
elseif seat == 3 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
elseif seat == 4 then
|
||||
return "北","dir_4"
|
||||
return "北", "dir_4"
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "南","dir_2"
|
||||
return "南", "dir_2"
|
||||
elseif seat == 3 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
if seat == 1 then
|
||||
return "东","dir_1"
|
||||
return "东", "dir_1"
|
||||
elseif seat == 2 then
|
||||
return "西","dir_3"
|
||||
return "西", "dir_3"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -261,7 +255,7 @@ end
|
|||
function M:SetCardBoxPosition()
|
||||
local _room = self._room
|
||||
for i = 1, _room.room_config.people_num do
|
||||
local tex = self._view:GetChild("cardbox"):GetChild("direction"..i)
|
||||
local tex = self._view:GetChild("cardbox"):GetChild("direction" .. i)
|
||||
local index = _room.self_player.seat + i - 1
|
||||
index = index > 4 and index - 4 or index
|
||||
tex.text = self._gamectr:GetPosString(index)
|
||||
|
|
@ -287,16 +281,16 @@ function M:markOutCards(showTip, data)
|
|||
end
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
MainView.OnPlayerEnter(self,...)
|
||||
local arg = {...}
|
||||
MainView.OnPlayerEnter(self, ...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = self._player_card_info[self:GetPos(p.seat)]
|
||||
info:SetPlayer(p)
|
||||
info:FillData()
|
||||
end
|
||||
|
||||
function M:OnPlayerReady( ... )
|
||||
local arg = {...}
|
||||
function M:OnPlayerReady(...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
|
|
@ -316,26 +310,25 @@ function M:OnPlayerReady( ... )
|
|||
|
||||
if readyNum == _room.room_config.people_num then
|
||||
local _cardbox = _view:GetChild("cardbox")
|
||||
for i=1,#_room.player_list do
|
||||
|
||||
for i = 1, #_room.player_list do
|
||||
local p = _room.player_list[i]
|
||||
local zi,icon = self:GetPosString(p.seat)
|
||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
local zi, icon = self:GetPosString(p.seat)
|
||||
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||
end
|
||||
end
|
||||
|
||||
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
||||
if self._state.selectedIndex == 2 then
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:StartGame()
|
||||
end
|
||||
|
||||
--self._ctr_action.selectedIndex = 2
|
||||
--self._ctr_action.selectedIndex = 2
|
||||
elseif not _room.self_player.ready then
|
||||
self._ctr_action.selectedIndex = 1
|
||||
self._ctr_action.selectedIndex = 1
|
||||
else
|
||||
self._ctr_action.selectedIndex = 0
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -376,42 +369,42 @@ function M:CountCardLeftNum(card)
|
|||
return count
|
||||
end
|
||||
|
||||
function M:OnPlayerLeave( ... )
|
||||
function M:OnPlayerLeave(...)
|
||||
MainView.OnPlayerLeave(self, ...)
|
||||
local _room = self._room
|
||||
if _room.banker_seat == _room.self_player.seat then
|
||||
self._ctr_action.selectedIndex = 0
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
local isOutCard = true
|
||||
local str = "玩家 "
|
||||
for _ , player in ipairs(self._room.player_list) do
|
||||
if player.line_state == 0 then
|
||||
isOutCard = false
|
||||
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
||||
local isOutCard = true
|
||||
local str = "玩家 "
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
if player.line_state == 0 then
|
||||
isOutCard = false
|
||||
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
||||
end
|
||||
end
|
||||
end
|
||||
-- if not isOutCard then
|
||||
-- str = str.sub(str, 1, string.len(str) - string.len("、"))
|
||||
-- str = str .. " 正在赶来,请稍等"
|
||||
-- if self._room.curren_round > 0 then
|
||||
-- self._waitingView = ModalWaitingView.new(self._view, str)
|
||||
-- end
|
||||
-- else
|
||||
-- if self._waitingView then
|
||||
-- self._waitingView:CloseWaitingView()
|
||||
-- end
|
||||
-- end
|
||||
-- if not isOutCard then
|
||||
-- str = str.sub(str, 1, string.len(str) - string.len("、"))
|
||||
-- str = str .. " 正在赶来,请稍等"
|
||||
-- if self._room.curren_round > 0 then
|
||||
-- self._waitingView = ModalWaitingView.new(self._view, str)
|
||||
-- end
|
||||
-- else
|
||||
-- if self._waitingView then
|
||||
-- self._waitingView:CloseWaitingView()
|
||||
-- end
|
||||
-- end
|
||||
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:RemoveCursor()
|
||||
|
|
@ -436,10 +429,10 @@ function M:PlayMJMusic(path)
|
|||
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
||||
end
|
||||
|
||||
function M:PlaySound(group,sex,path)
|
||||
function M:PlaySound(group, sex, path)
|
||||
local sex_path = ViewUtil.Sex_Chat[sex]
|
||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3",sex_path,path)
|
||||
ViewUtil.PlaySound(group,path1)
|
||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
|
||||
ViewUtil.PlaySound(group, path1)
|
||||
end
|
||||
|
||||
function M:GetPrefix()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ local M = PlayerCardInfoView
|
|||
--- Create a new PlayerCardInfoView
|
||||
function M.new(view, mainView)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = M})
|
||||
setmetatable(self, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
|
|
@ -101,13 +101,13 @@ function M:GetPrefix()
|
|||
end
|
||||
|
||||
function M:fillCard(obj, pos_str, card, use3d)
|
||||
--printlog("=============",card)
|
||||
--printlog("=============",card)
|
||||
if self._current_card_type == 2 and (use3d == nil or use3d == true) then
|
||||
obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card
|
||||
else
|
||||
obj.icon = 'ui://Main_PokeMaJiang/' .. self:GetPrefix() .. pos_str .. card
|
||||
end
|
||||
--printlog(obj.icon)
|
||||
--printlog(obj.icon)
|
||||
end
|
||||
|
||||
function M:getBackCard(card)
|
||||
|
|
@ -126,10 +126,10 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local handcard_list = self._mask_data['handcard_list']
|
||||
local oder = handcard_list['oder']
|
||||
local _player = self._player
|
||||
-- print(vardump(self._player))
|
||||
-- -- print(vardump(self._player))
|
||||
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
-- print(vardump(_player.card_list))
|
||||
-- -- print(vardump(_player.card_list))
|
||||
if (not mp) then
|
||||
local comp_back = handcard_list['comp_back']
|
||||
if self._current_card_type == 2 then
|
||||
|
|
@ -161,8 +161,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local outcard_list = self._mask_data['outcard_list']
|
||||
local comp = handcard_list['comp']
|
||||
local card = outcard_list['card']
|
||||
--print("comp"..comp)
|
||||
-- print(vardump(_player.card_list))
|
||||
---- print("comp"..comp)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. '_3d'
|
||||
|
|
@ -271,9 +271,9 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
sortStart = #outlist
|
||||
sortStep = -1
|
||||
end
|
||||
else
|
||||
sortType = outcard_list['sorting_order3d']
|
||||
if sortType == 1 then
|
||||
else
|
||||
sortType = outcard_list['sorting_order3d']
|
||||
if sortType == 1 then
|
||||
sortStart = 1
|
||||
sortStep = 1
|
||||
elseif sortType == -1 then
|
||||
|
|
@ -296,17 +296,17 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
end
|
||||
end
|
||||
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col,0,true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row,0,true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, 0, true)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, 0, true)
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
||||
end
|
||||
--printlog(cursor)
|
||||
--printlog("设置出牌======>>>")
|
||||
--printlog(obj)
|
||||
--printlog(card)
|
||||
--printlog(outlist[i + 1])
|
||||
--printlog(cursor)
|
||||
--printlog("设置出牌======>>>")
|
||||
--printlog(obj)
|
||||
--printlog(card)
|
||||
--printlog(outlist[i + 1])
|
||||
|
||||
self:fillCard(obj, card, outlist[i + 1])
|
||||
-- 添加角标
|
||||
|
|
@ -357,9 +357,9 @@ local function getPos(my_seat, other_seat, total)
|
|||
end
|
||||
|
||||
function M:UpdateFzList(fz, index, show_card)
|
||||
printlog("UpdateFzList=====》》》")
|
||||
printlog("index===",index)
|
||||
printlog("show_card===",show_card)
|
||||
printlog("UpdateFzList=====》》》")
|
||||
printlog("index===", index)
|
||||
printlog("show_card===", show_card)
|
||||
local gn = 3
|
||||
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
||||
gn = 4
|
||||
|
|
@ -443,35 +443,35 @@ function M:UpdateFzList(fz, index, show_card)
|
|||
end
|
||||
|
||||
--if (fz.type == FZType.Gang_An and i == gn) then
|
||||
-- if self._current_card_type == 2 then
|
||||
-- _oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00')
|
||||
-- else
|
||||
-- _oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00')
|
||||
-- end
|
||||
-- if self._current_card_type == 2 then
|
||||
-- _oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00')
|
||||
-- else
|
||||
-- _oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00')
|
||||
-- end
|
||||
|
||||
-- if show_card then
|
||||
-- _oc2.icon = UIPackage.GetItemURL('Main_PokeMaJiang', '202_00')
|
||||
-- end
|
||||
-- else
|
||||
if (fz.type == FZType.Chi) then
|
||||
local index = i
|
||||
if oder == AreaOderType.right_left or oder == AreaOderType.down_up then
|
||||
index = gn - i + 1
|
||||
end
|
||||
|
||||
self:fillCard(_oc, card, fz.allCard[index])
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '201_', fz.allCard[index], false)
|
||||
end
|
||||
else
|
||||
self:fillCard(_oc, card, fz.allCard[i])
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '201_', fz.card, false)
|
||||
end
|
||||
-- if show_card then
|
||||
-- _oc2.icon = UIPackage.GetItemURL('Main_PokeMaJiang', '202_00')
|
||||
-- end
|
||||
-- else
|
||||
if (fz.type == FZType.Chi) then
|
||||
local index = i
|
||||
if oder == AreaOderType.right_left or oder == AreaOderType.down_up then
|
||||
index = gn - i + 1
|
||||
end
|
||||
-- end
|
||||
|
||||
self:fillCard(_oc, card, fz.allCard[index])
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '201_', fz.allCard[index], false)
|
||||
end
|
||||
else
|
||||
self:fillCard(_oc, card, fz.allCard[i])
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '201_', fz.card, false)
|
||||
end
|
||||
end
|
||||
-- end
|
||||
end
|
||||
|
||||
obj.touchable = false
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function M:setHandCardPos(btn_card, i, getcard)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("======================onthisUpdateHandCard")
|
||||
-- print("======================onthisUpdateHandCard")
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
|
|
@ -154,7 +154,7 @@ function M:__OnDragEnd(context)
|
|||
local _room = DataManager.CurrenRoom
|
||||
if not _room or _room:GetReloadStatus() then return end
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ local MJTableBG = {}
|
|||
|
||||
local M = MJTableBG
|
||||
local mj_bg_config = {
|
||||
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"},
|
||||
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"},
|
||||
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"},
|
||||
{id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01"},
|
||||
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"},
|
||||
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"},
|
||||
{ id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
|
||||
{ id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
|
||||
{ id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
|
||||
{ id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01" },
|
||||
{ id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
|
||||
{ id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
|
||||
}
|
||||
|
||||
local function GetBG(data, game_id)
|
||||
|
|
@ -52,12 +52,12 @@ function MJTableBG.GetTableBG(game_id)
|
|||
local id = -1
|
||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
||||
|
||||
-- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
if json_data ~= nil then
|
||||
local config_data = json.decode(json_data)
|
||||
id = GetBG(config_data, game_id)
|
||||
end
|
||||
return id
|
||||
-- -- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
|
||||
if json_data ~= nil then
|
||||
local config_data = json.decode(json_data)
|
||||
id = GetBG(config_data, game_id)
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
function MJTableBG.LoadTableBG(id, game_id, main_view)
|
||||
|
|
@ -75,11 +75,11 @@ end
|
|||
function MJTableBG.SaveTableBG(game_id, bg_id)
|
||||
local config_data
|
||||
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
|
||||
if json_data ~= nil then
|
||||
config_data = json.decode(json_data)
|
||||
else
|
||||
config_data = {}
|
||||
end
|
||||
if json_data ~= nil then
|
||||
config_data = json.decode(json_data)
|
||||
else
|
||||
config_data = {}
|
||||
end
|
||||
SetBG(config_data, game_id, bg_id)
|
||||
Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ local M = {}
|
|||
|
||||
--- Create a new ZZ_MainView
|
||||
function M.new()
|
||||
setmetatable(M,{__index = MJMainView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MJMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "MainView"
|
||||
self.asset_group = "TuiDaoHu_MJ"
|
||||
self:init()
|
||||
|
|
@ -25,144 +25,137 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/tuidaohu/ui/Extend_MJ_TuiDaoHu")
|
||||
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. '倍'
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. '倍'
|
||||
|
||||
self.LaiziBG=self._view:GetChild('n103')
|
||||
self.LaiziBG.text="鬼牌"
|
||||
self.LaiziBG.visible=false
|
||||
self.selectLaiziBtn=self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn=self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn=self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self:SetReconnentLaiziTips()
|
||||
self.LaiziBG = self._view:GetChild('n103')
|
||||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self:SetReconnentLaiziTips()
|
||||
|
||||
self:PlayerChangeLineState()
|
||||
self:PlayerChangeLineState()
|
||||
|
||||
if room.playing or room.curren_round > 0 then
|
||||
self:ReloadRoom()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:SetReconnentLaiziTips()
|
||||
local room=DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId>0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false)
|
||||
end
|
||||
local room = DataManager.CurrenRoom
|
||||
if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
|
||||
self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function M:SetLaiZiCard(btn,cardId)
|
||||
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
|
||||
function M:SetLaiZiCard(btn, cardId)
|
||||
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||
end
|
||||
|
||||
|
||||
function M:IsShowLaiZi(btn,isShow)
|
||||
btn.visible=isShow
|
||||
function M:IsShowLaiZi(btn, isShow)
|
||||
btn.visible = isShow
|
||||
end
|
||||
|
||||
|
||||
function M:HideAllLaiZiCard()
|
||||
self.Laizi1Btn.visible=false
|
||||
self.Laizi2Btn.visible=false
|
||||
self.selectLaiziBtn.visible=false
|
||||
self.LaiziBG.visible=false
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
self.LaiziBG.visible = false
|
||||
end
|
||||
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim==nil then isShowAnim=false end
|
||||
function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
|
||||
--zhongid=currentLaizi1ID
|
||||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
printlog("当前赋值结果为====>>>")
|
||||
print(beforeLaiziID)
|
||||
print(currentLaizi1ID)
|
||||
print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID)
|
||||
end
|
||||
printlog("当前赋值结果为====>>>")
|
||||
-- print(beforeLaiziID)
|
||||
-- print(currentLaizi1ID)
|
||||
-- print(currentLaizi2ID)
|
||||
self:HideAllLaiZiCard()
|
||||
self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
|
||||
self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
if currentLaizi2ID then
|
||||
self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
end
|
||||
|
||||
|
||||
if isShowAnim==true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn,true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible=true
|
||||
self:IsShowLaiZi(self.Laizi1Btn,true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn,true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible=true
|
||||
if isShowAnim == true then
|
||||
self:IsShowLaiZi(self.selectLaiziBtn, true)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1)
|
||||
self:HideAllLaiZiCard()
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
self.LaiziBG.visible = true
|
||||
self:IsShowLaiZi(self.Laizi1Btn, true)
|
||||
if currentLaizi2ID then
|
||||
self:IsShowLaiZi(self.Laizi2Btn, true)
|
||||
end
|
||||
end
|
||||
self.LaiziBG.visible = true
|
||||
end
|
||||
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
self._player_info = {}
|
||||
local _player_info = self._player_info
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
local tem = self._view:GetChild("player_info" .. i)
|
||||
_player_info[i] = PlayerInfoView.new(tem,self)
|
||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
tem.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:NewMJPlayerCardInfoView(view,index)
|
||||
function M:NewMJPlayerCardInfoView(view, index)
|
||||
if index == 1 then
|
||||
return MJPlayerSelfCardInfoView.new(view,self)
|
||||
return MJPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return MJPlayerCardInfoView.new(view,self)
|
||||
return MJPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||
MainView.EventInit(self)
|
||||
local _room = self._room
|
||||
local _view = self._view
|
||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
local _gamectr = self._gamectr
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = {...}
|
||||
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4])
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||
local arg = { ... }
|
||||
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... )
|
||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||
-- self:ShowHuTip()
|
||||
self:UpdateRound()
|
||||
self._state.selectedIndex = 1
|
||||
local list = _room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
|
|
@ -172,8 +165,8 @@ function M:EventInit()
|
|||
card_info:UpdateHandCard()
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = {...}
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||
local arg = { ... }
|
||||
self._left_time = 15
|
||||
local seat = arg[1]
|
||||
self:UpdateCardBox(self:GetPos(seat))
|
||||
|
|
@ -187,11 +180,11 @@ function M:EventInit()
|
|||
info:UpdateHandCard(true)
|
||||
end)
|
||||
|
||||
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard"
|
||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||
self:__CloseTip()
|
||||
self._left_time = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card = arg[2]
|
||||
local seat = p.seat
|
||||
|
|
@ -208,7 +201,7 @@ function M:EventInit()
|
|||
end)
|
||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
|
|
@ -219,27 +212,27 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local weight = arg[2]
|
||||
self:__FangziTip(_tip, weight)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction))
|
||||
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local win_seat = arg[1]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
local lose_seat = arg[2]
|
||||
local win_card = arg[3]
|
||||
local cards = arg[4]
|
||||
local win_list = arg[5]
|
||||
local index = self:GetPos(win_seat)
|
||||
local info = self._player_card_info[index]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard(true, true)
|
||||
|
||||
|
|
@ -265,21 +258,21 @@ function M:EventInit()
|
|||
local he = UIPackage.CreateObjectFromURL(url)
|
||||
pNode:AddChild(he)
|
||||
he:GetTransition("t2"):Play()
|
||||
he:Center()
|
||||
if _room.room_config.people_num==2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
he:Center()
|
||||
if _room.room_config.people_num == 2 then
|
||||
if win_seat ~= _room.self_player.seat then
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
he.y = he.height * 0.4 * 0.5 * -1
|
||||
end
|
||||
end
|
||||
|
||||
if win_seat == _room.self_player.seat then
|
||||
printlog("自己位置=====")
|
||||
printlog("自己位置=====")
|
||||
he:Center()
|
||||
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||
printlog("自摸地址==========")
|
||||
printlog("自摸地址==========")
|
||||
he.scaleY = 0.4
|
||||
he.scaleX = 0.4
|
||||
he.x = he.width * 0.4 * 0.5 * -1
|
||||
|
|
@ -288,46 +281,45 @@ function M:EventInit()
|
|||
|
||||
|
||||
|
||||
---
|
||||
local isZiMo=win_seat==lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu=isZiMo
|
||||
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2))
|
||||
printlog("声音====>>>",hu_sound)
|
||||
self:PlaySound("TuiDaoHu_MJ",player.self_user.sex, hu_sound)
|
||||
---
|
||||
local isZiMo = win_seat == lose_seat
|
||||
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||
printlog("声音====>>>", hu_sound)
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, hu_sound)
|
||||
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local pNode = info._view
|
||||
local url = "eff_list1"
|
||||
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_TuiDaoHu/" .. url)
|
||||
he_list.touchable = false
|
||||
pNode:AddChild(he_list)
|
||||
he_list:Center()
|
||||
|
||||
coroutine.start(function()
|
||||
for i = 1 ,#win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type>0 and tem.type<32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
for i = 1, #win_list do
|
||||
local tem = win_list[i]
|
||||
if tem.type > 0 and tem.type < 32 then
|
||||
local com_name = "he" .. tem.type
|
||||
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
|
||||
coroutine.wait(0.3)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
coroutine.wait(2)
|
||||
obj_win_card:Dispose()
|
||||
he:Dispose()
|
||||
he_list:Dispose()
|
||||
self._popEvent = true
|
||||
end)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
self._popEvent = false
|
||||
local list = arg[1]
|
||||
local start_seat = arg[2]
|
||||
-- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao,self,list, start_seat)
|
||||
-- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||
|
|
@ -336,7 +328,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
local liuju = result.liuju
|
||||
local data = result.info_list
|
||||
|
|
@ -354,7 +346,7 @@ function M:EventInit()
|
|||
self:RemoveCursor()
|
||||
if self._clearingView == nil then
|
||||
self._clearingView = EXClearingView.new(self._root_view)
|
||||
coroutine.start(function()
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
self._clearingView:Show()
|
||||
self._popEvent = true
|
||||
|
|
@ -376,7 +368,7 @@ function M:EventInit()
|
|||
end
|
||||
info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
info._view:GetController("text_color").selectedIndex = 0
|
||||
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||
|
|
@ -402,7 +394,7 @@ function M:EventInit()
|
|||
self._left_time = 0
|
||||
self:UpdateCardBox(0)
|
||||
self._ctr_cardbox.selectedIndex = 0
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
|
@ -423,7 +415,7 @@ function M:EventInit()
|
|||
end)
|
||||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local num = arg[2]
|
||||
if num > 0 then
|
||||
|
|
@ -443,21 +435,21 @@ end
|
|||
|
||||
function M:OutCard(card)
|
||||
if card ~= 0 then
|
||||
printlog("当前出牌为===>>>"..card)
|
||||
printlog("当前出牌为===>>>" .. card)
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
self._room.curren_outcard_seat = -1
|
||||
_gamectr:SendOutCard(card, function()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
local info = self._player_card_info[1]
|
||||
self:RemoveCursor()
|
||||
info:UpdateHandCard()
|
||||
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex,tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>"..card)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||
self:PlayMJSound("chupai.mp3")
|
||||
-- self:ShowHuTip()
|
||||
end)
|
||||
else
|
||||
printlog("鬼牌不能出===>>>" .. card)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -475,37 +467,37 @@ function M:__FangziTip(tip, weight)
|
|||
|
||||
local tip_hu = false
|
||||
local count = #_tlist
|
||||
for k=1,#_tlist do
|
||||
for k = 1, #_tlist do
|
||||
local td = tip.tip_map_type[_tlist[k]][1]
|
||||
local url = "ui://Main_Majiang/Btn_fztip"
|
||||
local td_weight = td.weight
|
||||
if td_weight == 16 then td_weight = 8 end
|
||||
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight
|
||||
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||
btn_t.data = { tip, td }
|
||||
btn_t.onClick:Add(self.__TipAction,self)
|
||||
btn_t.onClick:Add(self.__TipAction, self)
|
||||
end
|
||||
|
||||
-- if not (tonumber(weight) >= 16) then
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||
_btn_pass.onClick:Set(function()
|
||||
if tonumber(weight) >= 8 then
|
||||
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
guo_msg:Close()
|
||||
end)
|
||||
guo_msg:Show()
|
||||
else
|
||||
_gamectr:SendAction(0)
|
||||
_chipeng_tip:Dispose()
|
||||
self._chipeng_tip = nil
|
||||
end
|
||||
end)
|
||||
-- end
|
||||
|
||||
self._view:AddChild(_chipeng_tip)
|
||||
|
|
@ -548,20 +540,21 @@ function M:_ChiView(tiplist, callback)
|
|||
local item_choose = list_choose:AddItemFromPool()
|
||||
item_choose:GetController("type").selectedIndex = 0
|
||||
for j = 1, 4 do
|
||||
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card)
|
||||
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
|
||||
end
|
||||
item_choose.onClick:Add(function()
|
||||
callback(tiplist[i].id)
|
||||
end)
|
||||
end
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2)
|
||||
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||
(self._view.height - _pop_tip_choice.height) / 2)
|
||||
self._view:AddChild(_pop_tip_choice)
|
||||
self._pop_tip_choice = _pop_tip_choice
|
||||
end
|
||||
|
||||
function M:OnFangziAction(...)
|
||||
self:__CloseTip()
|
||||
local arg = {...}
|
||||
local arg = { ... }
|
||||
local _player_card_info = self._player_card_info
|
||||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
|
|
@ -571,12 +564,12 @@ function M:OnFangziAction(...)
|
|||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect")
|
||||
if fz.type == FZType.Peng then
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"peng"..math.random(1, 3))
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||
else
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"gang"..math.random(1, 2))
|
||||
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||
|
|
@ -603,7 +596,7 @@ end
|
|||
function M:RunNiao(list, start_seat)
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu","Panel_Birds")
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "Panel_Birds")
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
|
|
@ -621,7 +614,7 @@ function M:RunNiao(list, start_seat)
|
|||
local card = list[i].card
|
||||
coroutine.wait(0.3)
|
||||
item:GetTransition("appear"):Play()
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card)
|
||||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
coroutine.start(function()
|
||||
|
|
@ -646,17 +639,17 @@ end
|
|||
-- end
|
||||
|
||||
function M:__PiaoNiaoTip()
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||
self._view:AddChild(obj_piao)
|
||||
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||
obj_piao.y = self._view.height * 0.6
|
||||
for i = 1, 4 do
|
||||
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||
self._gamectr:SendAction(i - 1)
|
||||
obj_piao:Dispose()
|
||||
end)
|
||||
end
|
||||
self._com_piao = obj_piao
|
||||
end
|
||||
|
||||
function M:ReloadRoom(bskip)
|
||||
|
|
@ -669,12 +662,12 @@ function M:ReloadRoom(bskip)
|
|||
-- end
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
if not room.playing then
|
||||
self._state.selectedIndex = 2
|
||||
else
|
||||
self._state.selectedIndex = 1
|
||||
self._room._reload_flag = true
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #room.player_list do
|
||||
|
|
@ -687,18 +680,18 @@ function M:ReloadRoom(bskip)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||
end
|
||||
|
||||
if p.seat == room.last_outcard_seat then
|
||||
local card = p.outcard_list[#p.outcard_list]
|
||||
info:UpdateOutCardList(nil,card, self._cursor)
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
elseif p.seat == room.curren_outcard_seat then
|
||||
info:UpdateHandCard(true)
|
||||
info:UpdateOutCardList()
|
||||
|
|
@ -712,11 +705,11 @@ function M:ReloadRoom(bskip)
|
|||
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
-- end
|
||||
if bskip == nil or bskip == false then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao~=nil and p.piao_niao > 0 then
|
||||
if p.ready and room.playing == false then
|
||||
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||
end
|
||||
end
|
||||
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||
|
|
@ -732,14 +725,14 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
|
||||
function M:PlayerChangeLineState()
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
-- local isOutCard = true
|
||||
-- local str = "玩家 "
|
||||
-- for _ , player in ipairs(self._room.player_list) do
|
||||
-- if player.line_state == 0 then
|
||||
-- isOutCard = false
|
||||
-- end
|
||||
-- end
|
||||
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||
end
|
||||
|
||||
function M:UpdateCardBox(seat)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,46 +45,46 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
printlog("初始化房间数据====>>>")
|
||||
pt(_tableInfo)
|
||||
printlog(_tableInfo.laiziCard)
|
||||
printlog(_tableInfo.laiziCard2)
|
||||
printlog(_tableInfo.laiziCardBefore)
|
||||
printlog(_tableInfo.laiziCard2Before)
|
||||
|
||||
room.laiziInfo={}
|
||||
if _tableInfo.laiziCardBefore>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2>0 then
|
||||
table.insert(room.laiziInfo,_tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId=_tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo=nil
|
||||
end
|
||||
room.laiziInfo = {}
|
||||
if _tableInfo.laiziCardBefore > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard)
|
||||
if _tableInfo.laiziCard2 > 0 then
|
||||
table.insert(room.laiziInfo, _tableInfo.laiziCard2)
|
||||
end
|
||||
room.beforelaiziCardId = _tableInfo.laiziCardBefore
|
||||
else
|
||||
room.laiziInfo = nil
|
||||
end
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
pt(_config)
|
||||
pt(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
|
|
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,16 +16,16 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
|
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
|
|||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
||||
for i=1,#self._carViewList do
|
||||
local obj=self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=1
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
|
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
|
|
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -203,10 +200,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
|||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayBackView =import(".EXPlayBackView")
|
||||
local EXPlayBackView = import(".EXPlayBackView")
|
||||
local MJRoom = require("main.majiang.MJRoom")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 22
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
|
|
@ -45,24 +45,24 @@ end
|
|||
|
||||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return MJRoom.new()
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
local room = DataManager.CurrenRoom
|
||||
local room = DataManager.CurrenRoom
|
||||
|
||||
local reload = s2croom["reload"]
|
||||
local reload = s2croom["reload"]
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
|
|
@ -88,23 +88,23 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||
room.last_outcard_seat = last_outcard_seat
|
||||
room.playing = playing
|
||||
for i=1,#_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k=1,#opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list+1] = fz
|
||||
end
|
||||
for i = 1, #_info_list do
|
||||
local tem = _info_list[i]
|
||||
local playerid = tem["playerid"]
|
||||
local p = room:GetPlayerById(playerid)
|
||||
local outcard_list = tem["outcard_list"]
|
||||
p.outcard_list = outcard_list
|
||||
p.total_score = tem["score"]
|
||||
p.hand_left_count = tem["card_count"]
|
||||
p.piao_niao = tem["piao_niao"] or 0
|
||||
local opcard = tem["opcard"]
|
||||
for k = 1, #opcard do
|
||||
local op = opcard[k]
|
||||
local fz = {}
|
||||
fz.type = op["type"]
|
||||
fz.card = op["card"]
|
||||
p.fz_list[#p.fz_list + 1] = fz
|
||||
end
|
||||
if not playing and room.curren_round > 0 then
|
||||
self.GetGameController():PlayerReady()
|
||||
end
|
||||
|
|
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_round = _tableInfo["round"]
|
||||
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = room:NewPlayer()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -137,18 +137,18 @@ function M:FillPlayBackData(pd_data)
|
|||
p.ready = _jp["ready"] == 1 and true or false
|
||||
local pid = _jp["aid"]
|
||||
p.piao_niao = _jp["piao_niao"]
|
||||
-- print(DataManager.SelfUser.account_id,pid)
|
||||
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||
-- if (278 == pid) then
|
||||
-- room.self_player = p
|
||||
-- p.self_user = DataManager.SelfUser
|
||||
-- else
|
||||
if p.seat == 1 then room.self_player = p end
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
local u = User.new()
|
||||
u.account_id = pid
|
||||
p.self_user = u
|
||||
u.nick_name = _jp["nick"]
|
||||
u.head_url = _jp["portrait"]
|
||||
u.sex = _jp["sex"]
|
||||
-- end
|
||||
p.self_user.host_ip = p.self_user.host_ip
|
||||
local _hand_card = _jp["hand_card"]
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
|||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view,mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -16,7 +16,8 @@ function M.new(view,mainView)
|
|||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
--if #tingList > 0 then
|
||||
-- table.insert(tingList, 412)
|
||||
--end
|
||||
|
|
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
|
|
@ -57,7 +59,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
|
|
@ -81,10 +83,10 @@ function M:__OnClickHandCard(context)
|
|||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i=1,#_carViewList do
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
|
|
@ -124,17 +126,17 @@ function M:__OnDragStart(card)
|
|||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
|
|
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
|
|
@ -168,10 +171,10 @@ function M:Clear(bskip)
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i=1,#self._carViewList do
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,15 +20,15 @@ local ChunTian_Record_Event = {
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'},
|
||||
{id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2'},
|
||||
{id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3'}
|
||||
{ id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
|
||||
}
|
||||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M, {__index = PKPlayBackView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = PKPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'ChunTian_PlayBackView'
|
||||
self:init()
|
||||
|
||||
|
|
@ -42,7 +42,8 @@ function M:InitView(url)
|
|||
end
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
UIPackage.AddPackage('extend/poker/chuntian/ui/Extend_Poker_ChunTian')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num, default_bg, bg_config)
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num,
|
||||
default_bg, bg_config)
|
||||
self._tex_round = self._view:GetChild('round')
|
||||
self._player_card_info = {}
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -55,7 +56,7 @@ function M:InitView(url)
|
|||
self._rightPanelView:Destroy()
|
||||
end
|
||||
|
||||
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
|
||||
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
|
||||
rightpanel:GetChild("btn_setting").onClick:Clear()
|
||||
|
||||
self._player_info = {}
|
||||
|
|
@ -65,7 +66,7 @@ function M:InitView(url)
|
|||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
end
|
||||
local list = self._room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info._view.visible = true
|
||||
|
|
@ -94,7 +95,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
|||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
print("hidezhanji 1111")
|
||||
-- print("hidezhanji 1111")
|
||||
self._currentStep = 1
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -109,12 +110,12 @@ function M:FillRoomData(data)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
|
||||
if p.total_hp then
|
||||
print("hidezhanji 2222")
|
||||
-- print("hidezhanji 2222")
|
||||
|
||||
head_info._view:GetChild('zhanji').visible=false
|
||||
head_info._view:GetChild('zhanji').visible = false
|
||||
|
||||
if room.hpOnOff == 1 or room:checkHpNonnegative() then
|
||||
head_info._view:GetChild('zhanji').visible=true
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||
end
|
||||
end
|
||||
|
|
@ -125,7 +126,6 @@ function M:FillRoomData(data)
|
|||
card_info:UpdateHandPoker(p.hand_list, false, true)
|
||||
end
|
||||
head_info:UpdatePiao(p.piao)
|
||||
|
||||
end
|
||||
|
||||
self:UpdateRound()
|
||||
|
|
@ -136,7 +136,7 @@ end
|
|||
|
||||
function M:ShowStep(index)
|
||||
local step = self._step[index]
|
||||
if step==nil then
|
||||
if step == nil then
|
||||
return
|
||||
end
|
||||
for i = 1, #step.player_card_data do
|
||||
|
|
@ -152,7 +152,6 @@ function M:ShowStep(index)
|
|||
else
|
||||
info:InitPoker(p.hand_list, false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if step.cmd == ChunTian_Record_Event.Evt_OutCard then
|
||||
|
|
@ -194,7 +193,8 @@ function M:ShowStep(index)
|
|||
end
|
||||
if step.cmd == ChunTian_Record_Event.Evt_Result then
|
||||
local Result = step.Result
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type, Result.winseat, 0, Result.remaincards)
|
||||
self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type,
|
||||
Result.winseat, 0, Result.remaincards)
|
||||
local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
|
||||
self._view:AddChildAt(self.result_view._view, num)
|
||||
else
|
||||
|
|
@ -257,6 +257,7 @@ function M:CmdPass(cmd, index)
|
|||
data.cmd = cmd.cmd
|
||||
data.current_out_seat = cmd.seat
|
||||
end
|
||||
|
||||
function M:Cmdresult(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
|||
|
||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = CardView})
|
||||
setmetatable(self, { __index = CardView })
|
||||
self.btn_card = card
|
||||
self.card_code_number = cardcodenum
|
||||
self.card_code_flower = cardcodeflower
|
||||
|
|
@ -38,8 +38,8 @@ local ChunTian_PlayerSelfPokerInfoView = {
|
|||
local M = ChunTian_PlayerSelfPokerInfoView
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = ChunTian_PlayerPokerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = ChunTian_PlayerPokerInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self.gameCtr = ControllerManager.GetController(GameController)
|
||||
|
|
@ -91,7 +91,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
-- self.zhizhanplay=0
|
||||
-- self.zhizhanzdts=0
|
||||
local cs = 1.25
|
||||
if DataManager.CurrenRoom.cardsize==0 then
|
||||
if DataManager.CurrenRoom.cardsize == 0 then
|
||||
cs = 1.35
|
||||
elseif DataManager.CurrenRoom.cardsize == 1 then
|
||||
cs = 1.25
|
||||
|
|
@ -102,7 +102,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
if self.cor_init_poker ~= nil then
|
||||
coroutine.stop(self.cor_init_poker)
|
||||
end
|
||||
-- print(vardump(self.card_list))
|
||||
-- -- print(vardump(self.card_list))
|
||||
self.cor_init_poker = nil
|
||||
self.card_list = {}
|
||||
|
||||
|
|
@ -110,73 +110,72 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
if isPlayAni == true then
|
||||
self.cor_init_poker =
|
||||
coroutine.start(
|
||||
function()
|
||||
self._mainView._popEvent = false
|
||||
if self._mainView._rightPanelView._settingView ~= nil then
|
||||
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(false)
|
||||
end
|
||||
table.sort(pokerList)
|
||||
function()
|
||||
self._mainView._popEvent = false
|
||||
if self._mainView._rightPanelView._settingView ~= nil then
|
||||
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(false)
|
||||
end
|
||||
table.sort(pokerList)
|
||||
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
local card_flower_code = pokerList[i]
|
||||
local btn_card = self:CreatPoker(card_number_code, cs, open)
|
||||
local x, y = self._view.width / 2 + 100, -200
|
||||
btn_card:SetXY(x, y)
|
||||
btn_card.alpha = 0
|
||||
btn_card.touchable = false
|
||||
-- coroutine.wait(0.05)
|
||||
self.cards_view:AddChild(btn_card)
|
||||
local card_view = NewCardView(btn_card, card_number_code, card_flower_code)
|
||||
self.card_list[#self.card_list + 1] = card_view
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
local card_flower_code = pokerList[i]
|
||||
local btn_card = self:CreatPoker(card_number_code, cs, open)
|
||||
local x, y = self._view.width / 2 + 100, -200
|
||||
btn_card:SetXY(x, y)
|
||||
btn_card.alpha = 0
|
||||
btn_card.touchable = false
|
||||
-- coroutine.wait(0.05)
|
||||
self.cards_view:AddChild(btn_card)
|
||||
local card_view = NewCardView(btn_card, card_number_code, card_flower_code)
|
||||
self.card_list[#self.card_list + 1] = card_view
|
||||
|
||||
table.sort(self.card_list, tableSortNumber)
|
||||
table.sort(self.card_list, tableSortNumber)
|
||||
|
||||
if i == #pokerList then
|
||||
for j = 1, #self.card_list do
|
||||
local card = self.card_list[j]
|
||||
card.btn_card.touchable = true
|
||||
if open ~= 1 then
|
||||
-- body
|
||||
self:AddCardMoveEvent(card)
|
||||
if i == #pokerList then
|
||||
for j = 1, #self.card_list do
|
||||
local card = self.card_list[j]
|
||||
card.btn_card.touchable = true
|
||||
if open ~= 1 then
|
||||
-- body
|
||||
self:AddCardMoveEvent(card)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for j = #self.card_list, 1, -1 do
|
||||
-- ViewUtil.PlaySound('ChunTianNew_PK', 'extend/poker/runfast/sound/mopai.mp3')
|
||||
local card_view = self.card_list[j]
|
||||
card_view.index = j
|
||||
self.cards_view:SetChildIndex(card_view.btn_card, card_view.index - 1)
|
||||
for j = #self.card_list, 1, -1 do
|
||||
-- ViewUtil.PlaySound('ChunTianNew_PK', 'extend/poker/runfast/sound/mopai.mp3')
|
||||
local card_view = self.card_list[j]
|
||||
card_view.index = j
|
||||
self.cards_view:SetChildIndex(card_view.btn_card, card_view.index - 1)
|
||||
|
||||
card_view.btn_card:TweenMove(self:GetHandCardPos(j, #self.card_list), 0.10)
|
||||
DSTween.To(
|
||||
0.7,
|
||||
1,
|
||||
0.1,
|
||||
function(value)
|
||||
card_view.btn_card:SetScale(value, value)
|
||||
end
|
||||
)
|
||||
DSTween.To(
|
||||
0.7,
|
||||
1,
|
||||
0.1,
|
||||
function(value)
|
||||
card_view.btn_card.alpha = value
|
||||
end
|
||||
)
|
||||
card_view.btn_card.alpha = 1
|
||||
end
|
||||
card_view.btn_card:TweenMove(self:GetHandCardPos(j, #self.card_list), 0.10)
|
||||
DSTween.To(
|
||||
0.7,
|
||||
1,
|
||||
0.1,
|
||||
function(value)
|
||||
card_view.btn_card:SetScale(value, value)
|
||||
end
|
||||
)
|
||||
DSTween.To(
|
||||
0.7,
|
||||
1,
|
||||
0.1,
|
||||
function(value)
|
||||
card_view.btn_card.alpha = value
|
||||
end
|
||||
)
|
||||
card_view.btn_card.alpha = 1
|
||||
end
|
||||
|
||||
self._mainView._popEvent = true
|
||||
if self._mainView._rightPanelView._settingView ~= nil then
|
||||
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(true)
|
||||
self._mainView._popEvent = true
|
||||
if self._mainView._rightPanelView._settingView ~= nil then
|
||||
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
else
|
||||
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
local card_flower_code = pokerList[i]
|
||||
|
|
@ -200,7 +199,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
|||
end
|
||||
|
||||
function M:updatePoker()
|
||||
|
||||
local templist = {}
|
||||
for i = 1, #self.card_list do
|
||||
templist[#templist + 1] = self.card_list[i].card_code_flower
|
||||
|
|
@ -249,21 +247,21 @@ function M:AddCardMoveEvent(card)
|
|||
if k == #self.card_list then
|
||||
if
|
||||
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
end
|
||||
else
|
||||
if
|
||||
card.btn_card.x +
|
||||
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
||||
min_x and
|
||||
card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
||||
min_x and
|
||||
card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -285,25 +283,25 @@ function M:AddCardMoveEvent(card)
|
|||
if card.btn_card.touchable == true then
|
||||
send_card[#send_card + 1] = card
|
||||
self:SetBtnCardColor(card, 1)
|
||||
--print(vardump(card))
|
||||
---- print(vardump(card))
|
||||
if k == #self.card_list then
|
||||
if
|
||||
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
end
|
||||
else
|
||||
if
|
||||
card.btn_card.x +
|
||||
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
||||
min_x and
|
||||
card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
(self.card_width + self:GetHandCardOffset(#self.card_list)) >
|
||||
min_x and
|
||||
card.btn_card.x < max_x and
|
||||
card.card_isTouchable == 0
|
||||
then
|
||||
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
--ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -343,6 +341,7 @@ function M:AddCardMoveEvent(card)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:zhizhanxuanpai() --智障选牌
|
||||
printlog("zhizhanxuanpai")
|
||||
-- body
|
||||
|
|
@ -417,9 +416,8 @@ function M:TouchMoving(context)
|
|||
else
|
||||
if
|
||||
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
||||
card.btn_card.x < max_x
|
||||
then
|
||||
|
||||
card.btn_card.x < max_x
|
||||
then
|
||||
self:SetBtnCardColor(card, 0.8)
|
||||
if #send_card1 == 0 then
|
||||
-- body
|
||||
|
|
@ -448,8 +446,8 @@ function M:TouchMoving(context)
|
|||
else
|
||||
if
|
||||
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
|
||||
card.btn_card.x < max_x
|
||||
then
|
||||
card.btn_card.x < max_x
|
||||
then
|
||||
-- self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
|
||||
-- card.card_isTouchable = 1
|
||||
-- ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
|
||||
|
|
@ -470,7 +468,7 @@ function M:TouchMoving(context)
|
|||
end
|
||||
end
|
||||
end
|
||||
--print(vardump(send_card1))
|
||||
---- print(vardump(send_card1))
|
||||
-- local send_card = {}
|
||||
-- self.send_card = {}
|
||||
-- for i = 1, #self.card_list do
|
||||
|
|
@ -486,8 +484,8 @@ end
|
|||
function M:SetBtnCardColor(card, num)
|
||||
if
|
||||
card.btn_card:GetChildAt(0) ~= nil and card.btn_card:GetChildAt(0):GetChildAt(0) ~= nil and
|
||||
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0) ~= nil
|
||||
then
|
||||
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0) ~= nil
|
||||
then
|
||||
-- body
|
||||
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(num, num, num)
|
||||
end
|
||||
|
|
@ -599,10 +597,9 @@ end
|
|||
function M:SetOutCardBlack()
|
||||
for i = 1, #self.out_card_list do
|
||||
local card = self.out_card_list[i]
|
||||
if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
|
||||
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
|
||||
end
|
||||
|
||||
if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
|
||||
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -632,13 +629,13 @@ function M:SetOutCardList(cardlist, isAnim)
|
|||
-- todo 出牌动画
|
||||
local pos =
|
||||
self:GetOutCardEndPokerPos(
|
||||
i,
|
||||
#cardlist,
|
||||
self.cards_view,
|
||||
card.btn_card,
|
||||
self.out_card_data['maxcount_x'],
|
||||
0.7
|
||||
)
|
||||
i,
|
||||
#cardlist,
|
||||
self.cards_view,
|
||||
card.btn_card,
|
||||
self.out_card_data['maxcount_x'],
|
||||
0.7
|
||||
)
|
||||
card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time)
|
||||
-- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x)
|
||||
-- card.btn_card:GetChildAt(0):SetScale(x, x)
|
||||
|
|
@ -650,16 +647,16 @@ function M:SetOutCardList(cardlist, isAnim)
|
|||
end
|
||||
self.move_cor =
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.05)
|
||||
for i = 1, #self.out_card_list do
|
||||
local card = self.out_card_list[i]
|
||||
self.cards_view:SetChildIndex(card, i - 1)
|
||||
function()
|
||||
coroutine.wait(0.05)
|
||||
for i = 1, #self.out_card_list do
|
||||
local card = self.out_card_list[i]
|
||||
self.cards_view:SetChildIndex(card, i - 1)
|
||||
end
|
||||
coroutine.wait(0.1)
|
||||
ViewUtil.PlaySound('ChunTian_PK', 'extend/poker/runfast/sound/chupai.mp3')
|
||||
end
|
||||
coroutine.wait(0.1)
|
||||
ViewUtil.PlaySound('ChunTian_PK', 'extend/poker/runfast/sound/chupai.mp3')
|
||||
end
|
||||
)
|
||||
)
|
||||
else
|
||||
for i = 1, #cardlist do
|
||||
local poker_item = UIPackage.CreateObject('Extend_Poker_ChunTian', 'poker7')
|
||||
|
|
@ -699,13 +696,13 @@ function M:SetOutCardList(cardlist, isAnim)
|
|||
self.cards_view:AddChild(poker_item)
|
||||
local pos =
|
||||
self:GetOutCardEndPokerPos(
|
||||
i,
|
||||
#cardlist,
|
||||
self.cards_view,
|
||||
poker_item,
|
||||
self.out_card_data['maxcount_x'],
|
||||
1
|
||||
)
|
||||
i,
|
||||
#cardlist,
|
||||
self.cards_view,
|
||||
poker_item,
|
||||
self.out_card_data['maxcount_x'],
|
||||
1
|
||||
)
|
||||
poker_item.xy = Vector2.New(pos.x, pos_y)
|
||||
self.out_card_list[#self.out_card_list + 1] = poker_item
|
||||
end
|
||||
|
|
@ -785,10 +782,10 @@ function M:BtnEvent()
|
|||
end
|
||||
local send_card = {}
|
||||
self.send_card = {}
|
||||
local currentCard={}
|
||||
local currentCard = {}
|
||||
for i = 1, #self.card_list do
|
||||
local card = self.card_list[i]
|
||||
table.insert(currentCard,card.card_code_flower)
|
||||
table.insert(currentCard, card.card_code_flower)
|
||||
if card.btn_card.selected then
|
||||
send_card[#send_card + 1] = card.card_code_flower
|
||||
self.send_card[#self.send_card + 1] = card
|
||||
|
|
@ -798,7 +795,7 @@ function M:BtnEvent()
|
|||
if #send_card == 0 then
|
||||
self:ErrorTip('请选择要出的牌 ')
|
||||
else
|
||||
self.gameCtr:SendCard(send_card,currentCard)
|
||||
self.gameCtr:SendCard(send_card, currentCard)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
|
@ -851,7 +848,7 @@ function M:BtnEvent()
|
|||
|
||||
local function click_tongyibaochun(sindex)
|
||||
self.ctr_baochun.selectedIndex = 0
|
||||
printlog("jefe:",sindex)
|
||||
printlog("jefe:", sindex)
|
||||
self.gameCtr:SendTongYiBaoChun(sindex)
|
||||
end
|
||||
|
||||
|
|
@ -875,8 +872,6 @@ function M:BtnEvent()
|
|||
btn_tongyi.onClick:Set(function()
|
||||
click_tongyibaochun(1)
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function M:ShowTipsCard(index)
|
||||
|
|
@ -897,7 +892,7 @@ function M:ShowTipsCard(index)
|
|||
end
|
||||
|
||||
function M:GetHandCardOffset(count)
|
||||
local start = -70---54
|
||||
local start = -70 ---54
|
||||
|
||||
local offset = 0
|
||||
if count > 10 then
|
||||
|
|
@ -916,6 +911,7 @@ function M:GetHandCardPos(index, card_count)
|
|||
x = start_x + (self.card_width + offset) * (index - 1)
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
||||
function M:GetHandCardPos1(index, card_count)
|
||||
local x, y = 0, -18
|
||||
local offset = self:GetHandCardOffset(card_count)
|
||||
|
|
@ -924,6 +920,7 @@ function M:GetHandCardPos1(index, card_count)
|
|||
x = start_x + (self.card_width + offset) * (index - 1)
|
||||
return x, y
|
||||
end
|
||||
|
||||
function M:ChangeOneCodeByFrom(card)
|
||||
local flower = math.floor(card / 100)
|
||||
local number = card % 100
|
||||
|
|
@ -943,13 +940,13 @@ function M:ErrorTip(error_text)
|
|||
self.cor_init_poker = nil
|
||||
self.cor_init_poker =
|
||||
coroutine.start(
|
||||
function()
|
||||
self.put_error_text.text = error_text
|
||||
self.ctr_put_error.selectedIndex = 1
|
||||
coroutine.wait(2)
|
||||
self.ctr_put_error.selectedIndex = 0
|
||||
end
|
||||
)
|
||||
function()
|
||||
self.put_error_text.text = error_text
|
||||
self.ctr_put_error.selectedIndex = 1
|
||||
coroutine.wait(2)
|
||||
self.ctr_put_error.selectedIndex = 0
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
--ChunTian_CardType
|
||||
|
|
@ -969,13 +966,13 @@ end
|
|||
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
||||
local tip_list = {}
|
||||
local sidaisan = false
|
||||
local touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
local touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
|
||||
--pt(self.card_list)
|
||||
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
|
||||
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
|
||||
--pt(card_map)
|
||||
printlog("TIP type:",type)
|
||||
printlog("TIP type:", type)
|
||||
if type == ChunTian_CardType.None then
|
||||
if DataManager.CurrenRoom.is_new_bout then
|
||||
tip_list = self:NewBoutTips(card_map)
|
||||
|
|
@ -984,10 +981,10 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|||
elseif type == ChunTian_CardType.Bomb then
|
||||
tip_list, touch_key_list = self:CheckBomb(card_map, number, length)
|
||||
else
|
||||
local list_type, list_bomb, list_tuituji = {}, {}, {}
|
||||
local list_type, list_bomb, list_tuituji = {}, {}, {}
|
||||
local touch_type, touch_bomb, touch_tuituji
|
||||
list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
|
||||
local card_templist = membe_clone(self.card_list)
|
||||
list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
|
||||
local card_templist = membe_clone(self.card_list)
|
||||
|
||||
if list_bomb ~= nil and tip_templist == nil then
|
||||
-- body
|
||||
|
|
@ -1057,7 +1054,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|||
-- body
|
||||
sidaisan = true
|
||||
end
|
||||
|
||||
elseif type == ChunTian_CardType.TuiTuJI then
|
||||
list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4)
|
||||
|
||||
|
|
@ -1085,8 +1081,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
|
|||
-- body
|
||||
tip_list = self:GetMergeAllList(tip_list, tip_templist2)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
|
||||
|
|
@ -1099,7 +1093,7 @@ end
|
|||
|
||||
-- 合并多个list
|
||||
function M:GetMergeAllList(...)
|
||||
local lists = {...}
|
||||
local lists = { ... }
|
||||
local merge_list = {}
|
||||
for i = 1, #lists do
|
||||
local list_item = lists[i]
|
||||
|
|
@ -1127,13 +1121,13 @@ function M:CheckOneCard(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if k > num and #v == 1 then
|
||||
one_card_list[#one_card_list + 1] = {v[1]}
|
||||
one_card_list[#one_card_list + 1] = { v[1] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if k > num and #v ~= 1 then
|
||||
one_card_list[#one_card_list + 1] = {v[1]}
|
||||
one_card_list[#one_card_list + 1] = { v[1] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1148,7 +1142,7 @@ function M:CheckOnePair(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
|
||||
if #v > 1 and k > num then
|
||||
one_pair_list[#one_pair_list + 1] = {v[1], v[2]}
|
||||
one_pair_list[#one_pair_list + 1] = { v[1], v[2] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1163,7 +1157,7 @@ function M:CheckThree(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v > 2 and k > num then
|
||||
three_list[#three_list + 1] = {v[1], v[2], v[3]}
|
||||
three_list[#three_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list[#touch_key_list + 1] = k
|
||||
end
|
||||
end
|
||||
|
|
@ -1210,8 +1204,8 @@ function M:CheckThreeAndOne(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v >= 3 and k > num then
|
||||
three_and_one_list[#three_and_one_list + 1] = {v[1], v[2], v[3]}
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
three_and_one_list[#three_and_one_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
return three_and_one_list, touch_key_list
|
||||
|
|
@ -1225,8 +1219,8 @@ function M:CheckThreeAndTwo(pokerMap, num, length)
|
|||
end
|
||||
for k, v in pairs(pokerMap) do
|
||||
if #v >= 3 and k > num then
|
||||
three_and_two_list[#three_and_two_list + 1] = {v[1], v[2], v[3]}
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
three_and_two_list[#three_and_two_list + 1] = { v[1], v[2], v[3] }
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
return three_and_two_list, touch_key_list
|
||||
|
|
@ -1343,7 +1337,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
|||
end
|
||||
if j == i + pair_length - 1 then
|
||||
plane_list[#plane_list + 1] = item_all_list
|
||||
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1351,7 +1345,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
|
|||
end
|
||||
|
||||
function M:SetNotTouchCard(touch_key_list, card_map)
|
||||
local all_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
local all_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
|
||||
for i = 1, #all_key_list do
|
||||
local key = all_key_list[i]
|
||||
local isExsit = self:IsExistByList(touch_key_list, key)
|
||||
|
|
@ -1394,13 +1388,14 @@ function M:GetCardMapAndMaxKey(pokerList)
|
|||
max_key = number
|
||||
end
|
||||
if map[number] == nil then
|
||||
map[number] = {pokerList[i]}
|
||||
map[number] = { pokerList[i] }
|
||||
else
|
||||
map[number][#map[number] + 1] = pokerList[i]
|
||||
end
|
||||
end
|
||||
return map, max_key
|
||||
end
|
||||
|
||||
function M:CheckOnes(pokerMap, num, length)
|
||||
local one_card_list = {}
|
||||
local touch_key_list = {}
|
||||
|
|
@ -1418,7 +1413,7 @@ function M:CheckOnes(pokerMap, num, length)
|
|||
for i = 0, length - 1 do
|
||||
if l == k + i and l ~= 15 and l ~= 16 then
|
||||
-- body
|
||||
text[#text + 1] = {p[1]}
|
||||
text[#text + 1] = { p[1] }
|
||||
text2[#text2 + 1] = l
|
||||
if #text >= length then
|
||||
-- body
|
||||
|
|
@ -1446,6 +1441,7 @@ function M:CheckOnes(pokerMap, num, length)
|
|||
end
|
||||
return one_card_list, touch_key_list, length
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
self:PlayScore(nil)
|
||||
self:SetOutCardInfo(nil, false)
|
||||
|
|
@ -1456,9 +1452,9 @@ function M:Clear()
|
|||
end
|
||||
|
||||
function M:ClearCheck()
|
||||
self.card_list = {}
|
||||
self.card_list = {}
|
||||
self.out_card_list = {}
|
||||
self.cards_view:RemoveChildren(0, -1, true)
|
||||
self.cards_view:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
||||
local ChunTian_RightPanelView = {}
|
||||
local M = ChunTian_RightPanelView
|
||||
local function __init(self,mainView,view)
|
||||
local function __init(self, mainView, view)
|
||||
local right_panel = view
|
||||
|
||||
local btn_setting = right_panel:GetChild("btn_setting")
|
||||
|
|
@ -22,7 +22,7 @@ local function __init(self,mainView,view)
|
|||
end
|
||||
end)
|
||||
else
|
||||
print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
|
||||
-- print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
|
||||
if mainView.dismiss_room_cd_time > 0 then
|
||||
GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
|
|
@ -54,17 +54,18 @@ local function __init(self,mainView,view)
|
|||
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
||||
-- self._timer:Start()
|
||||
end
|
||||
function ChunTian_RightPanelView.new(mainView,view)
|
||||
setmetatable(M, {__index = MainRightPanelView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = "ChunTian_RightPanelView"
|
||||
__init(self,mainView,view)
|
||||
function ChunTian_RightPanelView.new(mainView, view)
|
||||
setmetatable(M, { __index = MainRightPanelView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ChunTian_RightPanelView"
|
||||
__init(self, mainView, view)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:__UpdateTime()
|
||||
self._tex_data.text = os.date("%Y-%m-%d")
|
||||
self._tex_time.text = os.date("%H:%M")
|
||||
if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then
|
||||
if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then
|
||||
self._pb_batteryLevel.value = GameApplication.Instance:GetBatteryLevel()
|
||||
end
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ function M:__UpdateTime()
|
|||
local ping = _client:getAveragePingTime()
|
||||
if not ping then return end
|
||||
ping = math.floor(ping / 2)
|
||||
if ping > 300 then ping =300 end
|
||||
if ping > 300 then ping = 300 end
|
||||
if ping <= 100 then
|
||||
self.ctr_xh.selectedIndex = 0
|
||||
elseif ping <= 300 then
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ local M = ExtendConfig
|
|||
|
||||
|
||||
function ExtendConfig.new()
|
||||
setmetatable(M, {__index = IExtendConfig})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = IExtendConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExtendConfig"
|
||||
self.extend_id = 14
|
||||
self._viewMap = {}
|
||||
|
|
@ -41,10 +41,10 @@ end
|
|||
|
||||
local _gameInfo = nil
|
||||
function M:GetGameInfo()
|
||||
if not _gameInfo then
|
||||
_gameInfo = EXGameInfo.new()
|
||||
end
|
||||
return _gameInfo
|
||||
if not _gameInfo then
|
||||
_gameInfo = EXGameInfo.new()
|
||||
end
|
||||
return _gameInfo
|
||||
end
|
||||
|
||||
local _ctr_game = nil
|
||||
|
|
@ -59,13 +59,12 @@ function M:NewRoom()
|
|||
return ChunTian_Room.new()
|
||||
end
|
||||
|
||||
|
||||
function M:GetIconUrl()
|
||||
return "ui://Extend_Poker_ChunTian/icon"
|
||||
--
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room,_config)
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||
end
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
local _tableInfo = s2croom["tableInfo"]
|
||||
|
||||
room.xipaiScore=_tableInfo["xipai_score"]
|
||||
room.xipaiScore = _tableInfo["xipai_score"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
room.room_config = ChunTian_RoomConfig.new(_config)
|
||||
|
|
@ -91,7 +90,7 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
|
||||
local playerList = _tableInfo["playerData"]
|
||||
for i = 1,#playerList do
|
||||
for i = 1, #playerList do
|
||||
local _jp = playerList[i]
|
||||
|
||||
local p = ChunTian_Player.new()
|
||||
|
|
@ -131,7 +130,6 @@ function M:FillRoomData(s2croom)
|
|||
room.owner_id = owner
|
||||
room.game_status = 0
|
||||
if reload then
|
||||
|
||||
local reloadInfo = s2croom["reloadInfo"]
|
||||
|
||||
|
||||
|
|
@ -141,10 +139,8 @@ function M:FillRoomData(s2croom)
|
|||
room.curren_turn_seat = reloadInfo["active_seat"]
|
||||
local info_list = reloadInfo["info_list"]
|
||||
if playing == true then
|
||||
|
||||
|
||||
room.CurnrenState = StateType.Palying
|
||||
room.game_status=1
|
||||
room.game_status = 1
|
||||
|
||||
|
||||
for i = 1, #info_list do
|
||||
|
|
@ -152,7 +148,7 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
if p == room.self_player then
|
||||
p.hand_list = reloadInfo["hand_card"]
|
||||
p.open= reloadInfo["open"]
|
||||
p.open = reloadInfo["open"]
|
||||
end
|
||||
|
||||
p.hand_count = info_list[i]["card_size"]
|
||||
|
|
@ -160,17 +156,17 @@ function M:FillRoomData(s2croom)
|
|||
p.outCards = info_list[i]["outCards"]
|
||||
local last_outcard = info_list[i]["last_outcard"]
|
||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true)
|
||||
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
else
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
end
|
||||
end
|
||||
else
|
||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
--pt(s2croom)
|
||||
room.game_status=1
|
||||
room.game_status = 1
|
||||
|
||||
room.CurnrenState = StateType.PalyingWait
|
||||
|
||||
|
|
@ -185,19 +181,18 @@ function M:FillRoomData(s2croom)
|
|||
|
||||
local last_outcard = info_list[i]["last_outcard"]
|
||||
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true)
|
||||
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
|
||||
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
else
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
end
|
||||
|
||||
p.hand_list = info_list[i]["cards"]
|
||||
p.winscore = info_list[i]["winscore"]
|
||||
p.hand_count = info_list[i]["card_size"]
|
||||
p.thisboomnum=info_list[i]["thisboomnum"]
|
||||
p.open= info_list[i]["open"]
|
||||
p.thisboomnum = info_list[i]["thisboomnum"]
|
||||
p.open = info_list[i]["open"]
|
||||
|
||||
p.handCards = info_list[i]["handCards"]
|
||||
p.outCards = info_list[i]["outCards"]
|
||||
|
|
@ -208,8 +203,6 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:FillPlayBackData(pd_data)
|
||||
local room = DataManager.CurrenRoom
|
||||
local _tableInfo = pd_data["info"]
|
||||
|
|
@ -224,7 +217,7 @@ function M:FillPlayBackData(pd_data)
|
|||
room.curren_turn_seat = active_seat
|
||||
room.curren_round = _tableInfo["round"]
|
||||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1,#_info_list do
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = ChunTian_Player.new()
|
||||
p.seat = _jp["seat"]
|
||||
|
|
@ -245,7 +238,7 @@ function M:FillPlayBackData(pd_data)
|
|||
p.hand_list = _hand_card
|
||||
p.hand_count = #_hand_card
|
||||
p.total_score = _jp["score"]
|
||||
p.open= _jp["open"]
|
||||
p.open = _jp["open"]
|
||||
p.hp_info = _jp["hp_info"]
|
||||
if _jp['hp_info'] then
|
||||
p.cur_hp = _jp.hp_info.cur_hp
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ local MuShi_GameController = {}
|
|||
local M = MuShi_GameController
|
||||
|
||||
function M.new()
|
||||
setmetatable(M, {__index = GameController})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = GameController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self:init("木虱")
|
||||
self.class = "MuShi_GameController"
|
||||
return self
|
||||
|
|
@ -39,8 +39,8 @@ function M:RegisterEvt()
|
|||
-- self._eventmap[MuShi_Protocol.MuShi_Options] = self.OnOptions
|
||||
-- self._eventmap[MuShi_Protocol.MuShi_Index_Move] = self.OnIndexMove
|
||||
--self._eventmap[MuShi_Protocol.MuShi_Play_Succ] = self.OnPlaySucc
|
||||
self._eventmap[MuShi_Protocol.MuShi_Put_Error] = self.OnPutError
|
||||
self._eventmap[MuShi_Protocol.MuShi_Pass_Succ] = self.OnPassSucc
|
||||
self._eventmap[MuShi_Protocol.MuShi_Put_Error] = self.OnPutError
|
||||
self._eventmap[MuShi_Protocol.MuShi_Pass_Succ] = self.OnPassSucc
|
||||
self._eventmap[MuShi_Protocol.MuShi_Result] = self.OnResult
|
||||
self._eventmap[MuShi_Protocol.MuShi_Bomb_Score] = self.OnBombScore
|
||||
self._eventmap[MuShi_Protocol.MuShi_Piao_Tip] = self.OnPiaoTip
|
||||
|
|
@ -61,8 +61,7 @@ function M:RegisterEvt()
|
|||
self._eventmap[MuShi_Protocol.GAME_EVT_CUOPAI_FINISH_RSP] = self.FinishCuoPai
|
||||
|
||||
|
||||
-- self._eventmap[Protocol.GAME_EVT_READY] = self.OnExTendPlayerReady
|
||||
|
||||
-- self._eventmap[Protocol.GAME_EVT_READY] = self.OnExTendPlayerReady
|
||||
end
|
||||
|
||||
function M:OnExTendPlayerReady(evt_data)
|
||||
|
|
@ -110,10 +109,10 @@ function M:SendBuPai(bupai)
|
|||
_client:send(MuShi_Protocol.MuShi_Send_Piao, _data)
|
||||
end
|
||||
|
||||
function M:SendCard(cards,currentCard)
|
||||
function M:SendCard(cards, currentCard)
|
||||
local _data = {}
|
||||
_data["card"] = cards
|
||||
_data["all_card"] = currentCard
|
||||
_data["all_card"] = currentCard
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
_client:send(MuShi_Protocol.MuShi_Send_Card, _data)
|
||||
end
|
||||
|
|
@ -141,7 +140,7 @@ function M:ConformToNextGame()
|
|||
end
|
||||
|
||||
function M:StarQiangZhuang()
|
||||
printlog("开始抢庄====================================")
|
||||
printlog("开始抢庄====================================")
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnQiangZhuang)
|
||||
|
|
@ -150,12 +149,12 @@ function M:StarQiangZhuang()
|
|||
end
|
||||
|
||||
function M:FinishCuoPai(evt_data)
|
||||
print("上报搓牌返回==================")
|
||||
-- print("上报搓牌返回==================")
|
||||
local seat = evt_data["seat"]
|
||||
local card = evt_data["card"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai,seat,card)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai, seat, card)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -167,7 +166,7 @@ function M:OtherQiangZhuang(evt_data)
|
|||
local index = evt_data["index"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang,seat,index)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang, seat, index)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -179,17 +178,17 @@ function M:DingZhuang(evt_data)
|
|||
local score = evt_data["score"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat,index,score)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat, index, score)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:StarBet(evt_data)
|
||||
printlog("开始下注 ====================================",evt_data["seat"])
|
||||
printlog("开始下注 ====================================", evt_data["seat"])
|
||||
local seat = evt_data["seat"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet,seat)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet, seat)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -202,18 +201,18 @@ function M:OtherBet(evt_data)
|
|||
local score = evt_data["mul"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat,index,score)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat, index, score)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:TiQianStar(evt_data)
|
||||
-- printlog("发起提前开始返回1111====================================")
|
||||
-- printlog("发起提前开始返回1111====================================")
|
||||
local seat = evt_data["seat"]
|
||||
local agree = evt_data["agree"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat,agree)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat, agree)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -224,7 +223,7 @@ function M:OnAgreeGame(evt_data)
|
|||
local agree = evt_data["agree"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat,agree)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat, agree)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -270,8 +269,8 @@ function M:OnInitCard(evt_data)
|
|||
--local cardopen = evt_data["cardopen"]
|
||||
|
||||
local playerAry = evt_data["playerAry"]
|
||||
-- printlog(#playerAry)
|
||||
-- pt(playerAry[1])
|
||||
-- printlog(#playerAry)
|
||||
-- pt(playerAry[1])
|
||||
local round = playerAry[1].round
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
|
|
@ -282,7 +281,7 @@ function M:OnInitCard(evt_data)
|
|||
self._room.curren_round = round
|
||||
--self._room.curren_round = round
|
||||
--DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, cardlist,cardtype,seat,cardopen)
|
||||
DispatchEvent(self._dispatcher,MuShi_GameEvent.OnInitCard,round,playerAry)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, playerAry)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -314,7 +313,8 @@ function M:OnPlaySucc(evt_data)
|
|||
player.hand_count = remain
|
||||
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
|
||||
player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,length)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,
|
||||
length)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -324,7 +324,7 @@ function M:OnPassSucc(evt_data)
|
|||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local p = self._room:GetPlayerBySeat(seat)
|
||||
p.out_card_list = {0}
|
||||
p.out_card_list = { 0 }
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p)
|
||||
end
|
||||
)
|
||||
|
|
@ -339,6 +339,7 @@ function M:OnPutError(evt_data)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:TuoGuan(isTuo)
|
||||
local _data = {}
|
||||
_data["tuoguan"] = isTuo
|
||||
|
|
@ -353,6 +354,7 @@ function M:Game_TuoGuan(evt_data)
|
|||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:OnIndexMove(evt_data)
|
||||
local seat = evt_data["index"]
|
||||
self._cacheEvent:Enqueue(
|
||||
|
|
@ -389,7 +391,6 @@ function M:OnPiaoTip(evt_data)
|
|||
--local reload = evt_data["reload"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips)
|
||||
end
|
||||
)
|
||||
|
|
@ -407,13 +408,13 @@ function M:OnPiaoAction(evt_data)
|
|||
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat,piao,card)
|
||||
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat, piao, card)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnResult(evt_data)
|
||||
-- printlog("结算消息==========================》")
|
||||
-- printlog("结算消息==========================》")
|
||||
--pt(evt_data)
|
||||
local result_type = evt_data["type"] --0小结算 1 大结算 2 解散房间
|
||||
|
||||
|
|
@ -468,6 +469,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:Game_TuoGuan(evt_data)
|
||||
local tuoguan = evt_data["tuoguan"]
|
||||
local seat = evt_data["seat"]
|
||||
|
|
@ -475,6 +477,7 @@ function M:Game_TuoGuan(evt_data)
|
|||
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:ChangeCodeByFrom(cardList, isSort)
|
||||
isSort = isSort or false
|
||||
local new_card_list = {}
|
||||
|
|
@ -595,7 +598,6 @@ end
|
|||
--Bomb = 11
|
||||
-- 牌型,大小, 长度
|
||||
function M:GetCardListInfo(cardlist)
|
||||
|
||||
if #cardlist == 0 then
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
|
|
@ -611,14 +613,12 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = math.floor(cardlist[1] / 10)
|
||||
elseif #cardlist == 3 then
|
||||
card_num = math.floor(cardlist[1] / 10)
|
||||
if card_num==14 and DataManager.CurrenRoom.room_config.threeA==1 then
|
||||
if card_num == 14 and DataManager.CurrenRoom.room_config.threeA == 1 then
|
||||
-- body
|
||||
card_type = MuShi_CardType.Bomb
|
||||
else
|
||||
card_type = MuShi_CardType.Three
|
||||
|
||||
end
|
||||
|
||||
elseif #cardlist == 4 then
|
||||
local max_key = 0
|
||||
for k, v in pairs(card_map) do
|
||||
|
|
@ -675,9 +675,7 @@ function M:GetCardListInfo(cardlist)
|
|||
local max_one_key, max_two_key, max_three_key = 0, 0, 0
|
||||
|
||||
for k, v in pairs(card_map) do
|
||||
|
||||
if #v == 2 then
|
||||
|
||||
if k > max_two_key then
|
||||
max_two_key = k
|
||||
end
|
||||
|
|
@ -687,7 +685,6 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = max_two_key
|
||||
end
|
||||
elseif #v == 1 then
|
||||
|
||||
if k > max_one_key then
|
||||
max_one_key = k
|
||||
end
|
||||
|
|
@ -697,7 +694,6 @@ function M:GetCardListInfo(cardlist)
|
|||
card_num = max_one_key
|
||||
end
|
||||
elseif #v == 3 then
|
||||
|
||||
if max_three_key == 0 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
|
|
@ -707,8 +703,8 @@ function M:GetCardListInfo(cardlist)
|
|||
elseif k < max_three_key and k == max_three_key - 1 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
-- else
|
||||
-- max_three_key = k
|
||||
-- else
|
||||
-- max_three_key = k
|
||||
end
|
||||
|
||||
--three_count = three_count + 1
|
||||
|
|
@ -727,24 +723,16 @@ function M:GetCardListInfo(cardlist)
|
|||
-- end
|
||||
plan_three_count = three_count
|
||||
|
||||
if three_count * 3 == #cardlist then
|
||||
if three_count * 3 == #cardlist then
|
||||
card_type = MuShi_CardType.Plane
|
||||
card_num = max_three_key
|
||||
|
||||
elseif three_count * 4 >= #cardlist and #cardlist%4==0 then
|
||||
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
|
||||
card_type = MuShi_CardType.PlaneAndOne
|
||||
card_num = max_three_key
|
||||
|
||||
|
||||
elseif three_count * 5 >= #cardlist and #cardlist%5==0 then
|
||||
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
|
||||
card_type = MuShi_CardType.PlaneAndTwo
|
||||
card_num = max_three_key
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
return card_type, card_num, card_length, plan_three_count
|
||||
|
|
@ -756,7 +744,7 @@ function M:GetCardMapByList(cardlist)
|
|||
local card = cardlist[i]
|
||||
local card_num = math.floor(cardlist[i] / 10)
|
||||
if card_map[card_num] == nil then
|
||||
card_map[card_num] = {card}
|
||||
card_map[card_num] = { card }
|
||||
else
|
||||
card_map[card_num][#card_map[card_num] + 1] = card
|
||||
end
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -29,15 +29,15 @@ local MuShi_Record_Event = {
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'},
|
||||
{id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'},
|
||||
{id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}
|
||||
{ id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
|
||||
{ id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' }
|
||||
}
|
||||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M, {__index = PKPlayBackView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = PKPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'MuShi_PlayBackView'
|
||||
self:init()
|
||||
|
||||
|
|
@ -51,7 +51,8 @@ function M:InitView(url)
|
|||
end
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
UIPackage.AddPackage('extend/poker/mushi/ui/Extend_Poker_MuShi')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg, bg_config)
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg,
|
||||
bg_config)
|
||||
self._tex_round = self._view:GetChild('round')
|
||||
self._player_card_info = {}
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -64,7 +65,7 @@ function M:InitView(url)
|
|||
self._rightPanelView:Destroy()
|
||||
end
|
||||
|
||||
self._rightPanelView = MuShi_RightPanelView.new(self, rightpanel)
|
||||
self._rightPanelView = MuShi_RightPanelView.new(self, rightpanel)
|
||||
rightpanel:GetChild("btn_setting").onClick:Clear()
|
||||
|
||||
self._player_info = {}
|
||||
|
|
@ -74,7 +75,7 @@ function M:InitView(url)
|
|||
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||
end
|
||||
local list = self._room.player_list
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info._view.visible = true
|
||||
|
|
@ -111,13 +112,12 @@ function M:InitView(url)
|
|||
self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong
|
||||
|
||||
self:CuoPai()
|
||||
|
||||
end
|
||||
|
||||
function M:CuoPai()
|
||||
self.cuopai = self._view:GetChild("cuopai")
|
||||
self.cuopai.visible = false
|
||||
-- print("self.btnY ",self.btnY)
|
||||
-- -- print("self.btnY ",self.btnY)
|
||||
end
|
||||
|
||||
function M:Wuyong()
|
||||
|
|
@ -132,7 +132,7 @@ function M:NewPlayerPokerInfoView(view, index)
|
|||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
--print("hidezhanji 1111")
|
||||
---- print("hidezhanji 1111")
|
||||
self._currentStep = 1
|
||||
local room = DataManager.CurrenRoom
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -147,11 +147,11 @@ function M:FillRoomData(data)
|
|||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
|
||||
if p.total_hp then
|
||||
-- print("hidezhanji 2222")
|
||||
head_info._view:GetChild('zhanji').visible=false
|
||||
-- -- print("hidezhanji 2222")
|
||||
head_info._view:GetChild('zhanji').visible = false
|
||||
|
||||
if room.hpOnOff == 1 or room:checkHpNonnegative() then
|
||||
head_info._view:GetChild('zhanji').visible=true
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
|
||||
end
|
||||
end
|
||||
|
|
@ -172,7 +172,7 @@ end
|
|||
|
||||
function M:ShowStep(index)
|
||||
local step = self._step[index]
|
||||
if step==nil then
|
||||
if step == nil then
|
||||
return
|
||||
end
|
||||
-- for i = 1, #step.player_card_data do
|
||||
|
|
@ -183,18 +183,18 @@ function M:ShowStep(index)
|
|||
-- end
|
||||
|
||||
-- Evt_alertQiangZhuang = 'alertQiangZhuang',
|
||||
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
||||
-- Evt_zhuangInfo = 'zhuangInfo',
|
||||
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
||||
-- Evt_userXiaZhu = 'userXiaZhu',
|
||||
-- Evt_alertBuPai = 'alertBuPai',
|
||||
-- Evt_playerBuPai = 'playerBuPai'
|
||||
-- Evt_userQiangZhuang = 'userQiangZhuang',
|
||||
-- Evt_zhuangInfo = 'zhuangInfo',
|
||||
-- Evt_alertXiaZhu = 'alertXiaZhu',
|
||||
-- Evt_userXiaZhu = 'userXiaZhu',
|
||||
-- Evt_alertBuPai = 'alertBuPai',
|
||||
-- Evt_playerBuPai = 'playerBuPai'
|
||||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||
player_head:MarkBank(false)
|
||||
player_head:UpdateFen(-1,0)
|
||||
player_head:UpdateFen(-1, 0)
|
||||
end
|
||||
self._player_card_info[1]:StarQiangZhuang(1)
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ function M:ShowStep(index)
|
|||
self._player_card_info[1]:StarQiangZhuang(0)
|
||||
end
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
head_info:UpdateFen(0,index)
|
||||
head_info:UpdateFen(0, index)
|
||||
end
|
||||
|
||||
if step.cmd == MuShi_Record_Event.Evt_zhuangInfo then
|
||||
|
|
@ -217,7 +217,7 @@ function M:ShowStep(index)
|
|||
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||
player_head:MarkBank(false)
|
||||
end
|
||||
head_info:UpdateFen(1,score)
|
||||
head_info:UpdateFen(1, score)
|
||||
head_info:MarkBank(true)
|
||||
end
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ function M:ShowStep(index)
|
|||
local seat = step.seat
|
||||
local index = step.index
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
head_info:UpdateFen(2,index)
|
||||
head_info:UpdateFen(2, index)
|
||||
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:StarBet(0)
|
||||
|
|
@ -241,7 +241,7 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||
local seat = step.seat
|
||||
if(seat == self._room.self_player.seat) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -253,7 +253,7 @@ function M:ShowStep(index)
|
|||
--printlog("补牌================",bupai,card)
|
||||
if (bupai == 1) then
|
||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
card_info:AddPoker(card,1)
|
||||
card_info:AddPoker(card, 1)
|
||||
end
|
||||
if self._room.self_player.seat == seat then
|
||||
local player_card_info = self._player_card_info[1]
|
||||
|
|
@ -263,7 +263,7 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
|
||||
local seat = step.seat
|
||||
if(seat == self._room.self_player.seat) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
self._player_card_info[1]:ChangeCtrBuPai(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -277,16 +277,15 @@ function M:ShowStep(index)
|
|||
|
||||
if step.cmd == MuShi_Record_Event.Evt_result then
|
||||
local result = step.result
|
||||
for i = 1,#result do
|
||||
for i = 1, #result do
|
||||
local seat = result[i].seat
|
||||
local cardType = result[i].cardType
|
||||
local cardPoint = result[i].cardPoint
|
||||
|
||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
card_info:SetCarType(cardType,cardPoint)
|
||||
card_info:SetCarType(cardType, cardPoint)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function M:GenerateAllStepData(data)
|
||||
|
|
@ -314,14 +313,12 @@ function M:GenerateAllStepData(data)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:CmdAlertQiangZhuang(cmd,index) --通知抢庄
|
||||
function M:CmdAlertQiangZhuang(cmd, index) --通知抢庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
end
|
||||
|
||||
function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
||||
function M:CmdUserQiangZhuang(cmd, index) --玩家抢庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
|
|
@ -329,7 +326,7 @@ function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
|
|||
data.score = cmd.data.score
|
||||
end
|
||||
|
||||
function M:CmdZhuangInfo(cmd,index) --定庄
|
||||
function M:CmdZhuangInfo(cmd, index) --定庄
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
|
|
@ -337,47 +334,45 @@ function M:CmdZhuangInfo(cmd,index) --定庄
|
|||
data.score = cmd.data.score
|
||||
end
|
||||
|
||||
function M:CmdAlertXiaZhu(cmd,index) --通知下注
|
||||
function M:CmdAlertXiaZhu(cmd, index) --通知下注
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.data.cmd
|
||||
data.seat = cmd.data.seat
|
||||
end
|
||||
|
||||
function M:CmdUserXiaZhu(cmd,index) --玩家下注
|
||||
function M:CmdUserXiaZhu(cmd, index) --玩家下注
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
data.index = cmd.data.index
|
||||
end
|
||||
|
||||
function M:CmdAlertBuPai(cmd,index) --通知补牌
|
||||
function M:CmdAlertBuPai(cmd, index) --通知补牌
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.data.cmd
|
||||
data.seat = cmd.data.seat
|
||||
end
|
||||
|
||||
function M:CmdPlayerBuPai(cmd,index) --玩家补牌
|
||||
function M:CmdPlayerBuPai(cmd, index) --玩家补牌
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.bupai = cmd.data.bupai
|
||||
data.card = cmd.data.card
|
||||
end
|
||||
|
||||
function M:CmdPlayerSendCards(cmd,index)
|
||||
function M:CmdPlayerSendCards(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.seat = cmd.data.seat
|
||||
data.cards = cmd.data.cards
|
||||
end
|
||||
|
||||
function M:CmdResult(cmd,index)
|
||||
function M:CmdResult(cmd, index)
|
||||
local data = self:CopyLastStep(index)
|
||||
data.cmd = cmd.cmd
|
||||
data.result = cmd.data.result
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:CopyLastStep(index)
|
||||
local step = {}
|
||||
local last_step = self._step[index]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ local CardView = {
|
|||
|
||||
local function NewCardView(card, cardcodenum, cardcodeflower)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = CardView})
|
||||
setmetatable(self, { __index = CardView })
|
||||
self.btn_card = card
|
||||
self.card_code_number = cardcodenum
|
||||
self.card_code_flower = cardcodeflower
|
||||
|
|
@ -38,8 +38,8 @@ local MuShi_PlayerSelfPokerInfoView = {
|
|||
local M = MuShi_PlayerSelfPokerInfoView
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = MuShi_PlayerPokerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
setmetatable(M, { __index = MuShi_PlayerPokerInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self.gameCtr = ControllerManager.GetController(GameController)
|
||||
|
|
@ -81,7 +81,7 @@ function M:init()
|
|||
self.carType.visible = false
|
||||
self.carText = self.carType:GetChild("n1")
|
||||
self.carText.text = ""
|
||||
-- self.carIcon.icon = "ui://Extend_Poker_MuShi/ms_type_10"
|
||||
-- self.carIcon.icon = "ui://Extend_Poker_MuShi/ms_type_10"
|
||||
--card_niao.icon = "ui://Main_Majiang/202_" .. currentNiaoList[i].card
|
||||
|
||||
self.btnBuPai = self._view:GetChild("bupai")
|
||||
|
|
@ -113,8 +113,6 @@ function M:init()
|
|||
self:BtnEvent()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:BtnEvent()
|
||||
self.btnBuPai.onClick:Set(function()
|
||||
--printlog("点击补牌=================================")
|
||||
|
|
@ -198,7 +196,7 @@ function M:ChangeCtrBuPai(b)
|
|||
self.ctr_bupai.selectedIndex = b
|
||||
end
|
||||
|
||||
function M:InitPoker(pokerList,cardtype,cardopen)
|
||||
function M:InitPoker(pokerList, cardtype, cardopen)
|
||||
self.cardopen = cardopen
|
||||
for i = 1, #pokerList do
|
||||
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
|
||||
|
|
@ -213,7 +211,7 @@ function M:InitPoker(pokerList,cardtype,cardopen)
|
|||
for i = 1, #self.card_list do
|
||||
local card = self.card_list[i]
|
||||
card.index = i
|
||||
-- self.cards_view:SetChildIndex(card.btn_card, card.index - 1)
|
||||
-- self.cards_view:SetChildIndex(card.btn_card, card.index - 1)
|
||||
--card.btn_card.xy = self:GetHandCardPos(i, #self.card_list)
|
||||
end
|
||||
|
||||
|
|
@ -236,10 +234,8 @@ function M:InitPoker2(pokerList)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:AddPoker(poker)
|
||||
--print("玩家自己加牌===========================================")
|
||||
---- print("玩家自己加牌===========================================")
|
||||
local card_number_code = self:ChangeOneCodeByFrom(poker)
|
||||
local card_flower_code = poker
|
||||
local btn_card = self:CreatPoker(poker, 1, 0)
|
||||
|
|
@ -260,12 +256,12 @@ function M:GetHandCardPos(index, card_count)
|
|||
local x, y = 0, -18
|
||||
local offset = 40
|
||||
|
||||
x = offset*index
|
||||
x = offset * index
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
||||
function M:ChangeOneCodeByFrom(card)
|
||||
if(card > 500) then
|
||||
if (card > 500) then
|
||||
return card
|
||||
end
|
||||
local flower = math.floor(card / 100)
|
||||
|
|
@ -283,13 +279,13 @@ function M:ErrorTip(error_text)
|
|||
self.cor_init_poker = nil
|
||||
self.cor_init_poker =
|
||||
coroutine.start(
|
||||
function()
|
||||
self.put_error_text.text = error_text
|
||||
self.ctr_put_error.selectedIndex = 1
|
||||
coroutine.wait(2)
|
||||
self.ctr_put_error.selectedIndex = 0
|
||||
end
|
||||
)
|
||||
function()
|
||||
self.put_error_text.text = error_text
|
||||
self.ctr_put_error.selectedIndex = 1
|
||||
coroutine.wait(2)
|
||||
self.ctr_put_error.selectedIndex = 0
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
|
|
@ -299,7 +295,7 @@ function M:Clear()
|
|||
self.out_card_list = {}
|
||||
self.cards_view:RemoveChildren(0, -1, true)
|
||||
self.carType.visible = false
|
||||
--self.mask_liangpai:RemoveChildren(0,-1,true)
|
||||
--self.mask_liangpai:RemoveChildren(0,-1,true)
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ function M:FillRoomData(s2croom)
|
|||
end
|
||||
end
|
||||
else
|
||||
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||
--pt(s2croom)
|
||||
room.game_status = 1
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue