From b071af8324b3241bdfff9a92e0649952f4e66139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Mon, 21 Apr 2025 15:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=8E=E5=B7=9D=E5=9B=9B=E4=BA=BA=E6=89=8B?= =?UTF-8?q?=E7=89=8C=E5=9B=9B=E4=BA=BA=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../majiang/lichuan/EXMainView_jaingxi.lua | 1 + .../lichuan/MJPlayerCardInfoView_jiangxi.lua | 14 +++++--- .../MJPlayerSelfCardInfoView_jiangxi.lua | 33 ++++++++++++++----- .../main/majiang/MJPlayerSelfCardInfoView.lua | 1 + 4 files changed, 36 insertions(+), 13 deletions(-) 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