master
罗家炜 2025-04-30 23:12:21 +08:00
parent 910d7508ec
commit 96963a0d18
15 changed files with 128 additions and 40 deletions

View File

@ -14,7 +14,7 @@ end
local _LocalConfigAllGame = { local _LocalConfigAllGame = {
10, 33, 10, 33,
90, -- 90,
66, 86, 87, 88, 89 66, 86, 87, 88, 89
} }

View File

@ -75,7 +75,6 @@ function M:UpdateHandCard(getcard, mp)
getcard = getcard or false getcard = getcard or false
mp = mp or false mp = mp or false
local handCardName = self._viewText_cardInfo['Hand_Card']
if self._view_handCardList.numItems > 0 then if self._view_handCardList.numItems > 0 then
self._view_handCardList:RemoveChildren() self._view_handCardList:RemoveChildren()
@ -95,14 +94,7 @@ function M:UpdateHandCard(getcard, mp)
else else
btn_card = self._view_handCardList:AddItemFromPool() btn_card = self._view_handCardList:AddItemFromPool()
end end
self:fillCard2(btn_card, handCardName, tem_card) self:FillHandCard(i, btn_card, tem_card)
local c_v = NewCardView(btn_card, tem_card)
c_v.index = i
c_v.old_postion = btn_card.xy
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))
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard)) -- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
end end
@ -116,15 +108,29 @@ function M:UpdateHandCard(getcard, mp)
end) end)
end end
function M:FillHandCard(i, btn_card, tem_card)
local handCardName = self._viewText_cardInfo['Hand_Card']
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
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
function M:onTouchBegin(context) function M:onTouchBegin(context)
local button = context.sender local button = context.sender
self._touchPos = button.xy self._touchPos = button.xy
local card = button.data local card = button.data
self._touchIndex = card.index self._touchIndex = card.index
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) local xy_event = Vector2.New(context.inputEvent.x, context.inputEvent.y)
card.touch_pos = xy - button.xy
card.touch_pos = Vector2.New(button.width / 2, button.height / 2)
if self.__OnDragStart then if self.__OnDragStart then
self:__OnDragStart(card.card_item) self:__OnDragStart(button, xy_event)
end end
end end
@ -132,7 +138,28 @@ function M:onTouchMove(context)
local button = context.sender local button = context.sender
local card = button.data local card = button.data
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) local xy = GRoot.inst:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
button.xy = xy - card.touch_pos
end
function M:__OnDragStart(button, xy_event)
local card = button.data
--复制一个按钮
local btn_card = self._view_handCardList:GetFromPool("")
print("__OnDragStart", btn_card)
self:FillHandCard(card.index, btn_card, card.card_item)
btn_card:GetController('move').selectedIndex = 1
local xy = GRoot.inst:GlobalToLocal(xy_event)
--将虚影按钮替换移动的按钮
GRoot.inst:AddChild(button)
-- GRoot.inst:BringToFront(button)
self._view_handCardList:AddChildAt(btn_card, card.index)
print("__OnDragStart1", btn_card, card.index)
self._view_handCardList.selectedIndex = card.index
button.xy = xy - card.touch_pos button.xy = xy - card.touch_pos
end end
@ -143,26 +170,84 @@ 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
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
local buttonHeight = button.height
local temp_button = self._view_handCardList:GetChildAt(card.index)
if (xy.y < 0 - buttonHeight 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
self.outcard_button = button self.outcard_button = button
button.xy = self._touchPos self._notMove = true
else else
if self._touchIndex ~= card.index then -- xy = self._view_handCardList:GetChildAt(0):GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
-- local tempPos = self._touchPos -- local xy_btnCard = self._view_getCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
-- self._touchPos = button.xy -- if xy.x > 0 then
-- button:TweenMove(tempPos, 0.2) -- print("lingmeng__OnDragEnd1")
else -- if xy_btnCard.x > 0 then
button:TweenMove(self._touchPos, 0.2) -- coroutine.start(function()
self._touchPos = -1 -- print("lingmeng__OnDragEnd2")
self._touchIndex = -1 -- local card = card
end -- local temp_button = temp_button
-- local move_button = self._view_getCard:GetChildAt(0)
-- local move_button_xy = self._view_handCardList:GlobalToLocal(self._view_getCard:LocalToGlobal(
-- Vector2.New(move_button.xy.x, move_button.xy.y)))
-- local temp_button_xy = self._view_getCard:GlobalToLocal(self._view_handCardList:LocalToGlobal(
-- Vector2.New(temp_button.xy.x, temp_button.xy.y)))
-- move_button:TweenMove(temp_button_xy, 0.3)
-- temp_button:TweenMove(move_button_xy, 0.3)
-- coroutine.wait(0.3)
-- self._view_handCardList:RemoveChildAt(card.index)
-- self._view_getCard:RemoveChildren()
-- self._view_getCard:AddChild(temp_button)
-- temp_button.xy = Vector2.New(0, 0)
-- move_button.data.index = card.index
-- self._view_handCardList:AddChildAt(move_button, card.index)
-- coroutine.wait(0.1)
-- self._notMove = true
-- end
-- )
-- else
-- local cardIndex = math.floor(xy.x / (buttonWidth + listGrap))
-- cardIndex = cardIndex >= self._view_handCardList.numItems and self._view_handCardList.numItems - 1 or
-- cardIndex
-- if cardIndex ~= card.index then
-- coroutine.start(function()
-- print("lingmeng__OnDragEnd2")
-- local card = card
-- local cardIndex = cardIndex
-- local temp_button = temp_button
-- local move_button = self._view_handCardList:GetChildAt(cardIndex)
-- local move_button_xy = move_button.xy
-- move_button:TweenMove(temp_button.xy, 0.3)
-- temp_button:TweenMove(move_button_xy, 0.3)
-- coroutine.wait(0.3)
-- self._view_handCardList:RemoveChildAt(card.index)
-- cardIndex = cardIndex > card.index and cardIndex - 1 or cardIndex
-- self._view_handCardList:RemoveChildAt(cardIndex)
-- temp_button.data.index = cardIndex
-- self._view_handCardList:AddChildAt(temp_button, cardIndex)
-- move_button.data.index = card.index
-- self._view_handCardList:AddChildAt(move_button, card.index)
-- coroutine.wait(0.1)
-- self._notMove = true
-- end
-- )
-- else
-- self._notMove = true
-- end
-- end
-- end
temp_button:GetController('move').selectedIndex = 0
button:Dispose()
end end
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
self._ctr_seletedGet.selectedIndex = 1 self._ctr_seletedGet.selectedIndex = 1
self._flag_seletedGet = 0
local button = context.data local button = context.data
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
@ -176,17 +261,20 @@ function M:__OnClickHandCard(context)
self._click_index = self._view_handCardList.selectedIndex self._click_index = self._view_handCardList.selectedIndex
end end
function M:__OnClickGetCard(context) function M:__OnClickGetCard(context, flag)
self._view_handCardList.selectedIndex = -1 self._view_handCardList.selectedIndex = -1
local button = context.sender local button = context.sender
local _room = DataManager.CurrenRoom local _room = DataManager.CurrenRoom
if ((Utils.IsDoubleClick(context) or self._ctr_seletedGet.selectedIndex == 0) and _room.curren_outcard_seat == _room.self_player.seat) then if ((Utils.IsDoubleClick(context) or self._flag_seletedGet == 1) and _room.curren_outcard_seat == _room.self_player.seat) then
local card = button.data local card = button.data
self._mainView:OutCard(card.card_item) self._mainView:OutCard(card.card_item)
self._view_handCardList.selectedIndex = -1 self._view_handCardList.selectedIndex = -1
self._click_index = self._view_handCardList.selectedIndex self._click_index = self._view_handCardList.selectedIndex
self._ctr_seletedGet.selectedIndex = 1 self._ctr_seletedGet.selectedIndex = 1
self._flag_seletedGet = 0
return
end end
self._flag_seletedGet = 1
end end
-- function M:UpdateFzList(fz, index, show_card) -- function M:UpdateFzList(fz, index, show_card)

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0 ambisonic: 0
3D: 1 3D: 1
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -3,5 +3,5 @@ guid: 4b618ab93186a8847819d82d0c80a2f3
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/6fce2e2af078662cc293ba2dc0119788
assetBundleVariant: assetBundleVariant:

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/181288c5e34f6e4bb4ee4e6ec786c57d
assetBundleVariant: assetBundleVariant:

View File

@ -3,5 +3,5 @@ guid: 3f81bf2b173f7084a9432868eaadd9fd
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName: extend/poker/suoha/181288c5e34f6e4bb4ee4e6ec786c57d
assetBundleVariant: assetBundleVariant: