黎川二人,四人自动布局正式完成
parent
7bf51f5168
commit
b86601898b
|
|
@ -129,15 +129,13 @@ function M:UpdateHandCard(getcard, mp)
|
|||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
|
||||
self._view_handCardList:RemoveChildren()
|
||||
for i = 0, self._player.hand_left_count - 1 do
|
||||
if getcard and i == self._player.hand_left_count - 1 then
|
||||
self._ctr_getCard.selectedIndex = 1
|
||||
else
|
||||
if i >= self._view_handCardList.numItems then
|
||||
-- if i >= self._view_handCardList.numItems then
|
||||
self._view_handCardList:AddItemFromPool()
|
||||
-- end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._ctr_getCard.selectedIndex = getcard and 1 or 0
|
||||
end
|
||||
|
||||
-- 获取麻将图片资源位置,可以在扩展中复写
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
print("lingmenginithand")
|
||||
MJPlayerSelfCardInfoView.init(self)
|
||||
|
||||
local CardInfo = self._view:GetChild('Text_CardInfo')
|
||||
|
|
@ -44,7 +45,7 @@ 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._viewBtn_getCard = self._view:GetChild('Btn_HandCard')
|
||||
self._view_getCard = self._view:GetChild('Btn_HandCard')
|
||||
|
||||
self._ctr_getCard = self._view:GetController('getCard')
|
||||
self._ctr_seletedGet = self._view:GetController('seletedGetCard')
|
||||
|
|
@ -147,41 +148,60 @@ function M:UpdateHandCard(getcard, mp)
|
|||
|
||||
|
||||
-----------------------lingmeng---------------------------
|
||||
print("lingmenghand", getcard)
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
|
||||
local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||
-- if self._view_handCardList.numItems > #card_list - 1 then
|
||||
self._view_handCardList:RemoveChildren()
|
||||
self._view_getCard:RemoveChildren()
|
||||
-- end
|
||||
|
||||
print("lingmenghand1", #card_list)
|
||||
pt(card_list)
|
||||
|
||||
for i = 0, (#card_list) - 1 do
|
||||
local tem_card = card_list[i + 1]
|
||||
local btn_card
|
||||
print("lingmenghand2", i)
|
||||
if getcard and i == (#card_list) - 1 then
|
||||
btn_card = self._viewBtn_getCard
|
||||
btn_card.onClick:Set(function(context)
|
||||
btn_card = self._view_getCard:AddItemFromPool()
|
||||
print("lingmenghand2-1-1")
|
||||
-- btn_card = self._view:GetChild('Btn_HandCard')
|
||||
btn_card.onClick:Add(function(context)
|
||||
self:__OnClickGetCard(context)
|
||||
end)
|
||||
print("lingmenghand2-1-2")
|
||||
print("===================lingmengcuowulail==============")
|
||||
else
|
||||
print("lingmenghand2-2-1")
|
||||
|
||||
-- if i >= self._view_handCardList.numItems then
|
||||
btn_card = self._view_handCardList:AddItemFromPool()
|
||||
-- else
|
||||
-- btn_card = self._view_handCardList:GetChildAt(i)
|
||||
-- end
|
||||
print("lingmenghand2-2-2")
|
||||
end
|
||||
self:fillCard2(btn_card, handCardName, tem_card)
|
||||
print("lingmenghandbuchong", btn_card, handCardName, tem_card)
|
||||
print("lingmenghandbuchong2", btn_card:GetChild("icon"), btn_card:GetChild("icon").url)
|
||||
btn_card.icon = 'ui://Main_Majiang/' .. handCardName .. tem_card
|
||||
-- self:fillCard2(btn_card, handCardName, tem_card)
|
||||
print("lingmenghand2-3")
|
||||
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
|
||||
print("lingmenghand2-4")
|
||||
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))
|
||||
print("lingmenghand2-5")
|
||||
end
|
||||
print("lingmenghand3", getcard, self._ctr_getCard)
|
||||
|
||||
if getcard then
|
||||
self._ctr_getCard.selectedIndex = 1
|
||||
|
|
@ -191,7 +211,7 @@ function M:UpdateHandCard(getcard, mp)
|
|||
self._view_handCardList.onClickItem:Set(function(context)
|
||||
self:__OnClickHandCard(context)
|
||||
end)
|
||||
|
||||
print("lingmenghand4")
|
||||
----------------------------------------------------------
|
||||
end
|
||||
|
||||
|
|
@ -281,7 +301,7 @@ end
|
|||
|
||||
function M:__OnClickHandCard(context)
|
||||
print("=======================lingmengclickhand")
|
||||
self._ctr_seletedGet.selectedIndex = 0
|
||||
self._ctr_seletedGet.selectedIndex = 1
|
||||
local button = context.data
|
||||
-- local _carViewList = self._carViewList
|
||||
-- for i = 1, #_carViewList do
|
||||
|
|
@ -403,10 +423,12 @@ function M:Clear(bskip)
|
|||
self._view_handCardList:RemoveChildren(0, -1, true)
|
||||
self._view_outCardList:RemoveChildren(0, -1, true)
|
||||
self._view_FZList:RemoveChildren(0, -1, true)
|
||||
self._view_getCard:RemoveChildren(0, -1, true)
|
||||
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
self._ctr_seletedGet.selectedIndex = 0
|
||||
|
||||
if bskip == nil or bskip == false then
|
||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -131,7 +131,10 @@ function M:fillCard2(obj, pos_str, card)
|
|||
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||
obj:GetController('jing').selectedIndex = 1
|
||||
end
|
||||
print("lingmenghandfill1")
|
||||
|
||||
obj:GetChild("icon").url = 'ui://Main_Majiang/' .. pos_str .. card
|
||||
print("lingmenghandfill2")
|
||||
end
|
||||
|
||||
function M:getBackCard(card)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue