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