黎川同步其他麻将声音

master
罗家炜 2025-09-09 21:06:16 +08:00
parent e25cf38c56
commit 60ea75868b
7 changed files with 101 additions and 55 deletions

View File

@ -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

View File

@ -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)
--[[

View File

@ -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

View File

@ -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)
--[[

View File

@ -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

View File

@ -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

View File

@ -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)
--[[