间距调小

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