金溪同步新二人桌面
parent
77943a6ed9
commit
98865be188
|
|
@ -25,7 +25,11 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi")
|
||||
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)
|
||||
function M:__BuGang(cardInfo, callback)
|
||||
local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_JinXi", "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: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)
|
||||
|
|
@ -75,15 +77,15 @@ function M:SetShowGangZiProcess(currentLaizi1ID, currentLaizi2ID, bugangnum, isS
|
|||
if isShowAnim == nil then isShowAnim = false end
|
||||
|
||||
self:SetGangZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||
self:SetGangZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
-- self:SetGangZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||
self:IsShowGangZi(self.Laizi1Btn, true)
|
||||
self:IsShowGangZi(self.Laizi2Btn, true)
|
||||
-- self:IsShowGangZi(self.Laizi2Btn, true)
|
||||
self.bugangnum.text = "当前 " .. bugangnum .. " 杠"
|
||||
end
|
||||
|
||||
function M:HideAllGangZiCard()
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
-- self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
--self.LaiziBG.visible=false
|
||||
end
|
||||
|
|
@ -97,9 +99,14 @@ 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:InitPlayerInfoView()
|
||||
self._player_info = {}
|
||||
|
|
@ -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,9 +1,14 @@
|
|||
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
||||
local PlayerInfoView_copy = require("Game.View.PlayerInfoView copy")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.new(view, mainView)
|
||||
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
|
||||
|
|
@ -12,10 +17,14 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
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,9 +57,13 @@ function M:UpdateRemainCard(card_num, hide)
|
|||
end
|
||||
|
||||
function M:FillData(player)
|
||||
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()
|
||||
local score = self._player.total_score
|
||||
|
|
|
|||
Loading…
Reference in New Issue