四人同步二

master
罗家炜 2025-04-22 18:29:09 +08:00
parent f35527cc04
commit 6785ccde59
2 changed files with 35 additions and 52 deletions

View File

@ -152,7 +152,7 @@ function M:UpdateHandCard(getcard, mp)
local handCardName = self._viewText_cardInfo['Hand_Card']
-- if self._view_handCardList.numItems > #card_list - 1 then
self._view_handCardList:RemoveChildrenToPool()
self._view_handCardList:RemoveChildren()
-- end
@ -180,6 +180,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))
end
if getcard then
@ -204,6 +205,7 @@ function M:UpdateOutCardList(outcard, card_item)
local outcard
local outlist = self._player.outcard_list
self._view_outCardList:RemoveChildren()
-- if self._view_outCardList.numItems < #outlist - 1 then
-- for i = 1, #outlist - 1 do
@ -265,22 +267,21 @@ function M:__OnDragEnd(context)
button.xy = self._touchPos
else
-- self._area_handcard_list:AddChildAt(button, card.index)
if self._touchIndex ~= card.index then
local tempPos = self._touchPos
self._touchPos = button.xy
button:TweenMove(tempPos, 0.2)
else
-- if self._touchIndex ~= card.index then
-- local tempPos = self._touchPos
-- self._touchPos = button.xy
-- button:TweenMove(tempPos, 0.2)
-- else
button:TweenMove(self._touchPos, 0.2)
self._touchPos = -1
self._touchIndex = -1
end
-- end
end
end
function M:__OnClickHandCard(context)
print("=======================lingmengclickhand")
self._ctr_seletedGet.selectedIndex = 0
self._click_index = self._view_handCardList.selectedIndex
local button = context.data
-- local _carViewList = self._carViewList
-- for i = 1, #_carViewList do
@ -296,8 +297,31 @@ function M:__OnClickHandCard(context)
self._click_index = self._view_handCardList.selectedIndex
self._ctr_seletedGet.selectedIndex = 0
end
self._click_index = self._view_handCardList.selectedIndex
end
-- function M:__OnClickHandCard(context)
-- print("=======================lingmengclickhand")
-- self._ctr_seletedGet.selectedIndex = 0
-- local button = context.sender
-- -- local _carViewList = self._carViewList
-- -- for i = 1, #_carViewList do
-- -- if (_carViewList[i].card ~= button) then
-- -- _carViewList[i].card.selected = false
-- -- end
-- -- end
-- button.selected = true
-- local _room = DataManager.CurrenRoom
-- if ((Utils.IsDoubleClick(context)) and _room.curren_outcard_seat == _room.self_player.seat) then
-- local card = button.data
-- self._mainView:OutCard(card.card_item)
-- self._view_handCardList.selectedIndex = -1
-- self._click_index = self._view_handCardList.selectedIndex
-- self._ctr_seletedGet.selectedIndex = 0
-- end
-- -- self._click_index = self._view_handCardList.selectedIndex
-- end
function M:__OnClickGetCard(context)
self._view_handCardList.selectedIndex = -1
local button = context.sender

View File

@ -153,47 +153,6 @@ function M:UpdateHandCard(getcard, mp)
_lit:AddChild(mp_card)
end
end
local handCardName = self._viewText_cardInfo['Hand_Card']
if self._view_handCardList.numItems > #cards - 1 then
self._view_handCardList:RemoveChildrenToPool()
end
for i = 0, (#cards) - 1 do
local tem_card = cards[i + 1]
local btn_card
if getcard and i == (#cards) - 1 then
btn_card = self._viewBtn_getCard
btn_card.onClick:Set(function(context)
self:__OnClickGetCard(context)
end)
else
if i >= self._view_handCardList.numItems then
btn_card = self._view_handCardList:AddItemFromPool()
else
btn_card = self._view_handCardList:GetChildAt(i)
end
end
self:fillCard2(btn_card, handCardName, tem_card)
local c_v = NewCardView(btn_card, tem_card)
c_v.index = i
c_v.old_postion = btn_card.xy
_carViewList[#_carViewList + 1] = c_v
btn_card.data = c_v
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
end
if getcard then
self._ctr_getCard.selectedIndex = 1
else
self._ctr_getCard.selectedIndex = 0
end
self._view_handCardList.onClickItem:Set(function(context)
self:__OnClickHandCard(context)
end)
end
function M:onTouchBegin(context)