新四人同步

master
罗家炜 2025-04-24 20:33:09 +08:00
parent 1e614133bb
commit 0b4308616f
5 changed files with 92 additions and 79 deletions

View File

@ -160,7 +160,7 @@ function M:UpdateHandCard(getcard, mp)
if self._view_handCardList.numItems > 0 then
self._view_handCardList:RemoveChildren()
end
if self._view_handCardList.numItems > 0 then
if self._view_getCard.numItems > 0 then
self._view_getCard:RemoveChildren()
end
@ -183,7 +183,7 @@ function M:UpdateHandCard(getcard, mp)
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
end
if getcard then

View File

@ -462,16 +462,16 @@ function M:EventInit()
local liuju = result.liuju
local data = result.info_list
local niao = result.niao
if liuju then
local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu")
self._view:AddChild(le)
le:Center()
le:GetTransition("t0"):Play()
coroutine.start(function()
coroutine.wait(1)
le:Dispose()
end)
end
-- if liuju then
-- local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu")
-- self._view:AddChild(le)
-- le:Center()
-- le:GetTransition("t0"):Play()
-- coroutine.start(function()
-- coroutine.wait(1)
-- le:Dispose()
-- end)
-- end
self:RemoveCursor()
if self._clearingView == nil then
self._clearingView = EXClearingView.new(self._root_view)
@ -515,7 +515,7 @@ function M:EventInit()
self._clearingView = nil
end)
end
self._player_card_info[1]:ShowHuTip()
-- self._player_card_info[1]:ShowHuTip()
end)
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)

View File

@ -34,10 +34,9 @@ function M:init()
self._view_handCardList = self._view:GetChild('List_HandCard')
self._view_FZList = self._view:GetChild('List_FZ')
self._view_outCardList = self._view:GetChild('List_OutCard')
self._view_getCard = self._view:GetChild('Btn_HandCard')
self._view_getCard = self._view:GetChild('Comp_HandCard')
self._ctr_getCard = self._view:GetController('getCard')
self._ctr_seletedGet = self._view:GetController('seletedGetCard')
end
function M:SetPlayer(p)
@ -69,15 +68,7 @@ end
function M:Clear()
--self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x
self._area_fz_list.y = self._src_fz_list.y
self._area_fz_list.width = self._src_fz_list.z
self._area_fz_list.height = self._src_fz_list.w
self._area_fz_list:RemoveChildren(0, -1, true)
self._area_handcard_list:RemoveChildren(0, -1, true)
self._area_outcard_list:RemoveChildren(0, -1, true)
self._mask_liangpai:RemoveChildren(0, -1, true)
self._view_handCardList:RemoveChildren(0, -1, true)
self._view_outCardList:RemoveChildren(0, -1, true)
self._view_FZList:RemoveChildren(0, -1, true)
@ -85,7 +76,6 @@ function M:Clear()
self._view_handCardList.selectedIndex = -1
self._click_index = self._view_handCardList.selectedIndex
self._ctr_seletedGet.selectedIndex = 0
end
-- 获取麻将资源前缀
@ -185,10 +175,11 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
cursor = cursor or nil
local outCardName = self._viewText_cardInfo['Out_Card']
local outcard
local outlist = self._player.outcard_list
self._view_outCardList:RemoveChildrenToPool()
for i = 0, #outlist - 1 do
local outcard = self._view_outCardList:AddItemFromPool()
self:fillCard2(outcard, outCardName, outlist[i + 1])
@ -307,67 +298,67 @@ local function replace_card(obj, prefix)
end
function M:ResetCardType()
local old_card_type = self._current_card_type
self._current_card_type = DataManager.CurrenRoom.card_type
-- local old_card_type = self._current_card_type
-- self._current_card_type = DataManager.CurrenRoom.card_type
--设置3d标志
if self._current_card_type == 2 then
local c3d = self._view:GetController('3d')
if c3d ~= nil then
c3d.selectedIndex = 1
-- --设置3d标志
-- if self._current_card_type == 2 then
-- local c3d = self._view:GetController('3d')
-- if c3d ~= nil then
-- c3d.selectedIndex = 1
self._area_fz_list.x = self._src_fz_list_3d.x
self._area_fz_list.y = self._src_fz_list_3d.y
self._area_fz_list.width = self._src_fz_list_3d.z
self._area_fz_list.height = self._src_fz_list_3d.w
end
else
local c3d = self._view:GetController('3d')
if c3d ~= nil then
c3d.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x
self._area_fz_list.y = self._src_fz_list.y
self._area_fz_list.width = self._src_fz_list.z
self._area_fz_list.height = self._src_fz_list.w
end
end
-- self._area_fz_list.x = self._src_fz_list_3d.x
-- self._area_fz_list.y = self._src_fz_list_3d.y
-- self._area_fz_list.width = self._src_fz_list_3d.z
-- self._area_fz_list.height = self._src_fz_list_3d.w
-- end
-- else
-- local c3d = self._view:GetController('3d')
-- if c3d ~= nil then
-- c3d.selectedIndex = 0
-- self._area_fz_list.x = self._src_fz_list.x
-- self._area_fz_list.y = self._src_fz_list.y
-- self._area_fz_list.width = self._src_fz_list.z
-- self._area_fz_list.height = self._src_fz_list.w
-- end
-- end
local change2d = false
if old_card_type == 2 and self._current_card_type ~= 2 then
change2d = true
end
-- local change2d = false
-- if old_card_type == 2 and self._current_card_type ~= 2 then
-- change2d = true
-- end
local change3d = false
if old_card_type ~= 2 and self._current_card_type == 2 then
change3d = true
end
-- local change3d = false
-- if old_card_type ~= 2 and self._current_card_type == 2 then
-- change3d = true
-- end
if change2d == false and change3d == false and self._current_card_type ~= 2 then
local prefix = self:GetPrefix()
-- if change2d == false and change3d == false and self._current_card_type ~= 2 then
-- local prefix = self:GetPrefix()
--更新已出牌
for i = 1, self._area_outcard_list.numChildren do
local obj = self._area_outcard_list:GetChildAt(i - 1)
replace_card(obj, prefix)
end
-- --更新已出牌
-- for i = 1, self._area_outcard_list.numChildren do
-- local obj = self._area_outcard_list:GetChildAt(i - 1)
-- replace_card(obj, prefix)
-- end
--更新手牌
for i = 1, self._area_handcard_list.numChildren do
local obj = self._area_handcard_list:GetChildAt(i - 1)
replace_card(obj, prefix)
end
-- --更新手牌
-- for i = 1, self._area_handcard_list.numChildren do
-- local obj = self._area_handcard_list:GetChildAt(i - 1)
-- replace_card(obj, prefix)
-- end
--更新放子牌
for i = 1, self._area_fz_list.numChildren do
local com = self._area_fz_list:GetChildAt(i - 1)
for j = 1, 4 do
local obj = com:GetChild('card_' .. j)
if obj then
replace_card(obj, prefix)
end
end
end
end
-- --更新放子牌
-- for i = 1, self._area_fz_list.numChildren do
-- local com = self._area_fz_list:GetChildAt(i - 1)
-- for j = 1, 4 do
-- local obj = com:GetChild('card_' .. j)
-- if obj then
-- replace_card(obj, prefix)
-- end
-- end
-- end
-- end
end
return M

View File

@ -36,6 +36,26 @@ end
function M:init()
MJPlayerCardInfoView.init(self)
self._view_getCard = self._view:GetChild('Btn_HandCard')
self._ctr_seletedGet = self._view:GetController('seletedGetCard')
end
function M:ShowHuTip(card_list)
printlog("ShowHuTip")
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
pt(tingList)
if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end
end
end
end
self._mainView._hu_tip:FillData(tingList)
end
function M:UpdateHandCard(getcard, mp)
@ -73,7 +93,7 @@ function M:UpdateHandCard(getcard, mp)
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
end
if getcard then
@ -207,6 +227,8 @@ end
function M:Clear()
MJPlayerCardInfoView.Clear(self)
self._ctr_seletedGet.selectedIndex = 0
end
return M