2025-04-01 10:48:36 +08:00
|
|
|
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
|
|
|
|
local MJPlayerCardInfoView = import(".MJPlayerCardInfoView")
|
|
|
|
|
local MJMainView = require("main.majiang.MJMainView")
|
|
|
|
|
local CS_ClearingView = import(".EXClearingView")
|
|
|
|
|
local CS_GameEvent = import(".CS_GameEvent")
|
|
|
|
|
local PlayerInfoView = import(".EXPlayerInfoView")
|
|
|
|
|
local HuTipView = import("main.majiang.HuTipView")
|
|
|
|
|
local SettingView = import("main.majiang.MJSettingViewNew")
|
|
|
|
|
|
|
|
|
|
-- local Fix_Msg_Chat = {
|
|
|
|
|
-- "你真棒!",
|
|
|
|
|
-- "快点出牌咯",
|
|
|
|
|
-- "神仙怕左手",
|
|
|
|
|
-- "这个吃得好",
|
|
|
|
|
-- "天灵灵 地灵灵 来支好牌行不行",
|
|
|
|
|
-- "我一听牌你就自摸",
|
|
|
|
|
-- "做了一天的最佳炮手",
|
|
|
|
|
-- "摸了一天的烂牌",
|
|
|
|
|
-- "不要走 决战到天亮",
|
|
|
|
|
-- "大家小心 我马上自摸",
|
|
|
|
|
-- "上家是冤家 放个牌吃行不行",
|
|
|
|
|
-- "冲动是魔鬼 犹豫也是",
|
|
|
|
|
-- "这局我糊了 请大家吃饭",
|
|
|
|
|
-- "这牌来得有点着急 简直让人疯狂",
|
|
|
|
|
-- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
--- Create a new CS_MainView
|
|
|
|
|
function M.new()
|
2025-04-11 12:49:08 +08:00
|
|
|
setmetatable(M, { __index = MJMainView })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
self.class = "CS_MainView"
|
|
|
|
|
self.asset_group = "ChangSha_MJ"
|
|
|
|
|
self:init()
|
|
|
|
|
ViewUtil.PlayMuisc(self.asset_group, "extend/majiang/changsha/sound/bg.mp3")
|
|
|
|
|
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:InitView(url)
|
|
|
|
|
local room = self._room
|
2025-04-02 19:03:26 +08:00
|
|
|
self._style = 1
|
|
|
|
|
self._gps_style = 1
|
|
|
|
|
self._full = true
|
2025-04-01 10:48:36 +08:00
|
|
|
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
2025-04-10 11:19:20 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
2025-04-11 12:49:08 +08:00
|
|
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
2025-04-07 19:37:37 +08:00
|
|
|
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人长麻 ' .. room.score_times .. '倍'
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
self.LaiziBG = self._view:GetChild('n103')
|
|
|
|
|
self.LaiziBG.text = "鬼牌"
|
|
|
|
|
self.LaiziBG.visible = false
|
|
|
|
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
2025-04-07 19:37:37 +08:00
|
|
|
-- self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
|
|
|
|
-- self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
|
|
|
|
-- self.Laizi1Btn.visible = false
|
|
|
|
|
-- self.Laizi2Btn.visible = false
|
2025-04-02 19:03:26 +08:00
|
|
|
self.selectLaiziBtn.visible = false
|
|
|
|
|
|
|
|
|
|
self._hu_tip = HuTipView.new(self)
|
2025-04-01 10:48:36 +08:00
|
|
|
self:PlayerChangeLineState()
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
---- print("CS_MainView")
|
2025-04-02 19:03:26 +08:00
|
|
|
if (room.playing or room.curren_round > 0) or room.status == 1 then
|
2025-04-01 10:48:36 +08:00
|
|
|
self:ReloadRoom()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
function M:NewMJPlayerCardInfoView(view, index)
|
|
|
|
|
if index == 1 then
|
|
|
|
|
return MJPlayerSelfCardInfoView.new(view, self)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
return MJPlayerCardInfoView.new(view, self)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:EventInit()
|
|
|
|
|
MainView.EventInit(self)
|
|
|
|
|
local _room = self._room
|
|
|
|
|
local _view = self._view
|
|
|
|
|
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
|
|
|
|
local _player_info = self._player_info
|
|
|
|
|
local _gamectr = self._gamectr
|
2025-04-02 19:03:26 +08:00
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventXiPai, function(...)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
local currentPlayer1 = arg[1]
|
|
|
|
|
local currentPlayer2 = arg[2]
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = false
|
2025-04-02 19:03:26 +08:00
|
|
|
if (currentPlayer1) then
|
|
|
|
|
local xipaiCB = function()
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = true
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
self:PlayXiPai(xipaiCB)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentPlayer2) then
|
2025-04-01 10:48:36 +08:00
|
|
|
--self._popEvent = false
|
2025-04-02 19:03:26 +08:00
|
|
|
local xipaiCB2 = function()
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = true
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
self:PlayXiPai1(xipaiCB2)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
2025-04-11 12:49:08 +08:00
|
|
|
_gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
|
|
|
|
|
local arg = { ... }
|
2025-04-10 11:19:20 +08:00
|
|
|
self._tex_LeftCard.text = arg[1]
|
2025-04-01 10:48:36 +08:00
|
|
|
local info = self._player_card_info[1]
|
|
|
|
|
info._player.auto_out_card = false
|
|
|
|
|
self:UpdateRound()
|
|
|
|
|
self._state.selectedIndex = 1
|
|
|
|
|
local list = _room.player_list
|
2025-04-02 19:03:26 +08:00
|
|
|
for i = 1, #list do
|
2025-04-01 10:48:36 +08:00
|
|
|
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)]
|
2025-04-02 19:03:26 +08:00
|
|
|
card_info:UpdateHandCard()
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventTurn, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
self._left_time = 15
|
|
|
|
|
local seat = arg[1]
|
|
|
|
|
self:UpdateCardBox(self:GetPos(seat))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.OutHint, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local auto = arg[1].auto
|
|
|
|
|
if auto then
|
|
|
|
|
local p = self._room.self_player
|
|
|
|
|
local my_info = self._player_card_info[1]
|
|
|
|
|
if not my_info._player then info._player = {} end
|
|
|
|
|
my_info._player.auto_out_card = true
|
|
|
|
|
-- coroutine.start(function()
|
|
|
|
|
-- coroutine.wait(0.5)
|
|
|
|
|
-- self:OutCard(p.card_list[#p.card_list])
|
|
|
|
|
-- end)
|
|
|
|
|
end
|
|
|
|
|
_room.curren_outcard_seat = _room.self_player.seat
|
|
|
|
|
--printlog("OutHint===>>>",_room.curren_outcard_seat)
|
|
|
|
|
local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
|
|
|
|
|
info:UpdateHandCard(true)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
2025-04-01 10:48:36 +08:00
|
|
|
_gamectr:AddEventListener(CS_GameEvent.OutCard, function(...)
|
|
|
|
|
self:__CloseTip()
|
|
|
|
|
self:ClearQSHTips()
|
|
|
|
|
self._left_time = 0
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local p = arg[1]
|
|
|
|
|
local seat = p.seat
|
|
|
|
|
local card = arg[2]
|
|
|
|
|
local info = self._player_card_info[self:GetPos(seat)]
|
|
|
|
|
self:RemoveCursor()
|
|
|
|
|
info:UpdateHandCard()
|
2025-04-02 19:03:26 +08:00
|
|
|
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
|
|
|
|
info:UpdateOutCardList(outcard, card, self._cursor)
|
|
|
|
|
self:PlaySound(p.self_user.sex, tostring(card))
|
2025-04-01 10:48:36 +08:00
|
|
|
self:PlayMJSound("chupai.mp3")
|
|
|
|
|
if seat == _room.self_player.seat then
|
|
|
|
|
_room.curren_outcard_seat = -1
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.GetCard, function(...)
|
|
|
|
|
self:__CloseTip()
|
|
|
|
|
if self.kg_card then
|
|
|
|
|
self.kg_card:Dispose()
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local seat = arg[1]
|
|
|
|
|
local card = arg[2]
|
2025-04-10 11:19:20 +08:00
|
|
|
self._tex_LeftCard.text = arg[3]
|
2025-04-01 10:48:36 +08:00
|
|
|
-- self:UpdateRoomInfo()
|
|
|
|
|
local info = self._player_card_info[self:GetPos(seat)]
|
|
|
|
|
info:UpdateHandCard(true)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.FZTips, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local _tip = arg[1]
|
2025-04-02 19:03:26 +08:00
|
|
|
self:__FangziTip(_tip)
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
_gamectr:AddEventListener(CS_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.ZPHuCard, function(...)
|
|
|
|
|
if self.kg_card then
|
|
|
|
|
self.kg_card:Dispose()
|
|
|
|
|
end
|
|
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
|
|
|
|
self:__CloseTip()
|
|
|
|
|
self._popEvent = false
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local win_seat = arg[1]
|
|
|
|
|
local lose_seat = arg[2]
|
|
|
|
|
local win_card = arg[3]
|
|
|
|
|
local cards = arg[4]
|
|
|
|
|
local win_list = arg[5]
|
|
|
|
|
local index = self:GetPos(win_seat)
|
|
|
|
|
local info = self._player_card_info[index]
|
|
|
|
|
self:RemoveCursor()
|
|
|
|
|
info:UpdateHandCard(false, true)
|
|
|
|
|
|
|
|
|
|
local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card")
|
|
|
|
|
obj_win_card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. win_card
|
|
|
|
|
obj_win_card:GetController("bg").selectedIndex = 1
|
|
|
|
|
info._view:AddChild(obj_win_card)
|
|
|
|
|
obj_win_card:Center()
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
local player = _room:GetPlayerBySeat(win_seat)
|
|
|
|
|
local hu_sound = win_seat == lose_seat and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
|
|
|
|
self:PlaySound(player.self_user.sex, hu_sound)
|
2025-04-01 10:48:36 +08:00
|
|
|
if win_list[1].type == 11 then
|
2025-04-02 19:03:26 +08:00
|
|
|
local url, pNode
|
|
|
|
|
if win_seat ~= _room.self_player.seat then
|
|
|
|
|
url = "ui://Main_Majiang/别人胡"
|
|
|
|
|
pNode = info._mask_liangpai
|
|
|
|
|
elseif win_seat == _room.self_player.seat then
|
|
|
|
|
url = "ui://Main_Majiang/自己胡牌"
|
|
|
|
|
pNode = self._view
|
|
|
|
|
end
|
|
|
|
|
if win_seat == lose_seat then
|
|
|
|
|
url = "ui://Main_Majiang/eff_zimo"
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
local he = UIPackage.CreateObjectFromURL(url)
|
|
|
|
|
pNode:AddChild(he)
|
|
|
|
|
he:GetTransition("t2"):Play()
|
2025-04-02 19:03:26 +08:00
|
|
|
if win_seat == _room.self_player.seat then
|
|
|
|
|
he:Center()
|
2025-04-01 10:48:36 +08:00
|
|
|
elseif url == "ui://Main_Majiang/eff_zimo" then
|
|
|
|
|
he.scaleY = 0.4
|
|
|
|
|
he.scaleX = 0.4
|
|
|
|
|
he.x = he.width * 0.4 * 0.5 * -1
|
|
|
|
|
he.y = he.height * 0.4 * 0.5 * -1
|
|
|
|
|
end
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(2)
|
|
|
|
|
obj_win_card:Dispose()
|
|
|
|
|
he:Dispose()
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
|
|
|
|
else
|
2025-04-02 19:03:26 +08:00
|
|
|
local pNode = info._view
|
|
|
|
|
local url = (index == 1 or index == 3) and "eff_list1" or "eff_list2"
|
|
|
|
|
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_ChangSha/" .. url)
|
|
|
|
|
he_list.touchable = false
|
|
|
|
|
pNode:AddChild(he_list)
|
|
|
|
|
he_list:Center()
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
for i = 1, #win_list do
|
|
|
|
|
local tem = win_list[i]
|
|
|
|
|
local com_name = "he" .. tem.type
|
|
|
|
|
if tem.type == 1 then
|
|
|
|
|
com_name = com_name .. "_" .. tem.value
|
|
|
|
|
end
|
|
|
|
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChangSha/" .. com_name)
|
|
|
|
|
coroutine.wait(0.3)
|
|
|
|
|
end
|
|
|
|
|
if player.win_count and player.win_count >= 3 then
|
|
|
|
|
he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_ChangSha/he_4w")
|
|
|
|
|
end
|
|
|
|
|
coroutine.wait(2)
|
|
|
|
|
obj_win_card:Dispose()
|
|
|
|
|
he_list:Dispose()
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventNiao, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = false
|
|
|
|
|
local list = arg[1]
|
|
|
|
|
local start_seat = arg[2]
|
|
|
|
|
ViewUtil.PlaySound("ChangSha_MJ", "extend/majiang/changsha/sound/zhuaniao.mp3")
|
2025-04-02 19:03:26 +08:00
|
|
|
coroutine.start(self.RunNiao, self, list, start_seat)
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.ZPResult1, function(...)
|
|
|
|
|
self._popEvent = false
|
|
|
|
|
self:__CloseTip()
|
|
|
|
|
if self._com_haidi then
|
|
|
|
|
self._com_haidi:Dispose()
|
|
|
|
|
self._com_haidi = nil
|
|
|
|
|
end
|
|
|
|
|
if self.kg_card then
|
|
|
|
|
self.kg_card:Dispose()
|
2025-04-02 19:03:26 +08:00
|
|
|
_room.kg_card = {}
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local result = arg[1]
|
|
|
|
|
local liuju = result.liuju
|
|
|
|
|
local data = result.info_list
|
|
|
|
|
local niao = result.niao
|
|
|
|
|
if liuju then
|
|
|
|
|
local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu")
|
|
|
|
|
self._view:AddChild(le)
|
|
|
|
|
le:Center()
|
|
|
|
|
le:GetTransition("t0"):Play()
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(1)
|
|
|
|
|
le:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
self:RemoveCursor()
|
|
|
|
|
if self._clearingView == nil then
|
|
|
|
|
self._clearingView = CS_ClearingView.new(self._view)
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
if self._clearingView._is_destroy then return end
|
|
|
|
|
self._clearingView:Show()
|
|
|
|
|
self._popEvent = true
|
2025-04-02 19:03:26 +08:00
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if _room.curren_round ~= _room.room_config.round then
|
|
|
|
|
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
|
|
|
|
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].hp_info.cur_hp
|
|
|
|
|
end
|
2025-04-10 11:19:20 +08:00
|
|
|
info:UpdateScore()
|
2025-04-01 10:48:36 +08:00
|
|
|
info._view:GetChild("zhanji").visible = true
|
|
|
|
|
local num = data[i].hp_info.total_hp
|
2025-04-02 19:03:26 +08:00
|
|
|
if num > 0 then
|
|
|
|
|
info._view:GetController("text_color").selectedIndex = 0
|
|
|
|
|
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
|
|
|
|
else
|
|
|
|
|
info._view:GetController("text_color").selectedIndex = 1
|
|
|
|
|
info._view:GetChild("text_jifen").text = d2ad(num)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
info._view:GetChild("mask_piao").title = ""
|
|
|
|
|
info._view:GetController("piao_niao").selectedIndex = 0
|
|
|
|
|
p.win_count = data[i].win_count
|
2025-04-01 10:48:36 +08:00
|
|
|
if p.win_count >= 3 then
|
|
|
|
|
info._view:GetController("three_win").selectedIndex = 1
|
|
|
|
|
info._view:GetChild("com_three_win"):GetChild("tex_win").text = p.win_count
|
|
|
|
|
info._view:GetChild("com_three_win"):GetTransition("t0"):Play()
|
|
|
|
|
else
|
|
|
|
|
info._view:GetController("three_win").selectedIndex = 0
|
|
|
|
|
end
|
|
|
|
|
info._view:GetController("ting").selectedIndex = 0
|
|
|
|
|
p.fz_list = {}
|
2025-04-02 19:03:26 +08:00
|
|
|
p.auto_play = false
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
DataManager.CurrenRoom.self_player.card_list = {}
|
|
|
|
|
self._state.selectedIndex = 2
|
|
|
|
|
self._clearingView = nil
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
self._player_card_info[1]:ShowHuTip()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.ZPResult2, function(...)
|
|
|
|
|
if self._com_haidi then
|
|
|
|
|
self._com_haidi:Dispose()
|
|
|
|
|
self._com_haidi = nil
|
|
|
|
|
end
|
|
|
|
|
self:UnmarkSelfTuoguan()
|
|
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local total_result = arg[2]
|
|
|
|
|
local result = arg[1]
|
|
|
|
|
local over = arg[3]
|
|
|
|
|
self._clearingView = CS_ClearingView.new()
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._clearingView:Show()
|
2025-04-02 19:03:26 +08:00
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
self._clearingView:InitData(over, _room, result, total_result)
|
|
|
|
|
ControllerManager.ChangeController(LoddyController)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventQSTip, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local data = arg[1]
|
|
|
|
|
local tip = data["types"]
|
|
|
|
|
local lit = data["tip_list"]
|
|
|
|
|
local htype = lit[1]["type"]
|
|
|
|
|
local tip_qishou
|
|
|
|
|
if htype == 7 then
|
|
|
|
|
tip_qishou = UIPackage.CreateObject("Extend_MJ_ChangSha", "pop_tip_qishou")
|
|
|
|
|
elseif htype == 8 then
|
|
|
|
|
tip_qishou = UIPackage.CreateObject("Extend_MJ_ChangSha", "pop_tip_zhongtu")
|
|
|
|
|
end
|
|
|
|
|
local tipList = tip_qishou:GetChild("list")
|
|
|
|
|
for i = 1, #tip do
|
|
|
|
|
local item = tipList:AddItemFromPool()
|
|
|
|
|
item:GetChild("icon").url = "ui://Extend_MJ_ChangSha/qs" .. tip[i].type
|
|
|
|
|
item:GetChild("num").text = tip[i].value
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
local id = lit[1].id
|
|
|
|
|
tip_qishou:GetChild("btn_qs").onClick:Add(function()
|
|
|
|
|
_gamectr:SendAction(id)
|
|
|
|
|
tip_qishou:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
local btn_close = tip_qishou:GetChild("btn_close")
|
|
|
|
|
btn_close.onClick:Add(function()
|
|
|
|
|
_gamectr:SendAction(0)
|
|
|
|
|
tip_qishou:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
self._view:AddChild(tip_qishou)
|
|
|
|
|
tip_qishou:Center()
|
|
|
|
|
self._com_qishou = tip_qishou
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EvnetQSAction, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local data = arg[1]
|
|
|
|
|
self._popEvent = false
|
|
|
|
|
self:__QsHu(data)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventKaiGang, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local data = arg[1]
|
|
|
|
|
local outlist = arg[2]
|
|
|
|
|
self._popEvent = false
|
|
|
|
|
self:__KaiGang(data)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EvnetHaiDi, function()
|
|
|
|
|
self:__Haidi()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EvnetPiaoTip, function()
|
2025-04-11 12:49:08 +08:00
|
|
|
self:UpdateRound()
|
|
|
|
|
self._tex_LeftCard.text = "0"
|
|
|
|
|
self._state.selectedIndex = 1
|
|
|
|
|
if oldGameVersion == 1 then
|
2025-04-01 10:48:36 +08:00
|
|
|
self:__PiaoNiaoTip()
|
|
|
|
|
else
|
|
|
|
|
self:__PiaoNiaoTip1()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EvnetPiao, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local seat = arg[1]
|
|
|
|
|
local num = arg[2]
|
|
|
|
|
if num > 0 then
|
|
|
|
|
local head_info = self._player_info[self:GetPos(seat)]
|
|
|
|
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. num
|
|
|
|
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
if seat == _room.self_player.seat then
|
2025-04-02 19:03:26 +08:00
|
|
|
if self._com_piao then
|
|
|
|
|
self._com_piao:Dispose()
|
2025-04-01 10:48:36 +08:00
|
|
|
self._com_piao = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventTingTip, function(...)
|
|
|
|
|
local com_tip = UIPackage.CreateObject("Main_Majiang", "Gcm_action_tips")
|
|
|
|
|
com_tip:GetController("hide_bg").selectedIndex = 1
|
|
|
|
|
self._chipeng_tip = com_tip
|
|
|
|
|
|
|
|
|
|
local _lit_fanzi = com_tip:GetChild("lit_fanzi")
|
|
|
|
|
_lit_fanzi:RemoveChildrenToPool()
|
|
|
|
|
|
|
|
|
|
local _btn_ting = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_fztip")
|
|
|
|
|
_btn_ting.icon = "ui://Main_Majiang/fztip_6"
|
2025-04-02 19:03:26 +08:00
|
|
|
_btn_ting.onClick:Set(function(...)
|
|
|
|
|
_gamectr:SendAction(1)
|
|
|
|
|
com_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
2025-04-02 19:03:26 +08:00
|
|
|
_btn_pass.onClick:Set(function(...)
|
|
|
|
|
_gamectr:SendAction(0)
|
|
|
|
|
self._chipeng_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
self._view:AddChild(com_tip)
|
|
|
|
|
com_tip:Center()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(CS_GameEvent.EventTing, function(...)
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local seat = arg[1]
|
|
|
|
|
local index = self:GetPos(seat)
|
|
|
|
|
local head_info = self._player_info[index]
|
|
|
|
|
head_info._view:GetController("ting").selectedIndex = 1
|
|
|
|
|
local info = self._player_card_info[index]
|
|
|
|
|
info._player.auto_out_card = true
|
2025-04-02 19:03:26 +08:00
|
|
|
info:UpdateHandCard()
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateRound()
|
2025-04-11 12:49:08 +08:00
|
|
|
self._view:GetChild("tex_round1").text = self._room.curren_round
|
|
|
|
|
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:InitPlayerInfoView()
|
2025-04-02 19:03:26 +08:00
|
|
|
self._player_info = {}
|
|
|
|
|
local _player_info = self._player_info
|
|
|
|
|
for i = 1, self._room.room_config.people_num do
|
|
|
|
|
local tem = self._view:GetChild("player_info" .. i)
|
|
|
|
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
|
|
|
|
tem.visible = false
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local discard_frame = 0
|
|
|
|
|
function M:OutCard(card)
|
|
|
|
|
-- 防止同一帧内执行两次OutCard事件
|
|
|
|
|
local last_discard_frame = discard_frame
|
|
|
|
|
discard_frame = Time.frameCount
|
2025-04-11 12:49:08 +08:00
|
|
|
---- print("帧数:-------------------------",discard_frame, last_discard_frame, discard_frame == last_discard_frame)
|
2025-04-01 10:48:36 +08:00
|
|
|
if discard_frame == last_discard_frame then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
|
|
|
self._room.curren_outcard_seat = -1
|
|
|
|
|
_gamectr:SendOutCard(card, function()
|
|
|
|
|
local info = self._player_card_info[1]
|
|
|
|
|
self:RemoveCursor()
|
|
|
|
|
info:UpdateHandCard()
|
|
|
|
|
|
|
|
|
|
info:UpdateOutCardList(nil, card, self._cursor)
|
2025-04-02 19:03:26 +08:00
|
|
|
self:PlaySound(self._room.self_player.self_user.sex, tostring(card))
|
2025-04-01 10:48:36 +08:00
|
|
|
self:PlayMJSound("chupai.mp3")
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
function M:__FangziTip(tip)
|
2025-04-01 10:48:36 +08:00
|
|
|
if self.kg_card then
|
|
|
|
|
self.kg_card:Dispose()
|
|
|
|
|
end
|
|
|
|
|
local _gamectr = self._gamectr
|
|
|
|
|
local _chipeng_tip = UIPackage.CreateObject("Main_Majiang", "Gcm_action_tips")
|
|
|
|
|
_chipeng_tip:GetController("hide_bg").selectedIndex = 1
|
|
|
|
|
self._chipeng_tip = _chipeng_tip
|
|
|
|
|
local p = self._room.self_player
|
|
|
|
|
-- self._player_card_info[self:GetPos(p.seat)]
|
|
|
|
|
|
|
|
|
|
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
|
|
|
|
|
_lit_fanzi:RemoveChildrenToPool()
|
|
|
|
|
local _tlist = table.keys(tip.tip_map_type)
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
local tip_hu = false
|
|
|
|
|
local count = #_tlist
|
|
|
|
|
table.sort(_tlist)
|
|
|
|
|
local isHu = false
|
2025-04-02 19:03:26 +08:00
|
|
|
for k = 1, #_tlist do
|
2025-04-01 10:48:36 +08:00
|
|
|
local td = tip.tip_map_type[_tlist[k]][1]
|
|
|
|
|
local url = "ui://Main_Majiang/Btn_fztip"
|
|
|
|
|
local weight = td.weight
|
2025-04-02 19:03:26 +08:00
|
|
|
if tonumber(weight) == 5 then
|
2025-04-01 10:48:36 +08:00
|
|
|
isHu = true
|
2025-04-02 19:03:26 +08:00
|
|
|
weight = 8
|
2025-04-01 10:48:36 +08:00
|
|
|
url = "ui://Main_Majiang/Btn_hu"
|
|
|
|
|
elseif tonumber(weight) == 3 then
|
|
|
|
|
weight = 16
|
|
|
|
|
end
|
|
|
|
|
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
2025-04-02 19:03:26 +08:00
|
|
|
if url == "ui://Main_Majiang/Btn_hu" and td.card then
|
2025-07-16 15:07:29 +08:00
|
|
|
btn_t:GetChild("hupai").icon = "ui://Main_Majiang/b202_" .. td.card
|
2025-04-02 19:03:26 +08:00
|
|
|
btn_t:GetController("hupai").selectedIndex = 1
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
btn_t.icon = "ui://Main_Majiang/fztip_" .. weight
|
2025-04-01 10:48:36 +08:00
|
|
|
btn_t.data = { tip, td }
|
2025-04-02 19:03:26 +08:00
|
|
|
btn_t.onClick:Add(self.__TipAction, self)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
|
|
|
|
_btn_pass.onClick:Set(function()
|
2025-04-02 19:03:26 +08:00
|
|
|
if isHu then
|
|
|
|
|
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
|
|
|
|
guo_msg.onOk:Add(function()
|
|
|
|
|
_gamectr:SendAction(0)
|
|
|
|
|
_chipeng_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
|
|
|
|
guo_msg:Close()
|
|
|
|
|
end)
|
|
|
|
|
guo_msg:Show()
|
|
|
|
|
else
|
|
|
|
|
_gamectr:SendAction(0)
|
|
|
|
|
_chipeng_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
self._view:AddChild(_chipeng_tip)
|
|
|
|
|
_chipeng_tip:Center()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__TipAction(context)
|
|
|
|
|
local data = context.sender.data
|
|
|
|
|
local _gamectr = self._gamectr
|
|
|
|
|
local tip = data[1]
|
|
|
|
|
local td = data[2]
|
|
|
|
|
local list = tip.tip_map_type[td.weight]
|
|
|
|
|
if (#list > 1) then
|
|
|
|
|
self:_ChiView(list, function(id)
|
|
|
|
|
_gamectr:SendAction(id)
|
|
|
|
|
self:__CloseTip()
|
2025-04-02 19:03:26 +08:00
|
|
|
end)
|
|
|
|
|
self._chipeng_tip.visible = false
|
|
|
|
|
return
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
_gamectr:SendAction(td.id)
|
|
|
|
|
if (self._chipeng_tip == nil) then return end
|
|
|
|
|
self._chipeng_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:_ChiView(tiplist, callback)
|
|
|
|
|
self._chipeng_tip.visible = false
|
|
|
|
|
local _pop_tip_choice = UIPackage.CreateObject("Extend_MJ_ChangSha", "Pop_tip_choice")
|
|
|
|
|
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
|
|
|
|
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
|
|
|
|
local crossCtr = _pop_tip_choice:GetController("state")
|
2025-04-02 19:03:26 +08:00
|
|
|
crossCtr.selectedIndex = #tiplist == 3 and 0 or
|
|
|
|
|
(#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
2025-04-01 10:48:36 +08:00
|
|
|
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
|
|
|
|
|
_pop_tip_choice:Dispose()
|
|
|
|
|
self._chipeng_tip.visible = true
|
|
|
|
|
end)
|
2025-04-02 19:03:26 +08:00
|
|
|
list_choose1:RemoveChildrenToPool()
|
|
|
|
|
list_choose2:RemoveChildrenToPool()
|
|
|
|
|
for i = 1, #tiplist do
|
|
|
|
|
local list_choose = i <= 3 and list_choose1 or list_choose2
|
2025-04-01 10:48:36 +08:00
|
|
|
local item_choose = list_choose:AddItemFromPool()
|
|
|
|
|
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
|
|
|
|
if tiplist[i].weight ~= 1 then
|
|
|
|
|
for j = 1, 4 do
|
2025-04-02 19:03:26 +08:00
|
|
|
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang",
|
|
|
|
|
self:GetPrefix() .. "202_" .. tiplist[i].card)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local tem = {}
|
|
|
|
|
table.insert(tem, tiplist[i].opcard[1])
|
|
|
|
|
table.insert(tem, tiplist[i].opcard[2])
|
|
|
|
|
local tcard = tiplist[i].card
|
|
|
|
|
table.insert(tem, tcard)
|
|
|
|
|
table.sort(tem, function(a, b)
|
|
|
|
|
return a < b
|
|
|
|
|
end)
|
2025-04-02 19:03:26 +08:00
|
|
|
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
|
|
|
|
tem[1])
|
|
|
|
|
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
|
|
|
|
tem[2])
|
|
|
|
|
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
|
|
|
|
tem[3])
|
2025-04-01 10:48:36 +08:00
|
|
|
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
|
|
|
|
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
item_choose.onClick:Add(function()
|
2025-04-02 19:03:26 +08:00
|
|
|
callback(tiplist[i].id)
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
|
|
|
|
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
|
|
|
|
(self._view.height - _pop_tip_choice.height) / 2)
|
|
|
|
|
self._view:AddChild(_pop_tip_choice)
|
|
|
|
|
self._pop_tip_choice = _pop_tip_choice
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__QsHu(data)
|
|
|
|
|
local seat = data.seat
|
|
|
|
|
if seat == DataManager.CurrenRoom.self_player.seat then
|
|
|
|
|
if self._com_qishou then
|
|
|
|
|
self._com_qishou:Dispose()
|
|
|
|
|
self._com_qishou = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if data.niao and #data.niao > 0 then
|
|
|
|
|
local shaizi = UIPackage.CreateObject("Extend_MJ_ChangSha", "Ani_shaizi")
|
|
|
|
|
local dice1 = data.niao[1].card
|
|
|
|
|
local dice2 = data.niao[2].card
|
|
|
|
|
shaizi:GetChild("shaizi1").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice1)
|
|
|
|
|
shaizi:GetChild("shaizi2").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice2)
|
|
|
|
|
self._view:AddChild(shaizi)
|
|
|
|
|
shaizi:Center()
|
|
|
|
|
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
-- coroutine.wait(0.5)
|
|
|
|
|
-- shaizi:GetController("c1").selectedIndex = 1
|
|
|
|
|
coroutine.wait(1.5)
|
|
|
|
|
local xy = shaizi.xy
|
|
|
|
|
local head_info = self._player_info[self:GetPos(seat)]
|
|
|
|
|
local target_xy = self._view:GlobalToLocal(head_info._view:LocalToGlobal(head_info:GetHeadCenter()))
|
|
|
|
|
local diff_x = (target_xy.x - 0.5 * shaizi.width) - xy.x
|
|
|
|
|
local diff_y = (target_xy.y - 0.5 * shaizi.height) - xy.y
|
2025-04-02 19:03:26 +08:00
|
|
|
self._tween_shaizi = TweenUtils.TweenFloat(0, 1, 1, function(value)
|
2025-04-01 10:48:36 +08:00
|
|
|
shaizi.x = xy.x + diff_x * value
|
|
|
|
|
shaizi.y = xy.y + diff_y * value
|
|
|
|
|
end)
|
|
|
|
|
coroutine.wait(1.2)
|
|
|
|
|
shaizi:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
local qs_data = data.data
|
|
|
|
|
local allShowCards = {}
|
|
|
|
|
local ShowCardsNum = {}
|
|
|
|
|
local types = {}
|
|
|
|
|
local showAllCards = false
|
|
|
|
|
local qs_type = data.type -- 6是起手胡 8是中途
|
|
|
|
|
for i = 1, #qs_data do
|
|
|
|
|
local cards = {}
|
2025-04-02 19:03:26 +08:00
|
|
|
local opcard = qs_data[i].opcard
|
2025-04-01 10:48:36 +08:00
|
|
|
local qtype = qs_data[i].type
|
|
|
|
|
if not types[qtype] then types[qtype] = qs_data[i].value end
|
|
|
|
|
if qtype == 23 or qtype == 24 or qtype == 27 then
|
|
|
|
|
showAllCards = true
|
|
|
|
|
allShowCards = opcard
|
|
|
|
|
end
|
|
|
|
|
if not showAllCards then
|
|
|
|
|
for j = 1, #opcard do
|
|
|
|
|
local card = opcard[j]
|
|
|
|
|
if cards[card] then
|
|
|
|
|
cards[card] = cards[card] + 1
|
|
|
|
|
else
|
|
|
|
|
cards[card] = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
for k, v in pairs(cards) do
|
2025-04-01 10:48:36 +08:00
|
|
|
local card = k
|
|
|
|
|
if ShowCardsNum[card] then
|
|
|
|
|
if ShowCardsNum[card] < cards[card] then
|
|
|
|
|
ShowCardsNum[card] = cards[card]
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ShowCardsNum[card] = cards[card]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not showAllCards then
|
2025-04-02 19:03:26 +08:00
|
|
|
for i, v in pairs(ShowCardsNum) do
|
2025-04-01 10:48:36 +08:00
|
|
|
for j = 1, v do
|
|
|
|
|
table.insert(allShowCards, i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
local info = self._player_card_info[self:GetPos(seat)]
|
|
|
|
|
local pNode = info._mask_liangpai
|
2025-04-02 19:03:26 +08:00
|
|
|
self.QSHList = {}
|
2025-04-01 10:48:36 +08:00
|
|
|
coroutine.start(function()
|
|
|
|
|
for i, v in pairs(types) do
|
|
|
|
|
local show_tip = UIPackage.CreateObject("Extend_MJ_ChangSha", "Tip_qishou")
|
|
|
|
|
show_tip:GetChild("icon").url = "ui://Extend_MJ_ChangSha/qs" .. i
|
|
|
|
|
show_tip:GetChild("num").text = v
|
|
|
|
|
pNode:AddChild(show_tip)
|
|
|
|
|
show_tip:Center()
|
2025-04-02 19:03:26 +08:00
|
|
|
table.insert(self.QSHList, show_tip)
|
2025-04-01 10:48:36 +08:00
|
|
|
--coroutine.wait(4)
|
|
|
|
|
--show_tip:Dispose()
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
end)
|
2025-04-01 10:48:36 +08:00
|
|
|
table.sort(allShowCards, ViewUtil.HandCardSort)
|
|
|
|
|
info:UpdateHandCard(false, false, allShowCards)
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
2025-04-02 19:03:26 +08:00
|
|
|
self._popEvent = true
|
2025-04-01 10:48:36 +08:00
|
|
|
coroutine.wait(4)
|
2025-04-02 19:03:26 +08:00
|
|
|
self._room.room_config.banyiquan = true
|
2025-04-01 10:48:36 +08:00
|
|
|
if not (self._room.room_config.banyiquan and qs_type == 6) then
|
|
|
|
|
info:UpdateHandCard(false, false, {})
|
|
|
|
|
end
|
|
|
|
|
--self._popEvent = true
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ClearQSHTips()
|
2025-04-02 19:03:26 +08:00
|
|
|
if self.QSHList and #self.QSHList > 0 then
|
|
|
|
|
for i = 1, #self.QSHList do
|
2025-04-01 10:48:36 +08:00
|
|
|
self.QSHList[i]:Dispose()
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
self.QSHList = nil
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__KaiGang(data)
|
|
|
|
|
local seat = data["seat"]
|
|
|
|
|
local kg_info = data["info"]
|
|
|
|
|
local dice1 = kg_info["diceNum1"]
|
|
|
|
|
local dice2 = kg_info["diceNum2"]
|
|
|
|
|
local cardList = kg_info["cardList"]
|
|
|
|
|
local info = self._player_card_info[self:GetPos(seat)]
|
|
|
|
|
local p = self._room:GetPlayerBySeat(seat)
|
|
|
|
|
local card = p.outcard_list[#p.outcard_list]
|
2025-04-02 19:03:26 +08:00
|
|
|
printlog("jefe kai_gang", dice1)
|
|
|
|
|
printlog("jefe kai_gang", dice2)
|
2025-04-01 10:48:36 +08:00
|
|
|
local shaizi = UIPackage.CreateObject("Extend_MJ_ChangSha", "Ani_shaizi")
|
|
|
|
|
shaizi:GetChild("shaizi1").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice1)
|
|
|
|
|
shaizi:GetChild("shaizi2").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice2)
|
|
|
|
|
self._view:AddChild(shaizi)
|
|
|
|
|
shaizi:Center()
|
|
|
|
|
|
|
|
|
|
if self.kg_card then self.kg_card:Dispose() end
|
|
|
|
|
self.kg_card = UIPackage.CreateObject("Extend_MJ_ChangSha", "kai_gang")
|
|
|
|
|
local gang_list = self.kg_card:GetChild("list")
|
|
|
|
|
gang_list:RemoveChildrenToPool()
|
|
|
|
|
for i = 1, #cardList do
|
|
|
|
|
local item = gang_list:AddItemFromPool()
|
|
|
|
|
item.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "201_" .. cardList[i])
|
|
|
|
|
end
|
|
|
|
|
if p.seat == self._room.self_player.seat then
|
|
|
|
|
if not info._player then info._player = {} end
|
|
|
|
|
info._player.auto_out_card = true
|
2025-04-02 19:03:26 +08:00
|
|
|
info:UpdateHandCard()
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
-- coroutine.wait(0.5)
|
|
|
|
|
-- shaizi:GetController("c1").selectedIndex = 1
|
|
|
|
|
coroutine.wait(1.5)
|
|
|
|
|
local xy = shaizi.xy
|
|
|
|
|
local head_info = self._player_info[self:GetPos(seat)]
|
|
|
|
|
local target_xy = self._view:GlobalToLocal(head_info._view:LocalToGlobal(head_info:GetHeadCenter()))
|
|
|
|
|
local diff_x = (target_xy.x - 0.5 * shaizi.width) - xy.x
|
|
|
|
|
local diff_y = (target_xy.y - 0.5 * shaizi.height) - xy.y
|
2025-04-02 19:03:26 +08:00
|
|
|
self._tween_shaizi = TweenUtils.TweenFloat(0, 1, 1, function(value)
|
2025-04-01 10:48:36 +08:00
|
|
|
shaizi.x = xy.x + diff_x * value
|
|
|
|
|
shaizi.y = xy.y + diff_y * value
|
|
|
|
|
end)
|
|
|
|
|
coroutine.wait(1.2)
|
|
|
|
|
shaizi:Dispose()
|
|
|
|
|
|
|
|
|
|
self._view:AddChild(self.kg_card)
|
|
|
|
|
self.kg_card:Center()
|
2025-04-02 19:03:26 +08:00
|
|
|
info:UpdateOutCardList(nil, card, self._cursor)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
coroutine.wait(1)
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__Haidi()
|
|
|
|
|
-- if DataManager.CurrenRoom.self_player.entrust then return end
|
|
|
|
|
local item = UIPackage.CreateObject("Extend_MJ_ChangSha", "hai_di")
|
|
|
|
|
local btn_confirm = item:GetChild("btn_confirm")
|
|
|
|
|
local btn_cancel = item:GetChild("btn_cancel")
|
|
|
|
|
local _gamectr = self._gamectr
|
|
|
|
|
btn_confirm.onClick:Add(function()
|
|
|
|
|
_gamectr:SendAction(1)
|
|
|
|
|
item:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
btn_cancel.onClick:Add(function()
|
2025-04-02 19:03:26 +08:00
|
|
|
_gamectr:SendAction(0)
|
|
|
|
|
item:Dispose()
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
self._view:AddChild(item)
|
|
|
|
|
item:Center()
|
|
|
|
|
self._com_haidi = item
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__PiaoNiaoTip()
|
2025-04-02 19:03:26 +08:00
|
|
|
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
|
|
|
|
self._view:AddChild(obj_piao)
|
|
|
|
|
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
|
|
|
|
obj_piao.y = self._view.height * 0.6
|
|
|
|
|
local piaoState = obj_piao:GetController('piao')
|
|
|
|
|
piaoState.selectedIndex = 1
|
|
|
|
|
for i = 1, 4 do
|
|
|
|
|
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
|
|
|
|
self._gamectr:SendAction(i - 1)
|
|
|
|
|
obj_piao:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
self._com_piao = obj_piao
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__PiaoNiaoTip1()
|
2025-04-02 19:03:26 +08:00
|
|
|
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
|
|
|
|
self._view:AddChild(obj_piao)
|
|
|
|
|
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
|
|
|
|
obj_piao.y = self._view.height * 0.6
|
|
|
|
|
local piaoState = obj_piao:GetController('piao')
|
|
|
|
|
|
|
|
|
|
local tconfig = DataManager.CurrenRoom.room_config.config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local piaoList = {}
|
|
|
|
|
|
|
|
|
|
for i = 1, 4 do
|
|
|
|
|
local piaoT = obj_piao:GetChild("btn_" .. i)
|
|
|
|
|
table.insert(piaoList, piaoT)
|
2025-04-01 10:48:36 +08:00
|
|
|
piaoT.onClick:Add(function()
|
2025-04-02 19:03:26 +08:00
|
|
|
self._gamectr:SendAction(i - 1)
|
|
|
|
|
obj_piao:Dispose()
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
|
|
|
|
self._com_piao = obj_piao
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tconfig.piao_niao < 2 then
|
|
|
|
|
for i = 1, #piaoList do
|
|
|
|
|
piaoList[i].visible = true
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
piaoState.selectedIndex = 1
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-04-02 19:03:26 +08:00
|
|
|
piaoList[1].visible = false
|
|
|
|
|
for i = 2, #piaoList do
|
|
|
|
|
piaoList[i].visible = tconfig["piao" .. (i - 1)]
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
piaoState.selectedIndex = 2
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
function M:OnFangziAction(...)
|
2025-04-01 10:48:36 +08:00
|
|
|
self._popEvent = false
|
|
|
|
|
if self.kg_card then
|
|
|
|
|
self.kg_card:Dispose()
|
|
|
|
|
end
|
|
|
|
|
self:__CloseTip()
|
2025-04-02 19:03:26 +08:00
|
|
|
local arg = { ... }
|
2025-04-01 10:48:36 +08:00
|
|
|
local _player_card_info = self._player_card_info
|
|
|
|
|
local fz = arg[1]
|
|
|
|
|
local player = arg[2]
|
|
|
|
|
local index = arg[3]
|
|
|
|
|
|
|
|
|
|
local info = _player_card_info[self:GetPos(player.seat)]
|
|
|
|
|
local pNode = info._mask_liangpai
|
|
|
|
|
local effect = UIPackage.CreateObject("Extend_MJ_ChangSha", "FzEffect")
|
|
|
|
|
|
|
|
|
|
local fangzi = ""
|
|
|
|
|
local fz_sound = ""
|
|
|
|
|
if fz.type == FZType.Peng then
|
|
|
|
|
fangzi = "碰"
|
2025-04-02 19:03:26 +08:00
|
|
|
fz_sound = "peng" .. math.random(1, 3)
|
2025-04-01 10:48:36 +08:00
|
|
|
elseif fz.type == FZType.Chi then
|
|
|
|
|
fangzi = "吃"
|
2025-04-02 19:03:26 +08:00
|
|
|
fz_sound = "chi" .. math.random(1, 3)
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-04-02 19:03:26 +08:00
|
|
|
if fz.opengang then
|
2025-04-01 10:48:36 +08:00
|
|
|
fangzi = "杠"
|
2025-04-02 19:03:26 +08:00
|
|
|
fz_sound = "gang" .. math.random(1, 2)
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
|
|
|
|
fangzi = "补"
|
|
|
|
|
fz_sound = "buzhang"
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
self:PlaySound(player.self_user.sex, fz_sound)
|
2025-04-01 10:48:36 +08:00
|
|
|
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", fangzi)
|
2025-04-02 19:03:26 +08:00
|
|
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", fangzi)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
effect.touchable = false
|
|
|
|
|
effect:GetTransition("t2"):Play()
|
|
|
|
|
pNode:AddChild(effect)
|
2025-04-02 19:03:26 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.3)
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
2025-04-02 19:03:26 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(1.8)
|
|
|
|
|
effect:Dispose()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
self:RemoveCursor()
|
|
|
|
|
if (player.seat ~= fz.from_seat) then
|
2025-04-02 19:03:26 +08:00
|
|
|
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
|
|
|
|
fs_info:UpdateOutCardList()
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
info:UpdateFzList(fz, index, true)
|
|
|
|
|
|
|
|
|
|
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
|
|
|
|
info:UpdateHandCard(getcard)
|
|
|
|
|
|
|
|
|
|
self:PlayMJSound("fangzi.mp3")
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
function M:RunNiao(list, start_seat)
|
|
|
|
|
local _room = self._room
|
|
|
|
|
--local _niao_View = self._niao_View
|
2025-04-02 19:03:26 +08:00
|
|
|
self._niao_View = UIPackage.CreateObject("Extend_MJ_ChangSha", "Panel_Birds")
|
2025-04-01 10:48:36 +08:00
|
|
|
self._view:AddChild(self._niao_View)
|
|
|
|
|
self._niao_View:Center()
|
|
|
|
|
local _niao_View = self._niao_View
|
|
|
|
|
local list_niao_card = self._niao_View:GetChild("Lst_birds")
|
|
|
|
|
list_niao_card:RemoveChildrenToPool()
|
2025-04-02 19:03:26 +08:00
|
|
|
for i = 1, #list do
|
|
|
|
|
--添加背面的麻將
|
|
|
|
|
local item = list_niao_card:AddItemFromPool()
|
|
|
|
|
item.icon = UIPackage.GetItemURL("Main_Majiang", "202_00")
|
|
|
|
|
item:GetChild("tex_score").text = "+" .. list[i].score
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
--顯示正面
|
|
|
|
|
local item = list_niao_card:GetChildAt(i - 1)
|
2025-04-02 19:03:26 +08:00
|
|
|
local card = list[i].card
|
|
|
|
|
-- coroutine.wait(0.3)
|
|
|
|
|
item:GetTransition("appear"):Play()
|
|
|
|
|
item.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "201_" .. card)
|
|
|
|
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
coroutine.start(function()
|
2025-04-02 19:03:26 +08:00
|
|
|
coroutine.wait(1.5)
|
|
|
|
|
_niao_View:Dispose()
|
|
|
|
|
self._popEvent = true
|
2025-04-01 10:48:36 +08:00
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:ReloadRoom(bskip)
|
2025-04-02 19:03:26 +08:00
|
|
|
local room = self._room
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
if bskip == nil or bskip == false then
|
|
|
|
|
if not room.playing then
|
2025-04-02 19:03:26 +08:00
|
|
|
self._state.selectedIndex = 2
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-04-02 19:03:26 +08:00
|
|
|
self._state.selectedIndex = 1
|
|
|
|
|
self._room._reload_flag = true
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if room.kg_card and #room.kg_card ~= 0 then
|
|
|
|
|
self.kg_card = UIPackage.CreateObject("Extend_MJ_ChangSha", "kai_gang")
|
|
|
|
|
for i = 1, #room.kg_card do
|
|
|
|
|
local item = self.kg_card:GetChild("list"):AddItemFromPool()
|
|
|
|
|
item.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "201_" .. room.kg_card[i])
|
|
|
|
|
end
|
|
|
|
|
self._view:AddChild(self.kg_card)
|
|
|
|
|
self.kg_card:Center()
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
for i = 1, #room.player_list do
|
2025-04-01 10:48:36 +08:00
|
|
|
local p = room.player_list[i]
|
|
|
|
|
local info = self._player_card_info[self:GetPos(p.seat)]
|
|
|
|
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
|
|
|
|
head_info._view:GetChild('zhanji').visible = true
|
|
|
|
|
local num = p.total_hp or 0
|
|
|
|
|
if num > 0 then
|
|
|
|
|
head_info._view:GetController('text_color').selectedIndex = 0
|
|
|
|
|
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
|
|
|
|
else
|
|
|
|
|
head_info._view:GetController('text_color').selectedIndex = 1
|
|
|
|
|
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
if p.win_count ~= nil and p.win_count >= 3 then
|
2025-04-01 10:48:36 +08:00
|
|
|
head_info._view:GetController("three_win").selectedIndex = 1
|
|
|
|
|
head_info._view:GetChild("com_three_win"):GetChild("tex_win").text = p.win_count
|
|
|
|
|
end
|
|
|
|
|
if p.ting then
|
|
|
|
|
head_info._view:GetController("ting").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #p.fz_list do
|
|
|
|
|
info:UpdateFzList(p.fz_list[i], -1)
|
|
|
|
|
end
|
|
|
|
|
if p == room.self_player and p.auto_play then
|
|
|
|
|
if not info._player then info._player = {} end
|
|
|
|
|
info._player.auto_out_card = true
|
|
|
|
|
end
|
|
|
|
|
info:UpdateHandCard()
|
|
|
|
|
if p.seat == room.last_outcard_seat then
|
2025-04-02 19:03:26 +08:00
|
|
|
local card = p.outcard_list[#p.outcard_list]
|
|
|
|
|
info:UpdateOutCardList(nil, card, self._cursor)
|
2025-04-01 10:48:36 +08:00
|
|
|
elseif p.seat == room.curren_outcard_seat then
|
2025-04-02 19:03:26 +08:00
|
|
|
info:UpdateHandCard(true)
|
|
|
|
|
info:UpdateOutCardList()
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-04-02 19:03:26 +08:00
|
|
|
info:UpdateOutCardList()
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
if p.seat == room.banker_seat then
|
2025-04-02 19:03:26 +08:00
|
|
|
local head = self._player_info[self:GetPos(p.seat)]
|
|
|
|
|
head:MarkBank(true)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
if bskip == nil or bskip == false then
|
|
|
|
|
if p.ready and room.playing == false then
|
2025-04-02 19:03:26 +08:00
|
|
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-04-02 19:03:26 +08:00
|
|
|
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
|
|
|
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
|
|
|
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
|
|
|
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if bskip == nil or bskip == false then
|
2025-04-01 10:48:36 +08:00
|
|
|
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
|
2025-04-10 11:19:20 +08:00
|
|
|
self._tex_LeftCard.text = room.left_count
|
2025-04-01 10:48:36 +08:00
|
|
|
self:UpdateRound()
|
2025-04-02 19:03:26 +08:00
|
|
|
end
|
|
|
|
|
local me = room.self_player
|
|
|
|
|
if room.curren_outcard_seat == me.seat and me.auto_play then
|
|
|
|
|
self:OutCard(me.draw_card)
|
|
|
|
|
me.draw_card = nil
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetPos(seat)
|
2025-04-02 19:03:26 +08:00
|
|
|
local pos = 0
|
|
|
|
|
if seat ~= 0 then
|
|
|
|
|
pos = ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
|
|
|
|
end
|
|
|
|
|
return pos
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
function M:PlaySound(sex, path)
|
|
|
|
|
MJMainView.PlaySound(self, "ChangSha_MJ", sex, path)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:PlayerChangeLineState()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateCardBox(seat)
|
|
|
|
|
local index = seat
|
|
|
|
|
local people_num = self._room.room_config.people_num
|
|
|
|
|
if people_num == 2 and seat == 2 then
|
|
|
|
|
index = 3
|
|
|
|
|
elseif people_num == 3 and seat == 3 then
|
|
|
|
|
index = 4
|
|
|
|
|
end
|
|
|
|
|
self._ctr_cardbox.selectedIndex = index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:__CloseTip()
|
|
|
|
|
if (self._chipeng_tip) then
|
|
|
|
|
self._chipeng_tip:Dispose()
|
|
|
|
|
self._chipeng_tip = nil
|
|
|
|
|
end
|
|
|
|
|
if (self._pop_tip_choice) then
|
|
|
|
|
self._pop_tip_choice:Dispose()
|
|
|
|
|
self._pop_tip_choice = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 托管时关闭一些提示窗口,如起手胡、吃碰提示、海底,由扩展实现
|
|
|
|
|
function M:closeTipOnTuoguan()
|
|
|
|
|
self:__CloseTip()
|
|
|
|
|
if self._com_haidi then
|
|
|
|
|
self._com_haidi:Dispose()
|
|
|
|
|
self._com_haidi = nil
|
|
|
|
|
end
|
|
|
|
|
if self._com_qishou then
|
|
|
|
|
self._com_qishou:Dispose()
|
|
|
|
|
self._com_qishou = nil
|
|
|
|
|
end
|
|
|
|
|
-- if self._com_piao then
|
|
|
|
|
-- self._com_piao:Dispose()
|
|
|
|
|
-- self._com_piao = nil
|
|
|
|
|
-- end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:Destroy()
|
2025-04-02 19:03:26 +08:00
|
|
|
MJMainView.Destroy(self)
|
|
|
|
|
UIPackage.RemovePackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
|
|
|
|
if self._tween_shaizi then
|
|
|
|
|
TweenUtils.Kill(self._tween_shaizi)
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-02 19:03:26 +08:00
|
|
|
return M
|