间距调小

master
罗家炜 2025-06-20 21:01:40 +08:00
parent f3046eb536
commit 4ecc3ce48e
1 changed files with 99 additions and 103 deletions

View File

@ -23,7 +23,7 @@ local CardView = {
local function NewCardView(card, cardItem, index_X, index_Y)
local self = {}
setmetatable(self, {__index = CardView})
setmetatable(self, { __index = CardView })
self.btn_card = card
self.card_item = cardItem
self.index_X = index_X
@ -42,7 +42,7 @@ local PlayerSelfCardInfoView = {
local M = PlayerSelfCardInfoView
function M.new(view, mainView)
local self = {}
setmetatable(self, {__index = M})
setmetatable(self, { __index = M })
self._view = view
self._mainView = mainView
self:init()
@ -71,7 +71,6 @@ function M:init()
self:BtnEvent()
end
function M:ShwoDaNiao(niao)
self.ctr_niao.selectedIndex = 1
end
@ -83,30 +82,28 @@ end
function M:ShowPiao(piao)
self:UpdateIsOnClick(true)
self.ctr_niao.selectedIndex = piao
-- self:EnableAllPiaoTouch()
-- self:EnableAllPiaoTouch()
end
function M:HidePiao()
self.ctr_niao.selectedIndex = 0
end
function M:BtnEvent()
self.btn_tips = self._view:GetChild('btn_tips')
local function click_niao1(vaule)
local closeNiaoTipsFunc=function ()
local closeNiaoTipsFunc = function()
self.ctr_niao.selectedIndex = 0
end
ControllerManager.GetController(GameController):SendNiao(1,closeNiaoTipsFunc)
ControllerManager.GetController(GameController):SendNiao(1, closeNiaoTipsFunc)
end
local function click_niao0(vaule)
local closeNiaoTipsFunc=function ()
local closeNiaoTipsFunc = function()
self.ctr_niao.selectedIndex = 0
end
ControllerManager.GetController(GameController):SendNiao(0,closeNiaoTipsFunc)
ControllerManager.GetController(GameController):SendNiao(0, closeNiaoTipsFunc)
end
local btn_budaniao = self._view:GetChild("budaniao")
@ -114,17 +111,14 @@ function M:BtnEvent()
local btn_daniao = self._view:GetChild("daniao")
btn_daniao.onClick:Set(click_niao1)
end
function M:EnableAllPiaoTouch()
for i=1,#self.PiaoList do
self.PiaoList[i].touchable=true
for i = 1, #self.PiaoList do
self.PiaoList[i].touchable = true
end
end
function M:SetPlayer(p)
self._player = p
end
@ -145,6 +139,7 @@ end
function M:fillCard(obj, card_type, cards)
end
function M:ShowHuTip(card)
if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then
local x = {}
@ -173,11 +168,10 @@ function M:ShowHuTip(card)
end
end
function M:SetNotPutCard()
local tempNotPutList=DataManager.CurrenRoom.self_player.currentNotPutCardList
if tempNotPutList and #tempNotPutList>0 then
for i=1,#tempNotPutList do
local tempNotPutList = DataManager.CurrenRoom.self_player.currentNotPutCardList
if tempNotPutList and #tempNotPutList > 0 then
for i = 1, #tempNotPutList do
self:UpdateKan(tempNotPutList[i])
end
end
@ -299,8 +293,6 @@ function M:InitHandCard(isPlayAni, index)
self:SetNotPutCard()
end
--更新手牌
function M:UpdateHandCards(list)
self.card_list = {}
@ -399,6 +391,7 @@ function M:ChuPaiTiShi()
self._view:GetController('chupai').selectedIndex = 0
end
end
-- 删手牌
function M:DeleteHandCard(carditem)
local card = nil
@ -441,6 +434,7 @@ function M:DeleteHandCard(carditem)
end
self:UpdateHandCardsPos()
end
--更新手牌的坎
function M:UpdateKan(card)
for i = 1, #self.card_list do
@ -485,6 +479,7 @@ function M:UpdateCardDisplay()
card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3)
end
end
--更新手牌大小
function M:UpdateCardSize()
local CountCards = {}
@ -762,7 +757,7 @@ end
--计算手牌位置
function M:GetHandCardPos(cards_view, cards)
local x, y = 0, 0
local card_width = self.card_width -- 牌的宽度
local card_width = self.card_width - 5 -- 牌的宽度
local middle_x = self._area_handcard_list.width / 2
local start_x = middle_x - (cards / 2 * (card_width))
x = start_x + (card_width) * (cards_view.index_X - 1)
@ -858,6 +853,7 @@ function M:ClearOutCard()
self._area_outcard_list:RemoveChildren(0, -1, true)
-- self._bgview.selectedIndex = 0
end
--出牌
function M:UpdateOutCardList(outcard)
self._area_outcard_list:RemoveChildren(0, -1, true)
@ -887,7 +883,6 @@ function M:PlayingOutCardAnima(card)
if (self._area_outcard_list ~= nil and self._area_outcard_list.numChildren > 0) then
self._area_outcard_list:GetChildAt(0):GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/202_', card)
self._view:GetTransition('t0'):Play()
end
coroutine.start(
function()
@ -906,6 +901,7 @@ function M:getCardItem(card_1, card_2)
return card_1 .. '6_' .. card_2
end
end
--得到设置的牌大小
function M:getCardSize()
if self._room.change_card_size ~= nil then