临时上传

master
罗家炜 2025-04-09 13:53:34 +08:00
parent 966fb9e36b
commit 98e5a0d49a
5 changed files with 71 additions and 65 deletions

View File

@ -295,6 +295,15 @@ function M:UpdateFamilyRoom(fgCtr, id)
local list_gamePlay = self._view:GetChild('list_gamePlay') local list_gamePlay = self._view:GetChild('list_gamePlay')
list_gamePlay:SetVirtual() list_gamePlay:SetVirtual()
local playList = self._group.playList local playList = self._group.playList
--初始化玩法列表,用于房间使用
local playGameInfoTable = {}
for i = 1, #playList do
playGameInfoTable[playList[i].id] = {
gameId = playList[i].gameId,
config = playList[i].config,
name = playList[i].name,
}
end
local roomList = self._group.rooms local roomList = self._group.rooms
print("=========================playList,rooms") print("=========================playList,rooms")
pt(playList) pt(playList)
@ -302,11 +311,12 @@ function M:UpdateFamilyRoom(fgCtr, id)
list_room.itemRenderer = function(index, obj) list_room.itemRenderer = function(index, obj)
if index < #roomList then if index < #roomList then
local newIndex = index + 1 local newIndex = index + 1
-- local config = ExtendManager.GetExtendConfig(roomList[index + 1].pid) local config = ExtendManager.GetExtendConfig(playGameInfoTable[roomList[newIndex].pid].gameId)
-- local mode = config:GetGameInfo() local mode = config:GetGameInfo()
-- local gamePlay = mode:LoadConfigToDetail("这是房间") local gamePlay = mode:LoadConfigToDetail(playGameInfoTable[roomList[newIndex].pid].config)
-- obj:GetChild('Label_gameRule').title = gamePlay obj:GetChild('Label_gameRule').title = gamePlay
obj:GetChild('game_type').text = string.format("房间-%s", roomList[newIndex].id) obj:GetChild('game_type').text = string.format("%s房间-%s", playGameInfoTable[roomList[newIndex].pid].name,
roomList[newIndex].id)
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1 obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1
obj:GetChild('btn_joinGame').onClick:Set(function() obj:GetChild('btn_joinGame').onClick:Set(function()
ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room') ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room')
@ -327,7 +337,8 @@ function M:UpdateFamilyRoom(fgCtr, id)
-- ViewManager.ChangeView(ViewManager.View_Lobby) -- ViewManager.ChangeView(ViewManager.View_Lobby)
return return
else else
ViewManager.ChangeView(ViewManager.View_Main, playList[index + 1].gameId) ViewManager.ChangeView(ViewManager.View_Main, playGameInfoTable[roomList[newIndex].pid]
.gameId)
end end
end, end,
id, id,

View File

@ -185,15 +185,14 @@ function M:LoadConfigData(data)
end end
function M:LoadConfigToDetail(data) function M:LoadConfigToDetail(data)
-- local configData = json.decode(data) local configData = json.decode(data)
-- local returnString = string.format("人数%s人,%s马%s%s%s%s%s%s,%s", configData.maxPlayers, local returnString = string.format("人数%s人,%s马,%s,%s,%s%s,%s", configData.maxPlayers,
-- configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖", configData.shaozhuang and ",有烧庄" or "", configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖",
-- configData.zuoma and ",庄家坐马" or "", configData.zimo and "只能自摸" or "自摸可点炮",
-- configData.zimo and ",只能自摸" or ",自摸可点炮", configData.tuoguan and string.format("%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
-- configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", configData.sanjingjiangma and "三精算奖马" or "三精不算奖马", configData.fengding and ",封顶10炮" or "",
-- configData.jiahu and ",可以假胡" or "", configData.fengding and ",封顶20炮" or "", configData.zikechengshun and "字可成顺" or "字不可成顺")
-- configData.zhuanwan and "大转弯" or "小转弯") return returnString
return data
end end
return M return M

View File

@ -25,11 +25,11 @@ function M:InitView(url)
self._gps_style = 1 self._gps_style = 1
self._full = true self._full = true
UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi") UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi")
if self._room.room_config.people_num == 2 then -- if self._room.room_config.people_num == 2 then
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num) -- MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
else -- else
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2") MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
end -- end
self._hu_tip = HuTipView.new(self) self._hu_tip = HuTipView.new(self)
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人个旧麻将 ' .. room.score_times .. '' self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人个旧麻将 ' .. room.score_times .. ''
@ -99,13 +99,13 @@ function M:IsShowGangZi(btn, isShow)
end end
function M:UpdateRound() function M:UpdateRound()
if self._room.room_config.people_num == 2 then -- if self._room.room_config.people_num == 2 then
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, -- self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
self._room.room_config.round) -- self._room.room_config.round)
else -- else
self._view:GetChild("tex_round1").text = self._room.curren_round self._view:GetChild("tex_round1").text = self._room.curren_round
self._view:GetChild("tex_round2").text = self._room.room_config.round self._view:GetChild("tex_round2").text = self._room.room_config.round
end -- end
end end
function M:InitPlayerInfoView() function M:InitPlayerInfoView()
@ -212,8 +212,7 @@ function M:EventInit()
local arg = { ... } local arg = { ... }
local seat = arg[1] local seat = arg[1]
local card = arg[2] local card = arg[2]
-- self._tex_leftTime.text = arg[3] self._tex_leftTime.text = arg[3]
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3])
-- self:UpdateRoomInfo() -- self:UpdateRoomInfo()
local info = self._player_card_info[self:GetPos(seat)] local info = self._player_card_info[self:GetPos(seat)]
info:UpdateHandCard(true) info:UpdateHandCard(true)
@ -417,7 +416,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
self:UpdateRound() self:UpdateRound()
self._tex_LeftCard.text = "剩余0张牌" self._tex_LeftCard.text = "0"
self._state.selectedIndex = 1 self._state.selectedIndex = 1
self:__PiaoNiaoTip() self:__PiaoNiaoTip()
end) end)
@ -769,7 +768,7 @@ function M:ReloadRoom(bskip)
if bskip == nil or bskip == false then if bskip == nil or bskip == false then
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat)) self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count) self._tex_LeftCard.text = room.left_count
self:UpdateRound() self:UpdateRound()
end end
end end

View File

@ -4,11 +4,11 @@ local PlayerInfoView_copy = require("Game.View.PlayerInfoView copy")
local M = {} local M = {}
function M.new(view, mainView) function M.new(view, mainView)
if mainView._room.room_config.people_num == 2 then -- if mainView._room.room_config.people_num == 2 then
setmetatable(M, { __index = PlayerInfoView_copy }) -- setmetatable(M, { __index = PlayerInfoView_copy })
else -- else
setmetatable(M, { __index = PlayerInfoView }) setmetatable(M, { __index = PlayerInfoView })
end -- end
local self = setmetatable({}, { __index = M }) local self = setmetatable({}, { __index = M })
self._view = view self._view = view
self._main_view = mainView self._main_view = mainView
@ -17,20 +17,20 @@ function M.new(view, mainView)
end end
function M:init() function M:init()
if self._main_view._room.room_config.people_num ~= 2 then -- if self._main_view._room.room_config.people_num ~= 2 then
PlayerInfoView.init(self) PlayerInfoView.init(self)
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1") self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2") self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
self._ct_score = self._view:GetChild("info"):GetController("score") self._ct_score = self._view:GetChild("info"):GetController("score")
else -- else
PlayerInfoView_copy.init(self) -- PlayerInfoView_copy.init(self)
end -- end
end end
function M:ShowInteraction(type,str) function M:ShowInteraction(type, str)
if type == 3 then if type == 3 then
Voice.DownLoad(str, function(clip) Voice.DownLoad(str, function(clip)
if (clip ) then if (clip) then
self:ShowMaskVoice(clip.length) self:ShowMaskVoice(clip.length)
GameApplication.Instance:PlayVoice(clip) GameApplication.Instance:PlayVoice(clip)
end end
@ -39,30 +39,30 @@ function M:ShowInteraction(type,str)
self:SetChat(str) self:SetChat(str)
elseif type == 2 then elseif type == 2 then
local chat_index = tonumber(str) local chat_index = tonumber(str)
self._main_view:PlayChatSound(self._player.self_user.sex,chat_index) self._main_view:PlayChatSound(self._player.self_user.sex, chat_index)
local language, index = self._main_view:GetChatMsgLanguage(chat_index) local language, index = self._main_view:GetChatMsgLanguage(chat_index)
self:SetChat(self._main_view.Fix_Msg_Chat[index]) self:SetChat(self._main_view.Fix_Msg_Chat[index])
elseif type == 1 then elseif type == 1 then
self:SetBiaoqing("ui://Chat/"..str) self:SetBiaoqing("ui://Chat/" .. str)
end end
end end
function M:UpdateRemainCard(card_num, hide) function M:UpdateRemainCard(card_num, hide)
if hide then if hide then
self._view:GetController("show_remain").selectedIndex = 0 self._view:GetController("show_remain").selectedIndex = 0
else else
self._view:GetController("show_remain").selectedIndex = 1 self._view:GetController("show_remain").selectedIndex = 1
end end
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
end end
function M:FillData(player) function M:FillData(player)
if self._main_view._room.room_config.people_num == 2 then -- if self._main_view._room.room_config.people_num == 2 then
PlayerInfoView_copy.FillData(self, player) -- PlayerInfoView_copy.FillData(self, player)
else -- else
PlayerInfoView.FillData(self, player) PlayerInfoView.FillData(self, player)
self:UpdateScore(player.total_score) self:UpdateScore(player.total_score)
end -- end
end end
function M:UpdateScore() function M:UpdateScore()

View File

@ -173,15 +173,12 @@ function M:LoadConfigData(data)
end end
function M:LoadConfigToDetail(data) function M:LoadConfigToDetail(data)
-- local configData = json.decode(data) local configData = json.decode(data)
-- local returnString = string.format("人数%s人,%s马%s%s%s%s%s%s,%s", configData.maxPlayers, local returnString = string.format("人数%s人%s%s,%s", configData.maxPlayers,
-- configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖", configData.shaozhuang and ",有烧庄" or "", configData.zimo and ",只能自摸" or ",自摸可点炮",
-- configData.zuoma and ",庄家坐马" or "", configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
-- configData.zimo and ",只能自摸" or ",自摸可点炮", configData.jingbibo and "有精必博" or "有精可胡")
-- configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管", return returnString
-- configData.jiahu and ",可以假胡" or "", configData.fengding and ",封顶20炮" or "",
-- configData.zhuanwan and "大转弯" or "小转弯")
return data
end end
return M return M