黎川四人手牌四人同步
parent
904f761f7c
commit
b071af8324
|
|
@ -212,6 +212,7 @@ function M:InitPlayerInfoView()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view, index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
|
print("===============================NewMJPlayerCardInfoView")
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view, self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -116,20 +116,26 @@ end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
print("==============================UpdateHandCardlingmeng", self._player.hand_left_count)
|
print("==============================UpdateHandCardlingmeng", self._player.hand_left_count)
|
||||||
MJPlayerCardInfoView.UpdateHandCard(self, getcard, mp)
|
-- MJPlayerCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
|
|
||||||
getcard = getcard or false
|
getcard = getcard or false
|
||||||
mp = mp or false
|
mp = mp or false
|
||||||
|
|
||||||
|
if self._view_handCardList.numItems > self._player.hand_left_count - 1 then
|
||||||
|
for i = 1, self._view_handCardList.numItems - self._player.hand_left_count + 1 do
|
||||||
|
self._view_handCardList:RemoveChildrenToPool()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i = 0, self._player.hand_left_count - 1 do
|
for i = 0, self._player.hand_left_count - 1 do
|
||||||
-- local tempCard = UIPackage.CreateObjectFromURL("ui://v0j9abjygi9910w")
|
|
||||||
-- self._view_handCardList:AddChild(tempCard)
|
|
||||||
if getcard and i == self._player.hand_left_count - 1 then
|
if getcard and i == self._player.hand_left_count - 1 then
|
||||||
self._ctr_getCard.selectedIndex = 1
|
self._ctr_getCard.selectedIndex = 1
|
||||||
else
|
else
|
||||||
|
if i >= self._view_handCardList.numItems then
|
||||||
self._view_handCardList:AddItemFromPool()
|
self._view_handCardList:AddItemFromPool()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取麻将图片资源位置,可以在扩展中复写
|
-- 获取麻将图片资源位置,可以在扩展中复写
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,10 @@ function M:ShowHuTip(card_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
-- MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||||
|
--[[
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i = 1, #self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj = self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
|
|
@ -92,7 +93,7 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
|
||||||
-- self:ShowHuTip(card_list)
|
-- self:ShowHuTip(card_list)
|
||||||
if getcard then
|
if getcard then
|
||||||
self._out_card = true
|
self._out_card = true
|
||||||
|
|
@ -141,29 +142,36 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------lingmeng---------------------------
|
-----------------------lingmeng---------------------------
|
||||||
|
|
||||||
getcard = getcard or false
|
getcard = getcard or false
|
||||||
mp = mp or false
|
mp = mp or false
|
||||||
|
|
||||||
local handCardName = self._viewText_cardInfo['Hand_Card']
|
local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||||
|
if self._view_handCardList.numItems > #card_list - 1 then
|
||||||
|
for i = 1, self._view_handCardList.numItems - #card_list + 1 do
|
||||||
|
self._view_handCardList:RemoveChildrenToPool()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i = 0, (#card_list) - 1 do
|
for i = 0, (#card_list) - 1 do
|
||||||
local tem_card = card_list[i + 1]
|
local tem_card = card_list[i + 1]
|
||||||
local btn_card
|
local btn_card
|
||||||
if getcard and i == (#card_list) - 1 then
|
if getcard and i == (#card_list) - 1 then
|
||||||
btn_card = self._viewBtn_getCard
|
btn_card = self._viewBtn_getCard
|
||||||
self._ctr_getCard.selectedIndex = 1
|
|
||||||
btn_card.onClick:Set(function(context)
|
btn_card.onClick:Set(function(context)
|
||||||
self:__OnClickGetCard(context)
|
self:__OnClickGetCard(context)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
|
if i >= self._view_handCardList.numItems then
|
||||||
btn_card = self._view_handCardList:AddItemFromPool()
|
btn_card = self._view_handCardList:AddItemFromPool()
|
||||||
self._ctr_getCard.selectedIndex = 0
|
else
|
||||||
|
btn_card = self._view_handCardList:GetChildAt(i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:fillCard2(btn_card, handCardName, tem_card)
|
self:fillCard2(btn_card, handCardName, tem_card)
|
||||||
local c_v = NewCardView(btn_card, tem_card)
|
local c_v = NewCardView(btn_card, tem_card)
|
||||||
c_v.index = i
|
c_v.index = i
|
||||||
|
|
@ -175,6 +183,13 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
||||||
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if getcard then
|
||||||
|
self._ctr_getCard.selectedIndex = 1
|
||||||
|
else
|
||||||
|
self._ctr_getCard.selectedIndex = 0
|
||||||
|
end
|
||||||
|
print("lingmengself1", self._ctr_getCard.selectedIndex)
|
||||||
self._view_handCardList.onClickItem:Set(function(context)
|
self._view_handCardList.onClickItem:Set(function(context)
|
||||||
self:__OnClickHandCard(context)
|
self:__OnClickHandCard(context)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ function M:setHandCardPos(btn_card, i, getcard)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
|
print("==========================UpdateHandCardold", getcard, mp)
|
||||||
if self.outcard_button then
|
if self.outcard_button then
|
||||||
self.outcard_button:Dispose()
|
self.outcard_button:Dispose()
|
||||||
self.outcard_button = nil
|
self.outcard_button = nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue