南城使用新二人对战页面,初始hp移动到邀请人时触发
parent
b97e76dd92
commit
b5fb6912da
|
|
@ -282,19 +282,6 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
|||
else
|
||||
list_familyNumber.itemRenderer = function(index, obj)
|
||||
obj:GetChild('text_name').text = members[index + 1].nick
|
||||
if self._lev ~= 3 then
|
||||
if members[index + 1].hp < 777777000 then
|
||||
fgCtr:FG_ChangeFag(group_id, members[index + 1].uid, members[index + 1].hp + 777777000,
|
||||
function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
|
||||
else
|
||||
ViewUtil.CloseModalWait('join_room')
|
||||
ViewUtil.ErrorMsg(self._root_view, res.ReturnCode, '默认分配积分失败')
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
list_familyNumber.numItems = res.Data.member_num
|
||||
return 1
|
||||
|
|
@ -506,7 +493,21 @@ function M:JoinRoom(roomId)
|
|||
-- ViewUtil.ShowBannerOnScreenCenter("加入房间回调")
|
||||
-- end)
|
||||
--先换成邀请玩家
|
||||
fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function()
|
||||
fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function(res)
|
||||
if (res.ReturnCode == 0) then
|
||||
ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1)
|
||||
fgCtr:FG_ChangeFag(self._group.id, tonumber(roomId), 777777000,
|
||||
function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
ViewUtil.ShowBannerOnScreenCenter('分配默认积分成功!', 1)
|
||||
else
|
||||
ViewUtil.ErrorMsg(self._root_view, res.ReturnCode, '默认分配积分失败')
|
||||
end
|
||||
end)
|
||||
else
|
||||
ViewUtil.ErrorTip(res.ReturnCode, '邀请玩家失败!')
|
||||
end
|
||||
|
||||
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num1, false,
|
||||
1)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,11 @@ function M:UpdateRemainCard(card_num, hide)
|
|||
end
|
||||
|
||||
function M:FillData(player)
|
||||
PlayerInfoView.FillData(self, player)
|
||||
if self._main_view._room.room_config.people_num == 2 then
|
||||
PlayerInfoView_copy.FillData(self, player)
|
||||
else
|
||||
PlayerInfoView.FillData(self, player)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@ function M:InitView(url)
|
|||
self._gps_style = 1
|
||||
self._full = true
|
||||
UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng")
|
||||
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 .. '倍'
|
||||
|
|
@ -95,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()
|
||||
|
|
@ -204,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)
|
||||
|
|
@ -365,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
|
||||
|
|
@ -408,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)
|
||||
|
|
@ -719,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
|
||||
|
|
@ -760,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,16 +17,20 @@ 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)
|
||||
function M:ShowInteraction(type, str)
|
||||
if type == 3 then
|
||||
Voice.DownLoad(str, function(clip)
|
||||
if (clip ) then
|
||||
if (clip) then
|
||||
self:ShowMaskVoice(clip.length)
|
||||
GameApplication.Instance:PlayVoice(clip)
|
||||
end
|
||||
|
|
@ -30,26 +39,30 @@ function M:ShowInteraction(type,str)
|
|||
self:SetChat(str)
|
||||
elseif type == 2 then
|
||||
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)
|
||||
self:SetChat(self._main_view.Fix_Msg_Chat[index])
|
||||
elseif type == 1 then
|
||||
self:SetBiaoqing("ui://Chat/"..str)
|
||||
self:SetBiaoqing("ui://Chat/" .. str)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateRemainCard(card_num, hide)
|
||||
if hide then
|
||||
self._view:GetController("show_remain").selectedIndex = 0
|
||||
self._view:GetController("show_remain").selectedIndex = 0
|
||||
else
|
||||
self._view:GetController("show_remain").selectedIndex = 1
|
||||
self._view:GetController("show_remain").selectedIndex = 1
|
||||
end
|
||||
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
|
||||
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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue