二人同步黎川
parent
9e830c82b5
commit
3f1b85e49d
|
|
@ -310,10 +310,10 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
list_room.itemRenderer = function(index, obj)
|
||||
if index < #roomList then
|
||||
local newIndex = index + 1
|
||||
-- local config = ExtendManager.GetExtendConfig(playGameInfoTable[roomList[newIndex].pid].gameId)
|
||||
-- local mode = config:GetGameInfo()
|
||||
-- local gamePlay = mode:LoadConfigToDetail(playGameInfoTable[roomList[newIndex].pid].config)
|
||||
-- obj:GetChild('Label_gameRule').title = gamePlay
|
||||
local config = ExtendManager.GetExtendConfig(playGameInfoTable[roomList[newIndex].pid].gameId)
|
||||
local mode = config:GetGameInfo()
|
||||
local gamePlay = mode:LoadConfigToDetail(playGameInfoTable[roomList[newIndex].pid].config)
|
||||
obj:GetChild('Label_gameRule').title = gamePlay
|
||||
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
|
||||
|
|
@ -334,8 +334,6 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
-- ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
return
|
||||
else
|
||||
ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间成功')
|
||||
|
||||
ViewManager.ChangeView(ViewManager.View_Main, playGameInfoTable[roomList[newIndex].pid]
|
||||
.gameId)
|
||||
end
|
||||
|
|
@ -346,10 +344,10 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
|||
end)
|
||||
else
|
||||
local newIndex = index - #roomList + 1
|
||||
-- local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId)
|
||||
-- local mode = config:GetGameInfo()
|
||||
-- local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config)
|
||||
-- obj:GetChild('Label_gameRule').title = gamePlay
|
||||
local config = ExtendManager.GetExtendConfig(playList[newIndex].gameId)
|
||||
local mode = config:GetGameInfo()
|
||||
local gamePlay = mode:LoadConfigToDetail(playList[newIndex].config)
|
||||
obj:GetChild('Label_gameRule').title = gamePlay
|
||||
obj:GetChild('game_type').text = playList[newIndex].name
|
||||
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0
|
||||
obj:GetChild('btn_joinGame').onClick:Set(function()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/fuzhou/ui/Extend_MJ_FuZhou")
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
if self._room.room_config.people_num == 2 then
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||
else
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
end
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
||||
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人个旧麻将 ' .. room.score_times .. '倍'
|
||||
|
|
@ -45,24 +49,22 @@ function M:InitView(url)
|
|||
end
|
||||
end
|
||||
|
||||
function M:__BuGang(card1, card2, callback)
|
||||
local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_FuZhou", "Gang_tip_choice")
|
||||
function M:__BuGang(cardInfo, callback)
|
||||
local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_NanCheng", "Gang_tip_choice")
|
||||
_gang_tip_choice.visible = true
|
||||
|
||||
local gangcard1 = _gang_tip_choice:GetChild("card1")
|
||||
local gangcard2 = _gang_tip_choice:GetChild("card2")
|
||||
|
||||
|
||||
gangcard1.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. card1)
|
||||
gangcard2.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. card2)
|
||||
|
||||
gangcard1.onClick:Add(function()
|
||||
callback(card1)
|
||||
local list_card = _gang_tip_choice:GetChild("list_card")
|
||||
list_card:SetVirtual()
|
||||
list_card.itemRenderer = function(index, obj)
|
||||
obj.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. cardInfo[index + 1])
|
||||
end
|
||||
list_card.numItems = #cardInfo
|
||||
list_card.onClickItem:Set(function(context)
|
||||
local item = context.data
|
||||
local index = list_card:GetChildIndex(item)
|
||||
callback(cardInfo[index + 1])
|
||||
end)
|
||||
|
||||
gangcard2.onClick:Add(function()
|
||||
callback(card2)
|
||||
end)
|
||||
|
||||
_gang_tip_choice.xy = Vector2((self._view.width - _gang_tip_choice.width) / 2,
|
||||
(self._view.height - _gang_tip_choice.height) / 2)
|
||||
|
|
@ -97,8 +99,13 @@ function M:IsShowGangZi(btn, isShow)
|
|||
end
|
||||
|
||||
function M:UpdateRound()
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
if self._room.room_config.people_num == 2 then
|
||||
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
|
||||
self._room.room_config.round)
|
||||
else
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
|
|
@ -141,7 +148,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...)
|
||||
local arg = { ... }
|
||||
self:__BuGang(arg[1], arg[2],
|
||||
self:__BuGang(arg[1],
|
||||
function(id)
|
||||
printlog(id)
|
||||
_gamectr:SendGangCard(id)
|
||||
|
|
@ -206,7 +213,7 @@ function M:EventInit()
|
|||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
self._tex_LeftCard.text = arg[3]
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3])
|
||||
-- self:UpdateRoomInfo()
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
info:UpdateHandCard(true)
|
||||
|
|
@ -367,7 +374,7 @@ function M:EventInit()
|
|||
if _room:checkHpNonnegative() then
|
||||
p.cur_hp = data[i].hp_info.cur_hp
|
||||
end
|
||||
info:UpdateScore()
|
||||
-- info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
|
|
@ -410,7 +417,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
|
||||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self._tex_LeftCard.text = "剩余0张牌"
|
||||
self._state.selectedIndex = 1
|
||||
self:__PiaoNiaoTip()
|
||||
end)
|
||||
|
|
@ -721,7 +728,7 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
info:UpdateHandCard()
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
-- head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
|
|
@ -762,7 +769,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if bskip == nil or bskip == false then
|
||||
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
|
||||
self._tex_LeftCard.text = room.left_count
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count)
|
||||
self:UpdateRound()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
||||
local PlayerInfoView_copy = require("Game.View.PlayerInfoView_copy")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = PlayerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
if mainView._room.room_config.people_num == 2 then
|
||||
setmetatable(M, { __index = PlayerInfoView_copy })
|
||||
else
|
||||
setmetatable(M, { __index = PlayerInfoView })
|
||||
end
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._main_view = mainView
|
||||
self:init()
|
||||
|
|
@ -12,10 +17,14 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
PlayerInfoView.init(self)
|
||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
||||
if self._main_view._room.room_config.people_num ~= 2 then
|
||||
PlayerInfoView.init(self)
|
||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
||||
else
|
||||
PlayerInfoView_copy.init(self)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowInteraction(type,str)
|
||||
|
|
@ -48,8 +57,12 @@ function M:UpdateRemainCard(card_num, hide)
|
|||
end
|
||||
|
||||
function M:FillData(player)
|
||||
PlayerInfoView.FillData(self, player)
|
||||
self:UpdateScore(player.total_score)
|
||||
if self._main_view._room.room_config.people_num == 2 then
|
||||
PlayerInfoView_copy.FillData(self, player)
|
||||
else
|
||||
PlayerInfoView.FillData(self, player)
|
||||
self:UpdateScore(player.total_score)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateScore()
|
||||
|
|
|
|||
|
|
@ -96,8 +96,13 @@ function M:IsShowGangZi(btn, isShow)
|
|||
end
|
||||
|
||||
function M:UpdateRound()
|
||||
if self._room.room_config.people_num == 2 then
|
||||
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
|
||||
self._room.room_config.round)
|
||||
else
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowJing()
|
||||
|
|
@ -220,7 +225,7 @@ function M:EventInit()
|
|||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
-- self._tex_leftTime.text = arg[3]
|
||||
self._tex_LeftCard.text = arg[3]
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3])
|
||||
-- self:UpdateRoomInfo()
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
info:UpdateHandCard(true)
|
||||
|
|
@ -382,7 +387,7 @@ function M:EventInit()
|
|||
if _room:checkHpNonnegative() then
|
||||
p.cur_hp = data[i].hp_info.cur_hp
|
||||
end
|
||||
info:UpdateScore()
|
||||
-- info:UpdateScore()
|
||||
info._view:GetChild("zhanji").visible = true
|
||||
local num = data[i].hp_info.total_hp
|
||||
if num > 0 then
|
||||
|
|
@ -425,7 +430,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
|
||||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self._tex_LeftCard.text = "剩余0张牌"
|
||||
self._state.selectedIndex = 1
|
||||
self:__PiaoNiaoTip()
|
||||
end)
|
||||
|
|
@ -736,7 +741,7 @@ function M:ReloadRoom(bskip)
|
|||
end
|
||||
info:UpdateHandCard()
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
head_info:UpdateScore()
|
||||
-- head_info:UpdateScore()
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = p.total_hp or 0
|
||||
if num > 0 then
|
||||
|
|
@ -777,7 +782,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if bskip == nil or bskip == false then
|
||||
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
|
||||
self._tex_LeftCard.text = room.left_count
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count)
|
||||
self:UpdateRound()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
||||
local PlayerInfoView_copy = require("Game.View.PlayerInfoView_copy")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, {__index = PlayerInfoView})
|
||||
local self = setmetatable({}, {__index = M})
|
||||
if mainView._room.room_config.people_num == 2 then
|
||||
setmetatable(M, { __index = PlayerInfoView_copy })
|
||||
else
|
||||
setmetatable(M, { __index = PlayerInfoView })
|
||||
end
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._main_view = mainView
|
||||
self:init()
|
||||
|
|
@ -12,10 +17,14 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
PlayerInfoView.init(self)
|
||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
||||
if self._main_view._room.room_config.people_num ~= 2 then
|
||||
PlayerInfoView.init(self)
|
||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
||||
else
|
||||
PlayerInfoView_copy.init(self)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowInteraction(type,str)
|
||||
|
|
@ -48,8 +57,12 @@ function M:UpdateRemainCard(card_num, hide)
|
|||
end
|
||||
|
||||
function M:FillData(player)
|
||||
PlayerInfoView.FillData(self, player)
|
||||
self:UpdateScore(player.total_score)
|
||||
if self._main_view._room.room_config.people_num == 2 then
|
||||
PlayerInfoView_copy.FillData(self, player)
|
||||
else
|
||||
PlayerInfoView.FillData(self, player)
|
||||
self:UpdateScore(player.total_score)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateScore()
|
||||
|
|
|
|||
|
|
@ -307,15 +307,9 @@ function M:OnChangeOption(ctype, pay_obj)
|
|||
end
|
||||
|
||||
function M:LoadConfigToDetail(data)
|
||||
-- local configData = json.decode(data)
|
||||
-- local returnString = string.format("人数%s人,%s马%s%s%s%s%s%s,%s", configData.maxPlayers,
|
||||
-- configData.jiangma and string.format("奖%d", configData.jiangma) or "不奖", configData.shaozhuang and ",有烧庄" or "",
|
||||
-- configData.zuoma and ",庄家坐马" or "",
|
||||
-- configData.zimo and ",只能自摸" or ",自摸可点炮",
|
||||
-- configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or "不能托管",
|
||||
-- configData.jiahu and ",可以假胡" or "", configData.fengding and ",封顶20炮" or "",
|
||||
-- configData.zhuanwan and "大转弯" or "小转弯")
|
||||
return data
|
||||
local configData = json.decode(data)
|
||||
local returnString = string.format("人数%s人", configData.maxPlayers)
|
||||
return returnString
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue