修复同时弹窗
parent
9c70b6c84c
commit
b3283b922c
|
|
@ -103,7 +103,10 @@ end
|
||||||
function M:OnEventResidueCard(evt_data)
|
function M:OnEventResidueCard(evt_data)
|
||||||
printlog("OnEventResidueCard")
|
printlog("OnEventResidueCard")
|
||||||
pt(evt_data)
|
pt(evt_data)
|
||||||
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard)
|
if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 发送放子选择到服务器
|
-- 发送放子选择到服务器
|
||||||
|
|
|
||||||
|
|
@ -69,20 +69,20 @@ function M:InitView(url)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.showNextCtr = self._view:GetController('showNext')
|
self.showNextCtr = self._view:GetController('showNext')
|
||||||
local showNextList = self._view:GetChild('list_showNext')
|
self.showNextList = self._view:GetChild('list_showNext')
|
||||||
self._view:GetChild('btn_showNext').onClick:Set(function()
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
self:reqResidueCard()
|
self:reqResidueCard()
|
||||||
end)
|
end)
|
||||||
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
self.showNextCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextList.selectedIndex = -1
|
self.showNextList.selectedIndex = -1
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
showNextList.onClickItem:Set(function(context)
|
self.showNextList.onClickItem:Set(function(context)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:SendNextCard(string.sub(context.data.name, -3))
|
_gamectr:SendNextCard(context.data.data.card)
|
||||||
self.showNextCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextList.selectedIndex = -1
|
self.showNextList.selectedIndex = -1
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -553,7 +553,27 @@ function M:EventInit()
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
|
local residueCard = arg[1]
|
||||||
|
local cardMap = {}
|
||||||
|
local cardSet = {}
|
||||||
self.showNextCtr.selectedIndex = 1
|
self.showNextCtr.selectedIndex = 1
|
||||||
|
for i = 1, #residueCard do
|
||||||
|
local cardNum = residueCard[i]
|
||||||
|
if not cardMap[cardNum] then
|
||||||
|
cardMap[cardNum] = 1
|
||||||
|
table.insert(cardSet, cardNum)
|
||||||
|
else
|
||||||
|
cardMap[cardNum] = cardMap[cardNum] + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(cardSet)
|
||||||
|
self.showNextList:SetVirtual()
|
||||||
|
self.showNextList.itemRenderer = function(index, obj)
|
||||||
|
local card = cardSet[index + 1]
|
||||||
|
self:FillShowCards(obj, card, cardMap[card])
|
||||||
|
obj.data = { card = card }
|
||||||
|
end
|
||||||
|
self.showNextList.numItems = #cardSet
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -995,6 +1015,22 @@ function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
self._showNextName = context.data.name
|
self._showNextName = context.data.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:FillShowCards(obj, card, num)
|
||||||
|
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
end
|
||||||
|
if obj.icon then
|
||||||
|
obj.icon = 'ui://Main_Majiang/201_' .. card
|
||||||
|
else
|
||||||
|
obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card
|
||||||
|
end
|
||||||
|
if obj.title then
|
||||||
|
obj.title = string.format("%d张", num)
|
||||||
|
else
|
||||||
|
obj:GetChild("title").text = string.format("%d张", num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue