其他麻将同步
parent
d70d367fd7
commit
52e48d2217
|
|
@ -237,7 +237,9 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
-- self._left_time = 15
|
if not self._left_time or self._left_time <= 15 then
|
||||||
|
self._left_time = 15
|
||||||
|
end
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
-- if seat == self._room.self_player.seat then
|
-- if seat == self._room.self_player.seat then
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,17 @@ local PlayerInfoView2 = require("Game.View.PlayerInfoView2")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView,flag_witness)
|
||||||
setmetatable(M, { __index = PlayerInfoView2 })
|
setmetatable(M, { __index = PlayerInfoView2 })
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._main_view = mainView
|
self._main_view = mainView
|
||||||
self:init()
|
self:init(flag_witness)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init()
|
function M:init(flag_witness)
|
||||||
PlayerInfoView2.init(self)
|
PlayerInfoView2.init(self,flag_witness)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowInteraction(type, str)
|
function M:ShowInteraction(type, str)
|
||||||
|
|
|
||||||
|
|
@ -156,71 +156,13 @@ end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||||
MainView.EventInit(self)
|
getmetatable(M).__index.EventInit(self)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||||
local _player_info = self._player_info
|
local _player_info = self._player_info
|
||||||
local _gamectr = self._gamectr
|
local _gamectr = self._gamectr
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.PlayerEnter, function(...)
|
|
||||||
self:PlayMJSound("user_enter.mp3")
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local info1 = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info1:FillData(p)
|
|
||||||
info1._view.visible = true
|
|
||||||
|
|
||||||
local info2 = self._player_card_info[self:GetPos(p.seat)]
|
|
||||||
info2:SetPlayer(p)
|
|
||||||
info2:FillData()
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.PlayerLeave, function(...)
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local info1 = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info1._view.visible = false
|
|
||||||
self:PlayMJSound("user_leave.mp3")
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...)
|
|
||||||
self:PlayMJSound("user_enter.mp3")
|
|
||||||
local arg = { ... }
|
|
||||||
local witnessPlayerList = arg[1]
|
|
||||||
self._room.witness_player_list = witnessPlayerList
|
|
||||||
|
|
||||||
local _room = DataManager.CurrenRoom
|
|
||||||
local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players')
|
|
||||||
if viewList_witness.numItems == #_room.witness_player_list then
|
|
||||||
viewList_witness:RefreshVirtualList()
|
|
||||||
else
|
|
||||||
viewList_witness.numItems = #_room.witness_player_list
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...)
|
|
||||||
---- print("刷新托管数据=====")
|
|
||||||
local arg = { ... }
|
|
||||||
local player = arg[1]
|
|
||||||
local witnessPlayerList = self._room.witness_player_list
|
|
||||||
for i, _player in ipairs(witnessPlayerList) do
|
|
||||||
if _player.aid == player then
|
|
||||||
table.remove(witnessPlayerList, i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local _room = DataManager.CurrenRoom
|
|
||||||
local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players')
|
|
||||||
print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems)
|
|
||||||
if viewList_witness.numItems == #_room.witness_player_list then
|
|
||||||
viewList_witness:RefreshVirtualList()
|
|
||||||
else
|
|
||||||
viewList_witness.numItems = #_room.witness_player_list
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
print("lingmeng witness SendLaiZi")
|
print("lingmeng witness SendLaiZi")
|
||||||
|
|
@ -236,67 +178,10 @@ function M:EventInit()
|
||||||
print("lingmeng witness EventBuGang")
|
print("lingmeng witness EventBuGang")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
|
||||||
print("lingmeng witness SendCards")
|
|
||||||
self:ShowJing()
|
|
||||||
if self._clearingView then
|
|
||||||
self._clearingView:Destroy()
|
|
||||||
self._clearingView = nil
|
|
||||||
end
|
|
||||||
self:UpdateRound()
|
|
||||||
self:RemoveCursor()
|
|
||||||
self._state.selectedIndex = 4
|
|
||||||
local list = _room.player_list
|
|
||||||
for i = 1, #list do
|
|
||||||
local p = list[i]
|
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info:FillData(p)
|
|
||||||
info:MarkBank(p.seat == _room.banker_seat)
|
|
||||||
info:Ready(false)
|
|
||||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
|
||||||
card_info:Clear()
|
|
||||||
card_info:UpdateHandCardWitness()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
|
||||||
print("lingmeng witness EventTurn")
|
|
||||||
local arg = { ... }
|
|
||||||
-- self._left_time = 15
|
|
||||||
local seat = arg[1]
|
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
|
||||||
local playerInfo = self._player_info[self:GetPos(seat)]
|
|
||||||
local info = self._player_card_info[self:GetPos(seat)]
|
|
||||||
print("lingmeng hand_left_count", info._player.hand_left_count)
|
|
||||||
info._player.hand_left_count = info._player.hand_left_count + 1
|
|
||||||
info:UpdateHandCardWitness(true)
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
||||||
print("lingmeng witness OutHint")
|
print("lingmeng witness OutHint")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
|
||||||
print("lingmeng witness OutCard")
|
|
||||||
self._left_time = 0
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local card = arg[2]
|
|
||||||
local seat = p.seat
|
|
||||||
local info = self._player_card_info[self:GetPos(seat)]
|
|
||||||
|
|
||||||
self:RemoveCursor()
|
|
||||||
|
|
||||||
info:UpdateHandCardWitness(false)
|
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, nil, self._cursor)
|
|
||||||
self:PlayMJSound("chupai.mp3")
|
|
||||||
self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card))
|
|
||||||
if seat == _room.self_player.seat then
|
|
||||||
_room.curren_outcard_seat = -1
|
|
||||||
end
|
|
||||||
print("ling 2zhihou2")
|
|
||||||
end)
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
print("lingmeng witness GetCard")
|
print("lingmeng witness GetCard")
|
||||||
end)
|
end)
|
||||||
|
|
@ -415,6 +300,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
self:PlayMJSound("end_music.mp3")
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
|
|
@ -438,6 +324,7 @@ function M:EventInit()
|
||||||
-- self:RemoveCursor()
|
-- self:RemoveCursor()
|
||||||
if self._clearingView == nil then
|
if self._clearingView == nil then
|
||||||
self._clearingView = EXClearingView.new(self._root_view)
|
self._clearingView = EXClearingView.new(self._root_view)
|
||||||
|
self._clearingView._view:GetChild('btn_setting').onClick:Set(handler(self,self.ClickSetting))
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
coroutine.wait(0.5)
|
coroutine.wait(0.5)
|
||||||
self._clearingView:Show()
|
self._clearingView:Show()
|
||||||
|
|
@ -448,6 +335,31 @@ function M:EventInit()
|
||||||
if _room.curren_round ~= _room.room_config.round then
|
if _room.curren_round ~= _room.room_config.round then
|
||||||
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
||||||
self._clearingView:InitData(0, _room, result, nil, function(...)
|
self._clearingView:InitData(0, _room, result, nil, function(...)
|
||||||
|
for i = 1, #data do
|
||||||
|
local p = _room:GetPlayerBySeat(data[i].seat)
|
||||||
|
p.total_score = data[i].total_score
|
||||||
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
--card_info:Clear()
|
||||||
|
card_info:ResetCardType()
|
||||||
|
if _room:checkHpNonnegative() then
|
||||||
|
p.cur_hp = data[i].total_score
|
||||||
|
end
|
||||||
|
info:UpdateScore()
|
||||||
|
info._view:GetChild("zhanji").visible = true
|
||||||
|
local num = data[i].total_score
|
||||||
|
if num >= 0 then
|
||||||
|
info._view:GetController("text_color").selectedIndex = 0
|
||||||
|
info._view:GetChild("text_jifen").text = "+" .. num
|
||||||
|
else
|
||||||
|
info._view:GetController("text_color").selectedIndex = 1
|
||||||
|
info._view:GetChild("text_jifen").text = num
|
||||||
|
end
|
||||||
|
|
||||||
|
info._view:GetChild("mask_piao").title = ""
|
||||||
|
info._view:GetController("piao_niao").selectedIndex = 0
|
||||||
|
p.fz_list = {}
|
||||||
|
end
|
||||||
DataManager.CurrenRoom.self_player.card_list = {}
|
DataManager.CurrenRoom.self_player.card_list = {}
|
||||||
self._clearingView = nil
|
self._clearingView = nil
|
||||||
end)
|
end)
|
||||||
|
|
@ -456,7 +368,7 @@ function M:EventInit()
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
||||||
print("lingmeng witness ZPResult2")
|
print("lingmeng witness ZPResult2")
|
||||||
-- self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
|
|
@ -486,6 +398,18 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
print("lingmeng witness EventResidueCard")
|
print("lingmeng witness EventResidueCard")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--替换mianview的事件
|
||||||
|
_gamectr:AddEventListener(
|
||||||
|
GameEvent.PlayerState,
|
||||||
|
function(...)
|
||||||
|
printlog("lingmeng OnEventOnlineState")
|
||||||
|
local arg = { ... }
|
||||||
|
local p = arg[1]
|
||||||
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitPlayerInfoView()
|
function M:InitPlayerInfoView()
|
||||||
|
|
@ -493,7 +417,7 @@ function M:InitPlayerInfoView()
|
||||||
local _player_info = self._player_info
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild(string.format("player_info%d_2", i))
|
local tem = self._view:GetChild(string.format("player_info%d_2", i))
|
||||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
_player_info[i] = PlayerInfoView.new(tem, self,true)
|
||||||
tem.visible = false
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -105,22 +105,21 @@ function M:FillRoomData(s2croom)
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
local outcard_list = tem["outcard_list"]
|
|
||||||
p.outcard_list = outcard_list
|
|
||||||
p.total_score = tem["score"]
|
p.total_score = tem["score"]
|
||||||
p.hand_left_count = tem["card_count"]
|
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
if playing then
|
||||||
for k = 1, #opcard do
|
local outcard_list = tem["outcard_list"]
|
||||||
local op = opcard[k]
|
p.hand_left_count = tem["card_count"]
|
||||||
local fz = {}
|
p.outcard_list = outcard_list
|
||||||
fz.type = op["type"]
|
local opcard = tem["opcard"]
|
||||||
fz.card = op["card"]
|
for k = 1, #opcard do
|
||||||
fz.from_seat = op["from_seat"]
|
local op = opcard[k]
|
||||||
p.fz_list[#p.fz_list + 1] = fz
|
local fz = {}
|
||||||
end
|
fz.type = op["type"]
|
||||||
if not playing and room.curren_round > 0 then
|
fz.card = op["card"]
|
||||||
-- self.GetGameController():PlayerReady()
|
fz.from_seat = op["from_seat"]
|
||||||
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,8 @@ function M:fillResult0(room, peopleNum, result)
|
||||||
print("===============================FZType.Peng", room.jing, fzCardInfo[j].card)
|
print("===============================FZType.Peng", room.jing, fzCardInfo[j].card)
|
||||||
if room.jing == fzCardInfo[j].card then
|
if room.jing == fzCardInfo[j].card then
|
||||||
card:GetController('jing').selectedIndex = 1
|
card:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
card:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fzCardInfo[j].type == FZType.Chi then
|
elseif fzCardInfo[j].type == FZType.Chi then
|
||||||
|
|
@ -200,6 +202,8 @@ function M:fillResult0(room, peopleNum, result)
|
||||||
|
|
||||||
if room.jing == fzCardInfo[j].opcard[l] then
|
if room.jing == fzCardInfo[j].opcard[l] then
|
||||||
card:GetController('jing').selectedIndex = 1
|
card:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
card:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fzCardInfo[j].type == FZType.Gang or fzCardInfo[j].type == FZType.Gang_An or fzCardInfo[j].type == FZType.Gang_Peng then
|
elseif fzCardInfo[j].type == FZType.Gang or fzCardInfo[j].type == FZType.Gang_An or fzCardInfo[j].type == FZType.Gang_Peng then
|
||||||
|
|
@ -214,6 +218,8 @@ function M:fillResult0(room, peopleNum, result)
|
||||||
|
|
||||||
if room.jing == fzCardInfo[j].card then
|
if room.jing == fzCardInfo[j].card then
|
||||||
card:GetController('jing').selectedIndex = 1
|
card:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
card:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -230,6 +236,8 @@ function M:fillResult0(room, peopleNum, result)
|
||||||
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
|
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
|
||||||
if room.jing == infoList.hand_card[index + 1] then
|
if room.jing == infoList.hand_card[index + 1] then
|
||||||
obj:GetController('jing').selectedIndex = 1
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
handCardList.numItems = handInfoNum
|
handCardList.numItems = handInfoNum
|
||||||
|
|
@ -258,6 +266,8 @@ function M:fillResult0(room, peopleNum, result)
|
||||||
huCardBtn.icon = string.format("ui://Main_Majiang/b202_%d", infoList.win_card)
|
huCardBtn.icon = string.format("ui://Main_Majiang/b202_%d", infoList.win_card)
|
||||||
if room.jing == infoList.win_card then
|
if room.jing == infoList.win_card then
|
||||||
huCardBtn:GetController('jing').selectedIndex = 1
|
huCardBtn:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
huCardBtn:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
huCardBtn.visible = true
|
huCardBtn.visible = true
|
||||||
|
|
||||||
|
|
@ -358,6 +368,8 @@ function M:RemindCardRender(data, obj)
|
||||||
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data)
|
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data)
|
||||||
if room.jing == data then
|
if room.jing == data then
|
||||||
obj:GetController('jing').selectedIndex = 1
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,9 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
-- self._left_time = 15
|
if not self._left_time or self._left_time <= 15 then
|
||||||
|
self._left_time = 15
|
||||||
|
end
|
||||||
local seat = arg[1]
|
local seat = arg[1]
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
-- if seat == self._room.self_player.seat then
|
-- if seat == self._room.self_player.seat then
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,17 @@ local PlayerInfoView2 = require("Game.View.PlayerInfoView2")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView,flag_witness)
|
||||||
setmetatable(M, { __index = PlayerInfoView2 })
|
setmetatable(M, { __index = PlayerInfoView2 })
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._main_view = mainView
|
self._main_view = mainView
|
||||||
self:init()
|
self:init(flag_witness)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init()
|
function M:init(flag_witness)
|
||||||
PlayerInfoView2.init(self)
|
PlayerInfoView2.init(self,flag_witness)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowInteraction(type, str)
|
function M:ShowInteraction(type, str)
|
||||||
|
|
|
||||||
|
|
@ -156,72 +156,13 @@ end
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||||
MainView.EventInit(self)
|
getmetatable(M).__index.EventInit(self)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||||
local _player_info = self._player_info
|
local _player_info = self._player_info
|
||||||
local _gamectr = self._gamectr
|
local _gamectr = self._gamectr
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.PlayerEnter, function(...)
|
|
||||||
self:PlayMJSound("user_enter.mp3")
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local info1 = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info1:FillData(p)
|
|
||||||
info1._view.visible = true
|
|
||||||
|
|
||||||
local info2 = self._player_card_info[self:GetPos(p.seat)]
|
|
||||||
info2:SetPlayer(p)
|
|
||||||
info2:FillData()
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.PlayerLeave, function(...)
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local info1 = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info1._view.visible = false
|
|
||||||
self:PlayMJSound("user_leave.mp3")
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...)
|
|
||||||
self:PlayMJSound("user_enter.mp3")
|
|
||||||
local arg = { ... }
|
|
||||||
local witnessPlayerList = arg[1]
|
|
||||||
self._room.witness_player_list = witnessPlayerList
|
|
||||||
|
|
||||||
local _room = DataManager.CurrenRoom
|
|
||||||
local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players')
|
|
||||||
print("linemng tcp", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems)
|
|
||||||
if viewList_witness.numItems == #_room.witness_player_list then
|
|
||||||
viewList_witness:RefreshVirtualList()
|
|
||||||
else
|
|
||||||
viewList_witness.numItems = #_room.witness_player_list
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...)
|
|
||||||
---- print("刷新托管数据=====")
|
|
||||||
local arg = { ... }
|
|
||||||
local player = arg[1]
|
|
||||||
local witnessPlayerList = self._room.witness_player_list
|
|
||||||
for i, _player in ipairs(witnessPlayerList) do
|
|
||||||
if _player.aid == player then
|
|
||||||
table.remove(witnessPlayerList, i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local _room = DataManager.CurrenRoom
|
|
||||||
local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players')
|
|
||||||
print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems)
|
|
||||||
if viewList_witness.numItems == #_room.witness_player_list then
|
|
||||||
viewList_witness:RefreshVirtualList()
|
|
||||||
else
|
|
||||||
viewList_witness.numItems = #_room.witness_player_list
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
print("lingmeng witness SendLaiZi")
|
print("lingmeng witness SendLaiZi")
|
||||||
|
|
@ -237,67 +178,10 @@ function M:EventInit()
|
||||||
print("lingmeng witness EventBuGang")
|
print("lingmeng witness EventBuGang")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
|
||||||
print("lingmeng witness SendCards")
|
|
||||||
-- self:ShowJing()
|
|
||||||
if self._clearingView then
|
|
||||||
self._clearingView:Destroy()
|
|
||||||
self._clearingView = nil
|
|
||||||
end
|
|
||||||
self:UpdateRound()
|
|
||||||
self:RemoveCursor()
|
|
||||||
self._state.selectedIndex = 4
|
|
||||||
local list = _room.player_list
|
|
||||||
for i = 1, #list do
|
|
||||||
local p = list[i]
|
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
|
||||||
info:FillData(p)
|
|
||||||
info:MarkBank(p.seat == _room.banker_seat)
|
|
||||||
info:Ready(false)
|
|
||||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
|
||||||
card_info:Clear()
|
|
||||||
card_info:UpdateHandCardWitness()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
|
||||||
print("lingmeng witness EventTurn")
|
|
||||||
local arg = { ... }
|
|
||||||
-- self._left_time = 15
|
|
||||||
local seat = arg[1]
|
|
||||||
self:UpdateCardBox(self:GetPos(seat))
|
|
||||||
local playerInfo = self._player_info[self:GetPos(seat)]
|
|
||||||
local info = self._player_card_info[self:GetPos(seat)]
|
|
||||||
print("lingmeng hand_left_count", info._player.hand_left_count)
|
|
||||||
info._player.hand_left_count = info._player.hand_left_count + 1
|
|
||||||
info:UpdateHandCardWitness(true)
|
|
||||||
end)
|
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
||||||
print("lingmeng witness OutHint")
|
print("lingmeng witness OutHint")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
|
||||||
print("lingmeng witness OutCard")
|
|
||||||
self._left_time = 0
|
|
||||||
local arg = { ... }
|
|
||||||
local p = arg[1]
|
|
||||||
local card = arg[2]
|
|
||||||
local seat = p.seat
|
|
||||||
local info = self._player_card_info[self:GetPos(seat)]
|
|
||||||
|
|
||||||
self:RemoveCursor()
|
|
||||||
|
|
||||||
info:UpdateHandCardWitness(false)
|
|
||||||
|
|
||||||
info:UpdateOutCardList(nil, nil, self._cursor)
|
|
||||||
self:PlayMJSound("chupai.mp3")
|
|
||||||
self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card))
|
|
||||||
if seat == _room.self_player.seat then
|
|
||||||
_room.curren_outcard_seat = -1
|
|
||||||
end
|
|
||||||
print("ling 2zhihou2")
|
|
||||||
end)
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
print("lingmeng witness GetCard")
|
print("lingmeng witness GetCard")
|
||||||
end)
|
end)
|
||||||
|
|
@ -416,6 +300,7 @@ function M:EventInit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
self:PlayMJSound("end_music.mp3")
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
|
|
@ -439,6 +324,7 @@ function M:EventInit()
|
||||||
-- self:RemoveCursor()
|
-- self:RemoveCursor()
|
||||||
if self._clearingView == nil then
|
if self._clearingView == nil then
|
||||||
self._clearingView = EXClearingView.new(self._root_view)
|
self._clearingView = EXClearingView.new(self._root_view)
|
||||||
|
self._clearingView._view:GetChild('btn_setting').onClick:Set(handler(self,self.ClickSetting))
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
coroutine.wait(0.5)
|
coroutine.wait(0.5)
|
||||||
self._clearingView:Show()
|
self._clearingView:Show()
|
||||||
|
|
@ -449,6 +335,31 @@ function M:EventInit()
|
||||||
if _room.curren_round ~= _room.room_config.round then
|
if _room.curren_round ~= _room.room_config.round then
|
||||||
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
||||||
self._clearingView:InitData(0, _room, result, nil, function(...)
|
self._clearingView:InitData(0, _room, result, nil, function(...)
|
||||||
|
for i = 1, #data do
|
||||||
|
local p = _room:GetPlayerBySeat(data[i].seat)
|
||||||
|
p.total_score = data[i].total_score
|
||||||
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
--card_info:Clear()
|
||||||
|
card_info:ResetCardType()
|
||||||
|
if _room:checkHpNonnegative() then
|
||||||
|
p.cur_hp = data[i].total_score
|
||||||
|
end
|
||||||
|
info:UpdateScore()
|
||||||
|
info._view:GetChild("zhanji").visible = true
|
||||||
|
local num = data[i].total_score
|
||||||
|
if num >= 0 then
|
||||||
|
info._view:GetController("text_color").selectedIndex = 0
|
||||||
|
info._view:GetChild("text_jifen").text = "+" .. num
|
||||||
|
else
|
||||||
|
info._view:GetController("text_color").selectedIndex = 1
|
||||||
|
info._view:GetChild("text_jifen").text = num
|
||||||
|
end
|
||||||
|
|
||||||
|
info._view:GetChild("mask_piao").title = ""
|
||||||
|
info._view:GetController("piao_niao").selectedIndex = 0
|
||||||
|
p.fz_list = {}
|
||||||
|
end
|
||||||
DataManager.CurrenRoom.self_player.card_list = {}
|
DataManager.CurrenRoom.self_player.card_list = {}
|
||||||
self._clearingView = nil
|
self._clearingView = nil
|
||||||
end)
|
end)
|
||||||
|
|
@ -457,7 +368,7 @@ function M:EventInit()
|
||||||
|
|
||||||
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
||||||
print("lingmeng witness ZPResult2")
|
print("lingmeng witness ZPResult2")
|
||||||
-- self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self:UpdateCardBox(0)
|
self:UpdateCardBox(0)
|
||||||
self._ctr_cardbox.selectedIndex = 0
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
|
|
@ -487,6 +398,18 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
print("lingmeng witness EventResidueCard")
|
print("lingmeng witness EventResidueCard")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--替换mianview的事件
|
||||||
|
_gamectr:AddEventListener(
|
||||||
|
GameEvent.PlayerState,
|
||||||
|
function(...)
|
||||||
|
printlog("lingmeng OnEventOnlineState")
|
||||||
|
local arg = { ... }
|
||||||
|
local p = arg[1]
|
||||||
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitPlayerInfoView()
|
function M:InitPlayerInfoView()
|
||||||
|
|
@ -494,7 +417,7 @@ function M:InitPlayerInfoView()
|
||||||
local _player_info = self._player_info
|
local _player_info = self._player_info
|
||||||
for i = 1, self._room.room_config.people_num do
|
for i = 1, self._room.room_config.people_num do
|
||||||
local tem = self._view:GetChild(string.format("player_info%d_2", i))
|
local tem = self._view:GetChild(string.format("player_info%d_2", i))
|
||||||
_player_info[i] = PlayerInfoView.new(tem, self)
|
_player_info[i] = PlayerInfoView.new(tem, self,true)
|
||||||
tem.visible = false
|
tem.visible = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -101,22 +101,21 @@ function M:FillRoomData(s2croom)
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
local outcard_list = tem["outcard_list"]
|
|
||||||
p.outcard_list = outcard_list
|
|
||||||
p.total_score = tem["score"]
|
p.total_score = tem["score"]
|
||||||
p.hand_left_count = tem["card_count"]
|
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
if playing then
|
||||||
for k = 1, #opcard do
|
local outcard_list = tem["outcard_list"]
|
||||||
local op = opcard[k]
|
p.hand_left_count = tem["card_count"]
|
||||||
local fz = {}
|
p.outcard_list = outcard_list
|
||||||
fz.type = op["type"]
|
local opcard = tem["opcard"]
|
||||||
fz.card = op["card"]
|
for k = 1, #opcard do
|
||||||
fz.from_seat = op["from_seat"]
|
local op = opcard[k]
|
||||||
p.fz_list[#p.fz_list + 1] = fz
|
local fz = {}
|
||||||
end
|
fz.type = op["type"]
|
||||||
if not playing and room.curren_round > 0 then
|
fz.card = op["card"]
|
||||||
-- self.GetGameController():PlayerReady()
|
fz.from_seat = op["from_seat"]
|
||||||
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue