diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index fcf44781..5512d5cf 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -264,8 +264,9 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - self:PlaySound("FuZhou_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + self:PlaySound("FuZhou_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua index d3532956..248910d5 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua @@ -37,7 +37,7 @@ function M:InitView() UpdateBeat:Add(self.OnUpdate, self) self.HuCardImg = setmetatable(HuCardImg, { __index = self.HuCardImg }) - + self.Sound_path = "extend/majiang/fuzhou/sound/" local centerBox = self._view:GetChild("Comp_ConterBox") self._ctr_cardbox = centerBox:GetController("seat") self._tex_leftTime = centerBox:GetChild("Text_Time") @@ -168,6 +168,28 @@ function M:EventInit() end end) + _gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local player = arg[1] + local witnessPlayerList = self._room.witness_player_list + for i, _player in ipairs(witnessPlayerList) do + if _player.aid == player then + table.remove(witnessPlayerList, i) + break + end + end + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end) + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) local arg = { ... } print("lingmeng witness SendLaiZi") @@ -231,19 +253,14 @@ function M:EventInit() local card = arg[2] local seat = p.seat local info = self._player_card_info[self:GetPos(seat)] - print("lingmeng witness OutCard1", self:GetPos(seat), info) self:RemoveCursor() - print("lingmeng witness OutCard1-2") info:UpdateHandCardWitness(false) - print("lingmeng witness OutCard2") info:UpdateOutCardList(nil, nil, self._cursor) - print("ling 2zhihouq") - -- self:PlaySound("FuZhou_MJ", p.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") - print("ling 2zhihou") + self:PlaySound("FuZhou_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end @@ -311,11 +328,11 @@ function M:EventInit() -- ↓↓↓先排列好特效图片 if HuMsg.type > 2 and HuMsg.type < 32 then - -- local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", - -- ViewUtil.Sex_Chat[player.self_user.sex], - -- "he" .. HuMsg.type) - -- ViewUtil.PlaySound(self.asset_group, sound_name) - self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) + local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", + ViewUtil.Sex_Chat[player.self_user.sex], + "he" .. HuMsg.type) + ViewUtil.PlaySound(self.asset_group, sound_name) + -- self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) local imgList = self.HuCardImg[HuMsg.type] for _, img in pairs(imgList) do local imgPath = "ui://Main_Majiang/" .. img @@ -447,11 +464,6 @@ function M:InitPlayerInfoView() end end -local majiang_asset_path = "base/main_majiang/sound/" -function M:PlayMJSound(path) - ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path) -end - function M:NewMJPlayerCardInfoView(view, index) return MJMainView.NewMJPlayerCardInfoView(self, view, index) --[[ diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index c15e7c37..61d13f44 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -263,8 +263,9 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") +self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua index 9edd1439..9ca493ab 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua @@ -37,7 +37,7 @@ function M:InitView(url) UpdateBeat:Add(self.OnUpdate, self) self.HuCardImg = setmetatable(HuCardImg, { __index = self.HuCardImg }) - + self.Sound_path = "extend/majiang/jinxi/sound/" local centerBox = self._view:GetChild("Comp_ConterBox") self._ctr_cardbox = centerBox:GetController("seat") self._tex_leftTime = centerBox:GetChild("Text_Time") @@ -168,6 +168,28 @@ function M:EventInit() end end) + _gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local player = arg[1] + local witnessPlayerList = self._room.witness_player_list + for i, _player in ipairs(witnessPlayerList) do + if _player.aid == player then + table.remove(witnessPlayerList, i) + break + end + end + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end) + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) local arg = { ... } print("lingmeng witness SendLaiZi") @@ -231,19 +253,14 @@ function M:EventInit() local card = arg[2] local seat = p.seat local info = self._player_card_info[self:GetPos(seat)] - print("lingmeng witness OutCard1", self:GetPos(seat), info) self:RemoveCursor() - print("lingmeng witness OutCard1-2") info:UpdateHandCardWitness(false) - print("lingmeng witness OutCard2") info:UpdateOutCardList(nil, nil, self._cursor) - print("ling 2zhihouq") - --self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) self:PlayMJSound("chupai.mp3") - print("ling 2zhihou") + self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end @@ -311,11 +328,11 @@ function M:EventInit() -- ↓↓↓先排列好特效图片 if HuMsg.type > 2 and HuMsg.type < 32 then - -- local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", - -- ViewUtil.Sex_Chat[player.self_user.sex], - -- "he" .. HuMsg.type) - -- ViewUtil.PlaySound(self.asset_group, sound_name) - self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) + local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", + ViewUtil.Sex_Chat[player.self_user.sex], + "he" .. HuMsg.type) + ViewUtil.PlaySound(self.asset_group, sound_name) + -- self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) local imgList = self.HuCardImg[HuMsg.type] for _, img in pairs(imgList) do local imgPath = "ui://Main_Majiang/" .. img @@ -447,11 +464,6 @@ function M:InitPlayerInfoView() end end -local majiang_asset_path = "base/main_majiang/sound/" -function M:PlayMJSound(path) - ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path) -end - function M:NewMJPlayerCardInfoView(view, index) return MJMainView.NewMJPlayerCardInfoView(self, view, index) --[[ diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua index 35239867..c227cc59 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua @@ -256,6 +256,9 @@ function M:fillResult0(room, peopleNum, result) end huCardBtn.icon = string.format("ui://Main_Majiang/b202_%d", infoList.win_card) + if room.jing == infoList.win_card then + huCardBtn:GetController('jing').selectedIndex = 1 + end huCardBtn.visible = true jiangMaList.visible = true diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 235a6a4c..6f49f338 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -56,6 +56,10 @@ function M:InitView(url) --[[ MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) --]] + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData)) + self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') self._state.onChanged:Add(function() @@ -257,8 +261,9 @@ function M:EventInit() info:UpdateHandCard() local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url) info:UpdateOutCardList(outcard, card, self._cursor) - self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") +self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua index bdcb9084..b46004cb 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua @@ -37,7 +37,7 @@ function M:InitView() UpdateBeat:Add(self.OnUpdate, self) self.HuCardImg = setmetatable(HuCardImg, { __index = self.HuCardImg }) - + self.Sound_path = "extend/majiang/nancheng/sound/" local centerBox = self._view:GetChild("Comp_ConterBox") self._ctr_cardbox = centerBox:GetController("seat") self._tex_leftTime = centerBox:GetChild("Text_Time") @@ -168,6 +168,28 @@ function M:EventInit() end end) + _gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local player = arg[1] + local witnessPlayerList = self._room.witness_player_list + for i, _player in ipairs(witnessPlayerList) do + if _player.aid == player then + table.remove(witnessPlayerList, i) + break + end + end + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end) + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) local arg = { ... } print("lingmeng witness SendLaiZi") @@ -231,19 +253,14 @@ function M:EventInit() local card = arg[2] local seat = p.seat local info = self._player_card_info[self:GetPos(seat)] - print("lingmeng witness OutCard1", self:GetPos(seat), info) self:RemoveCursor() - print("lingmeng witness OutCard1-2") info:UpdateHandCardWitness(false) - print("lingmeng witness OutCard2") info:UpdateOutCardList(nil, nil, self._cursor) - print("ling 2zhihouq") - --self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) - -- self:PlayMJSound("chupai.mp3") - print("ling 2zhihou") + self:PlayMJSound("chupai.mp3") + self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end @@ -311,11 +328,11 @@ function M:EventInit() -- ↓↓↓先排列好特效图片 if HuMsg.type > 2 and HuMsg.type < 32 then - -- local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", - -- ViewUtil.Sex_Chat[player.self_user.sex], - -- "he" .. HuMsg.type) - -- ViewUtil.PlaySound(self.asset_group, sound_name) - self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) + local sound_name = string.format(self.Sound_path .. "%s/%s.mp3", + ViewUtil.Sex_Chat[player.self_user.sex], + "he" .. HuMsg.type) + ViewUtil.PlaySound(self.asset_group, sound_name) + -- self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type) local imgList = self.HuCardImg[HuMsg.type] for _, img in pairs(imgList) do local imgPath = "ui://Main_Majiang/" .. img @@ -447,11 +464,6 @@ function M:InitPlayerInfoView() end end -local majiang_asset_path = "base/main_majiang/sound/" -function M:PlayMJSound(path) - ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path) -end - function M:NewMJPlayerCardInfoView(view, index) return MJMainView.NewMJPlayerCardInfoView(self, view, index) --[[