全部放大

master
罗家炜 2025-04-11 12:49:08 +08:00
parent 944b9ed164
commit 9e830c82b5
157 changed files with 16807 additions and 17704 deletions

View File

@ -67,7 +67,7 @@ function NetClient.new(host, game, protocol)
-- self.responseMap = {} -- self.responseMap = {}
self.onevent = event("onevent", false) self.onevent = event("onevent", false)
self.onconnect = event("onconnect", false) self.onconnect = event("onconnect", false)
--print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol) ---- print("222222222222222222222222222222222222222222 ",host," ",host," ",game," ",self.protocol)
self.c__netClient = LuaNetClient(host, game, self, self.protocol) self.c__netClient = LuaNetClient(host, game, self, self.protocol)
self.c__netClient:SetCallBackListener(R.c__ondata) self.c__netClient:SetCallBackListener(R.c__ondata)
@ -92,7 +92,7 @@ local NULL_JSON = "{}"
--- send --- send
function R.send(self, cmd, data, callback) function R.send(self, cmd, data, callback)
if (debug_print) then if (debug_print) then
print("send host:" .. self.host) -- print("send host:" .. self.host)
end end
if self.c__netClient == nil then if self.c__netClient == nil then
return return
@ -170,7 +170,7 @@ end
---c#网络层回调函数 ---c#网络层回调函数
function R.c__onconnect(self, code) function R.c__onconnect(self, code)
if (debug_print) then if (debug_print) then
print("codeccccccccccccccccccccccccccccccccccccccc" .. code) -- print("codeccccccccccccccccccccccccccccccccccccccc" .. code)
end end
self.onconnect(code) self.onconnect(code)
end end

View File

@ -2,8 +2,8 @@ Queue = {}
function Queue.new(capacity) function Queue.new(capacity)
local self = {} local self = {}
setmetatable(self,{__index = Queue}) setmetatable(self, { __index = Queue })
self.capacity = capacity self.capacity = capacity
self.queue = {} self.queue = {}
self.size_ = 0 self.size_ = 0
@ -20,11 +20,11 @@ function Queue:Enqueue(element)
self.queue[self.rear] = element self.queue[self.rear] = element
else else
local temp = (self.rear + 1) % self.capacity local temp = (self.rear + 1) % self.capacity
--print("1111111111111111111====>>>>") ---- print("1111111111111111111====>>>>")
--print(temp) ---- print(temp)
if temp == self.head then if temp == self.head then
error("Error: capacity is full.") error("Error: capacity is full.")
ViewUtil.ErrorTip(10001,"Error: capacity is full.") ViewUtil.ErrorTip(10001, "Error: capacity is full.")
return return
else else
self.rear = temp self.rear = temp
@ -33,12 +33,11 @@ function Queue:Enqueue(element)
self.queue[self.rear] = element self.queue[self.rear] = element
self.size_ = self.size_ + 1 self.size_ = self.size_ + 1
end end
end end
function Queue:Dequeue() function Queue:Dequeue()
if self:IsEmpty() then if self:IsEmpty() then
ViewUtil.ErrorTip(10002,"Error: The Queue is empty.") ViewUtil.ErrorTip(10002, "Error: The Queue is empty.")
error("Error: The Queue is empty.") error("Error: The Queue is empty.")
return return
end end
@ -74,16 +73,16 @@ function Queue:dump()
local first_flag = true local first_flag = true
while h ~= r do while h ~= r do
if first_flag == true then if first_flag == true then
str = "{"..self.queue[h] str = "{" .. self.queue[h]
h = (h + 1) % self.capacity h = (h + 1) % self.capacity
first_flag = false first_flag = false
else else
str = str..","..self.queue[h] str = str .. "," .. self.queue[h]
h = (h + 1) % self.capacity h = (h + 1) % self.capacity
end end
end end
str = str..","..self.queue[r].."}" str = str .. "," .. self.queue[r] .. "}"
if(debug_print) then if (debug_print) then
print(str) -- print(str)
end end
end end

View File

@ -5,132 +5,131 @@
bit = bit or {} bit = bit or {}
function bit.init32() function bit.init32()
bit.data32 = {} bit.data32 = {}
for i=1,32 do for i = 1, 32 do
bit.data32[i]=2^(32-i) bit.data32[i] = 2 ^ (32 - i)
end end
end end
bit.init32() bit.init32()
function bit:d2b(arg) --bit:d2b function bit:d2b(arg) --bit:d2b
local tr={} local tr = {}
for i=1,32 do for i = 1, 32 do
if arg >= self.data32[i] then if arg >= self.data32[i] then
tr[i]=1 tr[i] = 1
arg=arg-self.data32[i] arg = arg - self.data32[i]
else else
tr[i]=0 tr[i] = 0
end end
end end
return tr return tr
end end
function bit:b2d(arg) --bit:b2d function bit:b2d(arg) --bit:b2d
local nr=0 local nr = 0
for i=1,32 do for i = 1, 32 do
if arg[i] ==1 then if arg[i] == 1 then
nr=nr+2^(32-i) nr = nr + 2 ^ (32 - i)
end end
end end
return nr return nr
end end
function bit:_xor(a,b) --bit:xor function bit:_xor(a, b) --bit:xor
local op1=self:d2b(a) local op1 = self:d2b(a)
local op2=self:d2b(b) local op2 = self:d2b(b)
local r={} local r = {}
for i=1,32 do for i = 1, 32 do
if op1[i]==op2[i] then if op1[i] == op2[i] then
r[i]=0 r[i] = 0
else else
r[i]=1 r[i] = 1
end end
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:_and(a,b) --bit:_and function bit:_and(a, b) --bit:_and
local op1=self:d2b(a) local op1 = self:d2b(a)
local op2=self:d2b(b) local op2 = self:d2b(b)
local r={} local r = {}
for i=1,32 do for i = 1, 32 do
if op1[i]==1 and op2[i]==1 then if op1[i] == 1 and op2[i] == 1 then
r[i]=1 r[i] = 1
else else
r[i]=0 r[i] = 0
end end
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:_or(a,b) --bit:_or function bit:_or(a, b) --bit:_or
local op1=self:d2b(a) local op1 = self:d2b(a)
local op2=self:d2b(b) local op2 = self:d2b(b)
local r={} local r = {}
for i=1,32 do for i = 1, 32 do
if op1[i]==1 or op2[i]==1 then if op1[i] == 1 or op2[i] == 1 then
r[i]=1 r[i] = 1
else else
r[i]=0 r[i] = 0
end end
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:_not(a) --bit:_not function bit:_not(a) --bit:_not
local op1=self:d2b(a) local op1 = self:d2b(a)
local r={} local r = {}
for i=1,32 do for i = 1, 32 do
if op1[i]==1 then if op1[i] == 1 then
r[i]=0 r[i] = 0
else else
r[i]=1 r[i] = 1
end end
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:_rshift(a,n) --bit:_rshift function bit:_rshift(a, n) --bit:_rshift
local op1=self:d2b(a) local op1 = self:d2b(a)
local r=self:d2b(0) local r = self:d2b(0)
if n < 32 and n > 0 then if n < 32 and n > 0 then
for i=1,n do for i = 1, n do
for i=31,1,-1 do for i = 31, 1, -1 do
op1[i+1]=op1[i] op1[i + 1] = op1[i]
end end
op1[1]=0 op1[1] = 0
end end
r=op1 r = op1
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:_lshift(a,n) --bit:_lshift function bit:_lshift(a, n) --bit:_lshift
local op1=self:d2b(a) local op1 = self:d2b(a)
local r=self:d2b(0) local r = self:d2b(0)
if n < 32 and n > 0 then if n < 32 and n > 0 then
for i=1,n do for i = 1, n do
for i=1,31 do for i = 1, 31 do
op1[i]=op1[i+1] op1[i] = op1[i + 1]
end end
op1[32]=0 op1[32] = 0
end end
r=op1 r = op1
end end
return self:b2d(r) return self:b2d(r)
end end
function bit:print(ta) function bit:print(ta)
local sr="" local sr = ""
for i=1,32 do for i = 1, 32 do
sr=sr..ta[i] sr = sr .. ta[i]
end end
print(sr) -- print(sr)
end end

View File

@ -1,5 +1,3 @@
string._htmlspecialchars_set = {} string._htmlspecialchars_set = {}
string._htmlspecialchars_set["&"] = "&amp;" string._htmlspecialchars_set["&"] = "&amp;"
string._htmlspecialchars_set["\""] = "&quot;" string._htmlspecialchars_set["\""] = "&quot;"
@ -10,7 +8,7 @@ string._htmlspecialchars_set[">"] = "&gt;"
--[[-- --[[--
HTML HTML
~~~ lua ~~~ lua
print(string.htmlspecialchars("<ABC>")) -- print(string.htmlspecialchars("<ABC>"))
-- 输出 &lt;ABC&gt; -- 输出 &lt;ABC&gt;
~~~ ~~~
@param string input @param string input
@ -26,7 +24,7 @@ end
--[[-- --[[--
HTML string.htmlspecialchars() HTML string.htmlspecialchars()
~~~ lua ~~~ lua
print(string.restorehtmlspecialchars("&lt;ABC&gt;")) -- print(string.restorehtmlspecialchars("&lt;ABC&gt;"))
-- 输出 <ABC> -- 输出 <ABC>
~~~ ~~~
@param string input @param string input
@ -42,7 +40,7 @@ end
--[[-- --[[--
\n HTML \n HTML
~~~ lua ~~~ lua
print(string.nl2br("Hello\nWorld")) -- print(string.nl2br("Hello\nWorld"))
-- 输出 -- 输出
-- Hello<br />World -- Hello<br />World
~~~ ~~~
@ -56,7 +54,7 @@ end
--[[-- --[[--
\n HTML \n HTML
~~~ lua ~~~ lua
print(string.nl2br("<Hello>\nWorld")) -- print(string.nl2br("<Hello>\nWorld"))
-- 输出 -- 输出
-- &lt;Hello&gt;<br />World -- &lt;Hello&gt;<br />World
~~~ ~~~
@ -88,10 +86,10 @@ local res = string.split(input, "-+-")
function string.split(input, delimiter) function string.split(input, delimiter)
input = tostring(input) input = tostring(input)
delimiter = tostring(delimiter) delimiter = tostring(delimiter)
if (delimiter=='') then return false end if (delimiter == '') then return false end
local pos,arr = 0, {} local pos, arr = 0, {}
-- for each divider found -- for each divider found
for st,sp in function() return string.find(input, delimiter, pos, true) end do for st, sp in function() return string.find(input, delimiter, pos, true) end do
table.insert(arr, string.sub(input, pos, st - 1)) table.insert(arr, string.sub(input, pos, st - 1))
pos = sp + 1 pos = sp + 1
end end
@ -103,7 +101,7 @@ end
~~~ lua ~~~ lua
local input = " ABC" local input = " ABC"
print(string.ltrim(input)) -- print(string.ltrim(input))
-- 输出 ABC输入字符串前面的两个空格被去掉了 -- 输出 ABC输入字符串前面的两个空格被去掉了
~~~ ~~~
@ -123,7 +121,7 @@ end
~~~ lua ~~~ lua
local input = "ABC " local input = "ABC "
print(string.ltrim(input)) -- print(string.ltrim(input))
-- 输出 ABC输入字符串最后的两个空格被去掉了 -- 输出 ABC输入字符串最后的两个空格被去掉了
~~~ ~~~
@param string input @param string input
@ -149,7 +147,7 @@ end
~~~ lua ~~~ lua
local input = "hello" local input = "hello"
print(string.ucfirst(input)) -- print(string.ucfirst(input))
-- 输出 Hello -- 输出 Hello
~~~ ~~~
@param string input @param string input
@ -167,7 +165,7 @@ end
URL URL
~~~ lua ~~~ lua
local input = "hello world" local input = "hello world"
print(string.urlencode(input)) -- print(string.urlencode(input))
-- 输出 -- 输出
-- hello%20world -- hello%20world
~~~ ~~~
@ -188,7 +186,7 @@ end
URL URL
~~~ lua ~~~ lua
local input = "hello%20world" local input = "hello%20world"
print(string.urldecode(input)) -- print(string.urldecode(input))
-- 输出 -- 输出
-- hello world -- hello world
~~~ ~~~
@ -197,9 +195,9 @@ print(string.urldecode(input))
@see string.urlencode @see string.urlencode
]] ]]
function string.urldecode(input) function string.urldecode(input)
input = string.gsub (input, "+", " ") input = string.gsub(input, "+", " ")
input = string.gsub (input, "%%(%x%x)", function(h) return string.char(checknumber(h,16)) end) input = string.gsub(input, "%%(%x%x)", function(h) return string.char(checknumber(h, 16)) end)
input = string.gsub (input, "\r\n", "\n") input = string.gsub(input, "\r\n", "\n")
return input return input
end end
@ -207,7 +205,7 @@ end
UTF8 UTF8
~~~ lua ~~~ lua
local input = "你好World" local input = "你好World"
print(string.utf8len(input)) -- print(string.utf8len(input))
-- 输出 7 -- 输出 7
~~~ ~~~
@param string input @param string input
@ -219,7 +217,7 @@ function string.utf8len(input)
local len = string.len(input) local len = string.len(input)
local left = len local left = len
local cnt = 0 local cnt = 0
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc} local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
while left ~= 0 do while left ~= 0 do
local tmp = string.byte(input, -left) local tmp = string.byte(input, -left)
local i = #arr local i = #arr
@ -247,11 +245,11 @@ function string.utf8sub(input, index, endIndex)
endIndex = index endIndex = index
index = 1 index = 1
end end
local len = string.len(input) local len = string.len(input)
local left = len local left = len
local cnt = 0 local cnt = 0
local head, tail = 0, 0 local head, tail = 0, 0
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc} local arr = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc }
while left ~= 0 do while left ~= 0 do
if cnt + 1 == index then if cnt + 1 == index then
head = len - left + 1 head = len - left + 1
@ -278,7 +276,7 @@ end
--[[-- --[[--
~~~ lua ~~~ lua
print(string.formatnumberthousands(1924235)) -- print(string.formatnumberthousands(1924235))
-- 输出 1,924,235 -- 输出 1,924,235
~~~ ~~~
@param number num @param number num
@ -294,12 +292,11 @@ function string.formatnumberthousands(num)
return formatted return formatted
end end
function string.concat(...)
function string.concat( ... )
local str = {} local str = {}
local tem = {...} local tem = { ... }
for _,v in ipairs(tem) do for _, v in ipairs(tem) do
str[#str + 1] = v str[#str + 1] = v
end end
return table.concat(str , "") return table.concat(str, "")
end end

View File

@ -1,46 +1,46 @@
EventContext = FairyGUI.EventContext EventContext = FairyGUI.EventContext
EventListener = FairyGUI.EventListener EventListener = FairyGUI.EventListener
EventDispatcher = FairyGUI.EventDispatcher EventDispatcher = FairyGUI.EventDispatcher
InputEvent = FairyGUI.InputEvent InputEvent = FairyGUI.InputEvent
NTexture = FairyGUI.NTexture NTexture = FairyGUI.NTexture
Container = FairyGUI.Container Container = FairyGUI.Container
Image = FairyGUI.Image Image = FairyGUI.Image
Stage = FairyGUI.Stage Stage = FairyGUI.Stage
Controller = FairyGUI.Controller Controller = FairyGUI.Controller
GObject = FairyGUI.GObject GObject = FairyGUI.GObject
GGraph = FairyGUI.GGraph GGraph = FairyGUI.GGraph
GGroup = FairyGUI.GGroup GGroup = FairyGUI.GGroup
GImage = FairyGUI.GImage GImage = FairyGUI.GImage
GLoader = FairyGUI.GLoader GLoader = FairyGUI.GLoader
GMovieClip = FairyGUI.GMovieClip GMovieClip = FairyGUI.GMovieClip
TextFormat = FairyGUI.TextFormat TextFormat = FairyGUI.TextFormat
GTextField = FairyGUI.GTextField GTextField = FairyGUI.GTextField
GRichTextField = FairyGUI.GRichTextField GRichTextField = FairyGUI.GRichTextField
GTextInput = FairyGUI.GTextInput GTextInput = FairyGUI.GTextInput
GComponent = FairyGUI.GComponent GComponent = FairyGUI.GComponent
GList = FairyGUI.GList GList = FairyGUI.GList
GRoot = FairyGUI.GRoot GRoot = FairyGUI.GRoot
GLabel = FairyGUI.GLabel GLabel = FairyGUI.GLabel
GButton = FairyGUI.GButton GButton = FairyGUI.GButton
GComboBox = FairyGUI.GComboBox GComboBox = FairyGUI.GComboBox
GProgressBar = FairyGUI.GProgressBar GProgressBar = FairyGUI.GProgressBar
GSlider = FairyGUI.GSlider GSlider = FairyGUI.GSlider
PopupMenu = FairyGUI.PopupMenu PopupMenu = FairyGUI.PopupMenu
ScrollPane = FairyGUI.ScrollPane ScrollPane = FairyGUI.ScrollPane
Transition = FairyGUI.Transition Transition = FairyGUI.Transition
UIPackage = FairyGUI.UIPackage UIPackage = FairyGUI.UIPackage
Window = FairyGUI.Window Window = FairyGUI.Window
GObjectPool = FairyGUI.GObjectPool GObjectPool = FairyGUI.GObjectPool
Relations = FairyGUI.Relations Relations = FairyGUI.Relations
RelationType = FairyGUI.RelationType RelationType = FairyGUI.RelationType
UIPanel = FairyGUI.UIPanel UIPanel = FairyGUI.UIPanel
UIPainter = FairyGUI.UIPainter UIPainter = FairyGUI.UIPainter
TypingEffect = FairyGUI.TypingEffect TypingEffect = FairyGUI.TypingEffect
GTween = FairyGUI.GTween GTween = FairyGUI.GTween
GTweener = FairyGUI.GTweener GTweener = FairyGUI.GTweener
EaseType = FairyGUI.EaseType EaseType = FairyGUI.EaseType
fgui = {} fgui = {}
--[[ --[[
FairyGUIWindowWindowWindow FairyGUIWindowWindowWindow
@ -48,11 +48,11 @@ OnInit、DoHideAnimation、DoShowAnimation、OnShown、OnHide。
MyWinClass = fgui.window_class() MyWinClass = fgui.window_class()
function MyWinClass:ctor() function MyWinClass:ctor()
print('MyWinClass-ctor') -- print('MyWinClass-ctor')
self.contentPane = UIPackage.CreateObject("Basics", "WindowA") self.contentPane = UIPackage.CreateObject("Basics", "WindowA")
end end
function MyWinClass:OnShown() function MyWinClass:OnShown()
print('MyWinClass-onShown') -- print('MyWinClass-onShown')
end end
local win = MyWinClass.New() local win = MyWinClass.New()
win:Show() win:Show()
@ -74,7 +74,7 @@ function fgui.window_class(base)
tolua.setpeer(ins, t) tolua.setpeer(ins, t)
ins:SetLuaPeer(t) ins:SetLuaPeer(t)
if t.ctor then if t.ctor then
t.ctor(ins,...) t.ctor(ins, ...)
end end
return ins return ins
@ -92,12 +92,12 @@ MyButton = fgui.extension_class(GButton)
fgui.register_extension("ui://包名/我的按钮", MyButton) fgui.register_extension("ui://包名/我的按钮", MyButton)
function MyButton:ctor() --当组件构建完成时此方法被调用 function MyButton:ctor() --当组件构建完成时此方法被调用
print(self:GetChild("n1")) -- print(self:GetChild("n1"))
end end
--添加自定义的方法和字段 --添加自定义的方法和字段
function MyButton:Test() function MyButton:Test()
print('test') -- print('test')
end end
local get = tolua.initget(MyButton) local get = tolua.initget(MyButton)
@ -133,7 +133,7 @@ function fgui.extension_class(base)
o.Extend = function(ins) o.Extend = function(ins)
local t = {} local t = {}
setmetatable(t, o) setmetatable(t, o)
tolua.setpeer(ins,t) tolua.setpeer(ins, t)
return t return t
end end

View File

@ -18,13 +18,13 @@ GameEvent = {
-- 更新玩家信息 -- 更新玩家信息
OnUpdateInfo = 'OnUpdateInfo', OnUpdateInfo = 'OnUpdateInfo',
--打开托管 --打开托管
TupGuanOpen='TupGuanOpen', TupGuanOpen = 'TupGuanOpen',
--关闭托管 --关闭托管
TupGuanClose='TupGuanClose', TupGuanClose = 'TupGuanClose',
--麻将修改牌大小 --麻将修改牌大小
MJModifySzie='MJModifySzie', MJModifySzie = 'MJModifySzie',
} }
--- Base GameController --- Base GameController
@ -40,7 +40,7 @@ GameController = {
local M = GameController local M = GameController
setmetatable(M, {__index = IController}) setmetatable(M, { __index = IController })
function M:init(name) function M:init(name)
self._name = name self._name = name
@ -48,13 +48,13 @@ function M:init(name)
self._cacheEvent = Queue.new(1000) self._cacheEvent = Queue.new(1000)
self._eventmap = {} self._eventmap = {}
self._dispatcher = {} self._dispatcher = {}
self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT]=self.ResetConnect self._eventmap[Protocol.FGMGR_EVT_UPDATE_RECONECT] = self.ResetConnect
self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter self._eventmap[Protocol.GAME_EVT_PLAYER_JOIN] = self.OnEventPlayerEnter
self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState self._eventmap[Protocol.GAME_EVT_PLAYER_NET_STATE] = self.OnEventOnlineState
self._eventmap[Protocol.GAME_EVT_PLAYER_EXIT] = self.OnEventPlayerLeave self._eventmap[Protocol.GAME_EVT_PLAYER_EXIT] = self.OnEventPlayerLeave
self._eventmap[Protocol.GAME_EVT_READY] = self.OnEventPlayerReady 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_EXIT_ROOM_DISMISS] = self.OnEventExitRoomDismiss
self._eventmap[Protocol.GAME_EVT_DISMISS_ROOM] = self.OnEventDismissRoom 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_KICKED] = self.OnEventKicked
self._eventmap[Protocol.GAME_EVT_UPDATE_PLAYERINFO] = self.OnEvtUpdateInfo self._eventmap[Protocol.GAME_EVT_UPDATE_PLAYERINFO] = self.OnEvtUpdateInfo
self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips self._eventmap[Protocol.GAME_EVT_READY_ENTRUST] = self.OnEvtOpenTupGTips
self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips self._eventmap[Protocol.GAME_EVT_CANCEL_READY_ENTRUST] = self.OnEvtCloseTupGTips
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
end end
function DispatchEvent(_dispatcher, evt_name, ...) function DispatchEvent(_dispatcher, evt_name, ...)
@ -86,11 +84,10 @@ function M:AddEventListener(evt_name, func)
self._dispatcher[evt_name] = func self._dispatcher[evt_name] = func
end end
function M:ResetConnect() function M:ResetConnect()
-- print("断线重连================") -- -- print("断线重连================")
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect) --ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
ViewManager.refreshGameView() ViewManager.refreshGameView()
end end
----------------------请求------------------------------------ ----------------------请求------------------------------------
@ -101,11 +98,12 @@ function M:PlayerReady()
if not _client then if not _client then
return return
end end
print("====================================1发送准备")
_client:send(Protocol.GAME_READY) _client:send(Protocol.GAME_READY)
end end
function M:PlayerXiPai() function M:PlayerXiPai()
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
if not _client then if not _client then
return return
end end
@ -163,9 +161,9 @@ function M:AskDismissRoom()
if not _client then if not _client then
return return
end end
_client:send(Protocol.GAME_ASK_DISMISS_ROOM,nil,function (res) _client:send(Protocol.GAME_ASK_DISMISS_ROOM, nil, function(res)
if res.ReturnCode == 84 then if res.ReturnCode == 84 then
ViewUtil.ErrorTip(res.ReturnCode,"解散失败") ViewUtil.ErrorTip(res.ReturnCode, "解散失败")
end end
end) end)
end) end)
@ -178,7 +176,7 @@ function M:DismissRoomVote(agree)
if not _client then if not _client then
return return
end end
-- print(agree) -- -- print(agree)
local _data = {} local _data = {}
_data['result'] = agree _data['result'] = agree
_client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data) _client:send(Protocol.GAME_DISMISS_ROOM_VOTE, _data)
@ -261,7 +259,7 @@ end
-- 玩家进 -- 玩家进
function M:OnEventPlayerEnter(evt_data) function M:OnEventPlayerEnter(evt_data)
--print("进入房间++++++++++++++++++++++++++++++++++++++") ---- print("进入房间++++++++++++++++++++++++++++++++++++++")
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
local p = self._room:NewPlayer() local p = self._room:NewPlayer()
@ -280,13 +278,12 @@ function M:OnEventPlayerEnter(evt_data)
-- p.total_hp = evt_data["total_hp"] or 0 -- p.total_hp = evt_data["total_hp"] or 0
if evt_data['hp_info'] then if evt_data['hp_info'] then
p.cur_hp = evt_data.hp_info.cur_hp 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 end
p.self_user = _user p.self_user = _user
p.line_state = 1 p.line_state = 1
DataManager.CurrenRoom:AddPlayer(p) DataManager.CurrenRoom:AddPlayer(p)
DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p) DispatchEvent(self._dispatcher, GameEvent.PlayerEnter, p)
end end
) )
end end
@ -325,47 +322,42 @@ function M:OnEventPlayerReady(evt_data)
local pid = evt_data['aid'] local pid = evt_data['aid']
local p = self._room:GetPlayerById(pid) local p = self._room:GetPlayerById(pid)
p.ready = true p.ready = true
if evt_data.start~=nil then if evt_data.start ~= nil then
if evt_data.start==1 then if evt_data.start == 1 then
p.isSendCardState=true p.isSendCardState = true
else else
p.isSendCardState=false p.isSendCardState = false
end end
else
else p.isSendCardState = false
p.isSendCardState=false end
end
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p) DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
end end
) )
end end
function M:OnEventPlayerXiPaiReady(evt_data) function M:OnEventPlayerXiPaiReady(evt_data)
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
local pid = evt_data['aid'] local pid = evt_data['aid']
local p = self._room:GetPlayerById(pid) local p = self._room:GetPlayerById(pid)
p.ready = true p.ready = true
if evt_data.start~=nil then if evt_data.start ~= nil then
if evt_data.start==1 then if evt_data.start == 1 then
p.isSendCardState=true p.isSendCardState = true
else else
p.isSendCardState=false p.isSendCardState = false
end end
else
else p.isSendCardState = false
p.isSendCardState=false end
end
DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p) DispatchEvent(self._dispatcher, GameEvent.PlayerReady, p)
end end
) )
end end
-- 聊天事件 -- 聊天事件
function M:OnEventInteraction(evt_data) function M:OnEventInteraction(evt_data)
if self._room.ban_chat1 == false or self._room.ban_chat2 == false then if self._room.ban_chat1 == false or self._room.ban_chat2 == false then
@ -396,7 +388,6 @@ function M:OnEventUpdateGPS(evt_data)
) )
end end
-- 被踢出房间事件 -- 被踢出房间事件
function M:OnEventKicked() function M:OnEventKicked()
if ViewManager.GetCurrenView().dview_class == LobbyView then if ViewManager.GetCurrenView().dview_class == LobbyView then
@ -544,7 +535,7 @@ end
function M:OnEnter() function M:OnEnter()
if (debug_print) then if (debug_print) then
print(self._name .. '进入Game控制器') -- print(self._name .. '进入Game控制器')
end end
self._room = DataManager.CurrenRoom self._room = DataManager.CurrenRoom
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
@ -555,14 +546,14 @@ end
function M:OnExit() function M:OnExit()
if (debug_print) then if (debug_print) then
print(self._name .. ' 离开Game控制器') -- print(self._name .. ' 离开Game控制器')
end end
ControllerManager.SetGameNetClient(nil) ControllerManager.SetGameNetClient(nil)
self._cacheEvent:Clear() self._cacheEvent:Clear()
end end
function M:__OnNetEvent(msg) function M:__OnNetEvent(msg)
--print("Game消息ID===>>"..msg.Command) ---- print("Game消息ID===>>"..msg.Command)
local func = self._eventmap[msg.Command] local func = self._eventmap[msg.Command]
if (func ~= nil) then if (func ~= nil) then
func(self, msg.Data) func(self, msg.Data)
@ -586,38 +577,32 @@ function M:ReturnToRoom()
end, end,
self.tmpGroupID self.tmpGroupID
) )
end end
function M:OnEvtOpenTupGTips(msg) function M:OnEvtOpenTupGTips(msg)
--print("显示托管倒计时=====================") ---- print("显示托管倒计时=====================")
pt(msg) pt(msg)
local pid = msg['aid'] local pid = msg['aid']
local p = self._room:GetPlayerById(pid) local p = self._room:GetPlayerById(pid)
local t=msg['time'] local t = msg['time']
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,true, t) DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, true, t)
end end
function M:OnEvtCloseTupGTips(msg) function M:OnEvtCloseTupGTips(msg)
--print("关闭托管倒计时=================") ---- print("关闭托管倒计时=================")
--pt(msg) --pt(msg)
local pid = msg['aid'] local pid = msg['aid']
local p = self._room:GetPlayerById(pid) local p = self._room:GetPlayerById(pid)
local t=msg['time'] local t = msg['time']
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,false, t) DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t)
end end
function M:DispatchEventTuoGuan(p, isShow, t)
function M:DispatchEventTuoGuan(p,isShow,t) DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p,isShow, t)
end end
function M:OnEvtOpenGameHuTuoGtips(isAuto) function M:OnEvtOpenGameHuTuoGtips(isAuto)
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
if not _client then if not _client then
return return
end end

View File

@ -72,7 +72,7 @@ function M:connect(host, groupId, callback)
self._mgr_client:destroy() self._mgr_client:destroy()
self._mgr_client = nil self._mgr_client = nil
end end
print("666666666666666666666666666 ", host) -- print("666666666666666666666666666 ", host)
local _mgr_client = NetClient.new(self.host, "mgr_group") local _mgr_client = NetClient.new(self.host, "mgr_group")
self._mgr_client = _mgr_client self._mgr_client = _mgr_client
_mgr_client:connect() _mgr_client:connect()
@ -186,7 +186,7 @@ end
-- 更新玩法 -- 更新玩法
function M:OnEvtUpdatePlay(evt_data) function M:OnEvtUpdatePlay(evt_data)
--print("更新玩法=============》》》") ---- print("更新玩法=============》》》")
--pt(evt_data) --pt(evt_data)
local pid = evt_data.pid local pid = evt_data.pid
local group = DataManager.groups:get(self.groupId) local group = DataManager.groups:get(self.groupId)
@ -354,7 +354,7 @@ function M:OnExit()
end end
function M:__OnNetEvent(msg) function M:__OnNetEvent(msg)
--print("消息ID===>>"..msg.Command) ---- print("消息ID===>>"..msg.Command)
local func = self._eventmap[msg.Command] local func = self._eventmap[msg.Command]
if (func ~= nil) then func(self, msg.Data) end if (func ~= nil) then func(self, msg.Data) end
end end

View File

@ -1,12 +1,11 @@
LoddyController = {} LoddyController = {}
local M = {} local M = {}
--- Create a new LoddyController --- Create a new LoddyController
function LoddyController.new() function LoddyController.new()
setmetatable(M, {__index = IController}) setmetatable(M, { __index = IController })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.baseType = LoddyController self.baseType = LoddyController
self.class = "Loddy" self.class = "Loddy"
self.recordList = {} self.recordList = {}
@ -14,11 +13,11 @@ function LoddyController.new()
end end
function M.OnEnter(self) function M.OnEnter(self)
--print(vardump(self,"loddy controller enter")) ---- print(vardump(self,"loddy controller enter"))
end end
function M.OnExit(self) function M.OnExit(self)
--print(vardump(self,"loddy controller exit")) ---- print(vardump(self,"loddy controller exit"))
end end
local function __FillRoomData(s2croom) local function __FillRoomData(s2croom)
@ -27,7 +26,7 @@ local function __FillRoomData(s2croom)
extend:FillRoomData(s2croom) extend:FillRoomData(s2croom)
end end
local function __ConntectGameServer(cmd,room, host, _data,callback) local function __ConntectGameServer(cmd, room, host, _data, callback)
-- local _data = {} -- local _data = {}
_data["session"] = room.session _data["session"] = room.session
local _game_client = NetClient.new(host, "game") local _game_client = NetClient.new(host, "game")
@ -35,7 +34,7 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
ControllerManager.SetGameNetClient(_game_client) ControllerManager.SetGameNetClient(_game_client)
_game_client.onconnect:Add(function(code) _game_client.onconnect:Add(function(code)
if (code == SocketCode.Connect) then if (code == SocketCode.Connect) then
_game_client:send(cmd, _data, function (response) _game_client:send(cmd, _data, function(response)
if (response.ReturnCode == 0) then if (response.ReturnCode == 0) then
_game_client.onconnect:Clear() _game_client.onconnect:Clear()
_game_client.onconnect:Add(ControllerManager.OnConnect) _game_client.onconnect:Add(ControllerManager.OnConnect)
@ -44,39 +43,38 @@ local function __ConntectGameServer(cmd,room, host, _data,callback)
end end
_game_client:destroy() _game_client:destroy()
if ControllerManager.GameNetClinet == _game_client then if ControllerManager.GameNetClinet == _game_client then
ControllerManager.GameNetClinet =nil ControllerManager.GameNetClinet = nil
end end
callback(response) callback(response)
end) end)
else else
if ControllerManager.GameNetClinet == _game_client then if ControllerManager.GameNetClinet == _game_client then
ControllerManager.GameNetClinet =nil ControllerManager.GameNetClinet = nil
end end
_game_client:destroy() _game_client:destroy()
callback({ReturnCode = 101}) callback({ ReturnCode = 101 })
end end
end) end)
end end
function M:CreateRoom(game_id, _data, callback) function M:CreateRoom(game_id, _data, callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
local data = {} local data = {}
data.game_id = game_id data.game_id = game_id
data["platform"] = GetPlatform() data["platform"] = GetPlatform()
data.config_data = _data data.config_data = _data
-- local runtime = os.clock() -- local runtime = os.clock()
_client:send(Protocol.WEB_CREATE_ROOM, data, function(res) _client:send(Protocol.WEB_CREATE_ROOM, data, function(res)
if ( res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then if (res.ReturnCode == Table_Error_code.ERR_IN_ROOM or res.ReturnCode == Table_Error_code.ERR_CREATE_ROOM) then
self:JoinRoom("000000",callback) self:JoinRoom("000000", callback)
return return
end end
if (res.ReturnCode == 0) then if (res.ReturnCode == 0) then
local json = res.Data local json = res.Data
local game_info = json["game_info"] local game_info = json["game_info"]
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
ExtendHotupdate.UpdateGame(game_info,function() ExtendHotupdate.UpdateGame(game_info, function()
res.ReturnCode = -2 res.ReturnCode = -2
callback(res) callback(res)
end) end)
@ -87,7 +85,7 @@ function M:CreateRoom(game_id, _data, callback)
local server_ip = json["server_ip"] local server_ip = json["server_ip"]
local server_port = json["server_port"] 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.game_id = game_id
room.room_id = room_id room.room_id = room_id
room.server_host = string.concat(server_ip, ":", server_port) room.server_host = string.concat(server_ip, ":", server_port)
@ -99,12 +97,12 @@ function M:CreateRoom(game_id, _data, callback)
local j_data = {} local j_data = {}
j_data["session"] = room.session j_data["session"] = room.session
if not DataManager.SelfUser.location then if not DataManager.SelfUser.location then
DataManager.SelfUser.location = Location.new() DataManager.SelfUser.location = Location.new()
end end
j_data["pos"] = DataManager.SelfUser.location:Location2String() j_data["pos"] = DataManager.SelfUser.location:Location2String()
-- game_net = -- game_net =
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data, function (response) __ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(response)
if (response.ReturnCode == 0) then if (response.ReturnCode == 0) then
-- game_net:clearEvent() -- game_net:clearEvent()
local _s2croom = response.Data local _s2croom = response.Data
@ -118,7 +116,7 @@ function M:CreateRoom(game_id, _data, callback)
local extend = ExtendManager.GetExtendConfig(room.game_id) local extend = ExtendManager.GetExtendConfig(room.game_id)
extend:FillRoomData(_s2croom) extend:FillRoomData(_s2croom)
ControllerManager.ChangeController(GameController) ControllerManager.ChangeController(GameController)
-- print("create room:"..(os.clock()-runtime)) -- -- print("create room:"..(os.clock()-runtime))
callback(response) callback(response)
return return
end end
@ -126,13 +124,13 @@ function M:CreateRoom(game_id, _data, callback)
callback(response) callback(response)
end) end)
else else
if callback then callback(res) end if callback then callback(res) end
end end
end) end)
end end
local join_room_frame = 0 local join_room_frame = 0
function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer) function M:PublicJoinRoom(cmd, room_id, callback, group_id, group_layer)
-- 同一帧不重复调用 -- 同一帧不重复调用
local last_frame = join_room_frame local last_frame = join_room_frame
join_room_frame = Time.frameCount join_room_frame = Time.frameCount
@ -147,12 +145,12 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
_data["floor"] = group_layer _data["floor"] = group_layer
_data["platform"] = GetPlatform() _data["platform"] = GetPlatform()
local _client = ControllerManager.WebClient; local _client = ControllerManager.WebClient;
_client:send(cmd, _data, function( res) _client:send(cmd, _data, function(res)
if (res.ReturnCode == 0) then if (res.ReturnCode == 0) then
local json = res.Data local json = res.Data
local game_info = json["game_info"] local game_info = json["game_info"]
if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then if ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
ExtendHotupdate.UpdateGame(game_info,function() ExtendHotupdate.UpdateGame(game_info, function()
res.ReturnCode = -2 res.ReturnCode = -2
callback(res) callback(res)
end) end)
@ -162,7 +160,7 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
local server_ip = json["server_ip"] local server_ip = json["server_ip"]
local server_port = json["server_port"] 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.lev = json["lev"] -- 自己在当前房间所在圈子的职位1盟主2管理员3用户非圈子房间就是3
room.room_id = json["room_id"] room.room_id = json["room_id"]
room.game_id = game_id room.game_id = game_id
@ -178,14 +176,14 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
DataManager.CurrenRoom = room DataManager.CurrenRoom = room
local j_data = {} local j_data = {}
if not DataManager.SelfUser.location then if not DataManager.SelfUser.location then
DataManager.SelfUser.location = Location.new() DataManager.SelfUser.location = Location.new()
end end
j_data["pos"] = DataManager.SelfUser.location:Location2String() j_data["pos"] = DataManager.SelfUser.location:Location2String()
-- local game_net = nil -- local game_net = nil
--print(vardump(room)) ---- print(vardump(room))
-- game_net = -- game_net =
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1) __ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
if (res1.ReturnCode ~= 0 ) then if (res1.ReturnCode ~= 0) then
if (callback) then callback(res1) end if (callback) then callback(res1) end
else else
local _s2croom = res1.Data local _s2croom = res1.Data
@ -198,7 +196,7 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
end end
room.agent = _s2croom.agent == 1 and true or false room.agent = _s2croom.agent == 1 and true or false
-- ControllerManager.SetGameNetClient(game_net) -- ControllerManager.SetGameNetClient(game_net)
local extend = ExtendManager.GetExtendConfig(room.game_id) local extend = ExtendManager.GetExtendConfig(room.game_id)
extend:FillRoomData(_s2croom) extend:FillRoomData(_s2croom)
ControllerManager.ChangeController(GameController) ControllerManager.ChangeController(GameController)
if callback then callback(res1) end if callback then callback(res1) end
@ -206,16 +204,15 @@ function M:PublicJoinRoom(cmd,room_id,callback,group_id,group_layer)
end) end)
-- callback(res) -- callback(res)
else else
if callback then callback(res) end if callback then callback(res) end
end end
end) end)
end end
function M:JoinRoom(room_id,callback,group_id,group_layer) function M:JoinRoom(room_id, callback, group_id, group_layer)
self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM,room_id,callback,group_id,group_layer) self:PublicJoinRoom(Protocol.WEB_JOIN_ROOM, room_id, callback, group_id, group_layer)
end end
function M:ResetJionRoom(callback) function M:ResetJionRoom(callback)
local _game = ControllerManager.GetController(GameController) local _game = ControllerManager.GetController(GameController)
local o_room = DataManager.CurrenRoom local o_room = DataManager.CurrenRoom
@ -224,7 +221,7 @@ function M:ResetJionRoom(callback)
DataManager.SelfUser.location = Location.new() DataManager.SelfUser.location = Location.new()
end end
j_data["pos"] = DataManager.SelfUser.location:Location2String() 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.lev = o_room.lev
room.room_id = o_room.room_id room.room_id = o_room.room_id
room.game_id = o_room.game_id room.game_id = o_room.game_id
@ -241,14 +238,14 @@ function M:ResetJionRoom(callback)
room.create_time = o_room.create_time room.create_time = o_room.create_time
room:SetReloadStatus(true) room:SetReloadStatus(true)
DataManager.CurrenRoom = room DataManager.CurrenRoom = room
__ConntectGameServer(Protocol.GAME_JOIN_ROOM,room,room.server_host, j_data,function ( res1) __ConntectGameServer(Protocol.GAME_JOIN_ROOM, room, room.server_host, j_data, function(res1)
room:SetReloadStatus(false) room:SetReloadStatus(false)
if (res1.ReturnCode ~= 0 ) then if (res1.ReturnCode ~= 0) then
if (callback) then callback(res1) end if (callback) then callback(res1) end
else else
printlog("ResetJionRoom==>>>") printlog("ResetJionRoom==>>>")
pt(res1) pt(res1)
ControllerManager.enterPlayerData=res1.Data.tableInfo.playerData ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
local _s2croom = res1.Data local _s2croom = res1.Data
local extend = ExtendManager.GetExtendConfig(room.game_id) local extend = ExtendManager.GetExtendConfig(room.game_id)
extend:FillRoomData(_s2croom) extend:FillRoomData(_s2croom)
@ -259,8 +256,8 @@ function M:ResetJionRoom(callback)
end end
function M:UpdatePlayerInfo(callback) function M:UpdatePlayerInfo(callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:send(Protocol.WEB_UPDATE_INFO, nil, function (res) _client:send(Protocol.WEB_UPDATE_INFO, nil, function(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
DataManager.SelfUser.diamo = res.Data.diamo DataManager.SelfUser.diamo = res.Data.diamo
DataManager.SelfUser.invited = res.Data.invitation DataManager.SelfUser.invited = res.Data.invitation
@ -272,12 +269,12 @@ function M:UpdatePlayerInfo(callback)
end) end)
end end
function M:UpdateNotice(id,callback) function M:UpdateNotice(id, callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
local _data = {} local _data = {}
_data.id = id _data.id = id
_client:send(Protocol.WEB_UPDATE_NOTICE, _data, function (res) _client:send(Protocol.WEB_UPDATE_NOTICE, _data, function(res)
--print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res) ---- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ",res)
--pt(res) --pt(res)
if res.ReturnCode == 0 and #res.Data.notice_list > 0 then if res.ReturnCode == 0 and #res.Data.notice_list > 0 then
callback(true, res.Data) callback(true, res.Data)
@ -298,10 +295,10 @@ function M:RequestRecordList(callback, roomid)
proto = Protocol.WEB_GET_MILITARY_BY_ROOMID proto = Protocol.WEB_GET_MILITARY_BY_ROOMID
_data.roomId = roomid _data.roomId = roomid
end end
_client:send(proto, _data, function (res) _client:send(proto, _data, function(res)
self.recordList = nil self.recordList = nil
-- print(vardump(res)) -- -- print(vardump(res))
if (res.ReturnCode == 0 or res.ReturnCode == 19 ) then if (res.ReturnCode == 0 or res.ReturnCode == 19) then
--self:RequestRankList(callback) --self:RequestRankList(callback)
self.recordList = {} self.recordList = {}
if res.ReturnCode == 19 then return end if res.ReturnCode == 19 then return end
@ -335,8 +332,8 @@ function M:RequestRecordList(callback, roomid)
end end
local round_count = record_list_item["round"] local round_count = record_list_item["round"]
for j = 1,round_count do for j = 1, round_count do
local round_score_str = record_list_item["round_"..j] local round_score_str = record_list_item["round_" .. j]
local m_round_game = MGameTimes.new() local m_round_game = MGameTimes.new()
if round_score_str then if round_score_str then
local round_score_item = json.decode(round_score_str) local round_score_item = json.decode(round_score_str)
@ -359,50 +356,45 @@ function M:RequestRecordList(callback, roomid)
end) end)
end end
function M:RequestPlayBack(_data, callback, game_info)
function M:RequestPlayBack(_data,callback,game_info)
if game_info and ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then if game_info and ExtendHotupdate.CheckVersion(game_info) ~= ExtendHotupdate.VERSION_NORMAL then
ExtendHotupdate.UpdateGame(game_info,function() ExtendHotupdate.UpdateGame(game_info, function()
self:RequestPlayBack(_data,callback) self:RequestPlayBack(_data, callback)
end) end)
return return
else else
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:send(Protocol.WEB_GET_PLAY_BACK , _data , function (res) _client:send(Protocol.WEB_GET_PLAY_BACK, _data, function(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
local data = json.decode(res.Data.playback) local data = json.decode(res.Data.playback)
local cmdList = data.cmdList local cmdList = data.cmdList
local info = data.info local info = data.info
local extend = ExtendManager.GetExtendConfig(info.game_id) local extend = ExtendManager.GetExtendConfig(info.game_id)
local room = extend:NewRoom() local room = extend:NewRoom()
room.game_id = info.game_id room.game_id = info.game_id
DataManager.CurrenRoom = room DataManager.CurrenRoom = room
extend:FillPlayBackData(data) extend:FillPlayBackData(data)
if not room.self_player then if not room.self_player then
room.self_player = room:GetPlayerBySeat(1) room.self_player = room:GetPlayerBySeat(1)
end end
callback(res.ReturnCode,data) callback(res.ReturnCode, data)
else else
callback(res.ReturnCode,nil) callback(res.ReturnCode, nil)
end end
end) end)
end end
end end
--获取手机验证码 --获取手机验证码
function M:GetPhoneCode(phone,callback) function M:GetPhoneCode(phone, callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
local _data = {} local _data = {}
_data["phone"]=phone _data["phone"] = phone
_client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res) _client:send(Protocol.WEB_GET_VERIFCATION_CODE, _data, function(res)
callback(res) callback(res)
end) end)
end end
function M:GetUserInfo(callback) function M:GetUserInfo(callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:send(Protocol.WEB_GET_USER_INFO, nil, function(res) _client:send(Protocol.WEB_GET_USER_INFO, nil, function(res)
@ -419,7 +411,7 @@ function M:GetUserInfo(callback)
end) end)
end end
function M:UpdateUserInfo(_data,callback) function M:UpdateUserInfo(_data, callback)
local _client = ControllerManager.WebClient local _client = ControllerManager.WebClient
_client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res) _client:send(Protocol.WEB_UPDATE_USER_INFO, _data, function(res)
callback(res) callback(res)

View File

@ -61,7 +61,7 @@ local function __Login(cmd, _data, callBack)
end end
_client:setSession(data["session_id"] .. "," .. data["token"]) _client:setSession(data["session_id"] .. "," .. data["token"])
print("11111111111111111111111111111111") -- print("11111111111111111111111111111111")
pt(data) pt(data)
ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web) ControllerManager.GroupClient = NetClient.new(data.groupWeb, "web_group", ConnectionProtocol.Web)
ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"])) ControllerManager.GroupClient:setSession((data["session_id"] .. "," .. data["token"]))
@ -129,11 +129,11 @@ function M:QuickLogin(session_id, callback)
end end
function M.OnEnter(self) function M.OnEnter(self)
--print("login controller enter") ---- print("login controller enter")
end end
function M.OnExit(self) function M.OnExit(self)
--print("login controller exit") ---- print("login controller exit")
end end
--字符串类json格式转化为表 --字符串类json格式转化为表

View File

@ -102,7 +102,7 @@ function M:CreateRoom(game_id, _data, callback)
local extend = ExtendManager.GetExtendConfig(room.game_id) local extend = ExtendManager.GetExtendConfig(room.game_id)
extend:FillRoomData(_s2croom) extend:FillRoomData(_s2croom)
ControllerManager.ChangeController(GameController) ControllerManager.ChangeController(GameController)
-- print("create room:"..(os.clock()-runtime)) -- -- print("create room:"..(os.clock()-runtime))
callback(response) callback(response)
return return
end end

View File

@ -31,7 +31,7 @@ function ControllerManager.Init()
local hostIp = GetGameInfo("login_url") local hostIp = GetGameInfo("login_url")
if (debug_print) then if (debug_print) then
print("hostIp:::" .. hostIp) -- print("hostIp:::" .. hostIp)
end end
ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web) ControllerManager.WebClient = NetClient.new(hostIp, "majiang", ConnectionProtocol.Web)
--ControllerManager.GroupClient = nil--NetClient.new("http://192.168.0.1:8081/", "web_group", ConnectionProtocol.Web) --ControllerManager.GroupClient = nil--NetClient.new("http://192.168.0.1:8081/", "web_group", ConnectionProtocol.Web)
@ -76,7 +76,7 @@ function ControllerManager.SetGameNetClient(client)
end end
function ControllerManager.OnConnect(code) function ControllerManager.OnConnect(code)
print("=======================================ControllerManager", code) -- print("=======================================ControllerManager", code)
if (code ~= SocketCode.Connect) then if (code ~= SocketCode.Connect) then
ControllerManager.SetGameNetClient(nil) ControllerManager.SetGameNetClient(nil)
if code ~= SocketCode.DisconnectByServer then if code ~= SocketCode.DisconnectByServer then

View File

@ -5,12 +5,12 @@ local TableBG = {}
local M = TableBG local M = TableBG
local bg_config = { local bg_config = {
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"}, { id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"}, { id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"}, { id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
{id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01"}, { id = 4, url = "base/tablebg/bg/bg7", thumb = "ui://Common/b01" },
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"}, { id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"}, { id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
} }
function TableBG.GetBGConfig(config) function TableBG.GetBGConfig(config)
@ -49,12 +49,12 @@ end
function TableBG.GetTableBG(game_id) function TableBG.GetTableBG(game_id)
local id = -1 local id = -1
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code) local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
-- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id) -- -- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
if json_data ~= nil then if json_data ~= nil then
local config_data = json.decode(json_data) local config_data = json.decode(json_data)
id = GetBG(config_data, game_id) id = GetBG(config_data, game_id)
end end
return id return id
end end
function TableBG.LoadTableBG(id, game_id, main_view, config) function TableBG.LoadTableBG(id, game_id, main_view, config)
@ -80,11 +80,11 @@ end
function TableBG.SaveTableBG(game_id, bg_id) function TableBG.SaveTableBG(game_id, bg_id)
local config_data local config_data
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code) local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
if json_data ~= nil then if json_data ~= nil then
config_data = json.decode(json_data) config_data = json.decode(json_data)
else else
config_data = {} config_data = {}
end end
SetBG(config_data, game_id, bg_id) SetBG(config_data, game_id, bg_id)
Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data)) Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data))
end end

View File

@ -18,7 +18,7 @@ local function __ShowTip(_version_view, text, callback)
end end
local function __update_check(data, onback, _version_view) local function __update_check(data, onback, _version_view)
print("===================updateCheck") -- print("===================updateCheck")
local tex_tip = _version_view:GetChild("tex_info") local tex_tip = _version_view:GetChild("tex_info")
for k, game_data in ipairs(data) do for k, game_data in ipairs(data) do
local asset_path = game_data["bundle"]:gsub("\r\n", "") local asset_path = game_data["bundle"]:gsub("\r\n", "")

View File

@ -13,7 +13,7 @@ local _isInit = false
local function __new_config(data) local function __new_config(data)
local ec = reimport(data.bundle .. ".ExtendConfig") local ec = reimport(data.bundle .. ".ExtendConfig")
print("初始化ExtendManager===>>>" .. data.bundle) -- print("初始化ExtendManager===>>>" .. data.bundle)
--pt(data) --pt(data)
local config = ec.new() local config = ec.new()
ec.game_data = data ec.game_data = data

View File

@ -2,31 +2,31 @@
--author-- --author--
BaseWindow = { BaseWindow = {
--view description --view description
_view = nil, _view = nil,
--View 是否被销毁 --View 是否被销毁
_is_destroy = false, _is_destroy = false,
--是否播放动画 --是否播放动画
_animation = true, _animation = true,
--弹出动画0关闭1左边2右边 --弹出动画0关闭1左边2右边
_anim_pop = 0, _anim_pop = 0,
--关闭摧毁 --关闭摧毁
_close_destroy = false, _close_destroy = false,
--点击窗口以外关闭 --点击窗口以外关闭
_close_zone = true, _close_zone = true,
--队列 --队列
_queue = true, _queue = true,
--全屏 --全屏
_full = false, _full = false,
--全屏偏移 --全屏偏移
_full_offset = true, _full_offset = true,
--新窗口隐藏队列 --新窗口隐藏队列
_new_hide = true, _new_hide = true,
--模糊组件对象 --模糊组件对象
_put_map = true _put_map = true
} }
--window 列表 --window 列表
@ -34,14 +34,14 @@ local WindowMap = {
} }
local WindowQueue= { local WindowQueue = {
} }
local M = BaseWindow local M = BaseWindow
function BaseWindow.new(url,blur_view) function BaseWindow.new(url, blur_view)
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "BaseWindow" self.class = "BaseWindow"
-- self._blur_view = blur_view -- self._blur_view = blur_view
self:init(url) self:init(url)
@ -68,10 +68,10 @@ function M:init(url)
printlog(self._view) printlog(self._view)
-- self._view.fairyBatching = true -- self._view.fairyBatching = true
local btn_close = self._view:GetChild("btn_close") local btn_close = self._view:GetChild("btn_close")
if(btn_close) then if (btn_close) then
btn_close.onClick:Set(function() btn_close.onClick:Set(function()
self:CloseEvent() self:CloseEvent()
end) end)
end end
@ -83,29 +83,29 @@ function M:init(url)
win_mode.touchable = false win_mode.touchable = false
self:CloseEvent() self:CloseEvent()
end) end)
printlog("======================================",self._full) printlog("======================================", self._full)
if self._full then if self._full then
local offset = get_offset(self._full_offset) local offset = get_offset(self._full_offset)
if self._anim_pop == 0 then if self._anim_pop == 0 then
self._view:AddRelation(contentPane, RelationType.Size) self._view:AddRelation(contentPane, RelationType.Size)
contentPane:AddChild(self._view) contentPane:AddChild(self._view)
else else
contentPane:RemoveRelation(self._root_view, RelationType.Center_Center) contentPane:RemoveRelation(self._root_view, RelationType.Center_Center)
contentPane:AddRelation(self._root_view, RelationType.Middle_Middle) contentPane:AddRelation(self._root_view, RelationType.Middle_Middle)
PopPanel:AddChild(self._view) PopPanel:AddChild(self._view)
local click_item = PopPanel:GetChild("click_item") local click_item = PopPanel:GetChild("click_item")
if self._anim_pop == 1 then if self._anim_pop == 1 then
contentPane:AddRelation(self._root_view, RelationType.Left_Left) contentPane:AddRelation(self._root_view, RelationType.Left_Left)
self._view.x = 0 self._view.x = 0
elseif self._anim_pop == 2 then elseif self._anim_pop == 2 then
contentPane:AddRelation(self._root_view, RelationType.Right_Right) contentPane:AddRelation(self._root_view, RelationType.Right_Right)
self._view.x = GRoot.inst.width - self._view.width - offset self._view.x = GRoot.inst.width - self._view.width - offset
end end
self._view.y = (PopPanel.height - self._view.height) * 0.5 self._view.y = (PopPanel.height - self._view.height) * 0.5
click_item.xy = self._view.xy click_item.xy = self._view.xy
click_item.width = self._view.width click_item.width = self._view.width
click_item.height = self._view.height click_item.height = self._view.height
end end
else else
contentPane:AddChild(self._view) contentPane:AddChild(self._view)
contentPane.height = self._view.height contentPane.height = self._view.height
@ -114,13 +114,13 @@ function M:init(url)
end end
self._contentPane = contentPane self._contentPane = contentPane
if self._put_map then if self._put_map then
WindowMap[#WindowMap + 1] = self WindowMap[#WindowMap + 1] = self
end end
end end
-- 显示窗口 -- 显示窗口
function M:Show() function M:Show()
print("===========================================entershow",M.class) -- print("===========================================entershow",M.class)
local contentPane = self._root_view:GetChild("contentPane") local contentPane = self._root_view:GetChild("contentPane")
if self._anim_pop == 1 then if self._anim_pop == 1 then
contentPane:GetTransition("left_pop"):Play() contentPane:GetTransition("left_pop"):Play()
@ -140,7 +140,7 @@ function M:Show()
local _inQueue = false local _inQueue = false
if self._new_hide then if self._new_hide then
for i=1,#WindowQueue do for i = 1, #WindowQueue do
local win = WindowQueue[i] local win = WindowQueue[i]
if win == self then if win == self then
_inQueue = true _inQueue = true
@ -159,7 +159,7 @@ function M:Show()
self._contentPane.width = GRoot.inst.width - 2 * offset self._contentPane.width = GRoot.inst.width - 2 * offset
self._contentPane.height = GRoot.inst.height self._contentPane.height = GRoot.inst.height
self._contentPane.x = offset self._contentPane.x = offset
end end
end end
-- 关闭窗口 -- 关闭窗口
@ -168,9 +168,9 @@ function M:Close()
-- BlurView(self._blur_view,false) -- BlurView(self._blur_view,false)
-- end -- end
if self._queue then if self._queue then
for i,v in ipairs(WindowQueue) do for i, v in ipairs(WindowQueue) do
if v == self then if v == self then
table.remove(WindowQueue,i) table.remove(WindowQueue, i)
break break
end end
end end
@ -194,9 +194,9 @@ function M:Destroy()
if not _destroy_all then if not _destroy_all then
self:Close() self:Close()
if self._put_map then if self._put_map then
for i,v in ipairs(WindowMap) do for i, v in ipairs(WindowMap) do
if v == self then if v == self then
table.remove(WindowMap,i) table.remove(WindowMap, i)
break break
end end
end end
@ -212,16 +212,16 @@ function M:CloseEvent()
if self._close_destroy then if self._close_destroy then
self:Destroy() self:Destroy()
else else
self:Close() self:Close()
win_mode.touchable = true win_mode.touchable = true
end end
else else
self:ActionWithAnim(function() self:ActionWithAnim(function()
if self._close_destroy then if self._close_destroy then
self:Destroy() self:Destroy()
else else
self:Close() self:Close()
win_mode.touchable = true win_mode.touchable = true
end end
end) end)
end end
@ -245,7 +245,7 @@ end
function BaseWindow.DestroyAll() function BaseWindow.DestroyAll()
_destroy_all = true _destroy_all = true
local list = WindowMap local list = WindowMap
for i=1,#list do for i = 1, #list do
local win = list[i] local win = list[i]
win:Destroy() win:Destroy()
end end

View File

@ -52,13 +52,13 @@ function M:init(url)
list_playName.onClickItem:Add(function() list_playName.onClickItem:Add(function()
self.showView.visible = false self.showView.visible = false
local index = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId local index = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
local playDetail = view:GetChild(string.format("Label_Detail_%d",index)) local playDetail = view:GetChild(string.format("Label_Detail_%d", index))
local playView local playView
if not playDetail then if not playDetail then
playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d",index)) playDetail = UIPackage.CreateObjectFromURL(string.format("ui//Family/Label_Detail_%d", index))
if playDetail then if playDetail then
playView = view:AddChild(playDetail) playView = view:AddChild(playDetail)
playView.name = string.format("Label_Detail_%d",index) playView.name = string.format("Label_Detail_%d", index)
end end
end end
if not playDetail then if not playDetail then
@ -74,23 +74,23 @@ function M:init(url)
self.showView = view:GetChild(string.format("Label_Detail_%d", self.showView = view:GetChild(string.format("Label_Detail_%d",
PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId)) PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId))
-----------创建玩法---------- -----------创建玩法----------
view:GetChild('btn_Create').onClick:Add(function() view:GetChild('btn_Create').onClick:Add(function()
self:CreatePlay() self:CreatePlay()
end) end)
end end
function M:CreatePlay() function M:CreatePlay()
ViewUtil.ShowModalWait(self._root_view,"正在创建房间...") ViewUtil.ShowModalWait(self._root_view, "正在创建房间...")
local loddyCtr = ControllerManager.GetController(LoddyController) local loddyCtr = ControllerManager.GetController(LoddyController)
local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex+1].playeId local gameId = PlayInfo[1].playList[self.playNameCtr.selectedIndex + 1].playeId
local config = ExtendManager.GetExtendConfig(gameId) local config = ExtendManager.GetExtendConfig(gameId)
print("==============================config") -- print("==============================config")
pt(config) pt(config)
local mode = config:GetGameInfo() local mode = config:GetGameInfo()
print("==============================mode") -- print("==============================mode")
pt(mode) pt(mode)
local _data = mode:SelectedConfigData() local _data = mode:SelectedConfigData()
print("==============================_data") -- print("==============================_data")
pt(_data) pt(_data)
-- loddyCtr:CreateRoom(gameId,_data, function (res) -- loddyCtr:CreateRoom(gameId,_data, function (res)
-- self:__OnCreateRoomAction(res) -- self:__OnCreateRoomAction(res)
@ -111,7 +111,7 @@ function M:initePlayInfo()
local games = DataManager.SelfUser.games local games = DataManager.SelfUser.games
for i = 1, #games do for i = 1, #games do
if PlayInfo[1].playListInfo[games[i].game_id] then if PlayInfo[1].playListInfo[games[i].game_id] then
table.insert(PlayInfo[1].playList,PlayInfo[1].playListInfo[games[i].game_id]) table.insert(PlayInfo[1].playList, PlayInfo[1].playListInfo[games[i].game_id])
end end
end end
pt(PlayInfo) pt(PlayInfo)

View File

@ -258,7 +258,7 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
list_familyNumber:SetVirtual() list_familyNumber:SetVirtual()
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res) fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
local members = res.Data.members local members = res.Data.members
print("==========================res.Data.members") -- print("==========================res.Data.members")
pt(res.Data.members) pt(res.Data.members)
ViewUtil:CloseModalWait() ViewUtil:CloseModalWait()
if res.ReturnCode ~= 0 then if res.ReturnCode ~= 0 then
@ -303,7 +303,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
} }
end end
local roomList = self._group.rooms local roomList = self._group.rooms
print("=========================playList,rooms") -- print("=========================playList,rooms")
pt(playList) pt(playList)
pt(roomList) pt(roomList)
local roomCtr = ControllerManager.GetController(RoomController) local roomCtr = ControllerManager.GetController(RoomController)
@ -405,7 +405,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
end) end)
end end
local all_num = #playList + #roomList local all_num = #playList + #roomList
print("=================================================list_room", list_room, list_room.numItems, all_num) -- print("=================================================list_room", list_room, list_room.numItems, all_num)
pt(list_room) pt(list_room)
list_room.numItems = all_num list_room.numItems = all_num
list_gamePlay.numItems = #playList + 1 list_gamePlay.numItems = #playList + 1
@ -418,7 +418,7 @@ function M:ConnetFamily(index, groups, isCreate)
local list_family = self._view:GetChild('list_family') local list_family = self._view:GetChild('list_family')
list_family:SetVirtual() list_family:SetVirtual()
self._group = DataManager.groups:get(groups[index].id) self._group = DataManager.groups:get(groups[index].id)
print("===================================self._group") -- print("===================================self._group")
pt(self._group) pt(self._group)
self._roomNum = self._group.room_num self._roomNum = self._group.room_num
@ -533,7 +533,7 @@ function M:OnUpdate()
self._group.update_room = false self._group.update_room = false
self._fristRoom = true self._fristRoom = true
end end
print("====================================UpdateFamilyRoom", fgCtr, self._group.id) -- print("====================================UpdateFamilyRoom", fgCtr, self._group.id)
self:UpdateFamilyRoom(fgCtr, self._group.id) self:UpdateFamilyRoom(fgCtr, self._group.id)
end end
end end

View File

@ -36,7 +36,7 @@ function M:OnCreateRoom(mode_data)
local mode = mode_data.data local mode = mode_data.data
--点击建房按钮后保存当前游戏的config --点击建房按钮后保存当前游戏的config
local _data = mode:SelectedConfigData() local _data = mode:SelectedConfigData()
--print("OnCreateRoom================") ---- print("OnCreateRoom================")
--pt(_data) --pt(_data)
if not _data["stamina"] then _data["stamina"] = 0 end if not _data["stamina"] then _data["stamina"] = 0 end
local user_id = DataManager.SelfUser.account_id local user_id = DataManager.SelfUser.account_id

View File

@ -1,4 +1,3 @@
--进入房间View对象 --进入房间View对象
@ -9,8 +8,8 @@ local KEY_DEL = "del"
local KEY_CLEAR = "reset" local KEY_CLEAR = "reset"
function JoinRoomView.new() function JoinRoomView.new()
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "JoinRoomView" self.class = "JoinRoomView"
self._currenIndex = 0 self._currenIndex = 0
self._close_destroy = true self._close_destroy = true
@ -19,45 +18,45 @@ function JoinRoomView.new()
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
self.tex_num = self._view:GetChild("show_text") self.tex_num = self._view:GetChild("show_text")
self:ClearNumTex() self:ClearNumTex()
for i = 0 , 9 do for i = 0, 9 do
local obj = self._view:GetChild("btn_num_"..i) local obj = self._view:GetChild("btn_num_" .. i)
obj.onClick:Add(handler(self , self.OnNumButtonAction)) obj.onClick:Add(handler(self, self.OnNumButtonAction))
i = i + 1 i = i + 1
end end
local btn_reset = self._view:GetChild("btn_reset") local btn_reset = self._view:GetChild("btn_reset")
btn_reset.onClick:Add(handler(self , self.OnNumButtonAction)) btn_reset.onClick:Add(handler(self, self.OnNumButtonAction))
local btn_del = self._view:GetChild("btn_del") local btn_del = self._view:GetChild("btn_del")
btn_del.onClick:Add(handler(self , self.OnNumButtonAction)) btn_del.onClick:Add(handler(self, self.OnNumButtonAction))
end end
function M:OnNumButtonAction(context) function M:OnNumButtonAction(context)
local typer = string.sub(context.sender.name ,5) local typer = string.sub(context.sender.name, 5)
printlog("==========================OnNumButtonAction==============================") printlog("==========================OnNumButtonAction==============================")
printlog(typer) printlog(typer)
if typer == KEY_DEL then if typer == KEY_DEL then
if (self._currenIndex > 0) then if (self._currenIndex > 0) then
self._currenIndex = self._currenIndex - 1 self._currenIndex = self._currenIndex - 1
printlog("==================test=================") printlog("==================test=================")
print("ok") -- print("ok")
printlog(#self._texnum_str) printlog(#self._texnum_str)
printlog(self._currenIndex) printlog(self._currenIndex)
printlog("==================test=================") printlog("==================test=================")
self._texnum_str = string.sub(self._texnum_str,0,self._currenIndex) self._texnum_str = string.sub(self._texnum_str, 0, self._currenIndex)
self.tex_num.text = self._texnum_str self.tex_num.text = self._texnum_str
end end
elseif typer == KEY_CLEAR then elseif typer == KEY_CLEAR then
self:ClearNumTex() self:ClearNumTex()
else else
if (self._currenIndex < 6) then if (self._currenIndex < 6) then
self._currenIndex = self._currenIndex + 1 self._currenIndex = self._currenIndex + 1
self._texnum_str = self._texnum_str .. string.sub(typer,-1) self._texnum_str = self._texnum_str .. string.sub(typer, -1)
self.tex_num.text = self._texnum_str self.tex_num.text = self._texnum_str
if(self._currenIndex == 6) then if (self._currenIndex == 6) then
self:JoinRoom(self._texnum_str) self:JoinRoom(self._texnum_str)
end end
end end
@ -65,19 +64,19 @@ function M:OnNumButtonAction(context)
end end
function M:JoinRoom(str) function M:JoinRoom(str)
ViewUtil.ShowModalWait(self._root_view,"正在加入房间...") ViewUtil.ShowModalWait(self._root_view, "正在加入房间...")
local boddyCtr = ControllerManager.GetController(LoddyController) local boddyCtr = ControllerManager.GetController(LoddyController)
boddyCtr:JoinRoom(str, function (response) boddyCtr:JoinRoom(str, function(response)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if response.ReturnCode == -2 then if response.ReturnCode == -2 then
self:JoinRoom(str) self:JoinRoom(str)
return return
elseif response.ReturnCode ~=0 then elseif response.ReturnCode ~= 0 then
ViewUtil.ErrorTip(response.ReturnCode,"进入房间失败") ViewUtil.ErrorTip(response.ReturnCode, "进入房间失败")
return return
end end
self:Destroy() self:Destroy()
ViewManager.ChangeView(ViewManager.View_Main,DataManager.CurrenRoom.game_id) ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
end) end)
end end

View File

@ -21,9 +21,9 @@ function M:init(url)
local view = self._view local view = self._view
local user = self.user; local user = self.user;
print("================phone=====================") -- print("================phone=====================")
for k, v in pairs(user) do for k, v in pairs(user) do
print(string.format("k:%s|v:%s", k, v)) -- print(string.format("k:%s|v:%s", k, v))
end end
--show --show

View File

@ -3,25 +3,25 @@
local LobbyShopView = {} local LobbyShopView = {}
local M = LobbyShopView local M = LobbyShopView
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local SHOP_LIST = { local SHOP_LIST = {
{ {
num=2000, num = 2000,
price=300 price = 300
}, },
{ {
num=1000, num = 1000,
price=165 price = 165
}, },
{ {
num=300, num = 300,
price=50 price = 50
}, },
} }
function LobbyShopView.new(Fct_UpdateDiamo) function LobbyShopView.new(Fct_UpdateDiamo)
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = 'ShopView' self.class = 'ShopView'
self._close_destroy = true self._close_destroy = true
self:init('ui://Lobby/Shop') self:init('ui://Lobby/Shop')
@ -37,28 +37,25 @@ function M:init(url)
for i = 1, #SHOP_LIST do for i = 1, #SHOP_LIST do
local shopChild = UIPackage.CreateObjectFromURL('ui://Lobby/c_shop_child') local shopChild = UIPackage.CreateObjectFromURL('ui://Lobby/c_shop_child')
shopChild:GetChild('num').text = string.format("%s 张",SHOP_LIST[i].num) shopChild:GetChild('num').text = string.format("%s 张", SHOP_LIST[i].num)
local shopBuyBtn = shopChild:GetChild('btn_buy') local shopBuyBtn = shopChild:GetChild('btn_buy')
shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s",SHOP_LIST[i].price) shopBuyBtn:GetChild('sprite').icon = string.format("ui://Lobby/shop_buy_%s", SHOP_LIST[i].price)
shopBuyBtn.onClick:Set(function() shopBuyBtn.onClick:Set(function()
local index = i; local index = i;
if false then if false then
--发送购买给后端 --发送购买给后端
else else
--假数据 --假数据
print("===================shop====================") -- print("===================shop====================")
print(SHOP_LIST[index].num) -- print(SHOP_LIST[index].num)
print(DataManager.SelfUser.diamo) -- print(DataManager.SelfUser.diamo)
DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num DataManager.SelfUser.diamo = DataManager.SelfUser.diamo + SHOP_LIST[index].num
print(DataManager.SelfUser.diamo) -- print(DataManager.SelfUser.diamo)
self.UpdateDiamo() self.UpdateDiamo()
end end
end) end)
shopList:AddChild(shopChild) shopList:AddChild(shopChild)
end end
end end
return M return M

View File

@ -2,8 +2,8 @@ local NoticeView = {}
local M = NoticeView local M = NoticeView
function NoticeView.new(blur_view) function NoticeView.new(blur_view)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "NoticeView" self.class = "NoticeView"
-- self._blur_view = blur_view -- self._blur_view = blur_view
self:init("ui://Lobby/pop_notice") self:init("ui://Lobby/pop_notice")
@ -12,7 +12,7 @@ function NoticeView.new(blur_view)
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
self._close_destroy = true self._close_destroy = true
self._close_zone = true self._close_zone = true
end end
@ -40,7 +40,6 @@ function M:FillData(data)
end end
list.selectedIndex = 0 list.selectedIndex = 0
self:ShowIndex(1) self:ShowIndex(1)
end end
function M:ShowIndex(index) function M:ShowIndex(index)
@ -56,9 +55,7 @@ function M:ShowIndex(index)
-- pic.text = "<img src=\""..notices[index].picture.."\"></img>" -- pic.text = "<img src=\""..notices[index].picture.."\"></img>"
-- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>" -- pic.text = "<img src=\"".."http://www.w3school.com.cn/i/eg_tulip.jpg".."\"></img>"
-- print(pic.text) -- -- print(pic.text)
end end
function M:Destroy(flag) function M:Destroy(flag)

View File

@ -3,8 +3,8 @@ local PhonePasswordView = {}
local M = PhonePasswordView local M = PhonePasswordView
function PhonePasswordView.new(callback) function PhonePasswordView.new(callback)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PhonePasswordView" self.class = "PhonePasswordView"
self._callback = callback self._callback = callback
self._close_destroy = true self._close_destroy = true
@ -14,11 +14,11 @@ function PhonePasswordView.new(callback)
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
self.ctr_update = self._view:GetController("update") self.ctr_update = self._view:GetController("update")
if DataManager.SelfUser.password then if DataManager.SelfUser.password then
--self.ctr_update.selectedIndex = 1 --self.ctr_update.selectedIndex = 1
--print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id) ---- print("DataManager.SelfUser.account_idDataManager.SelfUser.account_idDataManager.SelfUser.account_id ",DataManager.SelfUser.account_id)
--self._view:GetChild("tex_phone").text = DataManager.SelfUser.account_id--ViewUtil.phone_hide(DataManager.SelfUser.phone) --self._view:GetChild("tex_phone").text = DataManager.SelfUser.account_id--ViewUtil.phone_hide(DataManager.SelfUser.phone)
end end
@ -41,8 +41,8 @@ function M:GetCode()
if not phone then if not phone then
return return
end end
local loddyctr = ControllerManager.GetController(LoddyController) local loddyctr = ControllerManager.GetController(LoddyController)
loddyctr:GetPhoneCode(phone,function( res) loddyctr:GetPhoneCode(phone, function(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
self._view:GetController("code").selectedIndex = 1 self._view:GetController("code").selectedIndex = 1
self._left_time = 120 self._left_time = 120
@ -60,10 +60,10 @@ function M:OnUpdate()
_left_time = _left_time - deltaTime _left_time = _left_time - deltaTime
_left_time = math.max(0, _left_time) _left_time = math.max(0, _left_time)
local leftTime = math.floor(_left_time) local leftTime = math.floor(_left_time)
self._view:GetChild("tex_time").text = tostring(leftTime).."后重新发送" self._view:GetChild("tex_time").text = tostring(leftTime) .. "后重新发送"
self._left_time = _left_time self._left_time = _left_time
else else
self._view:GetController("code").selectedIndex=0 self._view:GetController("code").selectedIndex = 0
UpdateBeat:Remove(self.OnUpdate, self) UpdateBeat:Remove(self.OnUpdate, self)
end end
end end
@ -75,10 +75,9 @@ end
--绑定 --绑定
function M:Bind() function M:Bind()
local tex_passwd = self._view:GetChild("tex_passwd") local tex_passwd = self._view:GetChild("tex_passwd")
local password = tex_passwd.text local password = tex_passwd.text
if string.len(password) <6 then if string.len(password) < 6 then
ViewUtil.ShowTips("请输入5位以上的密码") ViewUtil.ShowTips("请输入5位以上的密码")
return return
end end
@ -93,24 +92,23 @@ function M:Bind()
-- _data.phone = DataManager.SelfUser.phone -- _data.phone = DataManager.SelfUser.phone
-- _data.code = code -- _data.code = code
-- end -- end
ViewUtil.ShowModalWait(self._root_view,"正在提交...") ViewUtil.ShowModalWait(self._root_view, "正在提交...")
local loddyctr = ControllerManager.GetController(LoddyController) local loddyctr = ControllerManager.GetController(LoddyController)
_data.password = password _data.password = password
_data.type =3 _data.type = 3
loddyctr:UpdateUserInfo(_data,function( res) loddyctr:UpdateUserInfo(_data, function(res)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if (res.ReturnCode ==0) then if (res.ReturnCode == 0) then
DataManager.SelfUser.password = "123" DataManager.SelfUser.password = "123"
if self._callback then self._callback() end if self._callback then self._callback() end
else else
ViewUtil.ErrorTip(res.ReturnCode,"提交失败") ViewUtil.ErrorTip(res.ReturnCode, "提交失败")
end end
self:Close() self:Close()
end) end)
end end
function M:CheckInputCode() function M:CheckInputCode()
local code = self._view:GetChild("tex_code").text local code = self._view:GetChild("tex_code").text
if not (string.len(code) == 6) then if not (string.len(code) == 6) then

View File

@ -6,10 +6,10 @@ RankView = {}
local M = RankView local M = RankView
function RankView.new( main_view,video ) function RankView.new(main_view, video)
UIPackage.AddPackage("base/rank/ui/Rank") UIPackage.AddPackage("base/rank/ui/Rank")
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "RankView" self.class = "RankView"
self._animation = false self._animation = false
self._full = true self._full = true
@ -24,9 +24,8 @@ function RankView.new( main_view,video )
return self return self
end end
function M:init( url ) function M:init(url)
BaseWindow.init(self, url)
BaseWindow.init(self,url)
self._view:GetController("tab").selectedIndex = self._video and 1 or 0 self._view:GetController("tab").selectedIndex = self._video and 1 or 0
self._curren_tex = "" self._curren_tex = ""
@ -37,30 +36,27 @@ function M:init( url )
for i = 0, 9 do for i = 0, 9 do
local btn = develop_panel:GetChild("btn_" .. i) local btn = develop_panel:GetChild("btn_" .. i)
btn.onClick:Add(function() btn.onClick:Add(function()
if self._curren_len < 6 then if self._curren_len < 6 then
self._curren_tex = self._curren_tex .. i self._curren_tex = self._curren_tex .. i
self._curren_len = self._curren_len + 1 self._curren_len = self._curren_len + 1
self.tex_roomid.text = self._curren_tex self.tex_roomid.text = self._curren_tex
if self._curren_len == 6 then if self._curren_len == 6 then
ViewUtil.ShowModalWait(self._root_view) ViewUtil.ShowModalWait(self._root_view)
local loddyCtr1 = ControllerManager.GetController(LoddyController) local loddyCtr1 = ControllerManager.GetController(LoddyController)
loddyCtr1:RequestRecordList(function (result) loddyCtr1:RequestRecordList(function(result)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if self._is_destroy then if self._is_destroy then
return return
end end
if result == Table_Error_code.ERR_TIMEOUT then if result == Table_Error_code.ERR_TIMEOUT then
self:readData() self:readData()
return return
end end
if result == 0 then if result == 0 then
self:InitRecord1(loddyCtr1.recordList, true) self:InitRecord1(loddyCtr1.recordList, true)
end end
end, self._curren_tex) end, self._curren_tex)
end end
end end
end) end)
@ -79,8 +75,6 @@ function M:init( url )
self._curren_len = 0 self._curren_len = 0
self.tex_roomid.text = self._curren_tex self.tex_roomid.text = self._curren_tex
end) end)
end end
function M:readData() function M:readData()
@ -90,19 +84,18 @@ function M:readData()
record_list_1:RemoveChildrenToPool() record_list_1:RemoveChildrenToPool()
local loddyCtr1 = ControllerManager.GetController(LoddyController) local loddyCtr1 = ControllerManager.GetController(LoddyController)
loddyCtr1:RequestRecordList(function (result) loddyCtr1:RequestRecordList(function(result)
if self._is_destroy then if self._is_destroy then
return return
end end
if result == Table_Error_code.ERR_TIMEOUT then if result == Table_Error_code.ERR_TIMEOUT then
self:readData() self:readData()
return return
end end
self:InitRecord1(loddyCtr1.recordList) self:InitRecord1(loddyCtr1.recordList)
end)
end)
end end
function M:Show() function M:Show()
@ -118,21 +111,18 @@ end
local load_head_num = 0 local load_head_num = 0
function M:InitRecord1(recordList, develop_tool) function M:InitRecord1(recordList, develop_tool)
---- print("InitRecord1=========")
--print("InitRecord1=========")
pt(recordList) pt(recordList)
local main_view = self._view local main_view = self._view
-- 战绩 list -- 战绩 list
local record_list_1, ctr_recored, ctr_no_record local record_list_1, ctr_recored, ctr_no_record
if develop_tool then if develop_tool then
ctr_recored = main_view:GetController("developer") ctr_recored = main_view:GetController("developer")
ctr_recored.selectedIndex = 1 ctr_recored.selectedIndex = 1
record_list_1 = main_view:GetChild("lst_record") record_list_1 = main_view:GetChild("lst_record")
local btn_backto_search = main_view:GetChild("btn_backto_search") local btn_backto_search = main_view:GetChild("btn_backto_search")
btn_backto_search.onClick:Set(function() btn_backto_search.onClick:Set(function()
ctr_recored.selectedIndex = 0 ctr_recored.selectedIndex = 0
self._curren_tex = "" self._curren_tex = ""
@ -146,10 +136,9 @@ function M:InitRecord1(recordList, develop_tool)
end end
record_list_1:RemoveChildrenToPool() record_list_1:RemoveChildrenToPool()
ctr_no_record.selectedIndex = #recordList == 0 and 1 or 0 ctr_no_record.selectedIndex = #recordList == 0 and 1 or 0
for i=1, #recordList do for i = 1, #recordList do
local record_list_item = recordList[i] local record_list_item = recordList[i]
local total_score_list = record_list_item.TotalScoreList local total_score_list = record_list_item.TotalScoreList
local item = record_list_1:AddItemFromPool() local item = record_list_1:AddItemFromPool()
local player_item_list = item:GetChild("big_round") 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 game_data = ExtendManager.GetGameData(game_id)
local room_type_str = record_list_item.GameInfo.name local room_type_str = record_list_item.GameInfo.name
local room_id_str = record_list_item.RoomId local room_id_str = record_list_item.RoomId
local time =tonumber(record_list_item.Time) local time = tonumber(record_list_item.Time)
local room_time_str = os.date("%Y-%m-%d %H:%M", time) local room_time_str = os.date("%Y-%m-%d %H:%M", time)
local item_score_list = record_list_item.GameTimes local item_score_list = record_list_item.GameTimes
local play_back_id = record_list_item.PlayBackId local play_back_id = record_list_item.PlayBackId
-- 显示 房间号 房间类型 时间 -- 显示 房间号 房间类型 时间
item:GetChild("RoomType").asTextField.text = room_type_str item:GetChild("RoomType").asTextField.text = room_type_str
@ -184,22 +173,22 @@ function M:InitRecord1(recordList, develop_tool)
-- 显示 每个玩家的 名字和 分数 -- 显示 每个玩家的 名字和 分数
-- player_list 是聊天室数据 -- player_list 是聊天室数据
local player_list = {} local player_list = {}
for j=1,#total_score_list do for j = 1, #total_score_list do
local player_list_item = total_score_list[j] local player_list_item = total_score_list[j]
local player_item = player_item_list:AddItemFromPool() local player_item = player_item_list:AddItemFromPool()
player_item:GetChild("n0").text = player_list_item.Name player_item:GetChild("n0").text = player_list_item.Name
local player_score = player_item:GetChild("n1") local player_score = player_item:GetChild("n1")
local score = player_list_item.Score local score = player_list_item.Score
if hpOnOff == 1 and hpType > 1 then if hpOnOff == 1 and hpType > 1 then
score = score / 10 score = score / 10
end end
if score < 0 then if score < 0 then
player_item:GetController("num_color").selectedIndex = 1 player_item:GetController("num_color").selectedIndex = 1
else else
player_item:GetController("num_color").selectedIndex = 0 player_item:GetController("num_color").selectedIndex = 0
end end
player_score.text = score >= 0 and "+"..score or score player_score.text = score >= 0 and "+" .. score or score
player_list[j] = {} player_list[j] = {}
player_list[j].id = player_list_item.Id player_list[j].id = player_list_item.Id
player_list[j].score = score player_list[j].score = score
@ -207,9 +196,9 @@ function M:InitRecord1(recordList, develop_tool)
player_list[j].nick = player_list_item.Name player_list[j].nick = player_list_item.Name
end end
-- 点击事件 -- 点击事件
item.onClick:Add(function () item.onClick:Add(function()
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str, item_score_list, game_id,
self:ShowRecord2(play_back_id, room_type_str, room_id_str, room_time_str,item_score_list, game_id, develop_tool, record_list_item) develop_tool, record_list_item)
end) end)
-- 分享 -- 分享
item:GetChild("btn_screenshot").onClick:Set(function() item:GetChild("btn_screenshot").onClick:Set(function()
@ -234,20 +223,20 @@ function M:InitRecord1(recordList, develop_tool)
end end
item:GetChild("name").text = p.Name item:GetChild("name").text = p.Name
local score = p.Score local score = p.Score
if hpOnOff == 1 and hpType > 1 then if hpOnOff == 1 and hpType > 1 then
score = score / 10 score = score / 10
end end
item:GetChild("score").text = score item:GetChild("score").text = score
if score < 0 then item:GetController("di").selectedIndex = 1 end if score < 0 then item:GetController("di").selectedIndex = 1 end
if p.Portrait and p.Portrait ~= "" then if p.Portrait and p.Portrait ~= "" then
ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function( ... ) ImageLoad.Load(p.Portrait, item:GetChild("n9")._iconObject, 1, function(...)
load_head_num = load_head_num - 1 load_head_num = load_head_num - 1
end) end)
else else
load_head_num = load_head_num - 1 load_head_num = load_head_num - 1
end end
end end
coroutine.start(function ( ... ) coroutine.start(function(...)
local left_time = 4 local left_time = 4
while (true) do while (true) do
if load_head_num == 0 or left_time == 0 then if load_head_num == 0 or left_time == 0 then
@ -266,7 +255,8 @@ function M:InitRecord1(recordList, develop_tool)
end) end)
item:GetChild("btn_link").onClick:Set(function() item:GetChild("btn_link").onClick:Set(function()
local group_id = record_list_item.group_id and tonumber(record_list_item.group_id) or 0 local group_id = record_list_item.group_id and tonumber(record_list_item.group_id) or 0
ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id, player_list, self._root_view) ShareChatRoom(record_list_item.RoomId, tostring(os.time()), #item_score_list, room_type_str, group_id,
player_list, self._root_view)
end) end)
end end
end end
@ -285,7 +275,7 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
local hpType = record_item.GameInfo.hpType local hpType = record_item.GameInfo.hpType
record_list_2:RemoveChildrenToPool() record_list_2:RemoveChildrenToPool()
for i=1,#item_score do for i = 1, #item_score do
local item_player_info = item_score[i] local item_player_info = item_score[i]
local play_back_id = item_player_info.PlayBackId local play_back_id = item_player_info.PlayBackId
local player_score = item_player_info.PlayerList local player_score = item_player_info.PlayerList
@ -307,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) record_item_2:GetChild("Number").text = tostring(i)
player_item_list:RemoveChildrenToPool() player_item_list:RemoveChildrenToPool()
for j=1,#player_score do for j = 1, #player_score do
local player_item = player_item_list:AddItemFromPool() local player_item = player_item_list:AddItemFromPool()
player_item:GetChild("n0").text = player_score[j].Name player_item:GetChild("n0").text = player_score[j].Name
local player_score_text = player_item:GetChild("n1") local player_score_text = player_item:GetChild("n1")
local score = player_score[j].Score local score = player_score[j].Score
if hpOnOff == 1 and hpType > 1 then if hpOnOff == 1 and hpType > 1 then
score = score / 10 score = score / 10
end end
if score < 0 then if score < 0 then
player_item:GetController("num_color").selectedIndex = 1 player_item:GetController("num_color").selectedIndex = 1
else else
player_item:GetController("num_color").selectedIndex = 0 player_item:GetController("num_color").selectedIndex = 0
end end
player_score_text.text = score >= 0 and "+"..score or score player_score_text.text = score >= 0 and "+" .. score or score
end end
local btn_play_back = record_item_2:GetChild("btn_play_back") local btn_play_back = record_item_2:GetChild("btn_play_back")
btn_play_back.onClick:Set(function() btn_play_back.onClick:Set(function()
--print("点击进入回放=====") ---- print("点击进入回放=====")
if DataManager.SelfUser.playback[playback_id] ~= nil and DataManager.SelfUser.playback[playback_id][i] ~= nil then if DataManager.SelfUser.playback[playback_id] ~= nil and DataManager.SelfUser.playback[playback_id][i] ~= nil then
--print("1111111111111111") ---- print("1111111111111111")
local room = ExtendManager.GetExtendConfig(game_id):NewRoom() local room = ExtendManager.GetExtendConfig(game_id):NewRoom()
DataManager.CurrenRoom = room DataManager.CurrenRoom = room
room.game_id = game_id room.game_id = game_id
local extend = ExtendManager.GetExtendConfig(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._totalRound = #item_score
main:FillRoomData(DataManager.SelfUser.playback[playback_id][i]) main:FillRoomData(DataManager.SelfUser.playback[playback_id][i])
else else
--print("2222222222222") ---- print("2222222222222")
ViewUtil.ShowModalWait(self._view) ViewUtil.ShowModalWait(self._view)
local _data = {} local _data = {}
_data["military_id"] = playback_id _data["military_id"] = playback_id
_data["round"] = tostring(i) _data["round"] = tostring(i)
local loddyCtr1 = ControllerManager.GetController(LoddyController) local loddyCtr1 = ControllerManager.GetController(LoddyController)
loddyCtr1:RequestPlayBack(_data,function(code,data) loddyCtr1:RequestPlayBack(_data, function(code, data)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if code == 0 then if code == 0 then
if DataManager.SelfUser.playback[playback_id] ~= nil then if DataManager.SelfUser.playback[playback_id] ~= nil then
@ -364,31 +352,30 @@ function M:ShowRecord2(playback_id, room_type, room_id, room_time, item_score, g
main._currentId = playback_id main._currentId = playback_id
main._currentRound = i main._currentRound = i
main._totalRound = #item_score main._totalRound = #item_score
--print(main) ---- print(main)
main:FillRoomData(data) main:FillRoomData(data)
elseif code == 25 then elseif code == 25 then
ViewUtil.ErrorTip(code, "回放未找到!") ViewUtil.ErrorTip(code, "回放未找到!")
btn_play_back.grayed = true btn_play_back.grayed = true
end end
end, record_item.GameInfo) end, record_item.GameInfo)
end end
end) end)
end end
end end
function M:GenaratePlayBack(id, game_id, ...) function M:GenaratePlayBack(id, game_id, ...)
local tem =nil local tem = nil
local dview_class = nil local dview_class = nil
if not dview_class then if not dview_class then
local exconfig = ExtendManager.GetExtendConfig(game_id) local exconfig = ExtendManager.GetExtendConfig(game_id)
dview_class = exconfig:GetView(id) dview_class = exconfig:GetView(id)
--print(dview_class) ---- print(dview_class)
end end
if not dview_class then if not dview_class then
return return
end end
local arg = {...} local arg = { ... }
tem = dview_class.new(...) tem = dview_class.new(...)
tem.Id = id tem.Id = id
tem:Show() tem:Show()

View File

@ -7,8 +7,8 @@ local UserEditView = {}
local M = UserEditView local M = UserEditView
function UserEditView.new(callback) function UserEditView.new(callback)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "UserEditView" self.class = "UserEditView"
self._callback = callback self._callback = callback
self._close_destroy = true self._close_destroy = true
@ -18,7 +18,7 @@ function UserEditView.new(callback)
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
local btn_head = self._view:GetChild("btn_head") local btn_head = self._view:GetChild("btn_head")
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject) ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
@ -32,20 +32,20 @@ function M:init(url)
local btn_edit_nick = self._view:GetChild("btn_edit_nick") local btn_edit_nick = self._view:GetChild("btn_edit_nick")
btn_edit_nick.onClick:Set(function() btn_edit_nick.onClick:Set(function()
local edit_nick_view = EditNickView.new(function() local edit_nick_view = EditNickView.new(function()
tex_nick.text = DataManager.SelfUser.nick_name tex_nick.text = DataManager.SelfUser.nick_name
self._callback() self._callback()
end) end)
edit_nick_view:Show() edit_nick_view:Show()
end) end)
local btn_edit_portrait = self._view:GetChild("btn_edit_portrait") local btn_edit_portrait = self._view:GetChild("btn_edit_portrait")
btn_edit_portrait.onClick:Set(function() btn_edit_portrait.onClick:Set(function()
-- local edit_portrait_view = EditPortraitView.new(function() -- local edit_portrait_view = EditPortraitView.new(function()
-- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject) -- ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
-- --print(DataManager.SelfUser.head_url) -- ---- print(DataManager.SelfUser.head_url)
-- self._callback() -- self._callback()
-- end) -- end)
-- edit_portrait_view:Show() -- edit_portrait_view:Show()
end) end)
end end

View File

@ -23,7 +23,7 @@ LobbyView = {}
local M = {} local M = {}
function LobbyView.new() function LobbyView.new()
-- print("new lobbyView!!!!") -- -- print("new lobbyView!!!!")
setmetatable(M, { __index = BaseView }) setmetatable(M, { __index = BaseView })
local self = setmetatable({}, { __index = M }) local self = setmetatable({}, { __index = M })
self.class = "LobbyView" self.class = "LobbyView"
@ -38,7 +38,7 @@ function LobbyView.new()
end end
function M:InitView(url) function M:InitView(url)
-- print("init lobbyView!!!!") -- -- print("init lobbyView!!!!")
BaseView.InitView(self, url) BaseView.InitView(self, url)
self._full_offset = false self._full_offset = false
local view = self._view local view = self._view
@ -338,7 +338,7 @@ function M:__show_service()
end end
function M:__GetMessage(data) function M:__GetMessage(data)
-- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~") -- -- print("on GetMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~")
if not data or not data.notice_list then if not data or not data.notice_list then
self._mesList = "" self._mesList = ""
else else
@ -364,7 +364,7 @@ function M:__PopMsg(index)
end end
function M:__moveMsg(index) function M:__moveMsg(index)
-- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!") -- -- print("on moveMsg!!!!!!!!!!!!!!!!!!!!!!!!!")
if not self._tex_message then return end if not self._tex_message then return end
index, self._tex_message.text = self:__PopMsg(index) index, self._tex_message.text = self:__PopMsg(index)
self._tex_message.x = self._message.width self._tex_message.x = self._message.width
@ -392,8 +392,8 @@ end
function M:__ShowShare() function M:__ShowShare()
local pop_share = self._view:GetChild("pop_share") local pop_share = self._view:GetChild("pop_share")
local shareUrl = GetGameInfo("invite_link") .. "?uid=" .. DataManager.SelfUser.account_id local shareUrl = GetGameInfo("invite_link") .. "?uid=" .. DataManager.SelfUser.account_id
--print("shareUrl=================") ---- print("shareUrl=================")
--print(shareUrl) ---- print(shareUrl)
local btn_wx_session = pop_share:GetChild("btn_wx_session") local btn_wx_session = pop_share:GetChild("btn_wx_session")
btn_wx_session.onClick:Add(function() btn_wx_session.onClick:Add(function()
shareQRCodePicture(shareUrl, 0) shareQRCodePicture(shareUrl, 0)
@ -437,7 +437,7 @@ function M:Destroy()
end end
function M:Show() function M:Show()
--print("on lobbyView show~~~~~~") ---- print("on lobbyView show~~~~~~")
BaseView.Show(self) BaseView.Show(self)
ViewUtil.PlaySoundBg() ViewUtil.PlaySoundBg()
UpdateBeat:Add(self.OnUpdate, self) UpdateBeat:Add(self.OnUpdate, self)

View File

@ -26,7 +26,7 @@ function M:init()
local view = self._view local view = self._view
-- view:GetChild("tex_version").text = "Version" .. GetGameInfoPlatform("version") -- view:GetChild("tex_version").text = "Version" .. GetGameInfoPlatform("version")
-- print(GameApplication.Instance.accountTest and 1 or 0) -- -- print(GameApplication.Instance.accountTest and 1 or 0)
view:GetController("test").selectedIndex = GameApplication.Instance.accountTest and 1 or 0 view:GetController("test").selectedIndex = GameApplication.Instance.accountTest and 1 or 0
self.agree = view:GetController("agree"); self.agree = view:GetController("agree");
-- Utils.LoadBg("loginbg", view) -- Utils.LoadBg("loginbg", view)
@ -70,7 +70,7 @@ function M:init()
Utils.SaveLocalFile(key, json.encode(_data)) Utils.SaveLocalFile(key, json.encode(_data))
end) end)
if not s then if not s then
print("Error:" .. e) -- print("Error:" .. e)
end end
DataManager.SelfUser.acc = utez DataManager.SelfUser.acc = utez
@ -218,7 +218,7 @@ end
function M:QuickLogin() function M:QuickLogin()
if (not GameApplication.Instance.accountTest) then if (not GameApplication.Instance.accountTest) then
local session_id = PlayerPrefs.GetString("session_id") local session_id = PlayerPrefs.GetString("session_id")
print("session_id:" .. session_id) -- print("session_id:" .. session_id)
if session_id and string.len(session_id) > 3 then if session_id and string.len(session_id) > 3 then
ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...") ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...")
local loginCtr = ControllerManager.GetController(LoginController) local loginCtr = ControllerManager.GetController(LoginController)
@ -231,8 +231,8 @@ end
function M:LoginCallBack(result, data) function M:LoginCallBack(result, data)
self.isWXCallBackMark = true self.isWXCallBackMark = true
--print("微信登录返回================================================================") ---- print("微信登录返回================================================================")
--print("result===>"..result) ---- print("result===>"..result)
--pt(data) --pt(data)
if (not result) or result ~= 0 then if (not result) or result ~= 0 then
if result == 10 then if result == 10 then

View File

@ -57,9 +57,9 @@ function M:SetTuoGuanState()
end end
function M:InitView(url, isHideIpAdds) function M:InitView(url, isHideIpAdds)
--print("url===>>>") ---- print("url===>>>")
--print(url) ---- print(url)
--print(debug.traceback()) ---- print(debug.traceback())
BaseView.InitView(self, url) BaseView.InitView(self, url)
-- --
@ -668,7 +668,7 @@ function M:EventInit()
_gamectr:AddEventListener( _gamectr:AddEventListener(
GameEvent.TupGuanOpen, GameEvent.TupGuanOpen,
function(...) function(...)
--print("刷新托管数据=====") ---- print("刷新托管数据=====")
local arg = { ... } local arg = { ... }
local p = arg[1] local p = arg[1]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
@ -802,17 +802,17 @@ function M:OnPlayerReady(...)
if p.isSendCardState ~= nil and p.isSendCardState == true then if p.isSendCardState ~= nil and p.isSendCardState == true then
p.isSendCardState = false p.isSendCardState = false
ControllerManager.IsSendCard = false ControllerManager.IsSendCard = false
--print("进入设置计时器控制==========") ---- print("进入设置计时器控制==========")
coroutine.start(function() coroutine.start(function()
--print("计时器倒计时5s=============") ---- print("计时器倒计时5s=============")
coroutine.wait(5) coroutine.wait(5)
--print("当前状态==============") ---- print("当前状态==============")
--print(ControllerManager.IsSendCard) ---- print(ControllerManager.IsSendCard)
if ControllerManager.IsSendCard == true then if ControllerManager.IsSendCard == true then
--print("以发送开牌======================") ---- print("以发送开牌======================")
return return
else else
--print("开始断线重连") ---- print("开始断线重连")
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect) --ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
ViewManager.refreshGameView() ViewManager.refreshGameView()
end end
@ -1097,7 +1097,7 @@ end
--游戏激活 --游戏激活
function M:OnApplicationActive() function M:OnApplicationActive()
--print("游戏激活================") ---- print("游戏激活================")
if os.time() - last_pause_time > 15 then if os.time() - last_pause_time > 15 then
last_pause_time = os.time() last_pause_time = os.time()
ControllerManager.WebClient:clearActionQueue() ControllerManager.WebClient:clearActionQueue()

View File

@ -8,9 +8,9 @@ local GroupMainView = {}
local M = GroupMainView local M = GroupMainView
function GroupMainView.new(main_view, root_view,par_veiw) function GroupMainView.new(main_view, root_view, par_veiw)
--print(debug.traceback()) ---- print(debug.traceback())
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = 'GroupMainView' self.class = 'GroupMainView'
UIPackage.AddPackage('base/newgroup/ui/NewGroup') UIPackage.AddPackage('base/newgroup/ui/NewGroup')
self._view = main_view self._view = main_view
@ -21,7 +21,7 @@ function GroupMainView.new(main_view, root_view,par_veiw)
end end
function M:InitView(url) function M:InitView(url)
--print(url) ---- print(url)
-- BlurView(self._view:GetChild("bg"),true) -- BlurView(self._view:GetChild("bg"),true)
if DataManager.SelfUser.agent > 0 then if DataManager.SelfUser.agent > 0 then
self._view:GetController('agent').selectedIndex = 1 self._view:GetController('agent').selectedIndex = 1
@ -37,7 +37,7 @@ function M:InitView(url)
cgv:Show() cgv:Show()
cgv:SetCallback(function(name, pay_type, fg_type) cgv:SetCallback(function(name, pay_type, fg_type)
ViewUtil.ShowModalWait(cgv._root_view) ViewUtil.ShowModalWait(cgv._root_view)
fgCtr:FG_CreateGroup(name,pay_type,fg_type,function(res) fgCtr:FG_CreateGroup(name, pay_type, fg_type, function(res)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if self._is_destroy then if self._is_destroy then
return return
@ -53,7 +53,7 @@ function M:InitView(url)
end) end)
self.btn_joingroup = self._par_veiw:GetChild('btn_join_group') 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() --[[self.btn_joingroup.onClick:Set(function()
local groups = DataManager.groups.groupList local groups = DataManager.groups.groupList
if #groups == 0 then if #groups == 0 then
@ -131,23 +131,22 @@ end
function M:DEnterGroup() function M:DEnterGroup()
local groups = DataManager.groups.groupList local groups = DataManager.groups.groupList
if #groups == 0 then if #groups == 0 then
--local jgv = JoinGroupView.new(self._root_view) --local jgv = JoinGroupView.new(self._root_view)
--jgv:Show() --jgv:Show()
else else
local info = GroupInfoView.new(groups[1], self.fg_info) local info = GroupInfoView.new(groups[1], self.fg_info)
self._groupInfoView = info self._groupInfoView = info
info:SetCallBack(function() info:SetCallBack(function()
self._groupInfoView = nil self._groupInfoView = nil
self:Show() self:Show()
self._view.visible = true self._view.visible = true
end) end)
--info:Show() --info:Show()
--self._view.visible = false --self._view.visible = false
end end
end end
local function SortGroups(a, b) local function SortGroups(a, b)
local sort_a = 0 local sort_a = 0
local sort_b = 0 local sort_b = 0
@ -157,13 +156,13 @@ local function SortGroups(a, b)
return sort_a > sort_b return sort_a > sort_b
end end
function M:__fill_item(item,group) function M:__fill_item(item, group)
item:GetChild('tex_name').text = group.name item:GetChild('tex_name').text = group.name
item:GetChild('tex_id').text = "ID:".. group.id item:GetChild('tex_id').text = "ID:" .. group.id
local p_num = group.total_member_num local p_num = group.total_member_num
item:GetChild('tex_p_num').text = p_num > 99 and '99+' or p_num item:GetChild('tex_p_num').text = p_num > 99 and '99+' or p_num
if group.lev < 3 then if group.lev < 3 then
if group.lev == 1 then if group.lev == 1 then
item:GetChild('tex_room_num').text = group.room_num item:GetChild('tex_room_num').text = group.room_num
else else
@ -171,7 +170,7 @@ function M:__fill_item(item,group)
end end
else else
if group.show_num > 0 and group.room_num > group.show_num then if group.show_num > 0 and group.room_num > group.show_num then
item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num--group.show_num item:GetChild('tex_room_num').text = group.show_num > 99 and '99+' or group.show_num --group.show_num
else else
item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num item:GetChild('tex_room_num').text = group.room_num > 99 and '99+' or group.room_num
end end
@ -192,7 +191,7 @@ function M:FillData()
local new_info = {} local new_info = {}
for i = 1, #groups do for i = 1, #groups do
local key = tostring(groups[i].id) local key = tostring(groups[i].id)
local key1 = tostring(groups[i].id).."vip" local key1 = tostring(groups[i].id) .. "vip"
if not fg_info[key] then if not fg_info[key] then
new_info[key] = 0 new_info[key] = 0
if not fg_info_changed then if not fg_info_changed then
@ -220,7 +219,7 @@ function M:FillData()
else else
self.btn_joingroup:GetController("info").selectedIndex = 1 self.btn_joingroup:GetController("info").selectedIndex = 1
ctr_empty_group.selectedIndex = 0 ctr_empty_group.selectedIndex = 0
self:__fill_item(self.btn_joingroup,groups[1]) self:__fill_item(self.btn_joingroup, groups[1])
end end
local lst_group = self._view:GetChild('lst_group') local lst_group = self._view:GetChild('lst_group')
@ -230,7 +229,7 @@ function M:FillData()
local item = lst_group:AddItemFromPool() local item = lst_group:AddItemFromPool()
item.data = group item.data = group
self:__fill_item(item,group) self:__fill_item(item, group)
local btn_top = item:GetChild('btn_top') local btn_top = item:GetChild('btn_top')
local ctr_select = btn_top:GetController('select') local ctr_select = btn_top:GetController('select')
@ -240,7 +239,7 @@ function M:FillData()
context:StopPropagation() context:StopPropagation()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
ViewUtil.ShowModalWait(self._root_view) ViewUtil.ShowModalWait(self._root_view)
fgCtr:FG_TopGroup(group.id,ctr_select.selectedIndex == 0,function(res) fgCtr:FG_TopGroup(group.id, ctr_select.selectedIndex == 0, function(res)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if self._is_destroy then if self._is_destroy then
return return
@ -274,7 +273,7 @@ function M:EnterGroup(fg_id)
--self._view.visible = false --self._view.visible = false
end end
function M:Show(fg_id,callback) function M:Show(fg_id, callback)
local fgCtr1 = ControllerManager.GetController(NewGroupController) local fgCtr1 = ControllerManager.GetController(NewGroupController)
fgCtr1:FG_GroupList(function(res) fgCtr1:FG_GroupList(function(res)
if self._is_destroy then if self._is_destroy then
@ -284,17 +283,16 @@ function M:Show(fg_id,callback)
self:FillData() self:FillData()
if fg_id then if fg_id then
self:EnterGroup(fg_id) self:EnterGroup(fg_id)
else else
if callback then if callback then
callback(0) callback(0)
end end
end
else
if callback then
callback(-1)
end end
else
if callback then
callback(-1)
end
end end
end) end)
end end

View File

@ -6,8 +6,8 @@ local GroupManagerView = {}
local M = GroupManagerView local M = GroupManagerView
function GroupManagerView.new(blur_view, gid, btn_type, callback) function GroupManagerView.new(blur_view, gid, btn_type, callback)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "GroupManagerView" self.class = "GroupManagerView"
-- self._close_destroy = true -- self._close_destroy = true
self._put_map = false self._put_map = false
@ -25,8 +25,8 @@ end
-- 获取界面配置 -- 获取界面配置
local function getPageConfig(id) local function getPageConfig(id)
--pt(MngPageConfig.PageList) --pt(MngPageConfig.PageList)
for i=1,#MngPageConfig.PageList do for i = 1, #MngPageConfig.PageList do
local tem = MngPageConfig.PageList[i] local tem = MngPageConfig.PageList[i]
if tem.id == id then if tem.id == id then
return tem return tem
@ -35,7 +35,7 @@ local function getPageConfig(id)
end end
function M:init(url, btn_type) function M:init(url, btn_type)
BaseWindow.init(self,url) BaseWindow.init(self, url)
self.titleTxt = self._view:GetChild("n79") self.titleTxt = self._view:GetChild("n79")
-- if btn_type == 2 then -- if btn_type == 2 then
-- self._view:GetChild("n0"):GetChild("icon").url = "ui://m7iejg46p41ohx8" -- self._view:GetChild("n0"):GetChild("icon").url = "ui://m7iejg46p41ohx8"
@ -57,7 +57,7 @@ function M:init(url, btn_type)
-- 初始化标题列表 -- 初始化标题列表
for i = 1, #self.page_config do for i = 1, #self.page_config do
-- print("page_config:"..self.page_config[i]) -- -- print("page_config:"..self.page_config[i])
local page = getPageConfig(self.page_config[i]) local page = getPageConfig(self.page_config[i])
--如果界面无show_key或圈子中对应的key为true才显示界面 --如果界面无show_key或圈子中对应的key为true才显示界面
if not page.show_key or (page.show_key and group[page.show_key]) then if not page.show_key or (page.show_key and group[page.show_key]) then
@ -91,7 +91,7 @@ function M:init(url, btn_type)
-- gmsv._view.x = offset -- gmsv._view.x = offset
-- end) -- end)
-- 所有子界面加载点 -- 所有子界面加载点
local anchor = self._view:GetChild("anchor") local anchor = self._view:GetChild("anchor")
-- 初始界面 -- 初始界面
local first_page_config = getPageConfig(self.page_config[1]) 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) --gmsv._view:AddRelation(anchor, RelationType.Size)
local offset = get_offset(self._full_offset) local offset = get_offset(self._full_offset)
gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset gmsv._view.width = GRoot.inst.width - 2 * offset - first_page_config.anchorOffset
gmsv._view.height = GRoot.inst.height gmsv._view.height = GRoot.inst.height
gmsv._view.x = 0--offset gmsv._view.x = 0 --offset
-- first_page_config = getPageConfig(self.page_config[2]) -- first_page_config = getPageConfig(self.page_config[2])
-- gmsv = first_page_config.view.new(self.group_id, self._root_view) -- gmsv = first_page_config.view.new(self.group_id, self._root_view)
@ -138,28 +138,27 @@ function M:init(url, btn_type)
local index = self.ctr_index.selectedIndex local index = self.ctr_index.selectedIndex
local page_info = getPageConfig(self.page_config[index + 1]) local page_info = getPageConfig(self.page_config[index + 1])
if not self._view_map[index + 1] then if not self._view_map[index + 1] then
local tem = page_info.view.new(self.group_id, self._root_view) local tem = page_info.view.new(self.group_id, self._root_view)
-- anchor:AddRelation(self._root_view, RelationType.Size,true) -- anchor:AddRelation(self._root_view, RelationType.Size,true)
--tem._view:Center(true) --tem._view:Center(true)
--print("222222222222222",anchor._view) ---- print("222222222222222",anchor._view)
anchor:AddChild(tem._view) anchor:AddChild(tem._view)
-- tem._view.parent = anchor -- tem._view.parent = anchor
local offset = get_offset(self._full_offset) local offset = get_offset(self._full_offset)
tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset tem._view.width = GRoot.inst.width - 2 * offset - page_info.anchorOffset
tem._view.height = GRoot.inst.height tem._view.height = GRoot.inst.height
tem._view.x = 0--offset tem._view.x = 0 --offset
--tem._view:AddRelation(self._root_view, RelationType.Size) --tem._view:AddRelation(self._root_view, RelationType.Size)
-- tem._view:MakeFullScreen() -- tem._view:MakeFullScreen()
tem.id = page_info.id tem.id = page_info.id
self._view_map[index + 1] = tem self._view_map[index + 1] = tem
-- --
-- anchor:SetBoundsChangedFlag() -- anchor:SetBoundsChangedFlag()
-- anchor:EnsureBoundsCorrect() -- anchor:EnsureBoundsCorrect()
-- tem._view:RemoveRelation(anchor, RelationType.Size) -- tem._view:RemoveRelation(anchor, RelationType.Size)
--tem._view:AddRelation(anchor, RelationType.Size) --tem._view:AddRelation(anchor, RelationType.Size)
else else
@ -176,12 +175,10 @@ function M:init(url, btn_type)
end) end)
end end
function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack) function M:SetCurrentGroupInfoViewIns(groupInfoViewCallBack)
self.groupInfoViewCallBack=groupInfoViewCallBack self.groupInfoViewCallBack = groupInfoViewCallBack
end end
-- 获取指定ID的页面 -- 获取指定ID的页面
function M:GetPageByID(id) function M:GetPageByID(id)
for i, v in pairs(self._view_map) do for i, v in pairs(self._view_map) do
@ -221,7 +218,7 @@ end
-- quick_access_id 是快速访问标志打开对应id的页面 -- quick_access_id 是快速访问标志打开对应id的页面
function M:Show(quick_access_id) function M:Show(quick_access_id)
local index = self.ctr_index.selectedIndex local index = self.ctr_index.selectedIndex
printlog("index+1index+1index+1index+1 ",index+1) printlog("index+1index+1index+1index+1 ", index + 1)
if not quick_access_id then if not quick_access_id then
local page_info = getPageConfig(self.page_config[index + 1]) local page_info = getPageConfig(self.page_config[index + 1])
if page_info.refresh then self._view_map[index + 1]:initData() end if page_info.refresh then self._view_map[index + 1]:initData() end

View File

@ -456,7 +456,7 @@ function M:FillFagData()
local tex_name = self._view:GetChild("tex_name") local tex_name = self._view:GetChild("tex_name")
local name = tex_name.text local name = tex_name.text
print("jefe:") -- print("jefe:")
pt(self.hpData) pt(self.hpData)
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
@ -469,7 +469,7 @@ function M:FillFagData()
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
--print("======新增玩法=============") ---- print("======新增玩法=============")
--pt(res) --pt(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
local play = {} local play = {}
@ -510,7 +510,7 @@ function M:FillFagData()
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
--print("======修改玩法=============") ---- print("======修改玩法=============")
--pt(res) --pt(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
local play = {} local play = {}

View File

@ -5,8 +5,8 @@ local GroupMemberFagLogView = {}
local M = GroupMemberFagLogView local M = GroupMemberFagLogView
function GroupMemberFagLogView.new(group_id, member, not_manager) function GroupMemberFagLogView.new(group_id, member, not_manager)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "GroupMemberFagLogView" self.class = "GroupMemberFagLogView"
self._close_destroy = true self._close_destroy = true
-- self._blur_view = blur_view -- self._blur_view = blur_view
@ -15,7 +15,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
self._full = true self._full = true
self._animation = false self._animation = false
self.group_id = group_id self.group_id = group_id
self.hp_log = {} self.hp_log = {}
self.daily_count = {} self.daily_count = {}
self.not_manager = not_manager self.not_manager = not_manager
self._full = true self._full = true
@ -25,7 +25,7 @@ function GroupMemberFagLogView.new(group_id, member, not_manager)
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
local btn_close = self._view:GetChild("btn_close") local btn_close = self._view:GetChild("btn_close")
btn_close.onClick:Set(function() btn_close.onClick:Set(function()
@ -33,26 +33,25 @@ function M:init(url)
end) end)
for i = 1, 8 do for i = 1, 8 do
local tem = math.pow(2, i - 1) local tem = math.pow(2, i - 1)
local btn_filter = self._view:GetChild("btn_filter" .. tem) local btn_filter = self._view:GetChild("btn_filter" .. tem)
if btn_filter then if btn_filter then
btn_filter.onClick:Set(function() btn_filter.onClick:Set(function()
self.hp_log = {} self.hp_log = {}
self.m_index = 0 self.m_index = 0
self.lst_fag.numItems = 0 self.lst_fag.numItems = 0
self:GetData(0) self:GetData(0)
end) end)
end end
end end
self.lst_fag = self._view:GetChild("lst_fag") self.lst_fag = self._view:GetChild("lst_fag")
self.lst_fag:SetVirtual() self.lst_fag:SetVirtual()
self.lst_fag.itemRenderer = function(index, obj) self.lst_fag.itemRenderer = function(index, obj)
self:OnRenderItem(index, obj) self:OnRenderItem(index, obj)
end end
self.lst_fag.scrollPane.onPullUpRelease:Set(function() self.lst_fag.scrollPane.onPullUpRelease:Set(function()
self:GetData(self.lst_fag.numItems+self.m_index) self:GetData(self.lst_fag.numItems + self.m_index)
end) end)
if not self.not_manager then if not self.not_manager then
self._view:GetController("manager").selectedIndex = 1 self._view:GetController("manager").selectedIndex = 1
@ -75,7 +74,8 @@ function M:init(url)
end end
end) end)
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"), -308, 0) self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"),
-308, 0)
self.begin_time, self.end_time = self.time_panel:GetDate() self.begin_time, self.end_time = self.time_panel:GetDate()
self._view:GetChild("btn_search").onClick:Set(function() self._view:GetChild("btn_search").onClick:Set(function()
@ -90,21 +90,21 @@ end
-- 获取过滤值,根据多选框计算 -- 获取过滤值,根据多选框计算
function M:GetFilter() function M:GetFilter()
local filter = 0 local filter = 0
for i = 1, 8 do for i = 1, 8 do
local tem = math.pow(2, i - 1) local tem = math.pow(2, i - 1)
--print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem) ---- print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
local btn_filter = self._view:GetChild("btn_filter" .. tem) local btn_filter = self._view:GetChild("btn_filter" .. tem)
if btn_filter and btn_filter.selected then if btn_filter and btn_filter.selected then
filter = filter + tem filter = filter + tem
end end
end end
return filter return filter
end end
-- 显示原因文本 -- 显示原因文本
local function __getReason(data) local function __getReason(data)
-- return "玩家操作" -- return "玩家操作"
local s_nick = string.utf8sub(data.m_nick, 6) local s_nick = string.utf8sub(data.m_nick, 6)
if data.reason == 6 then if data.reason == 6 then
return data.info 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 string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作减少")
-- return "每日提取" -- return "每日提取"
elseif data.reason == 12 then elseif data.reason == 12 then
return "推广奖励" return "推广奖励"
elseif data.reason == 13 then elseif data.reason == 13 then
if data.hp < 0 then if data.hp < 0 then
return string.format("转账给 [color=#FF6600]%s(%s)[/color]", s_nick, data.mgr_id) return string.format("转账给 [color=#FF6600]%s(%s)[/color]", s_nick, data.mgr_id)
@ -146,56 +146,57 @@ end
-- 获取体力值详情数据 -- 获取体力值详情数据
function M:GetData(index) function M:GetData(index)
local filter = self:GetFilter() local filter = self:GetFilter()
if filter == 0 then return end if filter == 0 then return end
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time, function(res) fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time,
if self._is_destroy then function(res)
return if self._is_destroy then
end return
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 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 self.lst_fag.numItems = #self.hp_log
end end
end) end)
end end
function M:GuoLv(data) function M:GuoLv(data)
if self.member.lev == 1 then if self.member.lev == 1 then
local m_data_other = {} local m_data_other = {}
local m_data_my = {} local m_data_my = {}
for i=1,#data do for i = 1, #data do
if self.member.uid ~= data[i].mgr_id then if self.member.uid ~= data[i].mgr_id then
table.insert(m_data_other,data[i]) table.insert(m_data_other, data[i])
else else
table.insert(m_data_my,data[i]) table.insert(m_data_my, data[i])
end end
end end
-- printlog("比较计算=========m_data_my>>>",#m_data_my) -- printlog("比较计算=========m_data_my>>>",#m_data_my)
-- printlog("比较计算=========m_data_other>>>",#m_data_other) -- printlog("比较计算=========m_data_other>>>",#m_data_other)
if #m_data_my>0 and #m_data_other==0 then if #m_data_my > 0 and #m_data_other == 0 then
for i = 1, #m_data_my do for i = 1, #m_data_my do
self.hp_log[#self.hp_log + 1] = m_data_my[i] self.hp_log[#self.hp_log + 1] = m_data_my[i]
end end
self.m_index = #data - #m_data_my + self.m_index self.m_index = #data - #m_data_my + self.m_index
else else
for i = 1, #m_data_other do 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 end
self.m_index = #data - #m_data_other + self.m_index self.m_index = #data - #m_data_other + self.m_index
end end
@ -203,9 +204,9 @@ function M:GuoLv(data)
local m_data_other = {} local m_data_other = {}
local m_data_my = {} local m_data_my = {}
for i=1,#data do for i = 1, #data do
if self.member.uid ~= data[i].mgr_id then if self.member.uid ~= data[i].mgr_id then
table.insert(m_data_other,data[i]) table.insert(m_data_other, data[i])
end end
end end
@ -217,13 +218,12 @@ function M:GuoLv(data)
end end
self.m_index = #data - #m_data_other + self.m_index self.m_index = #data - #m_data_other + self.m_index
end end
end end
local function fillItem(data, obj) local function fillItem(data, obj)
local num = d2ad(data.hp) local num = d2ad(data.hp)
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time) obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
obj:GetChild("tex_reason").text = __getReason(data) obj:GetChild("tex_reason").text = __getReason(data)
end end
@ -236,7 +236,7 @@ function M:OnRenderItem(index, obj)
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0 obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
obj:GetChild("tex_fag").text = d2ad(data.cur_hp) obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
obj:GetChild("tex_reason").text = __getReason(data) obj:GetChild("tex_reason").text = __getReason(data)
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M",data.time) obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
local btn_head = obj:GetChild("btn_head") local btn_head = obj:GetChild("btn_head")
btn_head.icon = "ui://Common/Head0" btn_head.icon = "ui://Common/Head0"
ImageLoad.Load(self.member.portrait, btn_head._iconObject) ImageLoad.Load(self.member.portrait, btn_head._iconObject)
@ -261,7 +261,7 @@ function M:OnRenderItem(index, obj)
local item = lst:AddItemFromPool() local item = lst:AddItemFromPool()
fillItem(data.detail[i], item) fillItem(data.detail[i], item)
end end
obj.height =95 * (#data.detail+1) obj.height = 95 * (#data.detail + 1)
self.lst_fag:RefreshVirtualList() self.lst_fag:RefreshVirtualList()
self.lst_fag:ScrollToView(index) self.lst_fag:ScrollToView(index)
else else
@ -281,7 +281,7 @@ function M:OnRenderItem(index, obj)
local item = lst:AddItemFromPool() local item = lst:AddItemFromPool()
fillItem(data.detail[i], item) fillItem(data.detail[i], item)
end end
obj.height =95 * (#data.detail+1) obj.height = 95 * (#data.detail + 1)
self.lst_fag:RefreshVirtualList() self.lst_fag:RefreshVirtualList()
self.lst_fag:ScrollToView(index) self.lst_fag:ScrollToView(index)
end end
@ -311,7 +311,7 @@ end
-- 填充日统计对象 -- 填充日统计对象
function M:OnRenderDailyItem(index, obj) function M:OnRenderDailyItem(index, obj)
local data = self.daily_count[#self.daily_count - index] local data = self.daily_count[#self.daily_count - index]
obj:GetChild("tex_date").text = os.date("%Y-%m-%d",data.time) obj:GetChild("tex_date").text = os.date("%Y-%m-%d", data.time)
local num = d2ad(data.num) local num = d2ad(data.num)
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
end end

View File

@ -4,7 +4,7 @@ local GroupSetPermissionView = import(".GroupSetPermissionView")
local GroupBanSameTableView = import(".GroupBanSameTableView") local GroupBanSameTableView = import(".GroupBanSameTableView")
local MngPermission = import(".MngPermission") local MngPermission = import(".MngPermission")
local GroupSetTagView = import("../GroupSetTagView") local GroupSetTagView = import("../GroupSetTagView")
local GroupSetMemberInfoDiaoduView=import('.GroupSetMemberInfoDiaoduView') local GroupSetMemberInfoDiaoduView = import('.GroupSetMemberInfoDiaoduView')
local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView") local GroupPartnerBanPlaysView = import(".GroupPartnerBanPlaysView")
-- 牌友圈成员体力值记录 -- 牌友圈成员体力值记录
@ -12,14 +12,14 @@ local GroupMemberOperateView = {}
local M = GroupMemberOperateView local M = GroupMemberOperateView
function GroupMemberOperateView.new(group_id, member, callBack,callBack1) function GroupMemberOperateView.new(group_id, member, callBack, callBack1)
setmetatable(M, {__index = BaseWindow}) setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "GroupMemberOperateView" self.class = "GroupMemberOperateView"
self._close_destroy = true self._close_destroy = true
-- self._blur_view = blur_view -- self._blur_view = blur_view
--print("GroupMemberOperateView==============") ---- print("GroupMemberOperateView==============")
--pt(member) --pt(member)
self.member = member self.member = member
self.group_id = group_id self.group_id = group_id
self.callBack = callBack self.callBack = callBack
@ -30,11 +30,11 @@ end
-- 管理员权限 -- 管理员权限
local MngPermissionList = { local MngPermissionList = {
DeleteMember = 1,-- 删除成员 DeleteMember = 1, -- 删除成员
AddMember = 2,--添加成员 AddMember = 2, --添加成员
SetFag = 3,--设置体力值 SetFag = 3, --设置体力值
BanPlaying = 4,--禁止游戏 BanPlaying = 4, --禁止游戏
BanSameTable = 5--禁止同桌 BanSameTable = 5 --禁止同桌
} }
local function CheckPermission(lev, permission) local function CheckPermission(lev, permission)
@ -46,13 +46,13 @@ local function CheckPermission(lev, permission)
end end
function M:init(url) function M:init(url)
BaseWindow.init(self,url) BaseWindow.init(self, url)
local member = self.member local member = self.member
local group = DataManager.groups:get(self.group_id) local group = DataManager.groups:get(self.group_id)
--print("DataManager.groups:get(self.group_id)") ---- print("DataManager.groups:get(self.group_id)")
--pt(group) --pt(group)
local perm_array = MngPermission.getPermData(group.permission) local perm_array = MngPermission.getPermData(group.permission)
local btn_close = self._view:GetChild("btn_close") local btn_close = self._view:GetChild("btn_close")
btn_close.onClick:Set(function() btn_close.onClick:Set(function()
@ -105,7 +105,6 @@ function M:init(url)
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
self._view:GetChild("btn_deploy").onClick:Set(function() self._view:GetChild("btn_deploy").onClick:Set(function()
local gniv = GroupNumberInputView.new(nil, function(num) local gniv = GroupNumberInputView.new(nil, function(num)
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local parent_id = tonumber(num) local parent_id = tonumber(num)
@ -128,7 +127,7 @@ function M:init(url)
ctr_superior.selectedIndex = 1 ctr_superior.selectedIndex = 1
ViewUtil.ShowBannerOnScreenCenter("调配玩家成功") ViewUtil.ShowBannerOnScreenCenter("调配玩家成功")
else else
ViewUtil.ErrorTip(res1.ReturnCode,"调配玩家失败") ViewUtil.ErrorTip(res1.ReturnCode, "调配玩家失败")
end end
end) end)
end end
@ -138,14 +137,14 @@ function M:init(url)
end) end)
local vipbtn = self._view:GetChild("btn_vip") local vipbtn = self._view:GetChild("btn_vip")
if vipbtn ~= nil then if vipbtn ~= nil then
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id ) then if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id) or (group.lev < 3 and member.uid == DataManager.SelfUser.account_id) then
vipbtn.visible = true vipbtn.visible = true
vipbtn.selected = member.isvip == 1 and true or false vipbtn.selected = member.isvip == 1 and true or false
vipbtn.onClick:Set(function() vipbtn.onClick:Set(function()
local selected = vipbtn.selected and 1 or 0 local selected = vipbtn.selected and 1 or 0
fgCtr:FG_GroupSetVip(self.group_id, member.uid, selected, function(res1) fgCtr:FG_GroupSetVip(self.group_id, member.uid, selected, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
@ -153,7 +152,7 @@ function M:init(url)
self.callBack() self.callBack()
else else
vipbtn.selected = not vipbtn.selected vipbtn.selected = not vipbtn.selected
ViewUtil.ErrorTip(res1.ReturnCode,"设置vip失败") ViewUtil.ErrorTip(res1.ReturnCode, "设置vip失败")
end end
end) end)
end) end)
@ -162,12 +161,12 @@ function M:init(url)
end end
end end
-- 管理功能列表 -- 管理功能列表
local lst_mng = self._view:GetChild("lst_mng") local lst_mng = self._view:GetChild("lst_mng")
lst_mng:RemoveChildrenToPool() lst_mng:RemoveChildrenToPool()
-- 删除按钮 -- 删除按钮
local option = group.option or 0 local option = group.option or 0
if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option,1) == 1) or group.lev < member.lev then if (group.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id and bit:_and(option, 1) == 1) or group.lev < member.lev then
local btn_del = lst_mng:AddItemFromPool() local btn_del = lst_mng:AddItemFromPool()
btn_del.icon = "ui://NewGroup/mng_del" btn_del.icon = "ui://NewGroup/mng_del"
btn_del.onClick:Set(function() btn_del.onClick:Set(function()
@ -179,7 +178,7 @@ function M:init(url)
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
fgCtr:FG_GroupRemoveMember(self.group_id, member.uid, function(res1) fgCtr:FG_GroupRemoveMember(self.group_id, member.uid, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
@ -187,22 +186,21 @@ function M:init(url)
ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家") ViewUtil.ShowBannerOnScreenCenter("已成功删除玩家")
self:Destroy() self:Destroy()
else else
ViewUtil.ErrorTip(res1.ReturnCode,"删除成员失败") ViewUtil.ErrorTip(res1.ReturnCode, "删除成员失败")
end end
end) end)
end) end)
_curren_msg:Show() _curren_msg:Show()
end) end)
end end
-- 禁止游戏 -- 禁止游戏
-- --
if (group.lev < member.lev) or (group.lev == 3 and group.partnerLev > 0 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) 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 btn_ban = lst_mng:AddItemFromPool()
local pic = member.ban == 1 and "mng_del_ban" or "mng_ban" 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() btn_ban.onClick:Set(function()
if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then
return return
@ -215,16 +213,16 @@ function M:init(url)
local val = 1 - member.ban local val = 1 - member.ban
fgCtr:FG_BanMember(self.group_id, member.uid, val, 1, function(res1) fgCtr:FG_BanMember(self.group_id, member.uid, val, 1, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
member.ban = val member.ban = val
pic = member.ban == 1 and "mng_del_ban" or "mng_ban" 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() self.callBack()
else else
ViewUtil.ErrorTip(res1.ReturnCode,"禁止娱乐失败!") ViewUtil.ErrorTip(res1.ReturnCode, "禁止娱乐失败!")
end end
end) end)
end) end)
@ -232,44 +230,44 @@ function M:init(url)
end) end)
end end
--print("group.type=====================") ---- print("group.type=====================")
--print(group.type) ---- print(group.type)
--pt(group) --pt(group)
if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then if member.partnerLev > 0 and group.type == 2 and member.uid ~= DataManager.SelfUser.account_id then
local btn_ban = lst_mng:AddItemFromPool() local btn_ban = lst_mng:AddItemFromPool()
local pic = member.group_ban == 1 and "mng_del_ban_group" or "mng_ban_group" 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) --printlog("jefe member.partnerLev",member.partnerLev)
--if member.partnerLev==1 then --if member.partnerLev==1 then
btn_ban.onClick:Set(function() btn_ban.onClick:Set(function()
-- if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then -- if not CheckPermission(group.lev, perm_array[MngPermissionList.BanPlaying]) then
-- return -- return
-- end -- end
local str = member.group_ban == 1 and "确定恢复该合伙人整组娱乐吗?" or "确定禁止该合伙人整组娱乐吗?" local str = member.group_ban == 1 and "确定恢复该合伙人整组娱乐吗?" or "确定禁止该合伙人整组娱乐吗?"
local _curren_msg = MsgWindow.new(nil, str, MsgWindow.MsgMode.OkAndCancel) local _curren_msg = MsgWindow.new(nil, str, MsgWindow.MsgMode.OkAndCancel)
_curren_msg.onOk:Add(function() _curren_msg.onOk:Add(function()
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local val = member.group_ban == 1 and 0 or 1 local val = member.group_ban == 1 and 0 or 1
fgCtr:FG_BanMember(self.group_id, member.uid, val, 2, function(res1) fgCtr:FG_BanMember(self.group_id, member.uid, val, 2, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
member.group_ban = val member.group_ban = val
pic = member.group_ban == 1 and "mng_del_ban_group" or "mng_ban_group" 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
self.callBack() self.callBack()
else else
ViewUtil.ErrorTip(res1.ReturnCode,val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!") ViewUtil.ErrorTip(res1.ReturnCode, val == 1 and "禁止整组娱乐失败!" or "恢复整组娱乐失败!")
end end
end)
end) end)
_curren_msg:Show()
end) end)
-- end _curren_msg:Show()
end)
-- end
end end
-- 禁止同桌 -- 禁止同桌
if group.lev < 3 then 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) local btv = GroupBanSameTableView.new(self.blur_view, self.group_id, member.uid, res.Data)
btv:Show() btv:Show()
else else
ViewUtil.ErrorTip(res.ReturnCode,"获取禁止同桌列表失败!") ViewUtil.ErrorTip(res.ReturnCode, "获取禁止同桌列表失败!")
end end
end) end)
end) end)
end end
if group.lev == 1 and member.lev > 1 and member.partnerLev >0 and member.uid ~= DataManager.SelfUser.account_id then if group.lev == 1 and member.lev > 1 and member.partnerLev > 0 and member.uid ~= DataManager.SelfUser.account_id then
--if false then --if false then
local btn_set_mng = lst_mng:AddItemFromPool() local btn_set_mng = lst_mng:AddItemFromPool()
btn_set_mng.icon = "ui://NewGroup/zhengzu" btn_set_mng.icon = "ui://NewGroup/zhengzu"
btn_set_mng.onClick:Set( btn_set_mng.onClick:Set(
function() function()
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
fgCtr:FG_GetBanMemberHB(self.group_id, member.uid, function(res) fgCtr:FG_GetBanMemberHB(self.group_id, member.uid, function(res)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
--pt(res) --pt(res)
if res.ReturnCode == 0 then if res.ReturnCode == 0 then
local diaoduView=GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid) local diaoduView = GroupSetMemberInfoDiaoduView.new(self.group_id, member.uid)
diaoduView:SetCurrentState(res.Data.group_black+1,res.Data) diaoduView:SetCurrentState(res.Data.group_black + 1, res.Data)
else else
ViewUtil.ErrorTip(res.ReturnCode,"获取整组调度失败!") ViewUtil.ErrorTip(res.ReturnCode, "获取整组调度失败!")
end end
end)
end) end)
end
end)
end
@ -331,7 +326,7 @@ function M:init(url)
local val = 4 - member.lev local val = 4 - member.lev
fgCtr:FG_SetManager(self.group_id, member.uid, val, function(res1) fgCtr:FG_SetManager(self.group_id, member.uid, val, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
@ -344,7 +339,7 @@ function M:init(url)
end end
self:Destroy() self:Destroy()
else else
ViewUtil.ErrorTip(res1.ReturnCode,"设置副群主失败!") ViewUtil.ErrorTip(res1.ReturnCode, "设置副群主失败!")
end end
end) end)
end) end)
@ -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 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" local pic = member.partnerLev == 0 and "mng_set_partner" or "mng_del_partner"
btn_set_partner.icon = "ui://NewGroup/" .. pic btn_set_partner.icon = "ui://NewGroup/" .. pic
btn_set_partner.onClick:Set(function() btn_set_partner.onClick:Set(function()
@ -365,7 +360,7 @@ function M:init(url)
local val = member.partnerLev > 0 and 2 or 1 local val = member.partnerLev > 0 and 2 or 1
fgCtr:FG_SetPartner(self.group_id, member.uid, val, function(res1) fgCtr:FG_SetPartner(self.group_id, member.uid, val, function(res1)
if self._is_destroy then if self._is_destroy then
return return
end end
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if res1.ReturnCode == 0 then if res1.ReturnCode == 0 then
@ -376,7 +371,7 @@ function M:init(url)
self:Destroy() self:Destroy()
else else
ViewUtil.ErrorTip(res1.ReturnCode,"设置合伙人失败失败!") ViewUtil.ErrorTip(res1.ReturnCode, "设置合伙人失败失败!")
end end
end) end)
end) end)
@ -384,7 +379,7 @@ function M:init(url)
end) end)
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() local btn_set_permission = lst_mng:AddItemFromPool()
btn_set_permission.icon = "ui://NewGroup/mng_set_permission" btn_set_permission.icon = "ui://NewGroup/mng_set_permission"
btn_set_permission.onClick:Set(function() btn_set_permission.onClick:Set(function()
@ -405,35 +400,35 @@ function M:init(url)
btn_move.icon = "ui://NewGroup/mng_move" btn_move.icon = "ui://NewGroup/mng_move"
btn_move.onClick:Set(function() btn_move.onClick:Set(function()
local gniv = GroupNumberInputView.new(nil, function(num) local gniv = GroupNumberInputView.new(nil, function(num)
local parent_id = tonumber(num) local parent_id = tonumber(num)
if parent_id == member.parentId then if parent_id == member.parentId then
ViewUtil.ErrorTip(nil, "已经在该合伙人名下") ViewUtil.ErrorTip(nil, "已经在该合伙人名下")
return return
elseif parent_id == member.id then elseif parent_id == member.id then
ViewUtil.ErrorTip(nil, "目标的上级不能是自己") ViewUtil.ErrorTip(nil, "目标的上级不能是自己")
return return
elseif parent_id == DataManager.SelfUser.account_id then elseif parent_id == DataManager.SelfUser.account_id then
self:MovePartner(parent_id, member, self._view) 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
return return
end end
if res.ReturnCode ~= 0 then ViewUtil.ShowModalWait()
ViewUtil.CloseModalWait() local fgCtr = ControllerManager.GetController(NewGroupController)
ViewUtil.ErrorTip(res.ReturnCode, "找不到成员") fgCtr:FG_FindMember(self.group_id, parent_id, function(res)
elseif res.Data.partnerLev == 0 then if self._is_destroy then
ViewUtil.CloseModalWait() return
ViewUtil.ErrorTip(res.ReturnCode, "目标不是合伙人") end
else if res.ReturnCode ~= 0 then
self:MovePartner(parent_id, member, self._view) ViewUtil.CloseModalWait()
end ViewUtil.ErrorTip(res.ReturnCode, "找不到成员")
end) elseif res.Data.partnerLev == 0 then
end, 0, nil, "ui://NewGroup/Win_AddFriend") ViewUtil.CloseModalWait()
gniv:Show() 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)
end end
@ -454,7 +449,7 @@ function M:init(url)
local btn_banplays = lst_mng:AddItemFromPool() local btn_banplays = lst_mng:AddItemFromPool()
btn_banplays.icon = "ui://NewGroup/mng_ban_plays" btn_banplays.icon = "ui://NewGroup/mng_ban_plays"
btn_banplays.onClick:Set(function() btn_banplays.onClick:Set(function()
local banplays = GroupPartnerBanPlaysView.new(self.group_id,member.uid) local banplays = GroupPartnerBanPlaysView.new(self.group_id, member.uid)
banplays:Show() banplays:Show()
end) end)
end end
@ -463,26 +458,26 @@ function M:init(url)
local btn_qiangzhi = lst_mng:AddItemFromPool() local btn_qiangzhi = lst_mng:AddItemFromPool()
btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi" btn_qiangzhi.icon = "ui://NewGroup/mng_qiangzhi"
btn_qiangzhi.onClick:Set(function() btn_qiangzhi.onClick:Set(function()
local msg_tip = MsgWindow.new(self._root_view,"确定全部提取吗?", MsgWindow.MsgMode.OnlyOk) local msg_tip = MsgWindow.new(self._root_view, "确定全部提取吗?", MsgWindow.MsgMode.OnlyOk)
msg_tip.onOk:Add(function( ... ) msg_tip.onOk:Add(function(...)
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res) fgCtr:FG_TakeHp1(self.group_id, member.uid, function(res)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if self._is_destroy then if self._is_destroy then
return 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 end
if res.ReturnCode ~= 0 then end
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() msg_tip:Show()
end) end)
end end
@ -499,10 +494,9 @@ function M:MovePartner(parent_id, member, obj)
obj:GetController("show_superior").selectedIndex = 1 obj:GetController("show_superior").selectedIndex = 1
ViewUtil.ShowBannerOnScreenCenter("转移成功") ViewUtil.ShowBannerOnScreenCenter("转移成功")
else else
ViewUtil.ErrorTip(res1.ReturnCode,"转移失败") ViewUtil.ErrorTip(res1.ReturnCode, "转移失败")
end end
end) end)
end end
return M return M

View File

@ -65,7 +65,7 @@ function M:OnRenderItem(index, obj)
local hpStr local hpStr
local hpData = json.decode(play.hpData) local hpData = json.decode(play.hpData)
if play.hpOnOff == 1 then if play.hpOnOff == 1 then
-- print(vardump(play)) -- -- print(vardump(play))
local str_reward_type = play.rewardType == 1 and "赢家返点" or (play.rewardType == 2 and "人头返点") local str_reward_type = play.rewardType == 1 and "赢家返点" or (play.rewardType == 2 and "人头返点")
local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点" local str_reward_val = play.rewardValueType == 1 and "百分比返点" or "固定值返点"
local str_hp_type = hpData.type == 1 and "固定抽水" or "浮动抽水" local str_hp_type = hpData.type == 1 and "固定抽水" or "浮动抽水"

View File

@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
local GroupSetPermissionView = import('.GroupSetPermissionView') local GroupSetPermissionView = import('.GroupSetPermissionView')
local GroupBanSameTableView = import('.GroupBanSameTableView') local GroupBanSameTableView = import('.GroupBanSameTableView')
local GroupMemberOperateView = import('.GroupMemberOperateView') local GroupMemberOperateView = import('.GroupMemberOperateView')
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView') local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
local MngPermission = import('.MngPermission') local MngPermission = import('.MngPermission')
@ -62,15 +62,15 @@ function M:FillView()
end end
self.lst_member.scrollPane.onPullUpRelease:Set( self.lst_member.scrollPane.onPullUpRelease:Set(
function() function()
--print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems) ---- print("aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb ",self.lst_member.numItems)
self:GetMemberData(self.lst_member.numItems) self:GetMemberData(self.lst_member.numItems)
end end
) )
--local n50=self._view:GetChild('n50') --local n50=self._view:GetChild('n50')
--print(n50) ---- print(n50)
--n50.displayObject.gameObject.transform.localPosition.x=214 --n50.displayObject.gameObject.transform.localPosition.x=214
--print(n50.displayObject.gameObject.transform.localPosition.x) ---- print(n50.displayObject.gameObject.transform.localPosition.x)
-- 搜索玩家 -- 搜索玩家
local ctr_search = self._view:GetController('search') local ctr_search = self._view:GetController('search')
self._view:GetChild('btn_search').onClick:Set( self._view:GetChild('btn_search').onClick:Set(
@ -103,8 +103,8 @@ function M:FillView()
item_result:RemoveChildrenToPool() item_result:RemoveChildrenToPool()
for j = 1, #res.Data.members do for j = 1, #res.Data.members do
local tem = item_result:AddItemFromPool() local tem = item_result:AddItemFromPool()
self:FillItem(tem, res.Data.members[j], true) self:FillItem(tem, res.Data.members[j], true)
end end
end end
end, end,
@ -147,11 +147,11 @@ function M:FillView()
self.group_id, self.group_id,
tonumber(self._texnum_str), tonumber(self._texnum_str),
function(response) function(response)
printlog("响应获取添加玩家==》》》") printlog("响应获取添加玩家==》》》")
pt(response) pt(response)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if (response.ReturnCode and response.ReturnCode == 0) then if (response.ReturnCode and response.ReturnCode == 0) then
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data) GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
self:ClearNumTex() self:ClearNumTex()
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1) --ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
else else
@ -174,9 +174,6 @@ function M:FillView()
self:initData() self:initData()
end end
) )
end end
-- 快速访问 -- 快速访问
@ -187,8 +184,8 @@ end
-- 获取成员数据 -- 获取成员数据
function M:GetMemberData(index) function M:GetMemberData(index)
--print("11111111111111111111") ---- print("11111111111111111111")
--print(debug.traceback()) ---- print(debug.traceback())
local group = DataManager.groups:get(self.group_id) local group = DataManager.groups:get(self.group_id)
if index == 0 then if index == 0 then
group:clearMember() group:clearMember()
@ -222,32 +219,32 @@ end
local function __change_fag(gid, pid, is_add, cur_hp, callback) local function __change_fag(gid, pid, is_add, cur_hp, callback)
local gniv = local gniv =
GroupNumberInputView.new( GroupNumberInputView.new(
nil, nil,
function(num) function(num)
num = ad2d((is_add and num or -num)) num = ad2d((is_add and num or -num))
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_ChangeFag( fgCtr:FG_ChangeFag(
gid, gid,
pid, pid,
num, num,
function(res1) function(res1)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
-- if gniv._is_destroy then -- if gniv._is_destroy then
-- return -- return
-- end -- end
if (res1.ReturnCode == 0) then if (res1.ReturnCode == 0) then
callback(res1.Data) callback(res1.Data)
else else
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!') ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
end
end end
end )
) -- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str end,
end, is_add and 1 or 2,
is_add and 1 or 2, cur_hp and d2ad(cur_hp) or nil
cur_hp and d2ad(cur_hp) or nil )
)
gniv:Show() gniv:Show()
end end
@ -286,13 +283,13 @@ function M:FillItem(obj, member, refresh)
end end
--上级 --上级
obj:GetChild('tex_shangjiName').text=member.parentId_nick or "" obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
if member.parentId==0 then if member.parentId == 0 then
obj:GetChild('tex_shangjiID').text="" obj:GetChild('tex_shangjiID').text = ""
else else
obj:GetChild('tex_shangjiID').text=member.parentId obj:GetChild('tex_shangjiID').text = member.parentId
end end
local perm_array = MngPermission.getPermData(group.permission) local perm_array = MngPermission.getPermData(group.permission)
@ -378,22 +375,22 @@ function M:FillItem(obj, member, refresh)
function() function()
local mflv = local mflv =
GroupMemberOperateView.new( GroupMemberOperateView.new(
self.group_id, self.group_id,
member, member,
function(delete) function(delete)
if delete ~= nil and delete == true then if delete ~= nil and delete == true then
local group = DataManager.groups:get(self.group_id) local group = DataManager.groups:get(self.group_id)
self.member_data = group.members self.member_data = group.members
self.lst_member.numItems = #self.member_data self.lst_member.numItems = #self.member_data
self._view:GetController('search').selectedIndex = 0 self._view:GetController('search').selectedIndex = 0
else else
self.lst_member.numItems = self.lst_member.numItems self.lst_member.numItems = self.lst_member.numItems
if refresh then if refresh then
self:FillItem(obj, member) self:FillItem(obj, member)
end
end end
end end
end )
)
mflv:Show() mflv:Show()
end end
) )
@ -428,8 +425,8 @@ function M:FillItem(obj, member, refresh)
item_result:RemoveChildrenToPool() item_result:RemoveChildrenToPool()
for j = 1, #res.Data.members do for j = 1, #res.Data.members do
local tem = item_result:AddItemFromPool() local tem = item_result:AddItemFromPool()
self:FillItem(tem, res.Data.members[j], true) self:FillItem(tem, res.Data.members[j], true)
end end
end end
end, end,

View File

@ -4,7 +4,7 @@ local GroupMemberFagLogView = import('.GroupMemberFagLogView')
local GroupSetPermissionView = import('.GroupSetPermissionView') local GroupSetPermissionView = import('.GroupSetPermissionView')
local GroupBanSameTableView = import('.GroupBanSameTableView') local GroupBanSameTableView = import('.GroupBanSameTableView')
local GroupMemberOperateView = import('.GroupMemberOperateView') local GroupMemberOperateView = import('.GroupMemberOperateView')
local GroupAddMemberInfoView=import('.GroupAddMemberInfoView') local GroupAddMemberInfoView = import('.GroupAddMemberInfoView')
local GroupStatMember = import('.GroupStatMember') local GroupStatMember = import('.GroupStatMember')
local GroupMngFagPackView = import('../GroupMngFagPackView') local GroupMngFagPackView = import('../GroupMngFagPackView')
@ -64,14 +64,13 @@ function M:FillView()
local rtype = self._view:GetChild("n132") local rtype = self._view:GetChild("n132")
rtype.visible = false rtype.visible = false
rtype.onChanged:Set(function () rtype.onChanged:Set(function()
if tostring(self.online) == rtype.value then if tostring(self.online) == rtype.value then
return return
end end
self.online = tonumber(rtype.value) self.online = tonumber(rtype.value)
self:GetMemberData(0) self:GetMemberData(0)
--printlog("aaaaaaaa222222222222222222222222222222") --printlog("aaaaaaaa222222222222222222222222222222")
end) end)
-- 初始化成员列表 -- 初始化成员列表
@ -87,10 +86,10 @@ function M:FillView()
end end
) )
--local n50=self._view:GetChild('n50') --local n50=self._view:GetChild('n50')
--print(n50) ---- print(n50)
--n50.displayObject.gameObject.transform.localPosition.x=214 --n50.displayObject.gameObject.transform.localPosition.x=214
--print(n50.displayObject.gameObject.transform.localPosition.x) ---- print(n50.displayObject.gameObject.transform.localPosition.x)
-- 搜索玩家 -- 搜索玩家
local ctr_search = self._view:GetController('search') local ctr_search = self._view:GetController('search')
self._view:GetChild('btn_search').onClick:Set( self._view:GetChild('btn_search').onClick:Set(
@ -123,8 +122,8 @@ function M:FillView()
item_result:RemoveChildrenToPool() item_result:RemoveChildrenToPool()
for j = 1, #res.Data.members do for j = 1, #res.Data.members do
local tem = item_result:AddItemFromPool() local tem = item_result:AddItemFromPool()
self:FillItem(tem, res.Data.members[j], true) self:FillItem(tem, res.Data.members[j], true)
end end
end end
end, end,
@ -167,11 +166,11 @@ function M:FillView()
self.group_id, self.group_id,
tonumber(self._texnum_str), tonumber(self._texnum_str),
function(response) function(response)
printlog("响应获取添加玩家==》》》") printlog("响应获取添加玩家==》》》")
pt(response) pt(response)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
if (response.ReturnCode and response.ReturnCode == 0) then if (response.ReturnCode and response.ReturnCode == 0) then
GroupAddMemberInfoView.new(self.group_id,tonumber(self._texnum_str)):SetAddMember(response.Data) GroupAddMemberInfoView.new(self.group_id, tonumber(self._texnum_str)):SetAddMember(response.Data)
self:ClearNumTex() self:ClearNumTex()
--ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1) --ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
else else
@ -200,13 +199,10 @@ function M:FillView()
--self._view:GetChild("n50").selected = true --self._view:GetChild("n50").selected = true
ctr_page.onChanged:Set( ctr_page.onChanged:Set(
function() function()
self.stype = ctr_page.selectedIndex + 1 self.stype = ctr_page.selectedIndex + 1
self:initData() self:initData()
end end
) )
end end
-- 快速访问 -- 快速访问
@ -217,8 +213,8 @@ end
-- 获取成员数据 -- 获取成员数据
function M:GetMemberData(index) function M:GetMemberData(index)
--print("11111111111111111111") ---- print("11111111111111111111")
--print(debug.traceback()) ---- print(debug.traceback())
-- local iClear = false -- local iClear = false
-- local rtype = self._view:GetChild("n132").value -- local rtype = self._view:GetChild("n132").value
-- if tostring(self.online) ~= rtype then -- if tostring(self.online) ~= rtype then
@ -258,32 +254,32 @@ end
local function __change_fag(gid, pid, is_add, cur_hp, callback) local function __change_fag(gid, pid, is_add, cur_hp, callback)
local gniv = local gniv =
GroupNumberInputView.new( GroupNumberInputView.new(
nil, nil,
function(num) function(num)
num = ad2d((is_add and num or -num)) num = ad2d((is_add and num or -num))
ViewUtil.ShowModalWait() ViewUtil.ShowModalWait()
local fgCtr = ControllerManager.GetController(NewGroupController) local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_ChangeFag( fgCtr:FG_ChangeFag(
gid, gid,
pid, pid,
num, num,
function(res1) function(res1)
ViewUtil.CloseModalWait() ViewUtil.CloseModalWait()
-- if gniv._is_destroy then -- if gniv._is_destroy then
-- return -- return
-- end -- end
if (res1.ReturnCode == 0) then if (res1.ReturnCode == 0) then
callback(res1.Data) callback(res1.Data)
else else
ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!') ViewUtil.ErrorTip(res1.ReturnCode, '更改积分失败!')
end
end end
end )
) -- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str
-- item:GetChild("tex_fag").text = (self_user or show_fag) and num or show_fag_str end,
end, is_add and 1 or 2,
is_add and 1 or 2, cur_hp and d2ad(cur_hp) or nil
cur_hp and d2ad(cur_hp) or nil )
)
gniv:Show() gniv:Show()
end end
@ -313,35 +309,35 @@ function M:FillItem(obj, member, refresh)
--obj:GetChild("tex_cost_count").text = d2ad(member.last_hp_cost) --obj:GetChild("tex_cost_count").text = d2ad(member.last_hp_cost)
--if member.online == 1 then --if member.online == 1 then
-- obj:GetChild('tex_last_login').text = '在线' -- obj:GetChild('tex_last_login').text = '在线'
-- else -- else
if member.last_time ~= 0 then if member.last_time ~= 0 then
-- local now_time = os.date("*t",now) -- 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 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)) -- local cha = math.ceil((today - member.last_time) / (24 * 60 *60))
-- if (cha > 0) then -- if (cha > 0) then
-- obj:GetChild('tex_last_login').text = cha.."天前" --'最近登录\n' .. os.date('%Y/%m/%d', member.last_time) -- obj:GetChild('tex_last_login').text = cha.."天前" --'最近登录\n' .. os.date('%Y/%m/%d', member.last_time)
-- else -- else
-- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time) -- obj:GetChild('tex_last_login').text = os.date('%Y/%m/%d', member.last_time)
-- end -- end
--print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time)) ---- print("11111aaaaaaaaaaaaaaaaaaaa ",os.date('%Y/%m/%d', member.last_time))
obj:GetChild('tex_last_login').text = "最近登录:"..os.date('%Y/%m/%d', member.last_time) obj:GetChild('tex_last_login').text = "最近登录:" .. os.date('%Y/%m/%d', member.last_time)
else else
obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time) obj:GetChild('tex_last_login').text = '加入时间\n' .. os.date('%Y/%m/%d', member.join_time)
end end
-- end -- end
obj:GetChild('tex_zongchangci').text = member.total_round 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_ruhui').text = os.date('%Y/%m/%d %H:%M:%S', member.join_time)
--上级 --上级
obj:GetChild('tex_shangjiName').text=member.parentId_nick or "" obj:GetChild('tex_shangjiName').text = member.parentId_nick or ""
if member.parentId==0 then if member.parentId == 0 then
obj:GetChild('tex_shangjiID').text="" obj:GetChild('tex_shangjiID').text = ""
else else
obj:GetChild('tex_shangjiID').text=member.parentId obj:GetChild('tex_shangjiID').text = member.parentId
end end
local perm_array = MngPermission.getPermData(group.permission) local perm_array = MngPermission.getPermData(group.permission)
@ -427,40 +423,41 @@ function M:FillItem(obj, member, refresh)
function() function()
local mflv = local mflv =
GroupMemberOperateView.new( GroupMemberOperateView.new(
self.group_id, self.group_id,
member, member,
function(delete) function(delete)
if delete ~= nil and delete == true then if delete ~= nil and delete == true then
local group = DataManager.groups:get(self.group_id) local group = DataManager.groups:get(self.group_id)
self.member_data = group.members self.member_data = group.members
self.lst_member.numItems = #self.member_data self.lst_member.numItems = #self.member_data
self._view:GetController('search').selectedIndex = 0 self._view:GetController('search').selectedIndex = 0
else else
self.lst_member.numItems = self.lst_member.numItems self.lst_member.numItems = self.lst_member.numItems
if refresh then if refresh then
self:FillItem(obj, member) self:FillItem(obj, member)
end
end end
end,
function()
self:GetMemberData(0)
end end
end, )
function()
self:GetMemberData(0)
end
)
mflv:Show() mflv:Show()
end end
) )
local btnBxx = obj:GetChild('btn_bxx') local btnBxx = obj:GetChild('btn_bxx')
btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and not (DataManager.SelfUser.account_id == member.uid) btnBxx.visible = (not (member.lev == 3 and member.partnerLev == 0)) and
not (DataManager.SelfUser.account_id == member.uid)
--btnBxx.visible = not (DataManager.SelfUser.account_id == member.uid) --btnBxx.visible = not (DataManager.SelfUser.account_id == member.uid)
obj:GetChild('btn_bxx').onClick:Set( obj:GetChild('btn_bxx').onClick:Set(
function() function()
local ctrNum=1 local ctrNum = 1
-- if not (member.lev == 3 and member.partnerLev == 0) then -- if not (member.lev == 3 and member.partnerLev == 0) then
-- ctrNum = 2 -- ctrNum = 2
-- end -- end
ctrNum=2 ctrNum = 2
local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view,ctrNum,member.uid) local gmv = GroupMngFagPackView.new(self.curGroup.id, self._root_view, ctrNum, member.uid)
gmv:SetCallback( gmv:SetCallback(
function() function()
btnBxx.selected = false btnBxx.selected = false
@ -471,7 +468,7 @@ function M:FillItem(obj, member, refresh)
) )
local superBtn = obj:GetChild('super_btn') local superBtn = obj:GetChild('super_btn')
superBtn.visible = group.lev == 1 superBtn.visible = group.lev == 1
obj:GetChild("super_btn").onClick:Set( obj:GetChild("super_btn").onClick:Set(
function() function()
ViewUtil.ShowModalWait(nil) ViewUtil.ShowModalWait(nil)
@ -502,8 +499,8 @@ function M:FillItem(obj, member, refresh)
item_result:RemoveChildrenToPool() item_result:RemoveChildrenToPool()
for j = 1, #res.Data.members do for j = 1, #res.Data.members do
local tem = item_result:AddItemFromPool() local tem = item_result:AddItemFromPool()
self:FillItem(tem, res.Data.members[j], true) self:FillItem(tem, res.Data.members[j], true)
end end
end end
end, end,

View File

@ -22,13 +22,13 @@ local M = PlayerInfoView
function M.new(view, main_view, isHideIpAdds) function M.new(view, main_view, isHideIpAdds)
local self = {} local self = {}
setmetatable(self, {__index = PlayerInfoView}) setmetatable(self, { __index = PlayerInfoView })
self._view = view self._view = view
self._main_view = main_view self._main_view = main_view
self._isHideIpAdds = isHideIpAdds self._isHideIpAdds = isHideIpAdds
self.isShowTGTimer=false self.isShowTGTimer = false
self.currentTime=0 self.currentTime = 0
self.totalTime=0 self.totalTime = 0
--self.isShow = fasle --self.isShow = fasle
self:init() self:init()
return self return self
@ -41,34 +41,34 @@ function M:init()
self._tex_player_name = player_name_score:GetChild('tex_player_name') self._tex_player_name = player_name_score:GetChild('tex_player_name')
self._tex_player_id = player_name_score:GetChild('tex_player_id') self._tex_player_id = player_name_score:GetChild('tex_player_id')
self._tex_score = player_name_score:GetChild('tex_score') self._tex_score = player_name_score:GetChild('tex_score')
self._tex_score.visible=true self._tex_score.visible = true
self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1") self._tex_score1 = self._view:GetChild("info"):GetChild("tex_score1")
if self._tex_score1 then if self._tex_score1 then
self._tex_score1.visible=true self._tex_score1.visible = true
end end
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
if self._tex_score2 then if self._tex_score2 then
self._tex_score2.visible=true self._tex_score2.visible = true
end end
self._tex_n4 = self._view:GetChild("info"):GetChild("n4") self._tex_n4 = self._view:GetChild("info"):GetChild("n4")
if self._tex_n4 then if self._tex_n4 then
self._tex_n4.visible=true self._tex_n4.visible = true
end end
self._tex_n5 = self._view:GetChild("info"):GetChild("n5") self._tex_n5 = self._view:GetChild("info"):GetChild("n5")
if self._tex_n5 then if self._tex_n5 then
self._tex_n5.visible=true self._tex_n5.visible = true
end end
self.n3Bg=self._view:GetChild("info"):GetChild("n3") self.n3Bg = self._view:GetChild("info"):GetChild("n3")
if self.n3Bg then if self.n3Bg then
--self.n3Bg:SetSize(138,55) --self.n3Bg:SetSize(138,55)
end end
self.zhanjitext=self._view:GetChild("text_jifen") self.zhanjitext = self._view:GetChild("text_jifen")
if self.zhanjitext then if self.zhanjitext then
self.zhanjitext.text=0 self.zhanjitext.text = 0
end end
self._biaoqing = view:GetChild('face') self._biaoqing = view:GetChild('face')
@ -83,68 +83,63 @@ function M:init()
self._ctr_mask_voice = view:GetController('mask_voice') self._ctr_mask_voice = view:GetController('mask_voice')
self._ctr_dismiss_room = view:GetController('dismiss_room') self._ctr_dismiss_room = view:GetController('dismiss_room')
self.PlayerTGTips=view:GetChild('tuoguanTips') self.PlayerTGTips = view:GetChild('tuoguanTips')
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
self.PlayerTGTips.displayObject.gameObject:SetActive(false) self.PlayerTGTips.displayObject.gameObject:SetActive(false)
end end
end end
function M:IsShowTGTips(isShow, time)
function M:IsShowTGTips(isShow,time)
--printlog("isShowisShowisShow==== ",isShow," time ",time) --printlog("isShowisShowisShow==== ",isShow," time ",time)
if time==nil then time=0 end if time == nil then time = 0 end
self.isShowTGTimer = isShow self.isShowTGTimer = isShow
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow) self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
end end
self.currentTime=0 self.currentTime = 0
if isShow then if isShow then
if self.PlayerTGTips then if self.PlayerTGTips then
self.PlayerTGTips.text="开启托管剩余时间"..time.."s" self.PlayerTGTips.text = "开启托管剩余时间" .. time .. "s"
end end
self.totalTime=time self.totalTime = time
--UpdateBeat:Remove(self.OnUpdate,self) --UpdateBeat:Remove(self.OnUpdate,self)
--UpdateBeat:Add(self.OnUpdate,self) --UpdateBeat:Add(self.OnUpdate,self)
-- printlog("aaaaaaaaa111111111111111111111111111111") -- printlog("aaaaaaaaa111111111111111111111111111111")
--TimerManager.RemoveTimer(self.OnUpdate) --TimerManager.RemoveTimer(self.OnUpdate)
TimerManager.AddTimer(self.OnUpdate,self) TimerManager.AddTimer(self.OnUpdate, self)
--printlog(self) --printlog(self)
else else
-- printlog("移除IsShowTGTips",self.isShow) -- printlog("移除IsShowTGTips",self.isShow)
--UpdateBeat:Remove(self.OnUpdate,self) --UpdateBeat:Remove(self.OnUpdate,self)
TimerManager.RemoveTimer(self.OnUpdate,self) TimerManager.RemoveTimer(self.OnUpdate, self)
end end
end end
function M:OnUpdate() function M:OnUpdate()
--printlog("OnUpdate=====================") --printlog("OnUpdate=====================")
if self.isShowTGTimer then if self.isShowTGTimer then
self.currentTime=self.currentTime+Time.deltaTime self.currentTime = self.currentTime + Time.deltaTime
if self.currentTime>=1 then if self.currentTime >= 1 then
self.currentTime=0 self.currentTime = 0
self.totalTime=self.totalTime-1 self.totalTime = self.totalTime - 1
--printlog("当前计时器===>>>",self.totalTime) --printlog("当前计时器===>>>",self.totalTime)
if self.PlayerTGTips then if self.PlayerTGTips then
self.PlayerTGTips.text="开启托管剩余时间"..self.totalTime.."s" self.PlayerTGTips.text = "开启托管剩余时间" .. self.totalTime .. "s"
end end
if self.totalTime<=0 then if self.totalTime <= 0 then
self.isShowTGTimer=false self.isShowTGTimer = false
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
self.PlayerTGTips.displayObject.gameObject:SetActive(false) self.PlayerTGTips.displayObject.gameObject:SetActive(false)
end end
end end
end end
if self.muShiPlayerUpdate then
self:muShiPlayerUpdate()
end
end
if self.muShiPlayerUpdate then
self:muShiPlayerUpdate()
end
end
end end
function M:FillData(player) function M:FillData(player)
@ -173,12 +168,12 @@ function M:FillData(player)
end end
if isHidden 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 then
if player.orgSeat and player.orgSeat > 0 then if player.orgSeat and player.orgSeat > 0 then
self._tex_player_name.text = "玩家"..player.orgSeat self._tex_player_name.text = "玩家" .. player.orgSeat
else else
self._tex_player_name.text = "玩家"..player.seat self._tex_player_name.text = "玩家" .. player.seat
player.orgSeat = membe_clone(player.seat) player.orgSeat = membe_clone(player.seat)
end end
if self._tex_player_id then if self._tex_player_id then
@ -187,7 +182,7 @@ function M:FillData(player)
else else
self._tex_player_name.text = player.self_user.nick_name self._tex_player_name.text = player.self_user.nick_name
if self._tex_player_id then if self._tex_player_id then
self._tex_player_id.text = "ID:".. player.self_user.account_id self._tex_player_id.text = "ID:" .. player.self_user.account_id
end end
end end
self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0 self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0
@ -208,12 +203,12 @@ function M:UpdateScore(score)
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room:checkHpNonnegative() then if room:checkHpNonnegative() then
if self._player.cur_hp then if self._player.cur_hp then
-- print(self._player.total_hp) -- -- print(self._player.total_hp)
-- if self._player.total_hp then -- if self._player.total_hp then
-- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp) -- score = d2ad(self._player.total_hp).."/"..d2ad(self._player.cur_hp)
-- else -- else
score = d2ad(self._player.cur_hp) score = d2ad(self._player.cur_hp)
-- end -- end
end end
end end
end end
@ -339,9 +334,11 @@ function M:MarkTuoguan()
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan') local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan') self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
end end
function M:UnmarkTuoguan() function M:UnmarkTuoguan()
self:RemoveMarkFromHead('mark_tuoguan') self:RemoveMarkFromHead('mark_tuoguan')
end end
-- 动态的往头像上加载组件 -- 动态的往头像上加载组件
function M:AddMarkToHead(com, key) function M:AddMarkToHead(com, key)
if key then if key then
@ -354,6 +351,7 @@ function M:AddMarkToHead(com, key)
com.touchable = false com.touchable = false
com.xy = self:GetHeadCenter() com.xy = self:GetHeadCenter()
end end
-- 动态移除组件 -- 动态移除组件
function M:RemoveMarkFromHead(key) function M:RemoveMarkFromHead(key)
if self[key] then if self[key] then
@ -363,11 +361,10 @@ function M:RemoveMarkFromHead(key)
end end
function M:Destroy() function M:Destroy()
self.isShowTGTimer=false self.isShowTGTimer = false
TimerManager.RemoveTimer(self.OnUpdate,self) TimerManager.RemoveTimer(self.OnUpdate, self)
self.OnUpdate=nil self.OnUpdate = nil
self.muShiPlayerUpdate=nil self.muShiPlayerUpdate = nil
end end
return M return M

View File

@ -128,7 +128,7 @@ function M:FillData(player)
end end
end end
print("============================playinfoview") -- print("============================playinfoview")
pt(player) pt(player)
if isHidden if isHidden

View File

@ -129,8 +129,8 @@ end
function ViewUtil.HandCardSort2(a, b) function ViewUtil.HandCardSort2(a, b)
a = tonumber(string.sub(a, 2)) a = tonumber(string.sub(a, 2))
b = tonumber(string.sub(b, 2)) b = tonumber(string.sub(b, 2))
--print(a) ---- print(a)
--print(b) ---- print(b)
return a < b return a < b
end end
@ -242,7 +242,7 @@ function get_gps(callback)
end) end)
end) end)
if not s then if not s then
--print("Error" .. e) ---- print("Error" .. e)
end end
elseif Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then elseif Application.platform == RuntimePlatform.WindowsPlayer or Application.platform == RuntimePlatform.WindowsEditor then
-- DataManager.SelfUser.location = Location.new(string.format("%s,%s", math.random(10,20), math.random(10,20))) -- DataManager.SelfUser.location = Location.new(string.format("%s,%s", math.random(10,20), math.random(10,20)))

View File

@ -53,7 +53,7 @@ local function __NetTip(txt_msg)
end end
local function __OnGameConnectAction(state) local function __OnGameConnectAction(state)
--print("state:"..state) ---- print("state:"..state)
NetResetConnectWindow.CloseNetReset() NetResetConnectWindow.CloseNetReset()
if state == SocketCode.Connect then if state == SocketCode.Connect then
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id) ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
@ -150,14 +150,14 @@ function ViewManager.ChangeView(id, game_id, callback)
end end
function ViewManager.OnApplicationPause() function ViewManager.OnApplicationPause()
-- print("game pause") -- -- print("game pause")
if (_currenView ~= nil) then if (_currenView ~= nil) then
_currenView:OnApplicationPause() _currenView:OnApplicationPause()
end end
end end
function ViewManager.OnApplicationActive() function ViewManager.OnApplicationActive()
-- print("game active") -- -- print("game active")
if (_currenView ~= nil) then if (_currenView ~= nil) then
_currenView:OnApplicationActive() _currenView:OnApplicationActive()
end end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,15 @@
local breakSocketHandle,debugXpCall = require("LuaDebugjit")("localhost",7003) local breakSocketHandle, debugXpCall = require("LuaDebugjit")("localhost", 7003)
local timer = Timer.New(function() local timer = Timer.New(function()
breakSocketHandle() end, 1, -1, false) breakSocketHandle()
end, 1, -1, false)
timer:Start(); timer:Start();
require "Core.init" require "Core.init"
json = require 'cjson' json = require 'cjson'
require'FairyGUI' require 'FairyGUI'
require'Game.ControllerManager' require 'Game.ControllerManager'
require'Game.ViewManager' require 'Game.ViewManager'
require'Game.DataManager' require 'Game.DataManager'
require "Game.ExtendManager" require "Game.ExtendManager"
require "Game.ExtendHotupdate" require "Game.ExtendHotupdate"
require "TableData" require "TableData"
@ -19,7 +20,7 @@ Utils = Game.Utils
PlayerPrefs = UnityEngine.PlayerPrefs PlayerPrefs = UnityEngine.PlayerPrefs
RuntimePlatform = UnityEngine.RuntimePlatform RuntimePlatform = UnityEngine.RuntimePlatform
Application = UnityEngine.Application Application = UnityEngine.Application
Screen=UnityEngine.Screen Screen = UnityEngine.Screen
ResourcesManager = taurus.unity.ResourcesManager ResourcesManager = taurus.unity.ResourcesManager
-- require 'tolua.reflection' -- require 'tolua.reflection'
-- tolua.loadassembly('Assembly-CSharp') -- tolua.loadassembly('Assembly-CSharp')
@ -31,21 +32,22 @@ local _game_info
local panel = nil local panel = nil
oldGameVersion=2 --1 原始 2 老游戏新加功能 oldGameVersion = 2 --1 原始 2 老游戏新加功能
--主入口函数。从这里开始lua逻辑 --主入口函数。从这里开始lua逻辑
function Main() function Main()
--PlayerPrefs.DeleteKey('session_id') --PlayerPrefs.DeleteKey('session_id')
Application.targetFrameRate = 60 Application.targetFrameRate = 60
FairyGUI.UIConfig.buttonSound =FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",typeof(UnityEngine.AudioClip))) FairyGUI.UIConfig.buttonSound = FairyGUI.NAudioClip(ResourcesManager.LoadObject("base/common/sound/click.mp3",
typeof(UnityEngine.AudioClip)))
FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S" FairyGUI.UIConfig.defaultFont = "FZDaBiaoSong-B06S"
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN","base/static/fonts/SIYUAN.TTF"),null) FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null)
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null) --FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null) --FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
_game_info = json.decode(GameApplication.Instance.GameInfo) _game_info = json.decode(GameApplication.Instance.GameInfo)
--_game_info["login_url"]="http://8.134.59.224:8101/" --_game_info["login_url"]="http://8.134.59.224:8101/"
--pt(_game_info) --pt(_game_info)
debug_print = false--GetGameInfo("debug_print") debug_print = false --GetGameInfo("debug_print")
if Application.platform == RuntimePlatform.WindowsEditor then if Application.platform == RuntimePlatform.WindowsEditor then
debug_print = true debug_print = true
end end
@ -62,7 +64,7 @@ function Main()
--web网络API版本号 --web网络API版本号
NetManager.VERSION = GetGameInfo("net_version") NetManager.VERSION = GetGameInfo("net_version")
TimerManager.New() TimerManager.New()
-- test:DynamicInvoke("222") -- test:DynamicInvoke("222")
--ExtendManager.Init() --ExtendManager.Init()
ControllerManager.Init() ControllerManager.Init()
@ -89,10 +91,8 @@ function Main()
end end
end end
end) end)
end end
function GetGameInfo(key) function GetGameInfo(key)
return _game_info[key] return _game_info[key]
end end
@ -102,12 +102,12 @@ function GetPlatform()
end end
function GetGameInfoPlatform(key) function GetGameInfoPlatform(key)
local p_key = GetPlatform() local p_key = GetPlatform()
local _platfrom = _game_info[p_key] local _platfrom = _game_info[p_key]
return _platfrom[key] return _platfrom[key]
end end
function BlurView(view,enabled) function BlurView(view, enabled)
if enabled then if enabled then
local bf = FairyGUI.BlurFilter() local bf = FairyGUI.BlurFilter()
bf.blurSize = 0.05 bf.blurSize = 0.05
@ -135,61 +135,60 @@ end
function ShareScreenShot(n, callback) function ShareScreenShot(n, callback)
local json_data = {} local json_data = {}
json_data["title"] = "湘北联赛" json_data["title"] = "湘北联赛"
local mediaObject = {} local mediaObject = {}
mediaObject["path"] = Application.persistentDataPath mediaObject["path"] = Application.persistentDataPath
mediaObject["filename"] = "screenshot" mediaObject["filename"] = "screenshot"
mediaObject["type"] = 1 mediaObject["type"] = 1
json_data["mediaObject"] = mediaObject json_data["mediaObject"] = mediaObject
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!" json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
json_data["scene"] = 0 json_data["scene"] = 0
local json_str =json.encode(json_data) local json_str = json.encode(json_data)
TakeScreenShot.Take(function() TakeScreenShot.Take(function()
-- 1微信 2支付宝 -- 1微信 2支付宝
GameApplication.Instance:ShareLink(n or 1, json_str, nil) GameApplication.Instance:ShareLink(n or 1, json_str, nil)
if callback then if callback then
callback() callback()
end end
end) end)
end end
function shareQRCodePicture(url,secene) function shareQRCodePicture(url, secene)
--print(debug.traceback()) ---- print(debug.traceback())
print(url) -- print(url)
print(secene) -- print(secene)
local json_data = {} local json_data = {}
json_data["title"] = "湘北联赛" json_data["title"] = "湘北联赛"
local mediaObject = {} local mediaObject = {}
local filename = "qrcode" .. DataManager.SelfUser.account_id local filename = "qrcode" .. DataManager.SelfUser.account_id
print(Application.persistentDataPath) -- print(Application.persistentDataPath)
mediaObject["path"] = Application.persistentDataPath mediaObject["path"] = Application.persistentDataPath
mediaObject["filename"] = filename mediaObject["filename"] = filename
mediaObject["type"] = 1 mediaObject["type"] = 1
json_data["mediaObject"] = mediaObject json_data["mediaObject"] = mediaObject
json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!" json_data["description"] = "一款现实中朋友约局休闲娱乐的场所!速度约朋友一起来玩吧!"
json_data["scene"] = secene json_data["scene"] = secene
print("json_data==================") -- print("json_data==================")
local json_str = json.encode(json_data) local json_str = json.encode(json_data)
pt(json_str) pt(json_str)
local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250) local tex2 = QRCodePicture.GenerateQRcode(url, 250, 250)
local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png",typeof(UnityEngine.Texture2D)) local tex1 = ResourcesManager.LoadObject("base/lobby/bg/bg.png", typeof(UnityEngine.Texture2D))
filename = filename ..".jpg" filename = filename .. ".jpg"
print("text2==========") -- print("text2==========")
print(tex2) -- print(tex2)
print("text1==========") -- print("text1==========")
print(tex1) -- print(tex1)
print("filename==========") -- print("filename==========")
print(filename) -- print(filename)
QRCodePicture.CombanitePicture(tex1,tex2,393,1334-802-250,filename) QRCodePicture.CombanitePicture(tex1, tex2, 393, 1334 - 802 - 250, filename)
GameApplication.Instance:ShareLink(1, json_str, nil) GameApplication.Instance:ShareLink(1, json_str, nil)
end end
function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name) function ShareChatRoom(room_id, share_time, round, game_name, group_id, player_list, _root_view, play_name)
end end
function UISetController(root,controller_name, gear_display, selectedIndex) function UISetController(root, controller_name, gear_display, selectedIndex)
local ctr = root:GetController(controller_name) local ctr = root:GetController(controller_name)
local gear = gear_display:GetGear(0) local gear = gear_display:GetGear(0)
@ -202,9 +201,9 @@ local bg_url = nil
function LoadGameBg(url, main_view) function LoadGameBg(url, main_view)
local win_mode = main_view:GetChild("win_mode") local win_mode = main_view:GetChild("win_mode")
win_mode:RemoveChildren(0, -1, true) win_mode:RemoveChildren(0, -1, true)
local tex_bg = ResourcesManager.LoadObjectByGroup(url..".png",typeof(UnityEngine.Texture), url) local tex_bg = ResourcesManager.LoadObjectByGroup(url .. ".png", typeof(UnityEngine.Texture), url)
print("===========================mainbg") -- print("===========================mainbg")
print(url..".png",typeof(UnityEngine.Texture), url) -- print(url..".png",typeof(UnityEngine.Texture), url)
local bg = GImage() local bg = GImage()
bg.texture = FairyGUI.NTexture(tex_bg) bg.texture = FairyGUI.NTexture(tex_bg)
bg.width = win_mode.width bg.width = win_mode.width
@ -225,7 +224,7 @@ function AddPanel(child)
panel:AddChild(child) panel:AddChild(child)
end end
function AddPanelAt(child,index) function AddPanelAt(child, index)
child:MakeFullScreen() child:MakeFullScreen()
child:AddRelation(GRoot.inst, RelationType.Size) child:AddRelation(GRoot.inst, RelationType.Size)
panel:AddChildAt(child, index) panel:AddChildAt(child, index)
@ -247,7 +246,7 @@ end
--场景切换通知 --场景切换通知
function OnLevelWasLoaded(level) function OnLevelWasLoaded(level)
Time.timeSinceLevelLoad = 0 Time.timeSinceLevelLoad = 0
end end
--程序切到后台 --程序切到后台
@ -261,118 +260,111 @@ function OnApplicationActive()
ViewManager.OnApplicationActive() ViewManager.OnApplicationActive()
end end
function pt(...) function pt(...)
if debug_print then if debug_print then
local arg={...} local arg = { ... }
local has=false local has = false
for _,v in pairs(arg) do for _, v in pairs(arg) do
if v and type(v)=="table" then if v and type(v) == "table" then
has=true has = true
break break
end end
end end
if not has then if not has then
print(...) -- print(...)
end end
local content="" local content = ""
for _,v in pairs(arg) do for _, v in pairs(arg) do
if v=="table" then if v == "table" then
content=content..tostring(v).."\n" content = content .. tostring(v) .. "\n"
else else
content=content.."==>[T]:"..LuaPrint(v,limit),debug.traceback().."\n" content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n"
end end
print(content) -- print(content)
end end
end
end
end end
function LuaPrint(lua_table, limit, indent, step)
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) if type(lua_table) == "string" or type(lua_table) == "number" then
step=step or 0 return "[No-Table]:" .. lua_table
indent=indent or 0 end
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 for k, v in pairs(lua_table) do
return "[No-Table]:"..lua_table if k ~= "_class_type" then
end local szBuffer = ""
Typev = type(v)
for k,v in pairs(lua_table) do if Typev == "table" then
if k~="_class_type" then szBuffer = "{"
local szBuffer="" end
Typev=type(v) local szPrefix = string.rep(" ", indent)
if Typev =="table" then if Typev == "table" and v._fields then
szBuffer="{" local kk, vv = next(v._fields)
end if type(vv) == "table" then
local szPrefix=string.rep(" ",indent) content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) ..
if Typev=="table" and v._fields then "}"
local kk,vv=next(v._fields) else
if type(vv)=="table" then content = content .. "\n\t" .. kk.name .. "=" .. vv
content=content.."\n\t"..kk.name.."={"..LuaPrint(vv._fields,5,indent+1,step+1).."}" end
else else
content=content.."\n\t"..kk.name.."="..vv if type(k) == "table" then
end if k.name then
else if type(v) ~= "table" then
if type(k)=="table" then content = content .. "\n" .. k.name .. "=" .. v
if k.name then else
if type(v)~="table" then content = content .. "\n" .. k.name .. " = list:"
content=content.."\n"..k.name.."="..v local tmp = "\n"
else for ka, va in ipairs(v) do
content=content.."\n"..k.name.." = list:" tmp = tmp .. "#" .. ka .. "_" .. tostring(va)
local tmp="\n" end
for ka,va in ipairs(v) do content = content .. tmp
tmp=tmp.."#"..ka.."_"..tostring(va) end
end end
content=content..tmp elseif type(k) == "function" then
end content = content .. "\n fun=function"
end else
formatting = szPrefix .. tostring(k) .. " = " .. szBuffer
elseif type(k)=="function" then if Typev == "table" then
content=content.."\n fun=function" content = content .. "\n" .. formatting
else content = content .. LuaPrint(v, limit, indent + 1, step + 1)
formatting=szPrefix..tostring(k).." = "..szBuffer content = content .. "\n" .. szPrefix .. "},"
if Typev=="table" then else
content=content.."\n"..formatting local szValue = ""
content=content..LuaPrint(v,limit,indent+1,step+1) if Typev == "string" then
content=content.."\n"..szPrefix.."}," szValue = string.format("%q", v)
else else
local szValue="" szValue = tostring(v)
if Typev=="string" then end
szValue=string.format("%q",v) content = content .. "\n" .. formatting .. (szValue or "nil") .. ","
else end
szValue=tostring(v) end
end end
content=content.."\n"..formatting..(szValue or "nil").."," end
end end
end return content
end
end
end
return content
end end
function printlog(...) function printlog(...)
if debug_print then if debug_print then
print(...) -- print(...)
end end
end end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "100Zhang_MJ" self.asset_group = "100Zhang_MJ"
self:init() self:init()
@ -25,144 +25,137 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/100zhang/ui/Extend_MJ_100Zhang") UIPackage.AddPackage("extend/majiang/100zhang/ui/Extend_MJ_100Zhang")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人100张 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人100张 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.beforelaiziCardId and room.beforelaiziCardId>0 then if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false) self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
--print(beforeLaiziID) ---- print(beforeLaiziID)
--print(currentLaizi1ID) ---- print(currentLaizi1ID)
--print(currentLaizi2ID) ---- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID then if currentLaizi2ID then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID then if currentLaizi2ID then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID then
if currentLaizi2ID then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -172,8 +165,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -187,11 +180,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -208,7 +201,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -219,27 +212,27 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
local arg = {...} local arg = { ... }
local _tip = arg[1] local _tip = arg[1]
local weight = arg[2] local weight = arg[2]
self:__FangziTip(_tip, weight) self:__FangziTip(_tip, weight)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -265,21 +258,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_Majiang/eff_zimo" then elseif url == "ui://Main_Majiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -288,47 +281,45 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("100Zhang_MJ",player.self_user.sex, hu_sound) self:PlaySound("100Zhang_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_100Zhang/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_100Zhang/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_100Zhang/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
--ViewUtil.PlaySound("100Zhang_MJ", "extend/majiang/100zhang/sound/zhuaniao.mp3") --ViewUtil.PlaySound("100Zhang_MJ", "extend/majiang/100zhang/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -337,7 +328,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -355,7 +346,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -377,7 +368,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -403,7 +394,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -424,7 +415,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -444,21 +435,21 @@ end
function M:OutCard(card) function M:OutCard(card)
if card ~= 0 then if card ~= 0 then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex,tostring(card)) self:PlaySound("100Zhang_MJ", self._room.self_player.self_user.sex, tostring(card))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
@ -476,37 +467,37 @@ function M:__FangziTip(tip, weight)
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1] local td = tip.tip_map_type[_tlist[k]][1]
local url = "ui://Main_Majiang/Btn_fztip" local url = "ui://Main_Majiang/Btn_fztip"
local td_weight = td.weight local td_weight = td.weight
if td_weight == 16 then td_weight = 8 end if td_weight == 16 then td_weight = 8 end
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
local btn_t = _lit_fanzi:AddItemFromPool(url) local btn_t = _lit_fanzi:AddItemFromPool(url)
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
btn_t.data = { tip, td } btn_t.data = { tip, td }
btn_t.onClick:Add(self.__TipAction,self) btn_t.onClick:Add(self.__TipAction, self)
end end
-- if not (tonumber(weight) >= 16) then -- if not (tonumber(weight) >= 16) then
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass") local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass") -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
_btn_pass.onClick:Set(function() _btn_pass.onClick:Set(function()
if tonumber(weight) >= 8 then if tonumber(weight) >= 8 then
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function() 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) _gamectr:SendAction(0)
_chipeng_tip:Dispose() _chipeng_tip:Dispose()
self._chipeng_tip = nil self._chipeng_tip = nil
end guo_msg:Close()
end) end)
guo_msg:Show()
else
_gamectr:SendAction(0)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
end
end)
-- end -- end
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
local item_choose = list_choose:AddItemFromPool() local item_choose = list_choose:AddItemFromPool()
item_choose:GetController("type").selectedIndex = 0 item_choose:GetController("type").selectedIndex = 0
for j = 1, 4 do for j = 1, 4 do
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card) item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
end end
item_choose.onClick:Add(function() item_choose.onClick:Add(function()
callback(tiplist[i].id) callback(tiplist[i].id)
end) end)
end end
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) _pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
(self._view.height - _pop_tip_choice.height) / 2)
self._view:AddChild(_pop_tip_choice) self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice self._pop_tip_choice = _pop_tip_choice
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
local pNode = info._mask_liangpai local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect") local effect = UIPackage.CreateObject("Extend_MJ_100Zhang", "FzEffect")
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
self:PlaySound("100Zhang_MJ", player.self_user.sex,"peng"..math.random(1, 3)) self:PlaySound("100Zhang_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
else else
self:PlaySound("100Zhang_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
self:PlaySound("100Zhang_MJ", player.self_user.sex,"gang"..math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
@ -605,7 +596,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_100Zhang", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -648,17 +639,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -671,12 +662,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -714,11 +705,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -734,14 +725,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,46 +45,46 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCardBefore) printlog(_tableInfo.laiziCardBefore)
printlog(_tableInfo.laiziCard2Before) printlog(_tableInfo.laiziCard2Before)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCardBefore>0 then if _tableInfo.laiziCardBefore > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
end end
room.beforelaiziCardId=_tableInfo.laiziCardBefore room.beforelaiziCardId = _tableInfo.laiziCardBefore
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,16 +16,16 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -203,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -6,8 +6,8 @@ local CS_ClearingView = {}
local M = CS_ClearingView local M = CS_ClearingView
function CS_ClearingView.new(blur_view) function CS_ClearingView.new(blur_view)
setmetatable(M, {__index = ResultView}) setmetatable(M, { __index = ResultView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self._full = true self._full = true
ResultView.init(self, "ui://Main_Majiang/clearing") ResultView.init(self, "ui://Main_Majiang/clearing")
@ -16,70 +16,63 @@ function CS_ClearingView.new(blur_view)
self._close_zone = false self._close_zone = false
self._close_destroy = true self._close_destroy = true
self.xiPaiCtr=self._view:GetController("xipai") self.xiPaiCtr = self._view:GetController("xipai")
self:InitMaPai() self:InitMaPai()
return self return self
end end
function M:InitMaPai() function M:InitMaPai()
self.maPaiCtr=self._view:GetController("mapai") self.maPaiCtr = self._view:GetController("mapai")
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
self.maPaiList={} self.maPaiList = {}
for i=1,10 do for i = 1, 10 do
local tempMP=self._view:GetChild("niao"..i) local tempMP = self._view:GetChild("niao" .. i)
table.insert(self.maPaiList,tempMP) table.insert(self.maPaiList, tempMP)
end
end
function M:IsMapaiShow(niao,isShow)
if niao then
niao.visible=isShow
end end
end end
function M:IsMapaiShow(niao, isShow)
function M:SetMaPaiValue(niao,value)
if niao then if niao then
niao.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..value niao.visible = isShow
end end
end end
function M:SetMaPaiColor(niao,num) function M:SetMaPaiValue(niao, value)
niao:GetController("color").selectedIndex=num 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 end
function M:HideAllMapai() function M:HideAllMapai()
for i=1,#self.maPaiList do for i = 1, #self.maPaiList do
self:IsMapaiShow(self.maPaiList[i],false) self:IsMapaiShow(self.maPaiList[i], false)
self:SetMaPaiColor(self.maPaiList[i],0) self:SetMaPaiColor(self.maPaiList[i], 0)
end end
end end
function M:ShowSelectMaPai(niaoList) function M:ShowSelectMaPai(niaoList)
if niaoList and #niaoList>0 then if niaoList and #niaoList > 0 then
self.maPaiCtr.selectedIndex=1 self.maPaiCtr.selectedIndex = 1
self:HideAllMapai() self:HideAllMapai()
for i=1,#niaoList do for i = 1, #niaoList do
self:IsMapaiShow(self.maPaiList[i],true) self:IsMapaiShow(self.maPaiList[i], true)
self:SetMaPaiValue(self.maPaiList[i],niaoList[i].card) self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
if niaoList[i].score>0 then if niaoList[i].score > 0 then
self:SetMaPaiColor(self.maPaiList[i],2) self:SetMaPaiColor(self.maPaiList[i], 2)
end end
end end
else else
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
end end
end end
function M:InitData(over, room, result, total_result, callback) function M:InitData(over, room, result, total_result, callback)
self._callback = callback self._callback = callback
local _overCtr = self._view:GetController("over") local _overCtr = self._view:GetController("over")
@ -89,23 +82,24 @@ function M:InitData(over, room, result, total_result, callback)
local _btnCtr = self._view:GetController("button") local _btnCtr = self._view:GetController("button")
local _sdkCtr = self._view:GetController("sdk") local _sdkCtr = self._view:GetController("sdk")
local ctr_type = self._view:GetController("type") local ctr_type = self._view:GetController("type")
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round, room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time())) self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round,
room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes(), "\r", "") self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes(), "\r", "")
-- self._view:GetChild("tex_roomnum").text = room.room_id -- self._view:GetChild("tex_roomnum").text = room.room_id
-- self._view:GetChild("tex_data").text = os.date("%Y-%m-%d %H:%M", os.time()) -- self._view:GetChild("tex_data").text = os.date("%Y-%m-%d %H:%M", os.time())
-- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time()) -- self._view:GetChild("tex_time").text = os.date("%H:%M", os.time())
local paixingxiangqing=self._view:GetChild("btn_detal") local paixingxiangqing = self._view:GetChild("btn_detal")
paixingxiangqing.visible=false paixingxiangqing.visible = false
local fanhuipaixing=self._view:GetChild("btn_fanhuipaixing") local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
fanhuipaixing.visible=false fanhuipaixing.visible = false
local round=DataManager.CurrenRoom.room_config.config.times or 1 local round = DataManager.CurrenRoom.room_config.config.times or 1
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
if xpconfig and round>1 then if xpconfig and round > 1 then
self.xiPaiCtr.selectedIndex=1 self.xiPaiCtr.selectedIndex = 1
else else
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
end end
@ -115,17 +109,17 @@ function M:InitData(over, room, result, total_result, callback)
if over ~= 2 then if over ~= 2 then
local xipai=self._view:GetChild("btn_xipai") local xipai = self._view:GetChild("btn_xipai")
xipai.touchable=true xipai.touchable = true
xipai.onClick:Add(function() xipai.onClick:Add(function()
local xiPaiCallBack=function () local xiPaiCallBack = function()
xipai.touchable=false xipai.touchable = false
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
ViewUtil.ErrorTip(1000000,"申请洗牌成功") ViewUtil.ErrorTip(1000000, "申请洗牌成功")
end end
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendXiPaiAction(xiPaiCallBack) _gamectr:SendXiPaiAction(xiPaiCallBack)
end) end)
if result and result.xipai_score then if result and result.xipai_score then
--xipai.text="洗牌 积分x"..result.xipai_score --xipai.text="洗牌 积分x"..result.xipai_score
end end
@ -155,14 +149,14 @@ function M:InitData(over, room, result, total_result, callback)
end) end)
self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player) self:AddClearItem(room, result.info_list, nil, over, result.niao, result.active_player)
elseif over == 1 then elseif over == 1 then
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
_btnCtr.selectedIndex = 1 _btnCtr.selectedIndex = 1
_sdkCtr.selectedIndex = 1 _sdkCtr.selectedIndex = 1
btn_result.onClick:Add(function() btn_result.onClick:Add(function()
_overCtr.selectedIndex = 1 _overCtr.selectedIndex = 1
_btnCtr.selectedIndex = 0 _btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 0 _sdkCtr.selectedIndex = 0
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
if self._qsinfo_view then if self._qsinfo_view then
self._qsinfo_view:Dispose() self._qsinfo_view:Dispose()
end end
@ -173,9 +167,9 @@ function M:InitData(over, room, result, total_result, callback)
self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player) self:AddClearItem(room, result.info_list, total_result.info_list, over, result.niao, result.active_player)
end end
else else
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
_overCtr.selectedIndex = 1 _overCtr.selectedIndex = 1
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
btn_close.onClick:Add(function() btn_close.onClick:Add(function()
ViewManager.ChangeView(ViewManager.View_Lobby) ViewManager.ChangeView(ViewManager.View_Lobby)
end) end)
@ -183,7 +177,7 @@ function M:InitData(over, room, result, total_result, callback)
end end
end end
function M:AddClearItem(room, data, total_data,over, niao, active_player) function M:AddClearItem(room, data, total_data, over, niao, active_player)
local n = over + 1 local n = over + 1
local list_view1 = self._view:GetChild("player_list_1") local list_view1 = self._view:GetChild("player_list_1")
local list_view2 = self._view:GetChild("player_list_2") local list_view2 = self._view:GetChild("player_list_2")
@ -202,13 +196,13 @@ function M:AddClearItem(room, data, total_data,over, niao, active_player)
end end
end end
end end
table.sort(data, function(a,b) return a.seat > b.seat end) table.sort(data, function(a, b) return a.seat > b.seat end)
list_view1:RemoveChildrenToPool() list_view1:RemoveChildrenToPool()
for i=1,#data do for i = 1, #data do
local item = list_view1:AddItemFromPool() local item = list_view1:AddItemFromPool()
self:FillItemData(room, data[i], item, active_player, niao) self:FillItemData(room, data[i], item, active_player, niao)
end end
if #data == 3 then if #data == 3 then
list_view1.lineGap = 54 list_view1.lineGap = 54
elseif #data == 2 then elseif #data == 2 then
list_view1.lineGap = 108 list_view1.lineGap = 108
@ -244,14 +238,14 @@ function M:FillItemData(room, data, item, active_player)
end end
local sp = " " local sp = " "
local str = "胡:"..huadd.."" local str = "胡:" .. huadd .. ""
str = str..sp.."扎鸟:"..birdadd.."" str = str .. sp .. "扎鸟:" .. birdadd .. ""
str = str..sp.."起手胡:"..qsadd.."" str = str .. sp .. "起手胡:" .. qsadd .. ""
-- if #qs_niao_list > 0 then -- if #qs_niao_list > 0 then
-- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. "" -- str = str .. "(摇骰点数:" .. qs_niao_list[1].card .. " " .. qs_niao_list[2].card .. ""
-- end -- end
if data["piao_niao_score"] then if data["piao_niao_score"] then
str = str..sp.."飘鸟:"..data["piao_niao_score"].."" str = str .. sp .. "飘鸟:" .. data["piao_niao_score"] .. ""
end end
item:GetChild("score1").text = str item:GetChild("score1").text = str
local win_list = data["win_list"] local win_list = data["win_list"]
@ -271,7 +265,7 @@ function M:FillItemData(room, data, item, active_player)
end end
str2 = CS_Win_Type[win_list[i].type] str2 = CS_Win_Type[win_list[i].type]
end end
str1 = str1..str2..sp str1 = str1 .. str2 .. sp
end end
item:GetChild("score3").text = str1 item:GetChild("score3").text = str1
end end
@ -284,9 +278,9 @@ function M:FillItemData(room, data, item, active_player)
if data["is_win"] and active_player == p.self_user.account_id and remove_win_card then if data["is_win"] and active_player == p.self_user.account_id and remove_win_card then
list_remove(hand_cards, data["win_card"]) list_remove(hand_cards, data["win_card"])
end end
for i=1,#hand_cards do for i = 1, #hand_cards do
local card = hand_list_view:AddItemFromPool() local card = hand_list_view:AddItemFromPool()
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..hand_cards[i] card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. hand_cards[i]
end end
hand_list_view.width = 52 * #hand_cards hand_list_view.width = 52 * #hand_cards
@ -294,27 +288,27 @@ function M:FillItemData(room, data, item, active_player)
local fz_card_list = item:GetChild("fz_card_list") local fz_card_list = item:GetChild("fz_card_list")
fz_card_list.width = 157 * #fz_card * 0.8 fz_card_list.width = 157 * #fz_card * 0.8
fz_card_list:RemoveChildrenToPool() fz_card_list:RemoveChildrenToPool()
for i=1,#fz_card do for i = 1, #fz_card do
if fz_card[i].type == FZType.Peng then if fz_card[i].type == FZType.Peng then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
for j=1,3 do for j = 1, 3 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].card card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].card
end end
elseif fz_card[i].type == FZType.Chi then elseif fz_card[i].type == FZType.Chi then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
for j = 1,3 do for j = 1, 3 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].opcard[j] card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].opcard[j]
end end
elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4")
for j=1,4 do for j = 1, 4 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
if fz_card[i].type == FZType.Gang_An and j == 4 then if fz_card[i].type == FZType.Gang_An and j == 4 then
card.icon = "ui://Main_Majiang/202_00" card.icon = "ui://Main_Majiang/202_00"
else else
card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..fz_card[i].card card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].card
end end
end end
end end
@ -322,7 +316,7 @@ function M:FillItemData(room, data, item, active_player)
-- local total_score = data["total_score"] -- local total_score = data["total_score"]
if total >= 0 then if total >= 0 then
item:GetChild("score2").text = "+"..total item:GetChild("score2").text = "+" .. total
item:GetChild("score2").grayed = false item:GetChild("score2").grayed = false
else else
item:GetChild("score2").text = total item:GetChild("score2").text = total
@ -342,13 +336,13 @@ function M:FillItemData(room, data, item, active_player)
local is_win = data["is_win"] or false local is_win = data["is_win"] or false
item:GetController("win").selectedIndex = is_win and 0 or 1 item:GetController("win").selectedIndex = is_win and 0 or 1
--print(p.self_user.account_id, active_player) ---- print(p.self_user.account_id, active_player)
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
item:GetController("win").selectedIndex = 2 item:GetController("win").selectedIndex = 2
end end
local win_card = item:GetChild("win_card") local win_card = item:GetChild("win_card")
if is_win then if is_win then
win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..data["win_card"] win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. data["win_card"]
end end
if data.niao then if data.niao then
item:GetController("niao").selectedIndex = 1 item:GetController("niao").selectedIndex = 1
@ -370,75 +364,76 @@ function M:FillItemData(room, data, item, active_player)
end end
function M:FillItemData2(room, data, list) function M:FillItemData2(room, data, list)
-- 赋值result_info聊天室分享需要 -- 赋值result_info聊天室分享需要
local player_list = {} local player_list = {}
for i = 1, #data do for i = 1, #data do
player_list[i] = {} player_list[i] = {}
local user = room:GetPlayerBySeat(data[i].seat).self_user local user = room:GetPlayerBySeat(data[i].seat).self_user
player_list[i].id = user.account_id player_list[i].id = user.account_id
player_list[i].hp_info = data[i].hp_info player_list[i].hp_info = data[i].hp_info
player_list[i].score = data[i].total_score 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].house = room.owner_id == player_list[i].id and 1 or 0
player_list[i].nick = user.nick_name player_list[i].nick = user.nick_name
player_list[i].head_url = user.head_url player_list[i].head_url = user.head_url
local settle_log = data[i].settle_log local settle_log = data[i].settle_log
player_list[i].param = {} player_list[i].param = {}
player_list[i].param[1]={} player_list[i].param[1] = {}
player_list[i].param[1].key = "大胡自摸:" player_list[i].param[1].key = "大胡自摸:"
player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo) player_list[i].param[1].value = tostring(data[i].settle_log.da_zimo)
player_list[i].param[2]={} player_list[i].param[2] = {}
player_list[i].param[2].key = "小胡自摸:" player_list[i].param[2].key = "小胡自摸:"
player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo) player_list[i].param[2].value = tostring(data[i].settle_log.xiao_zimo)
player_list[i].param[3]={} player_list[i].param[3] = {}
player_list[i].param[3].key = "大胡接炮:" player_list[i].param[3].key = "大胡接炮:"
player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao) player_list[i].param[3].value = tostring(data[i].settle_log.da_jie_pao)
player_list[i].param[4]={} player_list[i].param[4] = {}
player_list[i].param[4].key = "小胡接炮:" player_list[i].param[4].key = "小胡接炮:"
player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao) player_list[i].param[4].value = tostring(data[i].settle_log.xiao_jie_pao)
player_list[i].param[5]={} player_list[i].param[5] = {}
player_list[i].param[5].key = "大胡点炮:" player_list[i].param[5].key = "大胡点炮:"
player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao) player_list[i].param[5].value = tostring(data[i].settle_log.da_dian_pao)
player_list[i].param[6]={} player_list[i].param[6] = {}
player_list[i].param[6].key = "小胡点炮:" player_list[i].param[6].key = "小胡点炮:"
player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao) player_list[i].param[6].value = tostring(data[i].settle_log.xiao_dian_pao)
end end
local round = room.room_config.round local round = room.room_config.round
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list) self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
-- self:SetGSListlineGap(-10) -- self:SetGSListlineGap(-10)
local big_result = self._view:GetChild("big_result") local big_result = self._view:GetChild("big_result")
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()), room.room_id, room.curren_round, room.room_config.round) big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()),
local lst_p = big_result:GetChild("player_list") room.room_id, room.curren_round, room.room_config.round)
if #player_list == 3 then local lst_p = big_result:GetChild("player_list")
if #player_list == 3 then
lst_p.columnGap = 108 lst_p.columnGap = 108
elseif #player_list == 2 then elseif #player_list == 2 then
lst_p.columnGap = 208 lst_p.columnGap = 208
end end
self:InitBigResult(room, 30) self:InitBigResult(room, 30)
local show_detail = room.hpOnOff == 1 local show_detail = room.hpOnOff == 1
for i = 1, lst_p.numChildren do for i = 1, lst_p.numChildren do
local com_p = lst_p:GetChildAt(i - 1) local com_p = lst_p:GetChildAt(i - 1)
local list_param = com_p:GetChild("list_param") local list_param = com_p:GetChild("list_param")
for j = 1, list_param.numChildren do for j = 1, list_param.numChildren do
local tem = list_param:GetChildAt(j - 1) local tem = list_param:GetChildAt(j - 1)
tem:GetChild("txt_value").textFormat.size = 30 tem:GetChild("txt_value").textFormat.size = 30
end end
if show_detail then if show_detail then
local score = 0 local score = 0
if com_p:GetController("pn").selectedIndex == 0 then if com_p:GetController("pn").selectedIndex == 0 then
score = com_p:GetChild("txt_navigate").text score = com_p:GetChild("txt_navigate").text
else else
score = com_p:GetChild("txt_positive").text score = com_p:GetChild("txt_positive").text
end end
score = score / room.score_times score = score / room.score_times
com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times) com_p:GetChild("tex_detail_score").text = string.format("%s × %s倍", score, room.score_times)
end end
end end
if room.group_id ~= 0 then if room.group_id ~= 0 then
big_result:GetController("group").selectedIndex = 1 big_result:GetController("group").selectedIndex = 1
end end
DataManager.CurrenRoom = nil DataManager.CurrenRoom = nil
end end
-- 起手胡详情 -- 起手胡详情
@ -472,7 +467,7 @@ function M:__AddQSInfo(data, nick, room)
cards[card] = 1 cards[card] = 1
end end
end end
for k,v in pairs(cards) do for k, v in pairs(cards) do
local card = k local card = k
if card_map[card] then if card_map[card] then
if card_map[card] < cards[card] then if card_map[card] < cards[card] then
@ -484,7 +479,7 @@ function M:__AddQSInfo(data, nick, room)
end end
end end
local all_cards = {} local all_cards = {}
for j,v in pairs(card_map) do for j, v in pairs(card_map) do
for k = 1, v do for k = 1, v do
table.insert(all_cards, j) table.insert(all_cards, j)
end end
@ -493,11 +488,11 @@ function M:__AddQSInfo(data, nick, room)
for j = 1, #all_cards do for j = 1, #all_cards do
local citem = lst_card:AddItemFromPool() local citem = lst_card:AddItemFromPool()
citem.touchable = false citem.touchable = false
citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_"..all_cards[j] citem.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. all_cards[j]
end end
local cs_zhua_niao = room.room_config.niao_type == 2 local cs_zhua_niao = room.room_config.niao_type == 2
qsinfo:GetController("niao").selectedIndex = cs_zhua_niao and 1 or 0 qsinfo:GetController("niao").selectedIndex = cs_zhua_niao and 1 or 0
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_score").text = tem.score
item:GetChild("tex_niao_score").text = cs_zhua_niao and tem.niao_score or "" item:GetChild("tex_niao_score").text = cs_zhua_niao and tem.niao_score or ""
end end
@ -517,7 +512,7 @@ function M:__AddQSInfo(data, nick, room)
_touch_start_pos = self._view:GlobalToLocal(Vector2(context.inputEvent.x, context.inputEvent.y)) _touch_start_pos = self._view:GlobalToLocal(Vector2(context.inputEvent.x, context.inputEvent.y))
end) end)
btn_di.onTouchMove:Add(function(context) btn_di.onTouchMove:Add(function(context)
local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)) local xy = self._view:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
local dist = Vector2(xy.x - _touch_start_pos.x, xy.y - _touch_start_pos.y) local dist = Vector2(xy.x - _touch_start_pos.x, xy.y - _touch_start_pos.y)
local posx = _view_start_pos.x + dist.x local posx = _view_start_pos.x + dist.x
local posy = _view_start_pos.y + dist.y local posy = _view_start_pos.y + dist.y
@ -542,8 +537,8 @@ end
local prefix local prefix
function M:GetPrefix() function M:GetPrefix()
-- if not prefix then -- if not prefix then
prefix = get_majiang_prefix(10) prefix = get_majiang_prefix(10)
-- end -- end
return prefix return prefix
end end

View File

@ -29,8 +29,8 @@ local M = {}
--- Create a new CS_MainView --- Create a new CS_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "CS_MainView" self.class = "CS_MainView"
self.asset_group = "ChangSha_MJ" self.asset_group = "ChangSha_MJ"
self:init() self:init()
@ -47,7 +47,7 @@ function M:InitView(url)
-- self.Fix_Msg_Chat = Fix_Msg_Chat -- self.Fix_Msg_Chat = Fix_Msg_Chat
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha") UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
@ -68,7 +68,7 @@ function M:InitView(url)
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self:PlayerChangeLineState() self:PlayerChangeLineState()
--print("CS_MainView") ---- print("CS_MainView")
if (room.playing or room.curren_round > 0) or room.status == 1 then if (room.playing or room.curren_round > 0) or room.status == 1 then
self:ReloadRoom() self:ReloadRoom()
end end
@ -111,8 +111,8 @@ function M:EventInit()
end end
end) end)
_gamectr:AddEventListener(CS_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
local arg = {...} local arg = { ... }
self._tex_LeftCard.text = arg[1] self._tex_LeftCard.text = arg[1]
local info = self._player_card_info[1] local info = self._player_card_info[1]
info._player.auto_out_card = false info._player.auto_out_card = false
@ -451,10 +451,10 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(CS_GameEvent.EvnetPiaoTip, function() _gamectr:AddEventListener(CS_GameEvent.EvnetPiaoTip, function()
self:UpdateRound() self:UpdateRound()
self._tex_LeftCard.text = "0" self._tex_LeftCard.text = "0"
self._state.selectedIndex = 1 self._state.selectedIndex = 1
if oldGameVersion==1 then if oldGameVersion == 1 then
self:__PiaoNiaoTip() self:__PiaoNiaoTip()
else else
self:__PiaoNiaoTip1() self:__PiaoNiaoTip1()
@ -516,8 +516,8 @@ function M:EventInit()
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
@ -535,7 +535,7 @@ function M:OutCard(card)
-- 防止同一帧内执行两次OutCard事件 -- 防止同一帧内执行两次OutCard事件
local last_discard_frame = discard_frame local last_discard_frame = discard_frame
discard_frame = Time.frameCount discard_frame = Time.frameCount
--print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame) ---- print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
if discard_frame == last_discard_frame then if discard_frame == last_discard_frame then
return return
end end

View File

@ -32,17 +32,17 @@ local function CardPos(obj, area, oder, loc, offset)
end end
function M:UpdateHandCard(getcard, mp, opcard) function M:UpdateHandCard(getcard, mp, opcard)
-- mp 是否明牌 -- mp 是否明牌
-- 如果不明牌,但是有 opcard 表示是起手胡 -- 如果不明牌,但是有 opcard 表示是起手胡
getcard = getcard or false getcard = getcard or false
mp = mp or false mp = mp or false
local handcard_list = self._mask_data["handcard_list"] local handcard_list = self._mask_data["handcard_list"]
local oder = handcard_list["oder"] local oder = handcard_list["oder"]
local _player = self._player local _player = self._player
local comp_back = handcard_list["comp_back"] local comp_back = handcard_list["comp_back"]
local comp = handcard_list["comp"] local comp = handcard_list["comp"]
local outcard_list = self._mask_data["outcard_list"] local outcard_list = self._mask_data["outcard_list"]
local card = outcard_list["card"] local card = outcard_list["card"]
self._area_handcard_list:RemoveChildren(0, -1, true) self._area_handcard_list:RemoveChildren(0, -1, true)
local opnum = opcard and #opcard or -1 local opnum = opcard and #opcard or -1
@ -73,7 +73,7 @@ function M:UpdateHandCard(getcard, mp, opcard)
if opnum ~= -1 then if opnum ~= -1 then
loc = CardPos(obj, self._area_handcard_list, oder, loc, offset) loc = CardPos(obj, self._area_handcard_list, oder, loc, offset)
else else
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset) ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
end end
--改变左右两边的手牌的x值 --改变左右两边的手牌的x值
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then 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 outcard_list = self._mask_data["outcard_list"]
local comp = handcard_list["comp"] local comp = handcard_list["comp"]
local card = outcard_list["card"] local card = outcard_list["card"]
--print("comp"..comp) ---- print("comp"..comp)
-- print(vardump(_player.card_list)) -- -- print(vardump(_player.card_list))
if self._current_card_type == 2 then if self._current_card_type == 2 then
comp = comp .. "_3d" comp = comp .. "_3d"

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -36,7 +36,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list, DataManager.CurrenRoom.room_config.no_jiang) local tingList = CardCheck.tingPai(card_list, DataManager.CurrenRoom.self_player.fz_list,
DataManager.CurrenRoom.room_config.no_jiang)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -55,7 +56,7 @@ function M:UpdateHandCard(getcard, mp, opcard)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -112,7 +113,7 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
@ -152,18 +153,18 @@ function M:__OnClickHandCard(context)
end end
function M:__OnDragEnd(context, offset) function M:__OnDragEnd(context, offset)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
-- --
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
-- print(button.y - card.old_postion.y) -- -- print(button.y - card.old_postion.y)
-- if (button.y < -55 and _room.curren_outcard_seat == _room.self_player.seat) and self:CheckPlayerOnlineState() then -- if (button.y < -55 and _room.curren_outcard_seat == _room.self_player.seat) and self:CheckPlayerOnlineState() then
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
@ -184,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -198,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "ChaoShan_MJ" self.asset_group = "ChaoShan_MJ"
self:init() self:init()
@ -25,144 +25,137 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/chaoshan/ui/Extend_MJ_ChaoShan") UIPackage.AddPackage("extend/majiang/chaoshan/ui/Extend_MJ_ChaoShan")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮汕 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮汕 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.beforelaiziCardId and room.beforelaiziCardId>0 then if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false) self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
print(beforeLaiziID) -- print(beforeLaiziID)
print(currentLaizi1ID) -- print(currentLaizi1ID)
print(currentLaizi2ID) -- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID then if currentLaizi2ID then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID then if currentLaizi2ID then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID then
if currentLaizi2ID then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -172,8 +165,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -187,11 +180,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -208,7 +201,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -219,27 +212,27 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
local arg = {...} local arg = { ... }
local _tip = arg[1] local _tip = arg[1]
local weight = arg[2] local weight = arg[2]
self:__FangziTip(_tip, weight) self:__FangziTip(_tip, weight)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -265,21 +258,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_Majiang/eff_zimo" then elseif url == "ui://Main_Majiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -288,47 +281,45 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("ChaoShan_MJ",player.self_user.sex, hu_sound) self:PlaySound("ChaoShan_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoShan/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoShan/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoShan/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3") -- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -337,7 +328,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -355,7 +346,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -377,7 +368,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -403,7 +394,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -424,7 +415,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -444,21 +435,21 @@ end
function M:OutCard(card) function M:OutCard(card)
if card ~= 0 then if card ~= 0 then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex,tostring(card)) self:PlaySound("ChaoShan_MJ", self._room.self_player.self_user.sex, tostring(card))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
@ -476,37 +467,37 @@ function M:__FangziTip(tip, weight)
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1] local td = tip.tip_map_type[_tlist[k]][1]
local url = "ui://Main_Majiang/Btn_fztip" local url = "ui://Main_Majiang/Btn_fztip"
local td_weight = td.weight local td_weight = td.weight
if td_weight == 16 then td_weight = 8 end if td_weight == 16 then td_weight = 8 end
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
local btn_t = _lit_fanzi:AddItemFromPool(url) local btn_t = _lit_fanzi:AddItemFromPool(url)
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
btn_t.data = { tip, td } btn_t.data = { tip, td }
btn_t.onClick:Add(self.__TipAction,self) btn_t.onClick:Add(self.__TipAction, self)
end end
-- if not (tonumber(weight) >= 16) then -- if not (tonumber(weight) >= 16) then
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass") local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass") -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
_btn_pass.onClick:Set(function() _btn_pass.onClick:Set(function()
if tonumber(weight) >= 8 then if tonumber(weight) >= 8 then
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function() 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) _gamectr:SendAction(0)
_chipeng_tip:Dispose() _chipeng_tip:Dispose()
self._chipeng_tip = nil self._chipeng_tip = nil
end guo_msg:Close()
end) end)
guo_msg:Show()
else
_gamectr:SendAction(0)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
end
end)
-- end -- end
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
@ -549,20 +540,21 @@ function M:_ChiView(tiplist, callback)
local item_choose = list_choose:AddItemFromPool() local item_choose = list_choose:AddItemFromPool()
item_choose:GetController("type").selectedIndex = 0 item_choose:GetController("type").selectedIndex = 0
for j = 1, 4 do for j = 1, 4 do
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card) item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
end end
item_choose.onClick:Add(function() item_choose.onClick:Add(function()
callback(tiplist[i].id) callback(tiplist[i].id)
end) end)
end end
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) _pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
(self._view.height - _pop_tip_choice.height) / 2)
self._view:AddChild(_pop_tip_choice) self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice self._pop_tip_choice = _pop_tip_choice
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -572,13 +564,12 @@ function M:OnFangziAction(...)
local pNode = info._mask_liangpai local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect") local effect = UIPackage.CreateObject("Extend_MJ_ChaoShan", "FzEffect")
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"peng"..math.random(1, 3)) self:PlaySound("ChaoShan_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
else else
self:PlaySound("ChaoShan_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
self:PlaySound("ChaoShan_MJ", player.self_user.sex,"gang"..math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
@ -605,7 +596,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoShan", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -623,7 +614,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -648,17 +639,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -671,12 +662,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -714,11 +705,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -734,14 +725,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,46 +45,46 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCardBefore) printlog(_tableInfo.laiziCardBefore)
printlog(_tableInfo.laiziCard2Before) printlog(_tableInfo.laiziCard2Before)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCardBefore>0 then if _tableInfo.laiziCardBefore > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
end end
room.beforelaiziCardId=_tableInfo.laiziCardBefore room.beforelaiziCardId = _tableInfo.laiziCardBefore
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,16 +16,16 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -203,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "ChaoZhou_MJ" self.asset_group = "ChaoZhou_MJ"
self:init() self:init()
@ -25,144 +25,137 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/chaozhou/ui/Extend_MJ_ChaoZhou") UIPackage.AddPackage("extend/majiang/chaozhou/ui/Extend_MJ_ChaoZhou")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮州 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮州 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.beforelaiziCardId and room.beforelaiziCardId>0 then if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false) self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
print(beforeLaiziID) -- print(beforeLaiziID)
print(currentLaizi1ID) -- print(currentLaizi1ID)
print(currentLaizi2ID) -- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID then if currentLaizi2ID then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID then if currentLaizi2ID then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID then
if currentLaizi2ID then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -172,8 +165,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -187,11 +180,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -208,7 +201,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -219,27 +212,27 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
local arg = {...} local arg = { ... }
local _tip = arg[1] local _tip = arg[1]
local weight = arg[2] local weight = arg[2]
self:__FangziTip(_tip, weight) self:__FangziTip(_tip, weight)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -265,21 +258,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_Majiang/eff_zimo" then elseif url == "ui://Main_Majiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -288,57 +281,55 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("ChaoZhou_MJ",player.self_user.sex, hu_sound) self:PlaySound("ChaoZhou_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhou/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhou/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhou/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3") --ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...) _gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3") --ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -347,7 +338,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -365,7 +356,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -387,7 +378,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -413,7 +404,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -434,7 +425,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -454,21 +445,21 @@ end
function M:OutCard(card) function M:OutCard(card)
if card ~= 0 then if card ~= 0 then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex,tostring(card)) self:PlaySound("ChaoZhou_MJ", self._room.self_player.self_user.sex, tostring(card))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
@ -484,100 +475,94 @@ function M:__FangziTip(tip, weight)
_lit_fanzi:RemoveChildrenToPool() _lit_fanzi:RemoveChildrenToPool()
local _tlist = table.keys(tip.tip_map_type) local _tlist = table.keys(tip.tip_map_type)
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
for i=1,count do for i = 1, count do
if tip.tip_map_id[i].type==6 then if tip.tip_map_id[i].type == 6 then
tip_hu=true tip_hu = true
end end
end end
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1]
local 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] if tip_hu == false then
local url = "ui://Main_Majiang/Btn_fztip" local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
local td_weight = td.weight -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
if td_weight == 16 then td_weight = 8 end _btn_pass.onClick:Set(function()
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end if tonumber(weight) >= 8 then
if tip_hu==true then local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
if td.type==6 then guo_msg.onOk:Add(function()
local btn_t = _lit_fanzi:AddItemFromPool(url) _gamectr:SendAction(0)
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight _chipeng_tip:Dispose()
btn_t.data = { tip, td } self._chipeng_tip = nil
btn_t.onClick:Add(self.__TipAction,self) guo_msg:Close()
end 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 -- if not (tonumber(weight) >= 16) then
local btn_t = _lit_fanzi:AddItemFromPool(url) local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
btn_t.data = { tip, td } _btn_pass.onClick:Set(function()
btn_t.onClick:Add(self.__TipAction,self) if tonumber(weight) >= 8 then
end local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function()
end _gamectr:SendAction(0)
_chipeng_tip:Dispose()
if tip_hu==false then self._chipeng_tip = nil
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass") guo_msg:Close()
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass") end)
_btn_pass.onClick:Set(function() guo_msg:Show()
if tonumber(weight) >= 8 then else
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) _gamectr:SendAction(0)
guo_msg.onOk:Add(function() _chipeng_tip:Dispose()
_gamectr:SendAction(0) self._chipeng_tip = nil
_chipeng_tip:Dispose() end
self._chipeng_tip = nil end)
guo_msg:Close() -- end
end) 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
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
local item_choose = list_choose:AddItemFromPool() local item_choose = list_choose:AddItemFromPool()
item_choose:GetController("type").selectedIndex = 0 item_choose:GetController("type").selectedIndex = 0
for j = 1, 4 do for j = 1, 4 do
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card) item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
end end
item_choose.onClick:Add(function() item_choose.onClick:Add(function()
callback(tiplist[i].id) callback(tiplist[i].id)
end) end)
end end
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) _pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
(self._view.height - _pop_tip_choice.height) / 2)
self._view:AddChild(_pop_tip_choice) self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice self._pop_tip_choice = _pop_tip_choice
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
local pNode = info._mask_liangpai local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect") local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "FzEffect")
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"peng"..math.random(1, 3)) self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
else else
self:PlaySound("ChaoZhou_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
self:PlaySound("ChaoZhou_MJ", player.self_user.sex,"gang"..math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
@ -676,7 +661,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhou", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -719,17 +704,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -742,12 +727,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -785,11 +770,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -805,14 +790,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,46 +45,46 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCardBefore) printlog(_tableInfo.laiziCardBefore)
printlog(_tableInfo.laiziCard2Before) printlog(_tableInfo.laiziCard2Before)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCardBefore>0 then if _tableInfo.laiziCardBefore > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
end end
room.beforelaiziCardId=_tableInfo.laiziCardBefore room.beforelaiziCardId = _tableInfo.laiziCardBefore
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,16 +16,16 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -203,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "ChaoZhouGui_MJ" self.asset_group = "ChaoZhouGui_MJ"
self:init() self:init()
@ -25,144 +25,137 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/chaozhougui/ui/Extend_MJ_ChaoZhouGui") UIPackage.AddPackage("extend/majiang/chaozhougui/ui/Extend_MJ_ChaoZhouGui")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人潮鬼 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.beforelaiziCardId and room.beforelaiziCardId>0 then if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false) self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
print(beforeLaiziID) -- print(beforeLaiziID)
print(currentLaizi1ID) -- print(currentLaizi1ID)
print(currentLaizi2ID) -- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID then if currentLaizi2ID then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID then if currentLaizi2ID then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID then
if currentLaizi2ID then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -172,8 +165,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -187,11 +180,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -208,7 +201,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -219,27 +212,27 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
local arg = {...} local arg = { ... }
local _tip = arg[1] local _tip = arg[1]
local weight = arg[2] local weight = arg[2]
self:__FangziTip(_tip, weight) self:__FangziTip(_tip, weight)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -265,21 +258,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_Majiang/eff_zimo" then elseif url == "ui://Main_Majiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -288,57 +281,55 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("ChaoZhouGui_MJ",player.self_user.sex, hu_sound) self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhouGui/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChaoZhouGui/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChaoZhouGui/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3") --ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventMa, function(...) _gamectr:AddEventListener(TX_GameEvent.EventMa, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
--ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3") --ViewUtil.PlaySound("ChaoZhou_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -347,7 +338,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -365,7 +356,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -387,7 +378,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -413,7 +404,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -434,7 +425,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -454,21 +445,21 @@ end
function M:OutCard(card) function M:OutCard(card)
if card ~= 0 then if card ~= 0 then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex,tostring(card)) self:PlaySound("ChaoZhouGui_MJ", self._room.self_player.self_user.sex, tostring(card))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
@ -484,100 +475,94 @@ function M:__FangziTip(tip, weight)
_lit_fanzi:RemoveChildrenToPool() _lit_fanzi:RemoveChildrenToPool()
local _tlist = table.keys(tip.tip_map_type) local _tlist = table.keys(tip.tip_map_type)
if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu==true then if DataManager.CurrenRoom.room_config.must_hu and DataManager.CurrenRoom.room_config.must_hu == true then
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
for i=1,count do for i = 1, count do
if tip.tip_map_id[i].type==6 then if tip.tip_map_id[i].type == 6 then
tip_hu=true tip_hu = true
end end
end end
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1]
local 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] if tip_hu == false then
local url = "ui://Main_Majiang/Btn_fztip" local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
local td_weight = td.weight -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
if td_weight == 16 then td_weight = 8 end _btn_pass.onClick:Set(function()
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end if tonumber(weight) >= 8 then
if tip_hu==true then local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
if td.type==6 then guo_msg.onOk:Add(function()
local btn_t = _lit_fanzi:AddItemFromPool(url) _gamectr:SendAction(0)
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight _chipeng_tip:Dispose()
btn_t.data = { tip, td } self._chipeng_tip = nil
btn_t.onClick:Add(self.__TipAction,self) guo_msg:Close()
end 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 -- if not (tonumber(weight) >= 16) then
local btn_t = _lit_fanzi:AddItemFromPool(url) local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
btn_t.data = { tip, td } _btn_pass.onClick:Set(function()
btn_t.onClick:Add(self.__TipAction,self) if tonumber(weight) >= 8 then
end local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function()
end _gamectr:SendAction(0)
_chipeng_tip:Dispose()
if tip_hu==false then self._chipeng_tip = nil
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass") guo_msg:Close()
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass") end)
_btn_pass.onClick:Set(function() guo_msg:Show()
if tonumber(weight) >= 8 then else
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) _gamectr:SendAction(0)
guo_msg.onOk:Add(function() _chipeng_tip:Dispose()
_gamectr:SendAction(0) self._chipeng_tip = nil
_chipeng_tip:Dispose() end
self._chipeng_tip = nil end)
guo_msg:Close() -- end
end) 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
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
@ -620,20 +605,21 @@ function M:_ChiView(tiplist, callback)
local item_choose = list_choose:AddItemFromPool() local item_choose = list_choose:AddItemFromPool()
item_choose:GetController("type").selectedIndex = 0 item_choose:GetController("type").selectedIndex = 0
for j = 1, 4 do for j = 1, 4 do
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card) item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
end end
item_choose.onClick:Add(function() item_choose.onClick:Add(function()
callback(tiplist[i].id) callback(tiplist[i].id)
end) end)
end end
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) _pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
(self._view.height - _pop_tip_choice.height) / 2)
self._view:AddChild(_pop_tip_choice) self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice self._pop_tip_choice = _pop_tip_choice
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -643,13 +629,12 @@ function M:OnFangziAction(...)
local pNode = info._mask_liangpai local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect") local effect = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "FzEffect")
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"peng"..math.random(1, 3)) self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
else else
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
self:PlaySound("ChaoZhouGui_MJ", player.self_user.sex,"gang"..math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
@ -676,7 +661,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_ChaoZhouGui", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -694,7 +679,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -719,17 +704,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -742,12 +727,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -785,11 +770,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -805,14 +790,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,46 +45,46 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCardBefore) printlog(_tableInfo.laiziCardBefore)
printlog(_tableInfo.laiziCard2Before) printlog(_tableInfo.laiziCard2Before)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCardBefore>0 then if _tableInfo.laiziCardBefore > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
end end
room.beforelaiziCardId=_tableInfo.laiziCardBefore room.beforelaiziCardId = _tableInfo.laiziCardBefore
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,16 +16,16 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -203,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -17,16 +17,16 @@ end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
printlog("ShowHuTip") printlog("ShowHuTip")
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -204,10 +201,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 33 self.extend_id = 33
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,30 +45,30 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -91,23 +91,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -131,7 +131,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -140,18 +140,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -17,16 +17,16 @@ end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
printlog("ShowHuTip") printlog("ShowHuTip")
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -204,10 +201,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,24 +45,24 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
@ -88,23 +88,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -137,18 +137,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,7 +16,8 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
table.insert(tingList, 412) table.insert(tingList, 412)
end end
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -57,7 +59,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -81,10 +83,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -124,17 +126,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -168,10 +171,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -140,7 +140,7 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -17,16 +17,16 @@ end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
printlog("ShowHuTip") printlog("ShowHuTip")
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -160,17 +156,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -204,10 +201,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -121,7 +121,7 @@ function M:OnEventSendCards(evt_data)
_room.jing = jing _room.jing = jing
self._cacheEvent:Enqueue(function() self._cacheEvent:Enqueue(function()
_room.banker_seat = seat _room.banker_seat = seat
print("========================fuzhijing") -- print("========================fuzhijing")
for i = 1, #_room.player_list do for i = 1, #_room.player_list do
_room.player_list[i].hand_left_count = 13 _room.player_list[i].hand_left_count = 13
_room.player_list[i].fz_list = {} _room.player_list[i].fz_list = {}
@ -275,7 +275,7 @@ function M:OnEventFzAction(evt_data)
end end
function M:OnEventHu(evt_data) function M:OnEventHu(evt_data)
print("===========================OnEventHu") -- print("===========================OnEventHu")
local cards = evt_data["card"] local cards = evt_data["card"]
local win_p = self._room:GetPlayerBySeat(evt_data["seat"]) local win_p = self._room:GetPlayerBySeat(evt_data["seat"])
local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"]) local lose_p = self._room:GetPlayerBySeat(evt_data["from_seat"])

View File

@ -315,7 +315,7 @@ function M:EventInit()
local tem = win_list[i] local tem = win_list[i]
if tem.type > 0 and tem.type < 32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
print("===================================com_name", com_name) -- print("===================================com_name", com_name)
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end

View File

@ -109,7 +109,7 @@ function M:FillRoomData(s2croom)
p.fz_list[#p.fz_list + 1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
print("=======================在此进入") -- print("=======================在此进入")
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
end end
@ -141,7 +141,7 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser

View File

@ -110,7 +110,7 @@ function M:UpdateHandCard(getcard, mp)
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
print("==========================__OnClickHandCard") -- print("==========================__OnClickHandCard")
local button = context.sender local button = context.sender
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
@ -168,7 +168,7 @@ function M:__OnDragEnd(context)
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false

View File

@ -109,7 +109,6 @@ function M:FillRoomData(s2croom)
p.fz_list[#p.fz_list + 1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
print("=======================================自动开始")
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
end end
@ -141,7 +140,7 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser

View File

@ -166,7 +166,7 @@ function M:__OnDragEnd(context)
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "QiZhiBa_MJ" self.asset_group = "QiZhiBa_MJ"
self:init() self:init()
@ -25,146 +25,139 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/qizhiba/ui/Extend_MJ_QiZhiBa") UIPackage.AddPackage("extend/majiang/qizhiba/ui/Extend_MJ_QiZhiBa")
MJMainView.InitView(self,"ui://Main_PokeMaJiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_PokeMaJiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人七支八 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人七支八 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3])>0 then if room.laiziInfo and room.laiziInfo[3] and tonumber(room.laiziInfo[3]) > 0 then
self:SetShowLaiZiProcess(room.laiziInfo[3],room.laiziInfo[3],0,false) self:SetShowLaiZiProcess(room.laiziInfo[3], room.laiziInfo[3], 0, false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_PokeMaJiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_PokeMaJiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
print(beforeLaiziID) -- print(beforeLaiziID)
print(currentLaizi1ID) -- print(currentLaizi1ID)
print(currentLaizi2ID) -- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID>0 then if currentLaizi2ID > 0 then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID>0 then if currentLaizi2ID > 0 then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID > 0 then
if currentLaizi2ID>0 then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_PokeMaJiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_PokeMaJiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...) _gamectr:AddEventListener(TX_GameEvent.HuTipsAction, function(...)
self._hu_tip:HideHuTipsPanel() self._hu_tip:HideHuTipsPanel()
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -174,8 +167,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -189,11 +182,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_PokeMaJiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_PokeMaJiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -202,7 +195,7 @@ function M:EventInit()
info:UpdateHandCard() info:UpdateHandCard()
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
info:UpdateOutCardList(outcard, card, self._cursor) info:UpdateOutCardList(outcard, card, self._cursor)
local cardAudio=string.sub(card,2) local cardAudio = string.sub(card, 2)
self:PlaySound("QiZhiBa_MJ", p.self_user.sex, tostring(cardAudio)) self:PlaySound("QiZhiBa_MJ", p.self_user.sex, tostring(cardAudio))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
if seat == _room.self_player.seat then if seat == _room.self_player.seat then
@ -211,7 +204,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -222,26 +215,26 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
arg={...} arg = { ... }
local _tip = arg[1] local _tip = arg[1]
self:__FangziTip(_tip) self:__FangziTip(_tip)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -267,21 +260,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_PokeMaJiang/eff_zimo" then elseif url == "ui://Main_PokeMaJiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -290,47 +283,45 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("QiZhiBa_MJ",player.self_user.sex, hu_sound) self:PlaySound("QiZhiBa_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_QiZhiBa/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_QiZhiBa/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_QiZhiBa/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
-- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3") -- ViewUtil.PlaySound("ChaoShan_MJ", "extend/majiang/chaoshan/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -339,7 +330,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -357,7 +348,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -379,7 +370,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -405,7 +396,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -426,7 +417,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -445,61 +436,58 @@ function M:EventInit()
end end
function M:OutCard(card) function M:OutCard(card)
local isOut=IsHasDictionary(card,DataManager.CurrenRoom.laiziInfo) local isOut = IsHasDictionary(card, DataManager.CurrenRoom.laiziInfo)
if isOut==false then if isOut == false then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
local cardAudio=string.sub(card,2) local cardAudio = string.sub(card, 2)
self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex,tostring(cardAudio)) self:PlaySound("QiZhiBa_MJ", self._room.self_player.self_user.sex, tostring(cardAudio))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
function M:__FangziTip(tip, weight) function M:__FangziTip(tip, weight)
local _gamectr = self._gamectr local _gamectr = self._gamectr
local _chipeng_tip = UIPackage.CreateObject("Main_PokeMaJiang", "Gcm_action_tips") local _chipeng_tip = UIPackage.CreateObject("Main_PokeMaJiang", "Gcm_action_tips")
_chipeng_tip:GetController("hide_bg").selectedIndex = 1 _chipeng_tip:GetController("hide_bg").selectedIndex = 1
self._chipeng_tip = _chipeng_tip self._chipeng_tip = _chipeng_tip
local p = self._room.self_player local p = self._room.self_player
-- self._player_card_info[self:GetPos(p.seat)] -- self._player_card_info[self:GetPos(p.seat)]
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi") local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
_lit_fanzi:RemoveChildrenToPool() _lit_fanzi:RemoveChildrenToPool()
local _tlist = table.keys(tip.tip_map_type) local _tlist = table.keys(tip.tip_map_type)
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
table.sort(_tlist) table.sort(_tlist)
local isHu = false local isHu = false
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1]
local td = tip.tip_map_type[_tlist[k]][1]
local url = "ui://Main_PokeMaJiang/Btn_fztip" local url = "ui://Main_PokeMaJiang/Btn_fztip"
local td_weight = td.weight local td_weight = td.weight
if td_weight == 16 then td_weight = 8 end if td_weight == 16 then td_weight = 8 end
if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end if td_weight == 8 then url = "ui://Main_PokeMaJiang/Btn_hu" end
local btn_t = _lit_fanzi:AddItemFromPool(url) local btn_t = _lit_fanzi:AddItemFromPool(url)
btn_t.icon = "ui://Main_PokeMaJiang/fztip_"..td_weight btn_t.icon = "ui://Main_PokeMaJiang/fztip_" .. td_weight
btn_t.data = { tip, td } btn_t.data = { tip, td }
btn_t.onClick:Add(self.__TipAction,self) btn_t.onClick:Add(self.__TipAction, self)
end
end local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
_btn_pass.onClick:Set(function()
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_PokeMaJiang/Btn_pass")
_btn_pass.onClick:Set(function()
if isHu then if isHu then
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function() guo_msg.onOk:Add(function()
@ -514,29 +502,26 @@ function M:__FangziTip(tip, weight)
_chipeng_tip:Dispose() _chipeng_tip:Dispose()
self._chipeng_tip = nil self._chipeng_tip = nil
end end
end) end)
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
_chipeng_tip:Center() _chipeng_tip:Center()
end end
function M:__TipAction(context) function M:__TipAction(context)
local data = context.sender.data local data = context.sender.data
local _gamectr = self._gamectr local _gamectr = self._gamectr
local tip = data[1] local tip = data[1]
local td = data[2] local td = data[2]
local list = tip.tip_map_type[td.weight] local list = tip.tip_map_type[td.weight]
if (#list > 1) then if (#list > 1) then
self:_ChiView(list, function(id) self:_ChiView(list, function(id)
_gamectr:SendAction(id) _gamectr:SendAction(id)
self:__CloseTip() self:__CloseTip()
end) end)
self._chipeng_tip.visible = false self._chipeng_tip.visible = false
return return
end end
_gamectr:SendAction(td.id) _gamectr:SendAction(td.id)
if (self._chipeng_tip == nil) then return end if (self._chipeng_tip == nil) then return end
@ -544,55 +529,60 @@ function M:__TipAction(context)
self._chipeng_tip = nil self._chipeng_tip = nil
end end
function M:_ChiView(tiplist, callback) function M:_ChiView(tiplist, callback)
self._chipeng_tip.visible = false self._chipeng_tip.visible = false
local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice") local _pop_tip_choice = UIPackage.CreateObject("Main_PokeMaJiang", "Pop_tip_choice")
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose") local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2") local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
local crossCtr = _pop_tip_choice:GetController("state") local crossCtr = _pop_tip_choice:GetController("state")
crossCtr.selectedIndex = #tiplist == 3 and 0 or (#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4))) crossCtr.selectedIndex = #tiplist == 3 and 0 or
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function() (#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
_pop_tip_choice:Dispose() _pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
self._chipeng_tip.visible = true _pop_tip_choice:Dispose()
end) self._chipeng_tip.visible = true
list_choose1:RemoveChildrenToPool() end)
list_choose2:RemoveChildrenToPool() list_choose1:RemoveChildrenToPool()
for i = 1, #tiplist do list_choose2:RemoveChildrenToPool()
local list_choose = i <= 3 and list_choose1 or list_choose2 for i = 1, #tiplist do
local item_choose = list_choose:AddItemFromPool() local list_choose = i <= 3 and list_choose1 or list_choose2
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0 local item_choose = list_choose:AddItemFromPool()
if tiplist[i].weight ~= 1 then item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
for j = 1, 4 do if tiplist[i].weight ~= 1 then
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tiplist[i].card) for j = 1, 4 do
end item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_PokeMaJiang",
else self:GetPrefix() .. "201_" .. tiplist[i].card)
local tem = {} end
table.insert(tem, tiplist[i].opcard[1]) else
table.insert(tem, tiplist[i].opcard[2]) local tem = {}
local tcard = tiplist[i].card table.insert(tem, tiplist[i].opcard[1])
table.insert(tem, tcard) table.insert(tem, tiplist[i].opcard[2])
table.sort(tem, function(a, b) local tcard = tiplist[i].card
return a < b table.insert(tem, tcard)
end) table.sort(tem, function(a, b)
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[1]) return a < b
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[2]) end)
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang", self:GetPrefix() .. "201_"..tem[3]) item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2) self:GetPrefix() .. "201_" .. tem[1])
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1 item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
end self:GetPrefix() .. "201_" .. tem[2])
item_choose.onClick:Add(function() item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_PokeMaJiang",
callback(tiplist[i].id) self:GetPrefix() .. "201_" .. tem[3])
end) local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
end item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) end
self._view:AddChild(_pop_tip_choice) item_choose.onClick:Add(function()
self._pop_tip_choice = _pop_tip_choice 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 end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -614,27 +604,27 @@ function M:OnFangziAction(...)
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
end--]] end--]]
---- ----
local fangzi = "" local fangzi = ""
local fz_sound = "" local fz_sound = ""
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
fangzi = "" fangzi = ""
fz_sound = "peng"..math.random(1, 3) fz_sound = "peng" .. math.random(1, 3)
elseif fz.type == FZType.Chi then elseif fz.type == FZType.Chi then
fangzi = "" fangzi = ""
fz_sound = "chi"..math.random(1, 3) fz_sound = "chi" .. math.random(1, 3)
else else
if fz.opengang then if fz.opengang then
fangzi = "" fangzi = ""
fz_sound = "gang"..math.random(1, 2) fz_sound = "gang" .. math.random(1, 2)
else else
fangzi = "" fangzi = ""
fz_sound = "buzhang" fz_sound = "buzhang"
end end
end end
self:PlaySound("QiZhiBa_MJ",player.self_user.sex,fz_sound) self:PlaySound("QiZhiBa_MJ", player.self_user.sex, fz_sound)
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi) effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi) effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_PokeMaJiang", fangzi)
@ -662,7 +652,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_QiZhiBa", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -680,7 +670,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_PokeMaJiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -705,17 +695,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_PokeMaJiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_PokeMaJiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -728,12 +718,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -771,11 +761,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -791,14 +781,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = import(".main.MJRoom") local MJRoom = import(".main.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,49 +45,49 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCard3) printlog(_tableInfo.laiziCard3)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
if _tableInfo.laiziCard3>0 then if _tableInfo.laiziCard3 > 0 then
local str=string.sub(_tableInfo.laiziCard3,2) local str = string.sub(_tableInfo.laiziCard3, 2)
for i=1,4 do for i = 1, 4 do
table.insert(room.laiziInfo,tonumber(i..str)) table.insert(room.laiziInfo, tonumber(i .. str))
end end
end end
room.beforelaiziCardId=_tableInfo.laiziCard3 room.beforelaiziCardId = _tableInfo.laiziCard3
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
--pt(room.laiziInfo) --pt(room.laiziInfo)
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -110,24 +110,24 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
fz.allCard=op["opcard"] fz.allCard = op["opcard"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -151,7 +151,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -160,18 +160,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -15,80 +15,72 @@ function M.new(view,mainView)
return self return self
end end
function M:ShowHuTip(card_list,currentOnclickCard) function M:ShowHuTip(card_list, currentOnclickCard)
if currentOnclickCard then if currentOnclickCard then
if DataManager.CurrenRoom.self_player.CardTingList then if DataManager.CurrenRoom.self_player.CardTingList then
local tempV=DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard] local tempV = DataManager.CurrenRoom.self_player.CardTingList[currentOnclickCard]
if tempV and #tempV>0 then if tempV and #tempV > 0 then
self._mainView._hu_tip:FillData(tempV) self._mainView._hu_tip:FillData(tempV)
else else
self._mainView._hu_tip:HideHuTipsPanel() self._mainView._hu_tip:HideHuTipsPanel()
end end
end end
else
else --[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
--[[if DataManager.CurrenRoom.self_player.allTingPaiList and #DataManager.CurrenRoom.self_player.allTingPaiList>0 then
self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList) self._mainView._hu_tip:FillData(DataManager.CurrenRoom.self_player.allTingPaiList)
end--]] end--]]
end end
end end
function M:UpdateHandCard(getcard, mp) function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
self:ShowHuTip(card_list) self:ShowHuTip(card_list)
if getcard then if getcard then
self._out_card = true self._out_card = true
if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList>0 then if DataManager.CurrenRoom.self_player.tingPaiList and #DataManager.CurrenRoom.self_player.tingPaiList > 0 then
for i = 1, #_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local isTing,curIndex=CheckDictionaryFromContent(_carViewList[i].card_item,DataManager.CurrenRoom.self_player.tingPaiList) local isTing, curIndex = CheckDictionaryFromContent(_carViewList[i].card_item,
if isTing then DataManager.CurrenRoom.self_player.tingPaiList)
--printlog("听牌提示===》》》",curIndex) if isTing then
--pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex]) --printlog("听牌提示===》》》",curIndex)
local value=#DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value --pt(DataManager.CurrenRoom.self_player.tingPaiList[curIndex])
if tonumber(value)>1 then local value = #DataManager.CurrenRoom.self_player.tingPaiList[curIndex].value
btn:GetController("mark_ting").selectedIndex=2 if tonumber(value) > 1 then
else btn:GetController("mark_ting").selectedIndex = 2
btn:GetController("mark_ting").selectedIndex=1 else
end btn:GetController("mark_ting").selectedIndex = 1
end
end end
end end
end
end
--DataManager.CurrenRoom.self_player.tingPaiList=nil
--DataManager.CurrenRoom.self_player.tingPaiList=nil
else else
for i = 1, #_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
@ -98,21 +90,17 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
local button = context.sender local button = context.sender
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -126,8 +114,8 @@ function M:__OnClickHandCard(context)
end end
if self._out_card then if self._out_card then
printlog("点击开始出牌===>>>") printlog("点击开始出牌===>>>")
self:ShowHuTip(card_list,button.data.card_item) self:ShowHuTip(card_list, button.data.card_item)
end end
-- 标记出牌 -- 标记出牌
@ -153,19 +141,19 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
local isOut=IsHasDictionary(card.card_item,DataManager.CurrenRoom.laiziInfo) local isOut = IsHasDictionary(card.card_item, DataManager.CurrenRoom.laiziInfo)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut==false) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and isOut == false) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
self.outcard_button = button self.outcard_button = button
@ -184,6 +172,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -198,10 +187,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -4,15 +4,15 @@ local TableBG = require("Game.Data.TableBG")
local MJSettingView = import(".MJSettingViewNew") local MJSettingView = import(".MJSettingViewNew")
local MJMainRightPanelView = import(".MJMainRightPanelView") local MJMainRightPanelView = import(".MJMainRightPanelView")
local bg_config = { local bg_config = {
{id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01"}, { id = 1, url = "base/main_pokemajiang/bg/bg1", thumb = "ui://Main_PokeMaJiang/b01" },
{id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02"}, { id = 2, url = "base/main_pokemajiang/bg/bg2", thumb = "ui://Main_PokeMaJiang/b02" },
{id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03"} { id = 3, url = "base/main_pokemajiang/bg/bg3", thumb = "ui://Main_PokeMaJiang/b03" }
} }
local M = {} local M = {}
setmetatable(M,{__index = MainView}) setmetatable(M, { __index = MainView })
local default_bg = 1 local default_bg = 1
function M:InitView(url, use_custom_bg) function M:InitView(url, use_custom_bg)
@ -29,7 +29,7 @@ function M:InitView(url, use_custom_bg)
UIPackage.AddPackage("base/main_pokemajiang/ui/Main_PokeMaJiang") UIPackage.AddPackage("base/main_pokemajiang/ui/Main_PokeMaJiang")
MainView.InitView(self,url) MainView.InitView(self, url)
local _view = self._view local _view = self._view
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj") self._cursor = UIPackage.CreateObjectFromURL("ui://Main_PokeMaJiang/Ani_play_bj")
if not use_custom_bg then if not use_custom_bg then
@ -51,27 +51,26 @@ function M:InitView(url, use_custom_bg)
end end
local rightpanel = self._view:GetChild("com_roominfo") local rightpanel = self._view:GetChild("com_roominfo")
if self._rightPanelView ~= nil then if self._rightPanelView ~= nil then
self._rightPanelView:Destroy() self._rightPanelView:Destroy()
end end
self._rightPanelView = MJMainRightPanelView.new(self, rightpanel) self._rightPanelView = MJMainRightPanelView.new(self, rightpanel)
--local tempdsaf=self._view:GetChild("btn_back_jiesan") --local tempdsaf=self._view:GetChild("btn_back_jiesan")
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false) --tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
--print("2222222222222222222222") ---- print("2222222222222222222222")
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name) ---- print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false) --self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject --local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
--temp111:SetActive(false) --temp111:SetActive(false)
self._view:GetChild("btn_back_jiesan").onClick:Set(function () self._view:GetChild("btn_back_jiesan").onClick:Set(function()
if self.dismiss_room_cd_time > 0 then if self.dismiss_room_cd_time > 0 then
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
else else
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:AskDismissRoom() _gamectr:AskDismissRoom()
end end
end) end)
@ -82,11 +81,11 @@ function M:InitView(url, use_custom_bg)
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
for i = 1, _room.room_config.people_num do for i = 1, _room.room_config.people_num do
local tem = _view:GetChild("player_card_info" .. i) local tem = _view:GetChild("player_card_info" .. i)
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem,i) _player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
end end
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = _player_card_info[self:GetPos(p.seat)] local info = _player_card_info[self:GetPos(p.seat)]
info:SetPlayer(p) info:SetPlayer(p)
@ -95,23 +94,22 @@ function M:InitView(url, use_custom_bg)
local list = _room.player_list local list = _room.player_list
local readyNum = 0 local readyNum = 0
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
if p.ready then readyNum = readyNum + 1 end if p.ready then readyNum = readyNum + 1 end
end end
for i=1,#_room.player_list do for i = 1, #_room.player_list do
local p = _room.player_list[i] local p = _room.player_list[i]
local zi,icon = self:GetPosString(p.seat) local zi, icon = self:GetPosString(p.seat)
if self._room.card_type == 2 then if self._room.card_type == 2 then
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon _cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
end end
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi _cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
end end
self._ctr_action = _view:GetController("action") self._ctr_action = _view:GetController("action")
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
--self._ctr_action.selectedIndex = 2 --self._ctr_action.selectedIndex = 2
elseif not _room.self_player.ready then elseif not _room.self_player.ready then
@ -122,31 +120,28 @@ function M:InitView(url, use_custom_bg)
end end
function M:EventInit() function M:EventInit()
MainView.EventInit(self) MainView.EventInit(self)
end end
function M:Change3d(flag) function M:Change3d(flag)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _cardbox = _view:GetChild("cardbox") local _cardbox = _view:GetChild("cardbox")
for i=1,#_room.player_list do for i = 1, #_room.player_list do
local p = _room.player_list[i]
local 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] _cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
local zi,icon = self:GetPosString(p.seat) end
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
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动 -- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
-- 取消文字组合的3d控制器的位置 并设置对cardbox的关联左左顶顶 -- 取消文字组合的3d控制器的位置 并设置对cardbox的关联左左顶顶
if flag == true then if flag == true then
if _view:GetController("3d") ~= nil then if _view:GetController("3d") ~= nil then
_view:GetController("3d").selectedIndex = 1 _view:GetController("3d").selectedIndex = 1
_cardbox.x = (_view.width - _cardbox.width) * 0.5 _cardbox.x = (_view.width - _cardbox.width) * 0.5
@ -199,8 +194,8 @@ function M:NewSettingView()
-- gear:Apply() -- gear:Apply()
-- settingView.Change3d = function() end -- settingView.Change3d = function() end
settingView:FillBgSection(function(url,index) settingView:FillBgSection(function(url, index)
printlog("NewSettingView") printlog("NewSettingView")
LoadGameBg(url, self._root_view) LoadGameBg(url, self._root_view)
end, self._room.game_id, 1, bg_config) end, self._room.game_id, 1, bg_config)
@ -230,30 +225,29 @@ function M:GetIndex(seat)
end end
function M:GetPosString(seat) function M:GetPosString(seat)
if DataManager.CurrenRoom.room_config.people_num == 4 then if DataManager.CurrenRoom.room_config.people_num == 4 then
if seat == 1 then if seat == 1 then
return "","dir_1" return "", "dir_1"
elseif seat == 2 then elseif seat == 2 then
return "","dir_2" return "", "dir_2"
elseif seat == 3 then elseif seat == 3 then
return "西","dir_3" return "西", "dir_3"
elseif seat == 4 then elseif seat == 4 then
return "","dir_4" return "", "dir_4"
end end
elseif DataManager.CurrenRoom.room_config.people_num == 3 then elseif DataManager.CurrenRoom.room_config.people_num == 3 then
if seat == 1 then if seat == 1 then
return "","dir_1" return "", "dir_1"
elseif seat == 2 then elseif seat == 2 then
return "","dir_2" return "", "dir_2"
elseif seat == 3 then elseif seat == 3 then
return "西","dir_3" return "西", "dir_3"
end end
elseif DataManager.CurrenRoom.room_config.people_num == 2 then elseif DataManager.CurrenRoom.room_config.people_num == 2 then
if seat == 1 then if seat == 1 then
return "","dir_1" return "", "dir_1"
elseif seat == 2 then elseif seat == 2 then
return "西","dir_3" return "西", "dir_3"
end end
end end
end end
@ -261,7 +255,7 @@ end
function M:SetCardBoxPosition() function M:SetCardBoxPosition()
local _room = self._room local _room = self._room
for i = 1, _room.room_config.people_num do for i = 1, _room.room_config.people_num do
local tex = self._view:GetChild("cardbox"):GetChild("direction"..i) local tex = self._view:GetChild("cardbox"):GetChild("direction" .. i)
local index = _room.self_player.seat + i - 1 local index = _room.self_player.seat + i - 1
index = index > 4 and index - 4 or index index = index > 4 and index - 4 or index
tex.text = self._gamectr:GetPosString(index) tex.text = self._gamectr:GetPosString(index)
@ -287,16 +281,16 @@ function M:markOutCards(showTip, data)
end end
function M:OnPlayerEnter(...) function M:OnPlayerEnter(...)
MainView.OnPlayerEnter(self,...) MainView.OnPlayerEnter(self, ...)
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local info = self._player_card_info[self:GetPos(p.seat)] local info = self._player_card_info[self:GetPos(p.seat)]
info:SetPlayer(p) info:SetPlayer(p)
info:FillData() info:FillData()
end end
function M:OnPlayerReady( ... ) function M:OnPlayerReady(...)
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
@ -316,26 +310,25 @@ function M:OnPlayerReady( ... )
if readyNum == _room.room_config.people_num then if readyNum == _room.room_config.people_num then
local _cardbox = _view:GetChild("cardbox") local _cardbox = _view:GetChild("cardbox")
for i=1,#_room.player_list do for i = 1, #_room.player_list do
local p = _room.player_list[i] local p = _room.player_list[i]
local zi,icon = self:GetPosString(p.seat) local zi, icon = self:GetPosString(p.seat)
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon _cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi _cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
end end
end end
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
if self._state.selectedIndex == 2 then if self._state.selectedIndex == 2 then
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:StartGame() _gamectr:StartGame()
end end
--self._ctr_action.selectedIndex = 2 --self._ctr_action.selectedIndex = 2
elseif not _room.self_player.ready then elseif not _room.self_player.ready then
self._ctr_action.selectedIndex = 1 self._ctr_action.selectedIndex = 1
else else
self._ctr_action.selectedIndex = 0 self._ctr_action.selectedIndex = 0
end end
end end
@ -376,42 +369,42 @@ function M:CountCardLeftNum(card)
return count return count
end end
function M:OnPlayerLeave( ... ) function M:OnPlayerLeave(...)
MainView.OnPlayerLeave(self, ...) MainView.OnPlayerLeave(self, ...)
local _room = self._room local _room = self._room
if _room.banker_seat == _room.self_player.seat then if _room.banker_seat == _room.self_player.seat then
self._ctr_action.selectedIndex = 0 self._ctr_action.selectedIndex = 0
end end
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
local isOutCard = true local isOutCard = true
local str = "玩家 " local str = "玩家 "
for _ , player in ipairs(self._room.player_list) do for _, player in ipairs(self._room.player_list) do
if player.line_state == 0 then if player.line_state == 0 then
isOutCard = false isOutCard = false
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、" -- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
end
end end
end -- if not isOutCard then
-- if not isOutCard then -- str = str.sub(str, 1, string.len(str) - string.len("、"))
-- str = str.sub(str, 1, string.len(str) - string.len("、")) -- str = str .. " 正在赶来,请稍等"
-- str = str .. " 正在赶来,请稍等" -- if self._room.curren_round > 0 then
-- if self._room.curren_round > 0 then -- self._waitingView = ModalWaitingView.new(self._view, str)
-- self._waitingView = ModalWaitingView.new(self._view, str) -- end
-- end -- else
-- else -- if self._waitingView then
-- if self._waitingView then -- self._waitingView:CloseWaitingView()
-- self._waitingView:CloseWaitingView() -- end
-- end -- end
-- end
self._player_card_info[1]._area_handcard_list.touchable = isOutCard self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:RemoveCursor() function M:RemoveCursor()
@ -436,10 +429,10 @@ function M:PlayMJMusic(path)
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path) ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
end end
function M:PlaySound(group,sex,path) function M:PlaySound(group, sex, path)
local sex_path = ViewUtil.Sex_Chat[sex] local sex_path = ViewUtil.Sex_Chat[sex]
local path1 = majiang_asset_path .. string.format("%s/%s.mp3",sex_path,path) local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
ViewUtil.PlaySound(group,path1) ViewUtil.PlaySound(group, path1)
end end
function M:GetPrefix() function M:GetPrefix()

View File

@ -20,7 +20,7 @@ local M = PlayerCardInfoView
--- Create a new PlayerCardInfoView --- Create a new PlayerCardInfoView
function M.new(view, mainView) function M.new(view, mainView)
local self = {} local self = {}
setmetatable(self, {__index = M}) setmetatable(self, { __index = M })
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
self:init() self:init()
@ -101,13 +101,13 @@ function M:GetPrefix()
end end
function M:fillCard(obj, pos_str, card, use3d) 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 if self._current_card_type == 2 and (use3d == nil or use3d == true) then
obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card
else else
obj.icon = 'ui://Main_PokeMaJiang/' .. self:GetPrefix() .. pos_str .. card obj.icon = 'ui://Main_PokeMaJiang/' .. self:GetPrefix() .. pos_str .. card
end end
--printlog(obj.icon) --printlog(obj.icon)
end end
function M:getBackCard(card) function M:getBackCard(card)
@ -126,10 +126,10 @@ function M:UpdateHandCard(getcard, mp)
local handcard_list = self._mask_data['handcard_list'] local handcard_list = self._mask_data['handcard_list']
local oder = handcard_list['oder'] local oder = handcard_list['oder']
local _player = self._player local _player = self._player
-- print(vardump(self._player)) -- -- print(vardump(self._player))
self._area_handcard_list:RemoveChildren(0, -1, true) self._area_handcard_list:RemoveChildren(0, -1, true)
-- print(vardump(_player.card_list)) -- -- print(vardump(_player.card_list))
if (not mp) then if (not mp) then
local comp_back = handcard_list['comp_back'] local comp_back = handcard_list['comp_back']
if self._current_card_type == 2 then if self._current_card_type == 2 then
@ -161,8 +161,8 @@ function M:UpdateHandCard(getcard, mp)
local outcard_list = self._mask_data['outcard_list'] local outcard_list = self._mask_data['outcard_list']
local comp = handcard_list['comp'] local comp = handcard_list['comp']
local card = outcard_list['card'] local card = outcard_list['card']
--print("comp"..comp) ---- print("comp"..comp)
-- print(vardump(_player.card_list)) -- -- print(vardump(_player.card_list))
if self._current_card_type == 2 then if self._current_card_type == 2 then
comp = comp .. '_3d' comp = comp .. '_3d'
@ -271,9 +271,9 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
sortStart = #outlist sortStart = #outlist
sortStep = -1 sortStep = -1
end end
else else
sortType = outcard_list['sorting_order3d'] sortType = outcard_list['sorting_order3d']
if sortType == 1 then if sortType == 1 then
sortStart = 1 sortStart = 1
sortStep = 1 sortStep = 1
elseif sortType == -1 then elseif sortType == -1 then
@ -296,17 +296,17 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
end end
end end
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col,0,true) ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, 0, true)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row,0,true) ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, 0, true)
if self._current_card_type == 2 then if self._current_card_type == 2 then
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i) self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
end end
--printlog(cursor) --printlog(cursor)
--printlog("设置出牌======>>>") --printlog("设置出牌======>>>")
--printlog(obj) --printlog(obj)
--printlog(card) --printlog(card)
--printlog(outlist[i + 1]) --printlog(outlist[i + 1])
self:fillCard(obj, card, outlist[i + 1]) self:fillCard(obj, card, outlist[i + 1])
-- 添加角标 -- 添加角标
@ -357,9 +357,9 @@ local function getPos(my_seat, other_seat, total)
end end
function M:UpdateFzList(fz, index, show_card) function M:UpdateFzList(fz, index, show_card)
printlog("UpdateFzList=====》》》") printlog("UpdateFzList=====》》》")
printlog("index===",index) printlog("index===", index)
printlog("show_card===",show_card) printlog("show_card===", show_card)
local gn = 3 local gn = 3
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
gn = 4 gn = 4
@ -443,35 +443,35 @@ function M:UpdateFzList(fz, index, show_card)
end end
--if (fz.type == FZType.Gang_An and i == gn) then --if (fz.type == FZType.Gang_An and i == gn) then
-- if self._current_card_type == 2 then -- if self._current_card_type == 2 then
-- _oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00') -- _oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00')
-- else -- else
-- _oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00') -- _oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00')
-- end -- end
-- if show_card then -- if show_card then
-- _oc2.icon = UIPackage.GetItemURL('Main_PokeMaJiang', '202_00') -- _oc2.icon = UIPackage.GetItemURL('Main_PokeMaJiang', '202_00')
-- end -- end
-- else -- else
if (fz.type == FZType.Chi) then if (fz.type == FZType.Chi) then
local index = i local index = i
if oder == AreaOderType.right_left or oder == AreaOderType.down_up then if oder == AreaOderType.right_left or oder == AreaOderType.down_up then
index = gn - i + 1 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
end 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 end
obj.touchable = false obj.touchable = false

View File

@ -43,7 +43,7 @@ function M:setHandCardPos(btn_card, i, getcard)
end end
function M:UpdateHandCard(getcard, mp) function M:UpdateHandCard(getcard, mp)
print("======================onthisUpdateHandCard") -- print("======================onthisUpdateHandCard")
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
@ -154,7 +154,7 @@ function M:__OnDragEnd(context)
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
if not _room or _room:GetReloadStatus() then return end if not _room or _room:GetReloadStatus() then return end
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false

View File

@ -5,12 +5,12 @@ local MJTableBG = {}
local M = MJTableBG local M = MJTableBG
local mj_bg_config = { local mj_bg_config = {
{id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04"}, { id = 1, url = "base/tablebg/bg/bg1", thumb = "ui://Common/b04" },
{id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05"}, { id = 2, url = "base/tablebg/bg/bg2", thumb = "ui://Common/b05" },
{id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06"}, { id = 3, url = "base/tablebg/bg/bg3", thumb = "ui://Common/b06" },
{id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01"}, { id = 4, url = "base/main_pokemajiang/bg/bg6", thumb = "ui://Main_PokeMaJiang/b01" },
{id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02"}, { id = 5, url = "base/tablebg/bg/bg5", thumb = "ui://Common/b02" },
{id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03"}, { id = 6, url = "base/tablebg/bg/bg4", thumb = "ui://Common/b03" },
} }
local function GetBG(data, game_id) local function GetBG(data, game_id)
@ -52,12 +52,12 @@ function MJTableBG.GetTableBG(game_id)
local id = -1 local id = -1
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code) local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
-- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id) -- -- print(DataManager.SelfUser.invite_code, DataManager.SelfUser.account_id)
if json_data ~= nil then if json_data ~= nil then
local config_data = json.decode(json_data) local config_data = json.decode(json_data)
id = GetBG(config_data, game_id) id = GetBG(config_data, game_id)
end end
return id return id
end end
function MJTableBG.LoadTableBG(id, game_id, main_view) function MJTableBG.LoadTableBG(id, game_id, main_view)
@ -75,11 +75,11 @@ end
function MJTableBG.SaveTableBG(game_id, bg_id) function MJTableBG.SaveTableBG(game_id, bg_id)
local config_data local config_data
local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code) local json_data = Utils.LoadLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code)
if json_data ~= nil then if json_data ~= nil then
config_data = json.decode(json_data) config_data = json.decode(json_data)
else else
config_data = {} config_data = {}
end end
SetBG(config_data, game_id, bg_id) SetBG(config_data, game_id, bg_id)
Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data)) Utils.SaveLocalFile(DataManager.SelfUser.account_id .. DataManager.SelfUser.invite_code, json.encode(config_data))
end end

View File

@ -10,8 +10,8 @@ local M = {}
--- Create a new ZZ_MainView --- Create a new ZZ_MainView
function M.new() function M.new()
setmetatable(M,{__index = MJMainView}) setmetatable(M, { __index = MJMainView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "MainView" self.class = "MainView"
self.asset_group = "TuiDaoHu_MJ" self.asset_group = "TuiDaoHu_MJ"
self:init() self:init()
@ -25,144 +25,137 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/tuidaohu/ui/Extend_MJ_TuiDaoHu") UIPackage.AddPackage("extend/majiang/tuidaohu/ui/Extend_MJ_TuiDaoHu")
MJMainView.InitView(self,"ui://Main_Majiang/Main_"..room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text =room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人推倒胡 ' .. room.score_times .. ''
self.LaiziBG=self._view:GetChild('n103') self.LaiziBG = self._view:GetChild('n103')
self.LaiziBG.text="鬼牌" self.LaiziBG.text = "鬼牌"
self.LaiziBG.visible=false self.LaiziBG.visible = false
self.selectLaiziBtn=self._view:GetChild('selectlaizi') self.selectLaiziBtn = self._view:GetChild('selectlaizi')
self.Laizi1Btn=self._view:GetChild('selectlaizi1') self.Laizi1Btn = self._view:GetChild('selectlaizi1')
self.Laizi2Btn=self._view:GetChild('selectlaizi2') self.Laizi2Btn = self._view:GetChild('selectlaizi2')
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self:SetReconnentLaiziTips() self:SetReconnentLaiziTips()
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then
self:ReloadRoom() self:ReloadRoom()
end end
end end
function M:SetReconnentLaiziTips() function M:SetReconnentLaiziTips()
local room=DataManager.CurrenRoom local room = DataManager.CurrenRoom
if room.beforelaiziCardId and room.beforelaiziCardId>0 then if room.beforelaiziCardId and room.beforelaiziCardId > 0 then
self:SetShowLaiZiProcess(room.beforelaiziCardId,room.laiziInfo[1],room.laiziInfo[2],false) self:SetShowLaiZiProcess(room.beforelaiziCardId, room.laiziInfo[1], room.laiziInfo[2], false)
end end
end end
function M:SetLaiZiCard(btn, cardId)
function M:SetLaiZiCard(btn,cardId) btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
btn.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..cardId
end end
function M:IsShowLaiZi(btn, isShow)
function M:IsShowLaiZi(btn,isShow) btn.visible = isShow
btn.visible=isShow
end end
function M:HideAllLaiZiCard() function M:HideAllLaiZiCard()
self.Laizi1Btn.visible=false self.Laizi1Btn.visible = false
self.Laizi2Btn.visible=false self.Laizi2Btn.visible = false
self.selectLaiziBtn.visible=false self.selectLaiziBtn.visible = false
self.LaiziBG.visible=false self.LaiziBG.visible = false
end end
function M:SetShowLaiZiProcess(beforeLaiziID,currentLaizi1ID,currentLaizi2ID,isShowAnim) function M:SetShowLaiZiProcess(beforeLaiziID, currentLaizi1ID, currentLaizi2ID, isShowAnim)
--zhongid=currentLaizi1ID --zhongid=currentLaizi1ID
if isShowAnim==nil then isShowAnim=false end if isShowAnim == nil then isShowAnim = false end
printlog("当前赋值结果为====>>>") printlog("当前赋值结果为====>>>")
print(beforeLaiziID) -- print(beforeLaiziID)
print(currentLaizi1ID) -- print(currentLaizi1ID)
print(currentLaizi2ID) -- print(currentLaizi2ID)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self:SetLaiZiCard(self.selectLaiziBtn,beforeLaiziID) self:SetLaiZiCard(self.selectLaiziBtn, beforeLaiziID)
self:SetLaiZiCard(self.Laizi1Btn,currentLaizi1ID) self:SetLaiZiCard(self.Laizi1Btn, currentLaizi1ID)
if currentLaizi2ID then if currentLaizi2ID then
self:SetLaiZiCard(self.Laizi2Btn,currentLaizi2ID) self:SetLaiZiCard(self.Laizi2Btn, currentLaizi2ID)
end end
if isShowAnim==true then if isShowAnim == true then
self:IsShowLaiZi(self.selectLaiziBtn,true) self:IsShowLaiZi(self.selectLaiziBtn, true)
coroutine.start( coroutine.start(
function() function()
coroutine.wait(1) coroutine.wait(1)
self:HideAllLaiZiCard() self:HideAllLaiZiCard()
self.LaiziBG.visible=true self.LaiziBG.visible = true
self:IsShowLaiZi(self.Laizi1Btn,true) self:IsShowLaiZi(self.Laizi1Btn, true)
if currentLaizi2ID then if currentLaizi2ID then
self:IsShowLaiZi(self.Laizi2Btn,true) self:IsShowLaiZi(self.Laizi2Btn, true)
end end
end
end )
) else
else self.LaiziBG.visible = true
self.LaiziBG.visible=true self:IsShowLaiZi(self.Laizi1Btn, true)
self:IsShowLaiZi(self.Laizi1Btn,true) if currentLaizi2ID then
if currentLaizi2ID then self:IsShowLaiZi(self.Laizi2Btn, true)
self:IsShowLaiZi(self.Laizi2Btn,true) end
end end
end self.LaiziBG.visible = true
self.LaiziBG.visible=true
end end
function M:UpdateRound() function M:UpdateRound()
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
local tem = self._view:GetChild("player_info" .. i) local tem = self._view:GetChild("player_info" .. i)
_player_info[i] = PlayerInfoView.new(tem,self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
end end
function M:NewMJPlayerCardInfoView(view,index) function M:NewMJPlayerCardInfoView(view, index)
if index == 1 then if index == 1 then
return MJPlayerSelfCardInfoView.new(view,self) return MJPlayerSelfCardInfoView.new(view, self)
end end
return MJPlayerCardInfoView.new(view,self) return MJPlayerCardInfoView.new(view, self)
end end
function M:EventInit() function M:EventInit()
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
MainView.EventInit(self) MainView.EventInit(self)
local _room = self._room local _room = self._room
local _view = self._view local _view = self._view
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
local _player_info = self._player_info local _player_info = self._player_info
local _gamectr = self._gamectr local _gamectr = self._gamectr
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = {...} local arg = { ... }
self:SetShowLaiZiProcess(arg[1],arg[2],arg[3],arg[4]) self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
end) end)
_gamectr:AddEventListener(TX_GameEvent.SendCards,function( ... ) _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
-- self:ShowHuTip() -- self:ShowHuTip()
self:UpdateRound() self:UpdateRound()
self._state.selectedIndex = 1 self._state.selectedIndex = 1
local list = _room.player_list local list = _room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = self._player_info[self:GetPos(p.seat)] local info = self._player_info[self:GetPos(p.seat)]
info:FillData(p) info:FillData(p)
@ -172,8 +165,8 @@ function M:EventInit()
card_info:UpdateHandCard() card_info:UpdateHandCard()
end end
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
local arg = {...} local arg = { ... }
self._left_time = 15 self._left_time = 15
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
@ -187,11 +180,11 @@ function M:EventInit()
info:UpdateHandCard(true) info:UpdateHandCard(true)
end) end)
local _gcm_outcard_url ="ui://Main_Majiang/Gcm_OutCard" local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
self:__CloseTip() self:__CloseTip()
self._left_time = 0 self._left_time = 0
local arg = {...} local arg = { ... }
local p = arg[1] local p = arg[1]
local card = arg[2] local card = arg[2]
local seat = p.seat local seat = p.seat
@ -208,7 +201,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] -- self._tex_leftTime.text = arg[3]
@ -219,27 +212,27 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
local arg = {...} local arg = { ... }
local _tip = arg[1] local _tip = arg[1]
local weight = arg[2] local weight = arg[2]
self:__FangziTip(_tip, weight) self:__FangziTip(_tip, weight)
end) end)
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self,self.OnFangziAction)) _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self:__CloseTip() self:__CloseTip()
self._popEvent = false self._popEvent = false
local arg = {...} local arg = { ... }
local win_seat = arg[1] local win_seat = arg[1]
local lose_seat = arg[2] local lose_seat = arg[2]
local win_card = arg[3] local win_card = arg[3]
local cards = arg[4] local cards = arg[4]
local win_list = arg[5] local win_list = arg[5]
local index = self:GetPos(win_seat) local index = self:GetPos(win_seat)
local info = self._player_card_info[index] local info = self._player_card_info[index]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard(true, true) info:UpdateHandCard(true, true)
@ -265,21 +258,21 @@ function M:EventInit()
local he = UIPackage.CreateObjectFromURL(url) local he = UIPackage.CreateObjectFromURL(url)
pNode:AddChild(he) pNode:AddChild(he)
he:GetTransition("t2"):Play() he:GetTransition("t2"):Play()
he:Center() he:Center()
if _room.room_config.people_num==2 then if _room.room_config.people_num == 2 then
if win_seat ~= _room.self_player.seat then if win_seat ~= _room.self_player.seat then
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
he.y = he.height * 0.4 * 0.5 * -1 he.y = he.height * 0.4 * 0.5 * -1
end end
end end
if win_seat == _room.self_player.seat then if win_seat == _room.self_player.seat then
printlog("自己位置=====") printlog("自己位置=====")
he:Center() he:Center()
elseif url == "ui://Main_Majiang/eff_zimo" then elseif url == "ui://Main_Majiang/eff_zimo" then
printlog("自摸地址==========") printlog("自摸地址==========")
he.scaleY = 0.4 he.scaleY = 0.4
he.scaleX = 0.4 he.scaleX = 0.4
he.x = he.width * 0.4 * 0.5 * -1 he.x = he.width * 0.4 * 0.5 * -1
@ -288,46 +281,45 @@ function M:EventInit()
--- ---
local isZiMo=win_seat==lose_seat local isZiMo = win_seat == lose_seat
DataManager.CurrenRoom.isZiMoHu=isZiMo DataManager.CurrenRoom.isZiMoHu = isZiMo
local hu_sound = isZiMo and ("zimo"..math.random(1, 3)) or ("hu"..math.random(1, 2)) local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
printlog("声音====>>>",hu_sound) printlog("声音====>>>", hu_sound)
self:PlaySound("TuiDaoHu_MJ",player.self_user.sex, hu_sound) self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, hu_sound)
local pNode = info._view local pNode = info._view
local url = "eff_list1" local url = "eff_list1"
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_TuiDaoHu/" .. url) local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_TuiDaoHu/" .. url)
he_list.touchable = false he_list.touchable = false
pNode:AddChild(he_list) pNode:AddChild(he_list)
he_list:Center() he_list:Center()
coroutine.start(function() coroutine.start(function()
for i = 1 ,#win_list do for i = 1, #win_list do
local tem = win_list[i] local tem = win_list[i]
if tem.type>0 and tem.type<32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_TuiDaoHu/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end
end
end coroutine.wait(2)
obj_win_card:Dispose()
coroutine.wait(2) he:Dispose()
obj_win_card:Dispose() he_list:Dispose()
he:Dispose() self._popEvent = true
he_list:Dispose()
self._popEvent = true
end) end)
end) end)
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
local arg = {...} local arg = { ... }
self._popEvent = false self._popEvent = false
local list = arg[1] local list = arg[1]
local start_seat = arg[2] local start_seat = arg[2]
-- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3") -- ViewUtil.PlaySound("TuiDaoHu_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
coroutine.start(self.RunNiao,self,list, start_seat) coroutine.start(self.RunNiao, self, list, start_seat)
end) end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
@ -336,7 +328,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local result = arg[1] local result = arg[1]
local liuju = result.liuju local liuju = result.liuju
local data = result.info_list local data = result.info_list
@ -354,7 +346,7 @@ function M:EventInit()
self:RemoveCursor() self:RemoveCursor()
if self._clearingView == nil then if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view) self._clearingView = EXClearingView.new(self._root_view)
coroutine.start(function() coroutine.start(function()
coroutine.wait(0.5) coroutine.wait(0.5)
self._clearingView:Show() self._clearingView:Show()
self._popEvent = true self._popEvent = true
@ -376,7 +368,7 @@ function M:EventInit()
end end
info:UpdateScore() info:UpdateScore()
info._view:GetChild("zhanji").visible = true 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 if num > 0 then
info._view:GetController("text_color").selectedIndex = 0 info._view:GetController("text_color").selectedIndex = 0
info._view:GetChild("text_jifen").text = "+" .. d2ad(num) info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
@ -402,7 +394,7 @@ function M:EventInit()
self._left_time = 0 self._left_time = 0
self:UpdateCardBox(0) self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0 self._ctr_cardbox.selectedIndex = 0
local arg = {...} local arg = { ... }
local total_result = arg[2] local total_result = arg[2]
local result = arg[1] local result = arg[1]
local over = arg[3] local over = arg[3]
@ -423,7 +415,7 @@ function M:EventInit()
end) end)
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
local arg = {...} local arg = { ... }
local seat = arg[1] local seat = arg[1]
local num = arg[2] local num = arg[2]
if num > 0 then if num > 0 then
@ -443,21 +435,21 @@ end
function M:OutCard(card) function M:OutCard(card)
if card ~= 0 then if card ~= 0 then
printlog("当前出牌为===>>>"..card) printlog("当前出牌为===>>>" .. card)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
self._room.curren_outcard_seat = -1 self._room.curren_outcard_seat = -1
_gamectr:SendOutCard(card, function() _gamectr:SendOutCard(card, function()
local info = self._player_card_info[1] local info = self._player_card_info[1]
self:RemoveCursor() self:RemoveCursor()
info:UpdateHandCard() info:UpdateHandCard()
info:UpdateOutCardList(nil, card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex,tostring(card)) self:PlaySound("TuiDaoHu_MJ", self._room.self_player.self_user.sex, tostring(card))
self:PlayMJSound("chupai.mp3") self:PlayMJSound("chupai.mp3")
-- self:ShowHuTip() -- self:ShowHuTip()
end) end)
else else
printlog("鬼牌不能出===>>>"..card) printlog("鬼牌不能出===>>>" .. card)
end end
end end
@ -475,37 +467,37 @@ function M:__FangziTip(tip, weight)
local tip_hu = false local tip_hu = false
local count = #_tlist local count = #_tlist
for k=1,#_tlist do for k = 1, #_tlist do
local td = tip.tip_map_type[_tlist[k]][1] local td = tip.tip_map_type[_tlist[k]][1]
local url = "ui://Main_Majiang/Btn_fztip" local url = "ui://Main_Majiang/Btn_fztip"
local td_weight = td.weight local td_weight = td.weight
if td_weight == 16 then td_weight = 8 end if td_weight == 16 then td_weight = 8 end
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
local btn_t = _lit_fanzi:AddItemFromPool(url) local btn_t = _lit_fanzi:AddItemFromPool(url)
btn_t.icon = "ui://Main_Majiang/fztip_"..td_weight btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
btn_t.data = { tip, td } btn_t.data = { tip, td }
btn_t.onClick:Add(self.__TipAction,self) btn_t.onClick:Add(self.__TipAction, self)
end end
-- if not (tonumber(weight) >= 16) then -- if not (tonumber(weight) >= 16) then
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass") local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass") -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
_btn_pass.onClick:Set(function() _btn_pass.onClick:Set(function()
if tonumber(weight) >= 8 then if tonumber(weight) >= 8 then
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel) local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function() 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) _gamectr:SendAction(0)
_chipeng_tip:Dispose() _chipeng_tip:Dispose()
self._chipeng_tip = nil self._chipeng_tip = nil
end guo_msg:Close()
end) end)
guo_msg:Show()
else
_gamectr:SendAction(0)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
end
end)
-- end -- end
self._view:AddChild(_chipeng_tip) self._view:AddChild(_chipeng_tip)
@ -548,20 +540,21 @@ function M:_ChiView(tiplist, callback)
local item_choose = list_choose:AddItemFromPool() local item_choose = list_choose:AddItemFromPool()
item_choose:GetController("type").selectedIndex = 0 item_choose:GetController("type").selectedIndex = 0
for j = 1, 4 do for j = 1, 4 do
item_choose:GetChild("card"..j).icon = UIPackage.GetItemURL("Main_Majiang", "202_"..tiplist[i].card) item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. tiplist[i].card)
end end
item_choose.onClick:Add(function() item_choose.onClick:Add(function()
callback(tiplist[i].id) callback(tiplist[i].id)
end) end)
end end
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width)/2, (self._view.height - _pop_tip_choice.height)/2) _pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
(self._view.height - _pop_tip_choice.height) / 2)
self._view:AddChild(_pop_tip_choice) self._view:AddChild(_pop_tip_choice)
self._pop_tip_choice = _pop_tip_choice self._pop_tip_choice = _pop_tip_choice
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() self:__CloseTip()
local arg = {...} local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
local player = arg[2] local player = arg[2]
@ -571,12 +564,12 @@ function M:OnFangziAction(...)
local pNode = info._mask_liangpai local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect") local effect = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "FzEffect")
if fz.type == FZType.Peng then if fz.type == FZType.Peng then
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"peng"..math.random(1, 3)) self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
else else
self:PlaySound("TuiDaoHu_MJ", player.self_user.sex,"gang"..math.random(1, 2)) self:PlaySound("TuiDaoHu_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "") effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框") -- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
@ -603,7 +596,7 @@ end
function M:RunNiao(list, start_seat) function M:RunNiao(list, start_seat)
local _room = self._room local _room = self._room
--local _niao_View = self._niao_View --local _niao_View = self._niao_View
self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu","Panel_Birds") self._niao_View = UIPackage.CreateObject("Extend_MJ_TuiDaoHu", "Panel_Birds")
self._view:AddChild(self._niao_View) self._view:AddChild(self._niao_View)
self._niao_View:Center() self._niao_View:Center()
local _niao_View = self._niao_View local _niao_View = self._niao_View
@ -621,7 +614,7 @@ function M:RunNiao(list, start_seat)
local card = list[i].card local card = list[i].card
coroutine.wait(0.3) coroutine.wait(0.3)
item:GetTransition("appear"):Play() item:GetTransition("appear"):Play()
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_"..card) item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
end end
coroutine.start(function() coroutine.start(function()
@ -646,17 +639,17 @@ end
-- end -- end
function M:__PiaoNiaoTip() function M:__PiaoNiaoTip()
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao") local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
self._view:AddChild(obj_piao) self._view:AddChild(obj_piao)
obj_piao.x = (self._view.width - obj_piao.width) * 0.5 obj_piao.x = (self._view.width - obj_piao.width) * 0.5
obj_piao.y = self._view.height * 0.6 obj_piao.y = self._view.height * 0.6
for i = 1, 4 do for i = 1, 4 do
obj_piao:GetChild("btn_" .. i).onClick:Add(function() obj_piao:GetChild("btn_" .. i).onClick:Add(function()
self._gamectr:SendAction(i - 1) self._gamectr:SendAction(i - 1)
obj_piao:Dispose() obj_piao:Dispose()
end) end)
end end
self._com_piao = obj_piao self._com_piao = obj_piao
end end
function M:ReloadRoom(bskip) function M:ReloadRoom(bskip)
@ -669,12 +662,12 @@ function M:ReloadRoom(bskip)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if not room.playing then if not room.playing then
self._state.selectedIndex = 2 self._state.selectedIndex = 2
else else
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self._room._reload_flag = true self._room._reload_flag = true
end end
end end
for i = 1, #room.player_list do 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)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info:UpdateScore() head_info:UpdateScore()
head_info._view:GetChild('zhanji').visible = true head_info._view:GetChild('zhanji').visible = true
local num = p.total_hp or 0 local num = p.total_hp or 0
if num > 0 then if num > 0 then
head_info._view:GetController('text_color').selectedIndex = 0 head_info._view:GetController('text_color').selectedIndex = 0
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num) head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
else else
head_info._view:GetController('text_color').selectedIndex = 1 head_info._view:GetController('text_color').selectedIndex = 1
head_info._view:GetChild('text_jifen').text = d2ad(num) head_info._view:GetChild('text_jifen').text = d2ad(num)
end end
if p.seat == room.last_outcard_seat then if p.seat == room.last_outcard_seat then
local card = p.outcard_list[#p.outcard_list] local card = p.outcard_list[#p.outcard_list]
info:UpdateOutCardList(nil,card, self._cursor) info:UpdateOutCardList(nil, card, self._cursor)
elseif p.seat == room.curren_outcard_seat then elseif p.seat == room.curren_outcard_seat then
info:UpdateHandCard(true) info:UpdateHandCard(true)
info:UpdateOutCardList() info:UpdateOutCardList()
@ -712,11 +705,11 @@ function M:ReloadRoom(bskip)
-- self._player_info[self:GetPos(p.seat)]:Ready(true) -- self._player_info[self:GetPos(p.seat)]:Ready(true)
-- end -- end
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
if p.ready and room.playing == false then if p.ready and room.playing == false then
self._player_info[self:GetPos(p.seat)]:Ready(true) self._player_info[self:GetPos(p.seat)]:Ready(true)
end end
end end
if p.piao_niao~=nil and p.piao_niao > 0 then if p.piao_niao ~= nil and p.piao_niao > 0 then
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
head_info._view:GetController("piao_niao").selectedIndex = 1 head_info._view:GetController("piao_niao").selectedIndex = 1
@ -732,14 +725,14 @@ function M:ReloadRoom(bskip)
end end
function M:PlayerChangeLineState() function M:PlayerChangeLineState()
-- local isOutCard = true -- local isOutCard = true
-- local str = "玩家 " -- local str = "玩家 "
-- for _ , player in ipairs(self._room.player_list) do -- for _ , player in ipairs(self._room.player_list) do
-- if player.line_state == 0 then -- if player.line_state == 0 then
-- isOutCard = false -- isOutCard = false
-- end -- end
-- end -- end
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end end
function M:UpdateCardBox(seat) function M:UpdateCardBox(seat)

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,46 +45,46 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
printlog("初始化房间数据====>>>") printlog("初始化房间数据====>>>")
pt(_tableInfo) pt(_tableInfo)
printlog(_tableInfo.laiziCard) printlog(_tableInfo.laiziCard)
printlog(_tableInfo.laiziCard2) printlog(_tableInfo.laiziCard2)
printlog(_tableInfo.laiziCardBefore) printlog(_tableInfo.laiziCardBefore)
printlog(_tableInfo.laiziCard2Before) printlog(_tableInfo.laiziCard2Before)
room.laiziInfo={} room.laiziInfo = {}
if _tableInfo.laiziCardBefore>0 then if _tableInfo.laiziCardBefore > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard) table.insert(room.laiziInfo, _tableInfo.laiziCard)
if _tableInfo.laiziCard2>0 then if _tableInfo.laiziCard2 > 0 then
table.insert(room.laiziInfo,_tableInfo.laiziCard2) table.insert(room.laiziInfo, _tableInfo.laiziCard2)
end end
room.beforelaiziCardId=_tableInfo.laiziCardBefore room.beforelaiziCardId = _tableInfo.laiziCardBefore
else else
room.laiziInfo=nil room.laiziInfo = nil
end end
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
pt(_config) pt(_config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
@ -107,23 +107,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -147,7 +147,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -156,18 +156,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,16 +16,16 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i=1,#DataManager.CurrenRoom.laiziInfo do for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] ) table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end end
end end
end end
end end
self._mainView._hu_tip:FillData(tingList) self._mainView._hu_tip:FillData(tingList)
end end
@ -34,30 +34,26 @@ function M:UpdateHandCard(getcard, mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i=1,#self._carViewList do for i = 1, #self._carViewList do
local obj=self._carViewList[i] local obj = self._carViewList[i]
if obj and obj.card then if obj and obj.card then
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then if obj.card.GetController then
if obj.card:GetController("laizi") then if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex=1 obj.card:GetController("laizi").selectedIndex = 1
end end
end
end else
else if obj.card.GetController then
if obj.card.GetController then if obj.card:GetController("laizi") then
if obj.card:GetController("laizi") then obj.card:GetController("laizi").selectedIndex = 0
obj.card:GetController("laizi").selectedIndex=0 end
end end
end end
end end
end
end end
end
end
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
@ -72,7 +68,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -91,7 +88,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -108,7 +105,6 @@ function M:UpdateHandCard(getcard, mp)
end end
self._out_card = false self._out_card = false
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
@ -116,10 +112,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -159,17 +155,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -189,6 +185,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -203,10 +200,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
local EXMainView = import(".EXMainView") local EXMainView = import(".EXMainView")
local EXGameController = import(".EXGameController") local EXGameController = import(".EXGameController")
local EXRoomConfig = import(".EXRoomConfig") local EXRoomConfig = import(".EXRoomConfig")
local EXPlayBackView =import(".EXPlayBackView") local EXPlayBackView = import(".EXPlayBackView")
local MJRoom = require("main.majiang.MJRoom") local MJRoom = require("main.majiang.MJRoom")
local ExtendConfig = {} local ExtendConfig = {}
@ -13,14 +13,14 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 22 self.extend_id = 22
self._viewMap = {} self._viewMap = {}
self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_Main] = EXMainView
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
return self return self
end end
--卸载资源 --卸载资源
@ -45,24 +45,24 @@ end
local _ctr_game = nil local _ctr_game = nil
function M:GetGameController() function M:GetGameController()
if _ctr_game == nil then if _ctr_game == nil then
_ctr_game = EXGameController.new() _ctr_game = EXGameController.new()
end end
return _ctr_game return _ctr_game
end end
function M:NewRoom() function M:NewRoom()
return MJRoom.new() return MJRoom.new()
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = EXRoomConfig.new(_config) room.room_config = EXRoomConfig.new(_config)
end end
function M:FillRoomData(s2croom) 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 _tableInfo = s2croom["tableInfo"]
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
@ -88,23 +88,23 @@ function M:FillRoomData(s2croom)
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
room.last_outcard_seat = last_outcard_seat room.last_outcard_seat = last_outcard_seat
room.playing = playing room.playing = playing
for i=1,#_info_list do for i = 1, #_info_list do
local tem = _info_list[i] local tem = _info_list[i]
local playerid = tem["playerid"] local playerid = tem["playerid"]
local p = room:GetPlayerById(playerid) local p = room:GetPlayerById(playerid)
local outcard_list = tem["outcard_list"] local outcard_list = tem["outcard_list"]
p.outcard_list = outcard_list p.outcard_list = outcard_list
p.total_score = tem["score"] p.total_score = tem["score"]
p.hand_left_count = tem["card_count"] p.hand_left_count = tem["card_count"]
p.piao_niao = tem["piao_niao"] or 0 p.piao_niao = tem["piao_niao"] or 0
local opcard = tem["opcard"] local opcard = tem["opcard"]
for k=1,#opcard do for k = 1, #opcard do
local op = opcard[k] local op = opcard[k]
local fz = {} local fz = {}
fz.type = op["type"] fz.type = op["type"]
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list+1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
@ -128,7 +128,7 @@ function M:FillPlayBackData(pd_data)
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = room:NewPlayer() local p = room:NewPlayer()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -137,18 +137,18 @@ function M:FillPlayBackData(pd_data)
p.ready = _jp["ready"] == 1 and true or false p.ready = _jp["ready"] == 1 and true or false
local pid = _jp["aid"] local pid = _jp["aid"]
p.piao_niao = _jp["piao_niao"] p.piao_niao = _jp["piao_niao"]
-- print(DataManager.SelfUser.account_id,pid) -- -- print(DataManager.SelfUser.account_id,pid)
-- if (278 == pid) then -- if (278 == pid) then
-- room.self_player = p -- room.self_player = p
-- p.self_user = DataManager.SelfUser -- p.self_user = DataManager.SelfUser
-- else -- else
if p.seat == 1 then room.self_player = p end if p.seat == 1 then room.self_player = p end
local u = User.new() local u = User.new()
u.account_id = pid u.account_id = pid
p.self_user = u p.self_user = u
u.nick_name = _jp["nick"] u.nick_name = _jp["nick"]
u.head_url = _jp["portrait"] u.head_url = _jp["portrait"]
u.sex = _jp["sex"] u.sex = _jp["sex"]
-- end -- end
p.self_user.host_ip = p.self_user.host_ip p.self_user.host_ip = p.self_user.host_ip
local _hand_card = _jp["hand_card"] local _hand_card = _jp["hand_card"]

View File

@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
local M = {} local M = {}
-- --
function M.new(view,mainView) function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView}) setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, {__index = MJPlayerSelfCardInfoView}) setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({},{__index = M}) local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView" self.class = "PlayerSelfCardInfoView"
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
@ -16,7 +16,8 @@ function M.new(view,mainView)
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
--if #tingList > 0 then --if #tingList > 0 then
-- table.insert(tingList, 412) -- table.insert(tingList, 412)
--end --end
@ -38,7 +39,8 @@ function M:UpdateHandCard(getcard, mp)
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
list_remove(card_list, card) list_remove(card_list, card)
local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi) local tingList = CardCheck.tingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then if #tingList > 0 then
local count = 0 local count = 0
for j = 1, #tingList do for j = 1, #tingList do
@ -57,7 +59,7 @@ function M:UpdateHandCard(getcard, mp)
end) end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多' -- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false 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] local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1 tem.item:GetController("mark_ting").selectedIndex = 1
@ -81,10 +83,10 @@ function M:__OnClickHandCard(context)
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true
local card_list = {} local card_list = {}
for i=1,#_carViewList do for i = 1, #_carViewList do
local btn = _carViewList[i].card local btn = _carViewList[i].card
local card = self:GetCard(btn) local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then if btn ~= button and btn.selected == true then
if button.data.card_item == card then if button.data.card_item == card then
refresh = false refresh = false
else else
@ -124,17 +126,17 @@ function M:__OnDragStart(card)
end end
function M:__OnDragEnd(context) function M:__OnDragEnd(context)
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil
end end
local button = context.sender local button = context.sender
--button:RemoveFromParent() --button:RemoveFromParent()
local card = button.data local card = button.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 412) then
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
button.touchable = false button.touchable = false
@ -154,6 +156,7 @@ function M:CheckPlayerOnlineState()
end end
return true return true
end end
function M:Clear(bskip) function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0 --self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x self._area_fz_list.x = self._src_fz_list.x
@ -168,10 +171,10 @@ function M:Clear(bskip)
self._mask_liangpai:RemoveChildren(0, -1, true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
for i=1,#self._carViewList do for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose() self._carViewList[i].card:Dispose()
end end
self._carViewList = {} self._carViewList = {}
end end
return M return M

View File

@ -20,15 +20,15 @@ local ChunTian_Record_Event = {
local default_bg = 1 local default_bg = 1
local bg_config = { local bg_config = {
{id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1'}, { id = 1, url = 'extend/poker/chuntian/bg/bg1', thumb = 'ui://Extend_Poker_ChunTian/table_bg1' },
{id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2'}, { id = 2, url = 'extend/poker/chuntian/bg/bg2', thumb = 'ui://Extend_Poker_ChunTian/table_bg2' },
{id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3'} { id = 3, url = 'extend/poker/chuntian/bg/bg3', thumb = 'ui://Extend_Poker_ChunTian/table_bg3' }
} }
--- Create a new --- Create a new
function M.new() function M.new()
setmetatable(M, {__index = PKPlayBackView}) setmetatable(M, { __index = PKPlayBackView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = 'ChunTian_PlayBackView' self.class = 'ChunTian_PlayBackView'
self:init() self:init()
@ -42,7 +42,8 @@ function M:InitView(url)
end end
self._gamectr = ControllerManager.GetController(GameController) self._gamectr = ControllerManager.GetController(GameController)
UIPackage.AddPackage('extend/poker/chuntian/ui/Extend_Poker_ChunTian') UIPackage.AddPackage('extend/poker/chuntian/ui/Extend_Poker_ChunTian')
PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num, default_bg, bg_config) PKPlayBackView.InitView(self, 'ui://Extend_Poker_ChunTian/ChunTian_Main_' .. self._room.room_config.people_num,
default_bg, bg_config)
self._tex_round = self._view:GetChild('round') self._tex_round = self._view:GetChild('round')
self._player_card_info = {} self._player_card_info = {}
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
@ -55,7 +56,7 @@ function M:InitView(url)
self._rightPanelView:Destroy() self._rightPanelView:Destroy()
end end
self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel) self._rightPanelView = ChunTian_RightPanelView.new(self, rightpanel)
rightpanel:GetChild("btn_setting").onClick:Clear() rightpanel:GetChild("btn_setting").onClick:Clear()
self._player_info = {} self._player_info = {}
@ -65,7 +66,7 @@ function M:InitView(url)
_player_info[i] = PlayerInfoView.new(tem, self) _player_info[i] = PlayerInfoView.new(tem, self)
end end
local list = self._room.player_list local list = self._room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = _player_info[self:GetPos(p.seat)] local info = _player_info[self:GetPos(p.seat)]
info._view.visible = true info._view.visible = true
@ -94,7 +95,7 @@ function M:NewPlayerPokerInfoView(view, index)
end end
function M:FillRoomData(data) function M:FillRoomData(data)
print("hidezhanji 1111") -- print("hidezhanji 1111")
self._currentStep = 1 self._currentStep = 1
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
@ -109,12 +110,12 @@ function M:FillRoomData(data)
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
if p.total_hp then if p.total_hp then
print("hidezhanji 2222") -- print("hidezhanji 2222")
head_info._view:GetChild('zhanji').visible=false head_info._view:GetChild('zhanji').visible = false
if room.hpOnOff == 1 or room:checkHpNonnegative() then if room.hpOnOff == 1 or room:checkHpNonnegative() then
head_info._view:GetChild('zhanji').visible=true head_info._view:GetChild('zhanji').visible = true
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp) head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
end end
end end
@ -125,7 +126,6 @@ function M:FillRoomData(data)
card_info:UpdateHandPoker(p.hand_list, false, true) card_info:UpdateHandPoker(p.hand_list, false, true)
end end
head_info:UpdatePiao(p.piao) head_info:UpdatePiao(p.piao)
end end
self:UpdateRound() self:UpdateRound()
@ -136,7 +136,7 @@ end
function M:ShowStep(index) function M:ShowStep(index)
local step = self._step[index] local step = self._step[index]
if step==nil then if step == nil then
return return
end end
for i = 1, #step.player_card_data do for i = 1, #step.player_card_data do
@ -152,7 +152,6 @@ function M:ShowStep(index)
else else
info:InitPoker(p.hand_list, false) info:InitPoker(p.hand_list, false)
end end
end end
if step.cmd == ChunTian_Record_Event.Evt_OutCard then if step.cmd == ChunTian_Record_Event.Evt_OutCard then
@ -194,7 +193,8 @@ function M:ShowStep(index)
end end
if step.cmd == ChunTian_Record_Event.Evt_Result then if step.cmd == ChunTian_Record_Event.Evt_Result then
local Result = step.Result local Result = step.Result
self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type, Result.winseat, 0, Result.remaincards) self.result_view = ChunTian_ResultView.new(self._root_view, Result.info, self._room.room_id, Result.type,
Result.winseat, 0, Result.remaincards)
local num = self._view:GetChildIndex(self._view:GetChild("panel_record")) local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
self._view:AddChildAt(self.result_view._view, num) self._view:AddChildAt(self.result_view._view, num)
else else
@ -257,6 +257,7 @@ function M:CmdPass(cmd, index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.current_out_seat = cmd.seat data.current_out_seat = cmd.seat
end end
function M:Cmdresult(cmd, index) function M:Cmdresult(cmd, index)
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd

View File

@ -17,7 +17,7 @@ local CardView = {
local function NewCardView(card, cardcodenum, cardcodeflower) local function NewCardView(card, cardcodenum, cardcodeflower)
local self = {} local self = {}
setmetatable(self, {__index = CardView}) setmetatable(self, { __index = CardView })
self.btn_card = card self.btn_card = card
self.card_code_number = cardcodenum self.card_code_number = cardcodenum
self.card_code_flower = cardcodeflower self.card_code_flower = cardcodeflower
@ -38,8 +38,8 @@ local ChunTian_PlayerSelfPokerInfoView = {
local M = ChunTian_PlayerSelfPokerInfoView local M = ChunTian_PlayerSelfPokerInfoView
function M.new(view, mainView) function M.new(view, mainView)
setmetatable(M, {__index = ChunTian_PlayerPokerInfoView}) setmetatable(M, { __index = ChunTian_PlayerPokerInfoView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
self.gameCtr = ControllerManager.GetController(GameController) self.gameCtr = ControllerManager.GetController(GameController)
@ -91,7 +91,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
-- self.zhizhanplay=0 -- self.zhizhanplay=0
-- self.zhizhanzdts=0 -- self.zhizhanzdts=0
local cs = 1.25 local cs = 1.25
if DataManager.CurrenRoom.cardsize==0 then if DataManager.CurrenRoom.cardsize == 0 then
cs = 1.35 cs = 1.35
elseif DataManager.CurrenRoom.cardsize == 1 then elseif DataManager.CurrenRoom.cardsize == 1 then
cs = 1.25 cs = 1.25
@ -102,7 +102,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
if self.cor_init_poker ~= nil then if self.cor_init_poker ~= nil then
coroutine.stop(self.cor_init_poker) coroutine.stop(self.cor_init_poker)
end end
-- print(vardump(self.card_list)) -- -- print(vardump(self.card_list))
self.cor_init_poker = nil self.cor_init_poker = nil
self.card_list = {} self.card_list = {}
@ -110,73 +110,72 @@ function M:InitPoker(pokerList, isPlayAni, open)
if isPlayAni == true then if isPlayAni == true then
self.cor_init_poker = self.cor_init_poker =
coroutine.start( coroutine.start(
function() function()
self._mainView._popEvent = false self._mainView._popEvent = false
if self._mainView._rightPanelView._settingView ~= nil then if self._mainView._rightPanelView._settingView ~= nil then
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(false) self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(false)
end end
table.sort(pokerList) table.sort(pokerList)
for i = 1, #pokerList do for i = 1, #pokerList do
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i]) local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
local card_flower_code = pokerList[i] local card_flower_code = pokerList[i]
local btn_card = self:CreatPoker(card_number_code, cs, open) local btn_card = self:CreatPoker(card_number_code, cs, open)
local x, y = self._view.width / 2 + 100, -200 local x, y = self._view.width / 2 + 100, -200
btn_card:SetXY(x, y) btn_card:SetXY(x, y)
btn_card.alpha = 0 btn_card.alpha = 0
btn_card.touchable = false btn_card.touchable = false
-- coroutine.wait(0.05) -- coroutine.wait(0.05)
self.cards_view:AddChild(btn_card) self.cards_view:AddChild(btn_card)
local card_view = NewCardView(btn_card, card_number_code, card_flower_code) local card_view = NewCardView(btn_card, card_number_code, card_flower_code)
self.card_list[#self.card_list + 1] = card_view 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 if i == #pokerList then
for j = 1, #self.card_list do for j = 1, #self.card_list do
local card = self.card_list[j] local card = self.card_list[j]
card.btn_card.touchable = true card.btn_card.touchable = true
if open ~= 1 then if open ~= 1 then
-- body -- body
self:AddCardMoveEvent(card) self:AddCardMoveEvent(card)
end
end end
end end
end end
end for j = #self.card_list, 1, -1 do
for j = #self.card_list, 1, -1 do -- ViewUtil.PlaySound('ChunTianNew_PK', 'extend/poker/runfast/sound/mopai.mp3')
-- ViewUtil.PlaySound('ChunTianNew_PK', 'extend/poker/runfast/sound/mopai.mp3') local card_view = self.card_list[j]
local card_view = self.card_list[j] card_view.index = j
card_view.index = j self.cards_view:SetChildIndex(card_view.btn_card, card_view.index - 1)
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) card_view.btn_card:TweenMove(self:GetHandCardPos(j, #self.card_list), 0.10)
DSTween.To( DSTween.To(
0.7, 0.7,
1, 1,
0.1, 0.1,
function(value) function(value)
card_view.btn_card:SetScale(value, value) card_view.btn_card:SetScale(value, value)
end end
) )
DSTween.To( DSTween.To(
0.7, 0.7,
1, 1,
0.1, 0.1,
function(value) function(value)
card_view.btn_card.alpha = value card_view.btn_card.alpha = value
end end
) )
card_view.btn_card.alpha = 1 card_view.btn_card.alpha = 1
end end
self._mainView._popEvent = true self._mainView._popEvent = true
if self._mainView._rightPanelView._settingView ~= nil then if self._mainView._rightPanelView._settingView ~= nil then
self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(true) self._mainView._rightPanelView._settingView:SetBtnDismissRoomEnable(true)
end
end end
end )
)
else else
for i = 1, #pokerList do for i = 1, #pokerList do
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i]) local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
local card_flower_code = pokerList[i] local card_flower_code = pokerList[i]
@ -200,7 +199,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
end end
function M:updatePoker() function M:updatePoker()
local templist = {} local templist = {}
for i = 1, #self.card_list do for i = 1, #self.card_list do
templist[#templist + 1] = self.card_list[i].card_code_flower templist[#templist + 1] = self.card_list[i].card_code_flower
@ -249,21 +247,21 @@ function M:AddCardMoveEvent(card)
if k == #self.card_list then if k == #self.card_list then
if if
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
card.card_isTouchable == 0 card.card_isTouchable == 0
then then
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false) 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
else else
if if
card.btn_card.x + card.btn_card.x +
(self.card_width + self:GetHandCardOffset(#self.card_list)) > (self.card_width + self:GetHandCardOffset(#self.card_list)) >
min_x and min_x and
card.btn_card.x < max_x and card.btn_card.x < max_x and
card.card_isTouchable == 0 card.card_isTouchable == 0
then then
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false) 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 end
end end
@ -285,25 +283,25 @@ function M:AddCardMoveEvent(card)
if card.btn_card.touchable == true then if card.btn_card.touchable == true then
send_card[#send_card + 1] = card send_card[#send_card + 1] = card
self:SetBtnCardColor(card, 1) self:SetBtnCardColor(card, 1)
--print(vardump(card)) ---- print(vardump(card))
if k == #self.card_list then if k == #self.card_list then
if if
card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and card.btn_card.x + self.card_width > min_x and card.btn_card.x < max_x and
card.card_isTouchable == 0 card.card_isTouchable == 0
then then
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false) 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
else else
if if
card.btn_card.x + card.btn_card.x +
(self.card_width + self:GetHandCardOffset(#self.card_list)) > (self.card_width + self:GetHandCardOffset(#self.card_list)) >
min_x and min_x and
card.btn_card.x < max_x and card.btn_card.x < max_x and
card.card_isTouchable == 0 card.card_isTouchable == 0
then then
self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false) 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 end
end end
@ -343,6 +341,7 @@ function M:AddCardMoveEvent(card)
end end
) )
end end
function M:zhizhanxuanpai() --智障选牌 function M:zhizhanxuanpai() --智障选牌
printlog("zhizhanxuanpai") printlog("zhizhanxuanpai")
-- body -- body
@ -417,9 +416,8 @@ function M:TouchMoving(context)
else else
if if
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
card.btn_card.x < max_x card.btn_card.x < max_x
then then
self:SetBtnCardColor(card, 0.8) self:SetBtnCardColor(card, 0.8)
if #send_card1 == 0 then if #send_card1 == 0 then
-- body -- body
@ -448,8 +446,8 @@ function M:TouchMoving(context)
else else
if if
card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and card.btn_card.x + (self.card_width + self:GetHandCardOffset(#self.card_list)) > min_x and
card.btn_card.x < max_x card.btn_card.x < max_x
then then
-- self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false) -- self:UpdateCardMove(card.btn_card, not card.btn_card.selected, false)
-- card.card_isTouchable = 1 -- card.card_isTouchable = 1
-- ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3") -- ViewUtil.PlaySound("ChunTianNew_PK", "extend/poker/paodekuai/sound/click.mp3")
@ -470,7 +468,7 @@ function M:TouchMoving(context)
end end
end end
end end
--print(vardump(send_card1)) ---- print(vardump(send_card1))
-- local send_card = {} -- local send_card = {}
-- self.send_card = {} -- self.send_card = {}
-- for i = 1, #self.card_list do -- for i = 1, #self.card_list do
@ -486,8 +484,8 @@ end
function M:SetBtnCardColor(card, num) function M:SetBtnCardColor(card, num)
if if
card.btn_card:GetChildAt(0) ~= nil and card.btn_card:GetChildAt(0):GetChildAt(0) ~= nil and 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 card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0) ~= nil
then then
-- body -- body
card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(num, num, num) card.btn_card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(num, num, num)
end end
@ -599,10 +597,9 @@ end
function M:SetOutCardBlack() function M:SetOutCardBlack()
for i = 1, #self.out_card_list do for i = 1, #self.out_card_list do
local card = self.out_card_list[i] 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 if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7) card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
end end
end end
end end
@ -632,13 +629,13 @@ function M:SetOutCardList(cardlist, isAnim)
-- todo 出牌动画 -- todo 出牌动画
local pos = local pos =
self:GetOutCardEndPokerPos( self:GetOutCardEndPokerPos(
i, i,
#cardlist, #cardlist,
self.cards_view, self.cards_view,
card.btn_card, card.btn_card,
self.out_card_data['maxcount_x'], self.out_card_data['maxcount_x'],
0.7 0.7
) )
card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time) card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time)
-- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x) -- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x)
-- card.btn_card:GetChildAt(0):SetScale(x, x) -- card.btn_card:GetChildAt(0):SetScale(x, x)
@ -650,16 +647,16 @@ function M:SetOutCardList(cardlist, isAnim)
end end
self.move_cor = self.move_cor =
coroutine.start( coroutine.start(
function() function()
coroutine.wait(0.05) coroutine.wait(0.05)
for i = 1, #self.out_card_list do for i = 1, #self.out_card_list do
local card = self.out_card_list[i] local card = self.out_card_list[i]
self.cards_view:SetChildIndex(card, i - 1) self.cards_view:SetChildIndex(card, i - 1)
end
coroutine.wait(0.1)
ViewUtil.PlaySound('ChunTian_PK', 'extend/poker/runfast/sound/chupai.mp3')
end end
coroutine.wait(0.1) )
ViewUtil.PlaySound('ChunTian_PK', 'extend/poker/runfast/sound/chupai.mp3')
end
)
else else
for i = 1, #cardlist do for i = 1, #cardlist do
local poker_item = UIPackage.CreateObject('Extend_Poker_ChunTian', 'poker7') local poker_item = UIPackage.CreateObject('Extend_Poker_ChunTian', 'poker7')
@ -699,13 +696,13 @@ function M:SetOutCardList(cardlist, isAnim)
self.cards_view:AddChild(poker_item) self.cards_view:AddChild(poker_item)
local pos = local pos =
self:GetOutCardEndPokerPos( self:GetOutCardEndPokerPos(
i, i,
#cardlist, #cardlist,
self.cards_view, self.cards_view,
poker_item, poker_item,
self.out_card_data['maxcount_x'], self.out_card_data['maxcount_x'],
1 1
) )
poker_item.xy = Vector2.New(pos.x, pos_y) poker_item.xy = Vector2.New(pos.x, pos_y)
self.out_card_list[#self.out_card_list + 1] = poker_item self.out_card_list[#self.out_card_list + 1] = poker_item
end end
@ -785,10 +782,10 @@ function M:BtnEvent()
end end
local send_card = {} local send_card = {}
self.send_card = {} self.send_card = {}
local currentCard={} local currentCard = {}
for i = 1, #self.card_list do for i = 1, #self.card_list do
local card = self.card_list[i] local card = self.card_list[i]
table.insert(currentCard,card.card_code_flower) table.insert(currentCard, card.card_code_flower)
if card.btn_card.selected then if card.btn_card.selected then
send_card[#send_card + 1] = card.card_code_flower send_card[#send_card + 1] = card.card_code_flower
self.send_card[#self.send_card + 1] = card self.send_card[#self.send_card + 1] = card
@ -798,7 +795,7 @@ function M:BtnEvent()
if #send_card == 0 then if #send_card == 0 then
self:ErrorTip('请选择要出的牌 ') self:ErrorTip('请选择要出的牌 ')
else else
self.gameCtr:SendCard(send_card,currentCard) self.gameCtr:SendCard(send_card, currentCard)
end end
end end
) )
@ -851,7 +848,7 @@ function M:BtnEvent()
local function click_tongyibaochun(sindex) local function click_tongyibaochun(sindex)
self.ctr_baochun.selectedIndex = 0 self.ctr_baochun.selectedIndex = 0
printlog("jefe:",sindex) printlog("jefe:", sindex)
self.gameCtr:SendTongYiBaoChun(sindex) self.gameCtr:SendTongYiBaoChun(sindex)
end end
@ -875,8 +872,6 @@ function M:BtnEvent()
btn_tongyi.onClick:Set(function() btn_tongyi.onClick:Set(function()
click_tongyibaochun(1) click_tongyibaochun(1)
end) end)
end end
function M:ShowTipsCard(index) function M:ShowTipsCard(index)
@ -897,7 +892,7 @@ function M:ShowTipsCard(index)
end end
function M:GetHandCardOffset(count) function M:GetHandCardOffset(count)
local start = -70---54 local start = -70 ---54
local offset = 0 local offset = 0
if count > 10 then if count > 10 then
@ -916,6 +911,7 @@ function M:GetHandCardPos(index, card_count)
x = start_x + (self.card_width + offset) * (index - 1) x = start_x + (self.card_width + offset) * (index - 1)
return Vector2.New(x, y) return Vector2.New(x, y)
end end
function M:GetHandCardPos1(index, card_count) function M:GetHandCardPos1(index, card_count)
local x, y = 0, -18 local x, y = 0, -18
local offset = self:GetHandCardOffset(card_count) local offset = self:GetHandCardOffset(card_count)
@ -924,6 +920,7 @@ function M:GetHandCardPos1(index, card_count)
x = start_x + (self.card_width + offset) * (index - 1) x = start_x + (self.card_width + offset) * (index - 1)
return x, y return x, y
end end
function M:ChangeOneCodeByFrom(card) function M:ChangeOneCodeByFrom(card)
local flower = math.floor(card / 100) local flower = math.floor(card / 100)
local number = card % 100 local number = card % 100
@ -943,13 +940,13 @@ function M:ErrorTip(error_text)
self.cor_init_poker = nil self.cor_init_poker = nil
self.cor_init_poker = self.cor_init_poker =
coroutine.start( coroutine.start(
function() function()
self.put_error_text.text = error_text self.put_error_text.text = error_text
self.ctr_put_error.selectedIndex = 1 self.ctr_put_error.selectedIndex = 1
coroutine.wait(2) coroutine.wait(2)
self.ctr_put_error.selectedIndex = 0 self.ctr_put_error.selectedIndex = 0
end end
) )
end end
--ChunTian_CardType --ChunTian_CardType
@ -969,13 +966,13 @@ end
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist) function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
local tip_list = {} local tip_list = {}
local sidaisan = false local sidaisan = false
local touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} local touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111") --printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
--pt(self.card_list) --pt(self.card_list)
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list) local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
--printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key) --printlog("aaaaaaaaaaaaaaaaaa222222222222222222222222222222222222222 ",max_key)
--pt(card_map) --pt(card_map)
printlog("TIP type:",type) printlog("TIP type:", type)
if type == ChunTian_CardType.None then if type == ChunTian_CardType.None then
if DataManager.CurrenRoom.is_new_bout then if DataManager.CurrenRoom.is_new_bout then
tip_list = self:NewBoutTips(card_map) tip_list = self:NewBoutTips(card_map)
@ -984,10 +981,10 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
elseif type == ChunTian_CardType.Bomb then elseif type == ChunTian_CardType.Bomb then
tip_list, touch_key_list = self:CheckBomb(card_map, number, length) tip_list, touch_key_list = self:CheckBomb(card_map, number, length)
else else
local list_type, list_bomb, list_tuituji = {}, {}, {} local list_type, list_bomb, list_tuituji = {}, {}, {}
local touch_type, touch_bomb, touch_tuituji local touch_type, touch_bomb, touch_tuituji
list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4) list_bomb, touch_bomb = self:CheckBomb(card_map, 0, 4)
local card_templist = membe_clone(self.card_list) local card_templist = membe_clone(self.card_list)
if list_bomb ~= nil and tip_templist == nil then if list_bomb ~= nil and tip_templist == nil then
-- body -- body
@ -1057,7 +1054,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
-- body -- body
sidaisan = true sidaisan = true
end end
elseif type == ChunTian_CardType.TuiTuJI then elseif type == ChunTian_CardType.TuiTuJI then
list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4) list_type, touch_type = self:CheckTuiTuJi(card_map, 0, 4)
@ -1085,8 +1081,6 @@ function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
-- body -- body
tip_list = self:GetMergeAllList(tip_list, tip_templist2) tip_list = self:GetMergeAllList(tip_list, tip_templist2)
end end
end end
if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then if (tip_templist ~= nil and sidaisan == false and #tip_templist >= 1) then
@ -1099,7 +1093,7 @@ end
-- 合并多个list -- 合并多个list
function M:GetMergeAllList(...) function M:GetMergeAllList(...)
local lists = {...} local lists = { ... }
local merge_list = {} local merge_list = {}
for i = 1, #lists do for i = 1, #lists do
local list_item = lists[i] local list_item = lists[i]
@ -1127,13 +1121,13 @@ function M:CheckOneCard(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if k > num and #v == 1 then if k > num and #v == 1 then
one_card_list[#one_card_list + 1] = {v[1]} one_card_list[#one_card_list + 1] = { v[1] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if k > num and #v ~= 1 then if k > num and #v ~= 1 then
one_card_list[#one_card_list + 1] = {v[1]} one_card_list[#one_card_list + 1] = { v[1] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1148,7 +1142,7 @@ function M:CheckOnePair(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取 for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
if #v > 1 and k > num then if #v > 1 and k > num then
one_pair_list[#one_pair_list + 1] = {v[1], v[2]} one_pair_list[#one_pair_list + 1] = { v[1], v[2] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1163,7 +1157,7 @@ function M:CheckThree(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v > 2 and k > num then if #v > 2 and k > num then
three_list[#three_list + 1] = {v[1], v[2], v[3]} three_list[#three_list + 1] = { v[1], v[2], v[3] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1210,8 +1204,8 @@ function M:CheckThreeAndOne(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v >= 3 and k > num then if #v >= 3 and k > num then
three_and_one_list[#three_and_one_list + 1] = {v[1], v[2], v[3]} three_and_one_list[#three_and_one_list + 1] = { v[1], v[2], v[3] }
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
return three_and_one_list, touch_key_list return three_and_one_list, touch_key_list
@ -1225,8 +1219,8 @@ function M:CheckThreeAndTwo(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v >= 3 and k > num then if #v >= 3 and k > num then
three_and_two_list[#three_and_two_list + 1] = {v[1], v[2], v[3]} three_and_two_list[#three_and_two_list + 1] = { v[1], v[2], v[3] }
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
return three_and_two_list, touch_key_list return three_and_two_list, touch_key_list
@ -1343,7 +1337,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
end end
if j == i + pair_length - 1 then if j == i + pair_length - 1 then
plane_list[#plane_list + 1] = item_all_list plane_list[#plane_list + 1] = item_all_list
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
end end
@ -1351,7 +1345,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
end end
function M:SetNotTouchCard(touch_key_list, card_map) function M:SetNotTouchCard(touch_key_list, card_map)
local all_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} local all_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
for i = 1, #all_key_list do for i = 1, #all_key_list do
local key = all_key_list[i] local key = all_key_list[i]
local isExsit = self:IsExistByList(touch_key_list, key) local isExsit = self:IsExistByList(touch_key_list, key)
@ -1394,13 +1388,14 @@ function M:GetCardMapAndMaxKey(pokerList)
max_key = number max_key = number
end end
if map[number] == nil then if map[number] == nil then
map[number] = {pokerList[i]} map[number] = { pokerList[i] }
else else
map[number][#map[number] + 1] = pokerList[i] map[number][#map[number] + 1] = pokerList[i]
end end
end end
return map, max_key return map, max_key
end end
function M:CheckOnes(pokerMap, num, length) function M:CheckOnes(pokerMap, num, length)
local one_card_list = {} local one_card_list = {}
local touch_key_list = {} local touch_key_list = {}
@ -1418,7 +1413,7 @@ function M:CheckOnes(pokerMap, num, length)
for i = 0, length - 1 do for i = 0, length - 1 do
if l == k + i and l ~= 15 and l ~= 16 then if l == k + i and l ~= 15 and l ~= 16 then
-- body -- body
text[#text + 1] = {p[1]} text[#text + 1] = { p[1] }
text2[#text2 + 1] = l text2[#text2 + 1] = l
if #text >= length then if #text >= length then
-- body -- body
@ -1446,6 +1441,7 @@ function M:CheckOnes(pokerMap, num, length)
end end
return one_card_list, touch_key_list, length return one_card_list, touch_key_list, length
end end
function M:Clear() function M:Clear()
self:PlayScore(nil) self:PlayScore(nil)
self:SetOutCardInfo(nil, false) self:SetOutCardInfo(nil, false)
@ -1456,9 +1452,9 @@ function M:Clear()
end end
function M:ClearCheck() function M:ClearCheck()
self.card_list = {} self.card_list = {}
self.out_card_list = {} self.out_card_list = {}
self.cards_view:RemoveChildren(0, -1, true) self.cards_view:RemoveChildren(0, -1, true)
end end
function M:Destroy() function M:Destroy()

View File

@ -1,7 +1,7 @@
local MainRightPanelView = require("Game.View.MainRightPanelView") local MainRightPanelView = require("Game.View.MainRightPanelView")
local ChunTian_RightPanelView = {} local ChunTian_RightPanelView = {}
local M = ChunTian_RightPanelView local M = ChunTian_RightPanelView
local function __init(self,mainView,view) local function __init(self, mainView, view)
local right_panel = view local right_panel = view
local btn_setting = right_panel:GetChild("btn_setting") local btn_setting = right_panel:GetChild("btn_setting")
@ -22,7 +22,7 @@ local function __init(self,mainView,view)
end end
end) end)
else else
print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time) -- print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
if mainView.dismiss_room_cd_time > 0 then if mainView.dismiss_room_cd_time > 0 then
GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!") GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
else else
@ -54,17 +54,18 @@ local function __init(self,mainView,view)
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true) -- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
-- self._timer:Start() -- self._timer:Start()
end end
function ChunTian_RightPanelView.new(mainView,view) function ChunTian_RightPanelView.new(mainView, view)
setmetatable(M, {__index = MainRightPanelView}) setmetatable(M, { __index = MainRightPanelView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ChunTian_RightPanelView" self.class = "ChunTian_RightPanelView"
__init(self,mainView,view) __init(self, mainView, view)
return self return self
end end
function M:__UpdateTime() function M:__UpdateTime()
self._tex_data.text = os.date("%Y-%m-%d") self._tex_data.text = os.date("%Y-%m-%d")
self._tex_time.text = os.date("%H:%M") self._tex_time.text = os.date("%H:%M")
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() self._pb_batteryLevel.value = GameApplication.Instance:GetBatteryLevel()
end end
@ -74,7 +75,7 @@ function M:__UpdateTime()
local ping = _client:getAveragePingTime() local ping = _client:getAveragePingTime()
if not ping then return end if not ping then return end
ping = math.floor(ping / 2) ping = math.floor(ping / 2)
if ping > 300 then ping =300 end if ping > 300 then ping = 300 end
if ping <= 100 then if ping <= 100 then
self.ctr_xh.selectedIndex = 0 self.ctr_xh.selectedIndex = 0
elseif ping <= 300 then elseif ping <= 300 then

View File

@ -18,8 +18,8 @@ local M = ExtendConfig
function ExtendConfig.new() function ExtendConfig.new()
setmetatable(M, {__index = IExtendConfig}) setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "ExtendConfig" self.class = "ExtendConfig"
self.extend_id = 14 self.extend_id = 14
self._viewMap = {} self._viewMap = {}
@ -41,10 +41,10 @@ end
local _gameInfo = nil local _gameInfo = nil
function M:GetGameInfo() function M:GetGameInfo()
if not _gameInfo then if not _gameInfo then
_gameInfo = EXGameInfo.new() _gameInfo = EXGameInfo.new()
end end
return _gameInfo return _gameInfo
end end
local _ctr_game = nil local _ctr_game = nil
@ -59,13 +59,12 @@ function M:NewRoom()
return ChunTian_Room.new() return ChunTian_Room.new()
end end
function M:GetIconUrl() function M:GetIconUrl()
return "ui://Extend_Poker_ChunTian/icon" return "ui://Extend_Poker_ChunTian/icon"
-- --
end end
function M:FillRoomConfig(room,_config) function M:FillRoomConfig(room, _config)
room.room_config = ChunTian_RoomConfig.new(_config) room.room_config = ChunTian_RoomConfig.new(_config)
end end
@ -79,7 +78,7 @@ function M:FillRoomData(s2croom)
local _tableInfo = s2croom["tableInfo"] local _tableInfo = s2croom["tableInfo"]
room.xipaiScore=_tableInfo["xipai_score"] room.xipaiScore = _tableInfo["xipai_score"]
local _config = _tableInfo["config"] local _config = _tableInfo["config"]
room.room_config = ChunTian_RoomConfig.new(_config) room.room_config = ChunTian_RoomConfig.new(_config)
@ -91,7 +90,7 @@ function M:FillRoomData(s2croom)
end end
local playerList = _tableInfo["playerData"] local playerList = _tableInfo["playerData"]
for i = 1,#playerList do for i = 1, #playerList do
local _jp = playerList[i] local _jp = playerList[i]
local p = ChunTian_Player.new() local p = ChunTian_Player.new()
@ -131,7 +130,6 @@ function M:FillRoomData(s2croom)
room.owner_id = owner room.owner_id = owner
room.game_status = 0 room.game_status = 0
if reload then if reload then
local reloadInfo = s2croom["reloadInfo"] local reloadInfo = s2croom["reloadInfo"]
@ -141,10 +139,8 @@ function M:FillRoomData(s2croom)
room.curren_turn_seat = reloadInfo["active_seat"] room.curren_turn_seat = reloadInfo["active_seat"]
local info_list = reloadInfo["info_list"] local info_list = reloadInfo["info_list"]
if playing == true then if playing == true then
room.CurnrenState = StateType.Palying room.CurnrenState = StateType.Palying
room.game_status=1 room.game_status = 1
for i = 1, #info_list do for i = 1, #info_list do
@ -152,7 +148,7 @@ function M:FillRoomData(s2croom)
if p == room.self_player then if p == room.self_player then
p.hand_list = reloadInfo["hand_card"] p.hand_list = reloadInfo["hand_card"]
p.open= reloadInfo["open"] p.open = reloadInfo["open"]
end end
p.hand_count = info_list[i]["card_size"] p.hand_count = info_list[i]["card_size"]
@ -160,17 +156,17 @@ function M:FillRoomData(s2croom)
p.outCards = info_list[i]["outCards"] p.outCards = info_list[i]["outCards"]
local last_outcard = info_list[i]["last_outcard"] local last_outcard = info_list[i]["last_outcard"]
if last_outcard ~= nil and last_outcard[1] ~= 0 then if last_outcard ~= nil and last_outcard[1] ~= 0 then
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true) local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list) local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count) p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
else else
p.out_card_list = {0} p.out_card_list = { 0 }
end end
end end
else else
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111") -- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
--pt(s2croom) --pt(s2croom)
room.game_status=1 room.game_status = 1
room.CurnrenState = StateType.PalyingWait room.CurnrenState = StateType.PalyingWait
@ -185,19 +181,18 @@ function M:FillRoomData(s2croom)
local last_outcard = info_list[i]["last_outcard"] local last_outcard = info_list[i]["last_outcard"]
if last_outcard ~= nil and last_outcard[1] ~= 0 then if last_outcard ~= nil and last_outcard[1] ~= 0 then
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list,true) local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
local card_type,number,length,plan_three_count = _ctr_game:GetCardListInfo(out_card_list) p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list,card_type,number,plan_three_count)
else else
p.out_card_list = {0} p.out_card_list = { 0 }
end end
p.hand_list = info_list[i]["cards"] p.hand_list = info_list[i]["cards"]
p.winscore = info_list[i]["winscore"] p.winscore = info_list[i]["winscore"]
p.hand_count = info_list[i]["card_size"] p.hand_count = info_list[i]["card_size"]
p.thisboomnum=info_list[i]["thisboomnum"] p.thisboomnum = info_list[i]["thisboomnum"]
p.open= info_list[i]["open"] p.open = info_list[i]["open"]
p.handCards = info_list[i]["handCards"] p.handCards = info_list[i]["handCards"]
p.outCards = info_list[i]["outCards"] p.outCards = info_list[i]["outCards"]
@ -208,8 +203,6 @@ function M:FillRoomData(s2croom)
end end
end end
function M:FillPlayBackData(pd_data) function M:FillPlayBackData(pd_data)
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
local _tableInfo = pd_data["info"] local _tableInfo = pd_data["info"]
@ -224,7 +217,7 @@ function M:FillPlayBackData(pd_data)
room.curren_turn_seat = active_seat room.curren_turn_seat = active_seat
room.curren_round = _tableInfo["round"] room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"] local _info_list = _tableInfo["playerData"]
for i = 1,#_info_list do for i = 1, #_info_list do
local _jp = _info_list[i] local _jp = _info_list[i]
local p = ChunTian_Player.new() local p = ChunTian_Player.new()
p.seat = _jp["seat"] p.seat = _jp["seat"]
@ -245,7 +238,7 @@ function M:FillPlayBackData(pd_data)
p.hand_list = _hand_card p.hand_list = _hand_card
p.hand_count = #_hand_card p.hand_count = #_hand_card
p.total_score = _jp["score"] p.total_score = _jp["score"]
p.open= _jp["open"] p.open = _jp["open"]
p.hp_info = _jp["hp_info"] p.hp_info = _jp["hp_info"]
if _jp['hp_info'] then if _jp['hp_info'] then
p.cur_hp = _jp.hp_info.cur_hp p.cur_hp = _jp.hp_info.cur_hp

View File

@ -19,8 +19,8 @@ local MuShi_GameController = {}
local M = MuShi_GameController local M = MuShi_GameController
function M.new() function M.new()
setmetatable(M, {__index = GameController}) setmetatable(M, { __index = GameController })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self:init("木虱") self:init("木虱")
self.class = "MuShi_GameController" self.class = "MuShi_GameController"
return self return self
@ -39,8 +39,8 @@ function M:RegisterEvt()
-- self._eventmap[MuShi_Protocol.MuShi_Options] = self.OnOptions -- self._eventmap[MuShi_Protocol.MuShi_Options] = self.OnOptions
-- self._eventmap[MuShi_Protocol.MuShi_Index_Move] = self.OnIndexMove -- self._eventmap[MuShi_Protocol.MuShi_Index_Move] = self.OnIndexMove
--self._eventmap[MuShi_Protocol.MuShi_Play_Succ] = self.OnPlaySucc --self._eventmap[MuShi_Protocol.MuShi_Play_Succ] = self.OnPlaySucc
self._eventmap[MuShi_Protocol.MuShi_Put_Error] = self.OnPutError self._eventmap[MuShi_Protocol.MuShi_Put_Error] = self.OnPutError
self._eventmap[MuShi_Protocol.MuShi_Pass_Succ] = self.OnPassSucc self._eventmap[MuShi_Protocol.MuShi_Pass_Succ] = self.OnPassSucc
self._eventmap[MuShi_Protocol.MuShi_Result] = self.OnResult self._eventmap[MuShi_Protocol.MuShi_Result] = self.OnResult
self._eventmap[MuShi_Protocol.MuShi_Bomb_Score] = self.OnBombScore self._eventmap[MuShi_Protocol.MuShi_Bomb_Score] = self.OnBombScore
self._eventmap[MuShi_Protocol.MuShi_Piao_Tip] = self.OnPiaoTip 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[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 end
function M:OnExTendPlayerReady(evt_data) function M:OnExTendPlayerReady(evt_data)
@ -110,10 +109,10 @@ function M:SendBuPai(bupai)
_client:send(MuShi_Protocol.MuShi_Send_Piao, _data) _client:send(MuShi_Protocol.MuShi_Send_Piao, _data)
end end
function M:SendCard(cards,currentCard) function M:SendCard(cards, currentCard)
local _data = {} local _data = {}
_data["card"] = cards _data["card"] = cards
_data["all_card"] = currentCard _data["all_card"] = currentCard
local _client = ControllerManager.GameNetClinet local _client = ControllerManager.GameNetClinet
_client:send(MuShi_Protocol.MuShi_Send_Card, _data) _client:send(MuShi_Protocol.MuShi_Send_Card, _data)
end end
@ -141,7 +140,7 @@ function M:ConformToNextGame()
end end
function M:StarQiangZhuang() function M:StarQiangZhuang()
printlog("开始抢庄====================================") printlog("开始抢庄====================================")
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnQiangZhuang) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnQiangZhuang)
@ -150,12 +149,12 @@ function M:StarQiangZhuang()
end end
function M:FinishCuoPai(evt_data) function M:FinishCuoPai(evt_data)
print("上报搓牌返回==================") -- print("上报搓牌返回==================")
local seat = evt_data["seat"] local seat = evt_data["seat"]
local card = evt_data["card"] local card = evt_data["card"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai,seat,card) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnFinishCuoPai, seat, card)
end end
) )
end end
@ -167,7 +166,7 @@ function M:OtherQiangZhuang(evt_data)
local index = evt_data["index"] local index = evt_data["index"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang,seat,index) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnOtherQiangZhuang, seat, index)
end end
) )
end end
@ -179,17 +178,17 @@ function M:DingZhuang(evt_data)
local score = evt_data["score"] local score = evt_data["score"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat,index,score) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnZhuang, seat, index, score)
end end
) )
end end
function M:StarBet(evt_data) function M:StarBet(evt_data)
printlog("开始下注 ====================================",evt_data["seat"]) printlog("开始下注 ====================================", evt_data["seat"])
local seat = evt_data["seat"] local seat = evt_data["seat"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet,seat) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnStarBet, seat)
end end
) )
end end
@ -202,18 +201,18 @@ function M:OtherBet(evt_data)
local score = evt_data["mul"] local score = evt_data["mul"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat,index,score) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnBet, seat, index, score)
end end
) )
end end
function M:TiQianStar(evt_data) function M:TiQianStar(evt_data)
-- printlog("发起提前开始返回1111====================================") -- printlog("发起提前开始返回1111====================================")
local seat = evt_data["seat"] local seat = evt_data["seat"]
local agree = evt_data["agree"] local agree = evt_data["agree"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat,agree) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnTiQian, seat, agree)
end end
) )
end end
@ -224,7 +223,7 @@ function M:OnAgreeGame(evt_data)
local agree = evt_data["agree"] local agree = evt_data["agree"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat,agree) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnAgree, seat, agree)
end end
) )
end end
@ -270,8 +269,8 @@ function M:OnInitCard(evt_data)
--local cardopen = evt_data["cardopen"] --local cardopen = evt_data["cardopen"]
local playerAry = evt_data["playerAry"] local playerAry = evt_data["playerAry"]
-- printlog(#playerAry) -- printlog(#playerAry)
-- pt(playerAry[1]) -- pt(playerAry[1])
local round = playerAry[1].round local round = playerAry[1].round
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
@ -282,7 +281,7 @@ function M:OnInitCard(evt_data)
self._room.curren_round = round self._room.curren_round = round
--self._room.curren_round = round --self._room.curren_round = round
--DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, cardlist,cardtype,seat,cardopen) --DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, cardlist,cardtype,seat,cardopen)
DispatchEvent(self._dispatcher,MuShi_GameEvent.OnInitCard,round,playerAry) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnInitCard, round, playerAry)
end end
) )
end end
@ -314,7 +313,8 @@ function M:OnPlaySucc(evt_data)
player.hand_count = remain player.hand_count = remain
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list) local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count) player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,length) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPlaySucc, player, remain, card_type, number, otherList,
length)
end end
) )
end end
@ -324,7 +324,7 @@ function M:OnPassSucc(evt_data)
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
local p = self._room:GetPlayerBySeat(seat) local p = self._room:GetPlayerBySeat(seat)
p.out_card_list = {0} p.out_card_list = { 0 }
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPassSucc, p)
end end
) )
@ -339,6 +339,7 @@ function M:OnPutError(evt_data)
end end
) )
end end
function M:TuoGuan(isTuo) function M:TuoGuan(isTuo)
local _data = {} local _data = {}
_data["tuoguan"] = isTuo _data["tuoguan"] = isTuo
@ -353,6 +354,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat) DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
end) end)
end end
function M:OnIndexMove(evt_data) function M:OnIndexMove(evt_data)
local seat = evt_data["index"] local seat = evt_data["index"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
@ -389,7 +391,6 @@ function M:OnPiaoTip(evt_data)
--local reload = evt_data["reload"] --local reload = evt_data["reload"]
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoTips)
end end
) )
@ -407,13 +408,13 @@ function M:OnPiaoAction(evt_data)
self._cacheEvent:Enqueue( self._cacheEvent:Enqueue(
function() function()
DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat,piao,card) DispatchEvent(self._dispatcher, MuShi_GameEvent.OnPiaoAction, seat, piao, card)
end end
) )
end end
function M:OnResult(evt_data) function M:OnResult(evt_data)
-- printlog("结算消息==========================》") -- printlog("结算消息==========================》")
--pt(evt_data) --pt(evt_data)
local result_type = evt_data["type"] --0小结算 1 大结算 2 解散房间 local result_type = evt_data["type"] --0小结算 1 大结算 2 解散房间
@ -468,6 +469,7 @@ function M:OnConfrimToNextGameSucc(evt_data)
end end
) )
end end
function M:Game_TuoGuan(evt_data) function M:Game_TuoGuan(evt_data)
local tuoguan = evt_data["tuoguan"] local tuoguan = evt_data["tuoguan"]
local seat = evt_data["seat"] local seat = evt_data["seat"]
@ -475,6 +477,7 @@ function M:Game_TuoGuan(evt_data)
DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat) DispatchEvent(self._dispatcher, MuShi_GameEvent.Game_TuoGuan, tuoguan, seat)
end) end)
end end
function M:ChangeCodeByFrom(cardList, isSort) function M:ChangeCodeByFrom(cardList, isSort)
isSort = isSort or false isSort = isSort or false
local new_card_list = {} local new_card_list = {}
@ -595,7 +598,6 @@ end
--Bomb = 11 --Bomb = 11
-- 牌型,大小, 长度 -- 牌型,大小, 长度
function M:GetCardListInfo(cardlist) function M:GetCardListInfo(cardlist)
if #cardlist == 0 then if #cardlist == 0 then
return 0, 0, 0, 0 return 0, 0, 0, 0
end end
@ -611,14 +613,12 @@ function M:GetCardListInfo(cardlist)
card_num = math.floor(cardlist[1] / 10) card_num = math.floor(cardlist[1] / 10)
elseif #cardlist == 3 then elseif #cardlist == 3 then
card_num = math.floor(cardlist[1] / 10) card_num = math.floor(cardlist[1] / 10)
if card_num==14 and DataManager.CurrenRoom.room_config.threeA==1 then if card_num == 14 and DataManager.CurrenRoom.room_config.threeA == 1 then
-- body -- body
card_type = MuShi_CardType.Bomb card_type = MuShi_CardType.Bomb
else else
card_type = MuShi_CardType.Three card_type = MuShi_CardType.Three
end end
elseif #cardlist == 4 then elseif #cardlist == 4 then
local max_key = 0 local max_key = 0
for k, v in pairs(card_map) do for k, v in pairs(card_map) do
@ -675,9 +675,7 @@ function M:GetCardListInfo(cardlist)
local max_one_key, max_two_key, max_three_key = 0, 0, 0 local max_one_key, max_two_key, max_three_key = 0, 0, 0
for k, v in pairs(card_map) do for k, v in pairs(card_map) do
if #v == 2 then if #v == 2 then
if k > max_two_key then if k > max_two_key then
max_two_key = k max_two_key = k
end end
@ -687,7 +685,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_two_key card_num = max_two_key
end end
elseif #v == 1 then elseif #v == 1 then
if k > max_one_key then if k > max_one_key then
max_one_key = k max_one_key = k
end end
@ -697,7 +694,6 @@ function M:GetCardListInfo(cardlist)
card_num = max_one_key card_num = max_one_key
end end
elseif #v == 3 then elseif #v == 3 then
if max_three_key == 0 then if max_three_key == 0 then
max_three_key = k max_three_key = k
three_count = three_count + 1 three_count = three_count + 1
@ -707,8 +703,8 @@ function M:GetCardListInfo(cardlist)
elseif k < max_three_key and k == max_three_key - 1 then elseif k < max_three_key and k == max_three_key - 1 then
max_three_key = k max_three_key = k
three_count = three_count + 1 three_count = three_count + 1
-- else -- else
-- max_three_key = k -- max_three_key = k
end end
--three_count = three_count + 1 --three_count = three_count + 1
@ -727,24 +723,16 @@ function M:GetCardListInfo(cardlist)
-- end -- end
plan_three_count = three_count plan_three_count = three_count
if three_count * 3 == #cardlist then if three_count * 3 == #cardlist then
card_type = MuShi_CardType.Plane card_type = MuShi_CardType.Plane
card_num = max_three_key card_num = max_three_key
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
elseif three_count * 4 >= #cardlist and #cardlist%4==0 then
card_type = MuShi_CardType.PlaneAndOne card_type = MuShi_CardType.PlaneAndOne
card_num = max_three_key card_num = max_three_key
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
elseif three_count * 5 >= #cardlist and #cardlist%5==0 then
card_type = MuShi_CardType.PlaneAndTwo card_type = MuShi_CardType.PlaneAndTwo
card_num = max_three_key card_num = max_three_key
end end
end end
return card_type, card_num, card_length, plan_three_count return card_type, card_num, card_length, plan_three_count
@ -756,7 +744,7 @@ function M:GetCardMapByList(cardlist)
local card = cardlist[i] local card = cardlist[i]
local card_num = math.floor(cardlist[i] / 10) local card_num = math.floor(cardlist[i] / 10)
if card_map[card_num] == nil then if card_map[card_num] == nil then
card_map[card_num] = {card} card_map[card_num] = { card }
else else
card_map[card_num][#card_map[card_num] + 1] = card card_map[card_num][#card_map[card_num] + 1] = card
end end

View File

@ -29,15 +29,15 @@ local MuShi_Record_Event = {
local default_bg = 1 local default_bg = 1
local bg_config = { local bg_config = {
{id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}, { id = 1, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
{id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'}, { id = 2, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' },
{id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1'} { id = 3, url = 'extend/poker/mushi/bg/bg1', thumb = 'ui://Extend_Poker_MuShi/table_bg1' }
} }
--- Create a new --- Create a new
function M.new() function M.new()
setmetatable(M, {__index = PKPlayBackView}) setmetatable(M, { __index = PKPlayBackView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = 'MuShi_PlayBackView' self.class = 'MuShi_PlayBackView'
self:init() self:init()
@ -51,7 +51,8 @@ function M:InitView(url)
end end
self._gamectr = ControllerManager.GetController(GameController) self._gamectr = ControllerManager.GetController(GameController)
UIPackage.AddPackage('extend/poker/mushi/ui/Extend_Poker_MuShi') UIPackage.AddPackage('extend/poker/mushi/ui/Extend_Poker_MuShi')
PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg, bg_config) PKPlayBackView.InitView(self, 'ui://Extend_Poker_MuShi/MuShi_Main_' .. self._room.room_config.people_num, default_bg,
bg_config)
self._tex_round = self._view:GetChild('round') self._tex_round = self._view:GetChild('round')
self._player_card_info = {} self._player_card_info = {}
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
@ -64,7 +65,7 @@ function M:InitView(url)
self._rightPanelView:Destroy() self._rightPanelView:Destroy()
end end
self._rightPanelView = MuShi_RightPanelView.new(self, rightpanel) self._rightPanelView = MuShi_RightPanelView.new(self, rightpanel)
rightpanel:GetChild("btn_setting").onClick:Clear() rightpanel:GetChild("btn_setting").onClick:Clear()
self._player_info = {} self._player_info = {}
@ -74,7 +75,7 @@ function M:InitView(url)
_player_info[i] = PlayerInfoView.new(tem, self) _player_info[i] = PlayerInfoView.new(tem, self)
end end
local list = self._room.player_list local list = self._room.player_list
for i=1,#list do for i = 1, #list do
local p = list[i] local p = list[i]
local info = _player_info[self:GetPos(p.seat)] local info = _player_info[self:GetPos(p.seat)]
info._view.visible = true info._view.visible = true
@ -111,13 +112,12 @@ function M:InitView(url)
self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong self._cmdmap[MuShi_Record_Event.Evt_Result] = self.Wuyong
self:CuoPai() self:CuoPai()
end end
function M:CuoPai() function M:CuoPai()
self.cuopai = self._view:GetChild("cuopai") self.cuopai = self._view:GetChild("cuopai")
self.cuopai.visible = false self.cuopai.visible = false
-- print("self.btnY ",self.btnY) -- -- print("self.btnY ",self.btnY)
end end
function M:Wuyong() function M:Wuyong()
@ -132,7 +132,7 @@ function M:NewPlayerPokerInfoView(view, index)
end end
function M:FillRoomData(data) function M:FillRoomData(data)
--print("hidezhanji 1111") ---- print("hidezhanji 1111")
self._currentStep = 1 self._currentStep = 1
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
@ -147,11 +147,11 @@ function M:FillRoomData(data)
local head_info = self._player_info[self:GetPos(p.seat)] local head_info = self._player_info[self:GetPos(p.seat)]
if p.total_hp then if p.total_hp then
-- print("hidezhanji 2222") -- -- print("hidezhanji 2222")
head_info._view:GetChild('zhanji').visible=false head_info._view:GetChild('zhanji').visible = false
if room.hpOnOff == 1 or room:checkHpNonnegative() then if room.hpOnOff == 1 or room:checkHpNonnegative() then
head_info._view:GetChild('zhanji').visible=true head_info._view:GetChild('zhanji').visible = true
head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp) head_info._view:GetChild('text_jifen').text = d2ad(p.total_hp)
end end
end end
@ -172,7 +172,7 @@ end
function M:ShowStep(index) function M:ShowStep(index)
local step = self._step[index] local step = self._step[index]
if step==nil then if step == nil then
return return
end end
-- for i = 1, #step.player_card_data do -- for i = 1, #step.player_card_data do
@ -183,18 +183,18 @@ function M:ShowStep(index)
-- end -- end
-- Evt_alertQiangZhuang = 'alertQiangZhuang', -- Evt_alertQiangZhuang = 'alertQiangZhuang',
-- Evt_userQiangZhuang = 'userQiangZhuang', -- Evt_userQiangZhuang = 'userQiangZhuang',
-- Evt_zhuangInfo = 'zhuangInfo', -- Evt_zhuangInfo = 'zhuangInfo',
-- Evt_alertXiaZhu = 'alertXiaZhu', -- Evt_alertXiaZhu = 'alertXiaZhu',
-- Evt_userXiaZhu = 'userXiaZhu', -- Evt_userXiaZhu = 'userXiaZhu',
-- Evt_alertBuPai = 'alertBuPai', -- Evt_alertBuPai = 'alertBuPai',
-- Evt_playerBuPai = 'playerBuPai' -- Evt_playerBuPai = 'playerBuPai'
if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then if step.cmd == MuShi_Record_Event.Evt_alertQiangZhuang then
for _, player in ipairs(self._room.player_list) do for _, player in ipairs(self._room.player_list) do
local player_head = self._player_info[self:GetPos(player.seat)] local player_head = self._player_info[self:GetPos(player.seat)]
player_head:MarkBank(false) player_head:MarkBank(false)
player_head:UpdateFen(-1,0) player_head:UpdateFen(-1, 0)
end end
self._player_card_info[1]:StarQiangZhuang(1) self._player_card_info[1]:StarQiangZhuang(1)
end end
@ -206,7 +206,7 @@ function M:ShowStep(index)
self._player_card_info[1]:StarQiangZhuang(0) self._player_card_info[1]:StarQiangZhuang(0)
end end
local head_info = self._player_info[self:GetPos(seat)] local head_info = self._player_info[self:GetPos(seat)]
head_info:UpdateFen(0,index) head_info:UpdateFen(0, index)
end end
if step.cmd == MuShi_Record_Event.Evt_zhuangInfo then if step.cmd == MuShi_Record_Event.Evt_zhuangInfo then
@ -217,7 +217,7 @@ function M:ShowStep(index)
local player_head = self._player_info[self:GetPos(player.seat)] local player_head = self._player_info[self:GetPos(player.seat)]
player_head:MarkBank(false) player_head:MarkBank(false)
end end
head_info:UpdateFen(1,score) head_info:UpdateFen(1, score)
head_info:MarkBank(true) head_info:MarkBank(true)
end end
@ -232,7 +232,7 @@ function M:ShowStep(index)
local seat = step.seat local seat = step.seat
local index = step.index local index = step.index
local head_info = self._player_info[self:GetPos(seat)] local head_info = self._player_info[self:GetPos(seat)]
head_info:UpdateFen(2,index) head_info:UpdateFen(2, index)
if (seat == self._room.self_player.seat) then if (seat == self._room.self_player.seat) then
self._player_card_info[1]:StarBet(0) self._player_card_info[1]:StarBet(0)
@ -241,7 +241,7 @@ function M:ShowStep(index)
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
local seat = step.seat local seat = step.seat
if(seat == self._room.self_player.seat) then if (seat == self._room.self_player.seat) then
self._player_card_info[1]:ChangeCtrBuPai(1) self._player_card_info[1]:ChangeCtrBuPai(1)
end end
end end
@ -253,7 +253,7 @@ function M:ShowStep(index)
--printlog("补牌================",bupai,card) --printlog("补牌================",bupai,card)
if (bupai == 1) then if (bupai == 1) then
local card_info = self._player_card_info[self:GetPos(seat)] local card_info = self._player_card_info[self:GetPos(seat)]
card_info:AddPoker(card,1) card_info:AddPoker(card, 1)
end end
if self._room.self_player.seat == seat then if self._room.self_player.seat == seat then
local player_card_info = self._player_card_info[1] local player_card_info = self._player_card_info[1]
@ -263,7 +263,7 @@ function M:ShowStep(index)
if step.cmd == MuShi_Record_Event.Evt_alertBuPai then if step.cmd == MuShi_Record_Event.Evt_alertBuPai then
local seat = step.seat local seat = step.seat
if(seat == self._room.self_player.seat) then if (seat == self._room.self_player.seat) then
self._player_card_info[1]:ChangeCtrBuPai(1) self._player_card_info[1]:ChangeCtrBuPai(1)
end end
end end
@ -277,16 +277,15 @@ function M:ShowStep(index)
if step.cmd == MuShi_Record_Event.Evt_result then if step.cmd == MuShi_Record_Event.Evt_result then
local result = step.result local result = step.result
for i = 1,#result do for i = 1, #result do
local seat = result[i].seat local seat = result[i].seat
local cardType = result[i].cardType local cardType = result[i].cardType
local cardPoint = result[i].cardPoint local cardPoint = result[i].cardPoint
local card_info = self._player_card_info[self:GetPos(seat)] local card_info = self._player_card_info[self:GetPos(seat)]
card_info:SetCarType(cardType,cardPoint) card_info:SetCarType(cardType, cardPoint)
end end
end end
end end
function M:GenerateAllStepData(data) function M:GenerateAllStepData(data)
@ -314,14 +313,12 @@ function M:GenerateAllStepData(data)
end end
end end
function M:CmdAlertQiangZhuang(cmd, index) --通知抢庄
function M:CmdAlertQiangZhuang(cmd,index) --通知抢庄
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
end end
function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄 function M:CmdUserQiangZhuang(cmd, index) --玩家抢庄
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
@ -329,7 +326,7 @@ function M:CmdUserQiangZhuang(cmd,index) --玩家抢庄
data.score = cmd.data.score data.score = cmd.data.score
end end
function M:CmdZhuangInfo(cmd,index) --定庄 function M:CmdZhuangInfo(cmd, index) --定庄
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
@ -337,47 +334,45 @@ function M:CmdZhuangInfo(cmd,index) --定庄
data.score = cmd.data.score data.score = cmd.data.score
end end
function M:CmdAlertXiaZhu(cmd,index) --通知下注 function M:CmdAlertXiaZhu(cmd, index) --通知下注
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.data.cmd data.cmd = cmd.data.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
end end
function M:CmdUserXiaZhu(cmd,index) --玩家下注 function M:CmdUserXiaZhu(cmd, index) --玩家下注
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
data.index = cmd.data.index data.index = cmd.data.index
end end
function M:CmdAlertBuPai(cmd,index) --通知补牌 function M:CmdAlertBuPai(cmd, index) --通知补牌
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.data.cmd data.cmd = cmd.data.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
end end
function M:CmdPlayerBuPai(cmd,index) --玩家补牌 function M:CmdPlayerBuPai(cmd, index) --玩家补牌
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.bupai = cmd.data.bupai data.bupai = cmd.data.bupai
data.card = cmd.data.card data.card = cmd.data.card
end end
function M:CmdPlayerSendCards(cmd,index) function M:CmdPlayerSendCards(cmd, index)
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.seat = cmd.data.seat data.seat = cmd.data.seat
data.cards = cmd.data.cards data.cards = cmd.data.cards
end end
function M:CmdResult(cmd,index) function M:CmdResult(cmd, index)
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.result = cmd.data.result data.result = cmd.data.result
end end
function M:CopyLastStep(index) function M:CopyLastStep(index)
local step = {} local step = {}
local last_step = self._step[index] local last_step = self._step[index]

View File

@ -17,7 +17,7 @@ local CardView = {
local function NewCardView(card, cardcodenum, cardcodeflower) local function NewCardView(card, cardcodenum, cardcodeflower)
local self = {} local self = {}
setmetatable(self, {__index = CardView}) setmetatable(self, { __index = CardView })
self.btn_card = card self.btn_card = card
self.card_code_number = cardcodenum self.card_code_number = cardcodenum
self.card_code_flower = cardcodeflower self.card_code_flower = cardcodeflower
@ -38,8 +38,8 @@ local MuShi_PlayerSelfPokerInfoView = {
local M = MuShi_PlayerSelfPokerInfoView local M = MuShi_PlayerSelfPokerInfoView
function M.new(view, mainView) function M.new(view, mainView)
setmetatable(M, {__index = MuShi_PlayerPokerInfoView}) setmetatable(M, { __index = MuShi_PlayerPokerInfoView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
self.gameCtr = ControllerManager.GetController(GameController) self.gameCtr = ControllerManager.GetController(GameController)
@ -81,7 +81,7 @@ function M:init()
self.carType.visible = false self.carType.visible = false
self.carText = self.carType:GetChild("n1") self.carText = self.carType:GetChild("n1")
self.carText.text = "" 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 --card_niao.icon = "ui://Main_Majiang/202_" .. currentNiaoList[i].card
self.btnBuPai = self._view:GetChild("bupai") self.btnBuPai = self._view:GetChild("bupai")
@ -113,8 +113,6 @@ function M:init()
self:BtnEvent() self:BtnEvent()
end end
function M:BtnEvent() function M:BtnEvent()
self.btnBuPai.onClick:Set(function() self.btnBuPai.onClick:Set(function()
--printlog("点击补牌=================================") --printlog("点击补牌=================================")
@ -198,7 +196,7 @@ function M:ChangeCtrBuPai(b)
self.ctr_bupai.selectedIndex = b self.ctr_bupai.selectedIndex = b
end end
function M:InitPoker(pokerList,cardtype,cardopen) function M:InitPoker(pokerList, cardtype, cardopen)
self.cardopen = cardopen self.cardopen = cardopen
for i = 1, #pokerList do for i = 1, #pokerList do
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i]) local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
@ -213,7 +211,7 @@ function M:InitPoker(pokerList,cardtype,cardopen)
for i = 1, #self.card_list do for i = 1, #self.card_list do
local card = self.card_list[i] local card = self.card_list[i]
card.index = 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) --card.btn_card.xy = self:GetHandCardPos(i, #self.card_list)
end end
@ -236,10 +234,8 @@ function M:InitPoker2(pokerList)
end end
end end
function M:AddPoker(poker) function M:AddPoker(poker)
--print("玩家自己加牌===========================================") ---- print("玩家自己加牌===========================================")
local card_number_code = self:ChangeOneCodeByFrom(poker) local card_number_code = self:ChangeOneCodeByFrom(poker)
local card_flower_code = poker local card_flower_code = poker
local btn_card = self:CreatPoker(poker, 1, 0) local btn_card = self:CreatPoker(poker, 1, 0)
@ -260,12 +256,12 @@ function M:GetHandCardPos(index, card_count)
local x, y = 0, -18 local x, y = 0, -18
local offset = 40 local offset = 40
x = offset*index x = offset * index
return Vector2.New(x, y) return Vector2.New(x, y)
end end
function M:ChangeOneCodeByFrom(card) function M:ChangeOneCodeByFrom(card)
if(card > 500) then if (card > 500) then
return card return card
end end
local flower = math.floor(card / 100) local flower = math.floor(card / 100)
@ -283,13 +279,13 @@ function M:ErrorTip(error_text)
self.cor_init_poker = nil self.cor_init_poker = nil
self.cor_init_poker = self.cor_init_poker =
coroutine.start( coroutine.start(
function() function()
self.put_error_text.text = error_text self.put_error_text.text = error_text
self.ctr_put_error.selectedIndex = 1 self.ctr_put_error.selectedIndex = 1
coroutine.wait(2) coroutine.wait(2)
self.ctr_put_error.selectedIndex = 0 self.ctr_put_error.selectedIndex = 0
end end
) )
end end
function M:Clear() function M:Clear()
@ -299,7 +295,7 @@ function M:Clear()
self.out_card_list = {} self.out_card_list = {}
self.cards_view:RemoveChildren(0, -1, true) self.cards_view:RemoveChildren(0, -1, true)
self.carType.visible = false self.carType.visible = false
--self.mask_liangpai:RemoveChildren(0,-1,true) --self.mask_liangpai:RemoveChildren(0,-1,true)
end end
function M:Destroy() function M:Destroy()

View File

@ -168,7 +168,7 @@ function M:FillRoomData(s2croom)
end end
end end
else else
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111") -- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
--pt(s2croom) --pt(s2croom)
room.game_status = 1 room.game_status = 1

Some files were not shown because too many files have changed in this diff Show More