金溪同步新二人桌面
parent
77943a6ed9
commit
98865be188
|
|
@ -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/jinxi/ui/Extend_MJ_JinXi")
|
UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi")
|
||||||
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_JinXi", "Gang_tip_choice")
|
local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_JinXi", "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: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)
|
||||||
|
|
@ -75,15 +77,15 @@ function M:SetShowGangZiProcess(currentLaizi1ID, currentLaizi2ID, bugangnum, isS
|
||||||
if isShowAnim == nil then isShowAnim = false end
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
self:SetGangZiCard(self.Laizi1Btn, currentLaizi1ID)
|
self:SetGangZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
self:SetGangZiCard(self.Laizi2Btn, currentLaizi2ID)
|
-- self:SetGangZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
self:IsShowGangZi(self.Laizi1Btn, true)
|
self:IsShowGangZi(self.Laizi1Btn, true)
|
||||||
self:IsShowGangZi(self.Laizi2Btn, true)
|
-- self:IsShowGangZi(self.Laizi2Btn, true)
|
||||||
self.bugangnum.text = "当前 " .. bugangnum .. " 杠"
|
self.bugangnum.text = "当前 " .. bugangnum .. " 杠"
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:HideAllGangZiCard()
|
function M:HideAllGangZiCard()
|
||||||
self.Laizi1Btn.visible = false
|
self.Laizi1Btn.visible = false
|
||||||
self.Laizi2Btn.visible = false
|
-- self.Laizi2Btn.visible = false
|
||||||
self.selectLaiziBtn.visible = false
|
self.selectLaiziBtn.visible = false
|
||||||
--self.LaiziBG.visible=false
|
--self.LaiziBG.visible=false
|
||||||
end
|
end
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue