diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView_jaingxi.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView_jaingxi.lua index b7aea63a..9bd4d0a4 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView_jaingxi.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView_jaingxi.lua @@ -212,6 +212,7 @@ function M:InitPlayerInfoView() end function M:NewMJPlayerCardInfoView(view, index) + print("===============================NewMJPlayerCardInfoView") if index == 1 then return MJPlayerSelfCardInfoView.new(view, self) end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua index 351f8fce..435de4da 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerCardInfoView_jiangxi.lua @@ -116,18 +116,24 @@ end function M:UpdateHandCard(getcard, mp) print("==============================UpdateHandCardlingmeng", self._player.hand_left_count) - MJPlayerCardInfoView.UpdateHandCard(self, getcard, mp) + -- MJPlayerCardInfoView.UpdateHandCard(self, getcard, mp) getcard = getcard 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 - -- local tempCard = UIPackage.CreateObjectFromURL("ui://v0j9abjygi9910w") - -- self._view_handCardList:AddChild(tempCard) if getcard and i == self._player.hand_left_count - 1 then self._ctr_getCard.selectedIndex = 1 else - self._view_handCardList:AddItemFromPool() + if i >= self._view_handCardList.numItems then + self._view_handCardList:AddItemFromPool() + end end end end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua index 44e198be..63deb114 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/MJPlayerSelfCardInfoView_jiangxi.lua @@ -68,10 +68,11 @@ function M:ShowHuTip(card_list) end function M:UpdateHandCard(getcard, mp) - MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) + -- MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) local _carViewList = self._carViewList - - if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then + local card_list = DataManager.CurrenRoom.self_player.card_list + --[[ + if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then for i = 1, #self._carViewList do local obj = self._carViewList[i] if obj and obj.card then @@ -92,7 +93,7 @@ function M:UpdateHandCard(getcard, mp) end end - local card_list = DataManager.CurrenRoom.self_player.card_list + -- self:ShowHuTip(card_list) if getcard then self._out_card = true @@ -141,29 +142,36 @@ function M:UpdateHandCard(getcard, mp) end self._out_card = false end + ]] + -----------------------lingmeng--------------------------- - getcard = getcard or false mp = mp or false 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 local tem_card = card_list[i + 1] local btn_card if getcard and i == (#card_list) - 1 then btn_card = self._viewBtn_getCard - self._ctr_getCard.selectedIndex = 1 btn_card.onClick:Set(function(context) self:__OnClickGetCard(context) end) else - btn_card = self._view_handCardList:AddItemFromPool() - self._ctr_getCard.selectedIndex = 0 + if i >= self._view_handCardList.numItems then + btn_card = self._view_handCardList:AddItemFromPool() + else + btn_card = self._view_handCardList:GetChildAt(i) + end end - self:fillCard2(btn_card, handCardName, tem_card) local c_v = NewCardView(btn_card, tem_card) c_v.index = i @@ -175,6 +183,13 @@ function M:UpdateHandCard(getcard, mp) btn_card.onTouchMove:Set(handler(self, self.onTouchMove)) btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd)) 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:__OnClickHandCard(context) end) diff --git a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua index ff5e64d2..bbfc7933 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua @@ -65,6 +65,7 @@ function M:setHandCardPos(btn_card, i, getcard) end function M:UpdateHandCard(getcard, mp) + print("==========================UpdateHandCardold", getcard, mp) if self.outcard_button then self.outcard_button:Dispose() self.outcard_button = nil