2025-06-10 16:11:48 +08:00
|
|
|
local EXRoomConfig = import(".EXRoomConfig")
|
|
|
|
|
local EXClearingView = import(".EXClearingView")
|
|
|
|
|
local TX_GameEvent = import(".GameEvent")
|
2025-06-10 18:48:57 +08:00
|
|
|
local PlayerInfoView = import(".EXPlayerInfoView")
|
|
|
|
|
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
|
|
|
|
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
2025-06-25 22:49:44 +08:00
|
|
|
local SettingView = import(".EXSettingView")
|
2025-06-10 19:28:53 +08:00
|
|
|
local TableBG = require("Game.Data.TableBG")
|
2025-07-25 22:17:17 +08:00
|
|
|
local WitnessView = require("extend.Common.WitnessView")
|
2025-06-10 19:28:53 +08:00
|
|
|
|
2025-06-10 16:11:48 +08:00
|
|
|
|
|
|
|
|
local Record_Event = import(".RecordEvent")
|
|
|
|
|
|
2025-06-10 19:28:53 +08:00
|
|
|
local bg_config = {
|
|
|
|
|
{ id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" },
|
|
|
|
|
{ id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" },
|
|
|
|
|
{ id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" }
|
|
|
|
|
}
|
2025-06-10 16:11:48 +08:00
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
--- Create a new
|
|
|
|
|
function M.new()
|
2025-07-25 22:17:17 +08:00
|
|
|
setmetatable(M, { __index = WitnessView })
|
2025-06-10 16:11:48 +08:00
|
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
|
self.class = "EXMJWitness"
|
|
|
|
|
self:init()
|
|
|
|
|
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init()
|
|
|
|
|
self._gamectr = ControllerManager.GetController(GameController)
|
|
|
|
|
self._room = DataManager.CurrenRoom
|
|
|
|
|
self._room.Witness = true
|
|
|
|
|
UIPackage.AddPackage('base/chat/ui/Chat')
|
|
|
|
|
UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang")
|
|
|
|
|
self._eventmap = {}
|
|
|
|
|
-- self._full = true
|
|
|
|
|
self._put_map = false
|
|
|
|
|
self._new_hide = false
|
|
|
|
|
self._queue = false
|
|
|
|
|
self._style = 1
|
2025-06-10 18:48:57 +08:00
|
|
|
self._popEvent = true
|
2025-06-10 16:11:48 +08:00
|
|
|
self:InitView()
|
2025-07-25 23:37:32 +08:00
|
|
|
WitnessView.init(self)
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:InitView(url)
|
|
|
|
|
local room = self._room
|
|
|
|
|
UIPackage.AddPackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan")
|
|
|
|
|
BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num))
|
|
|
|
|
self:EventInit()
|
2025-06-10 18:48:57 +08:00
|
|
|
UpdateBeat:Add(self.OnUpdate, self)
|
2025-06-10 16:11:48 +08:00
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
local centerBox = self._view:GetChild("Comp_ConterBox")
|
|
|
|
|
self._ctr_cardbox = centerBox:GetController("seat")
|
|
|
|
|
self._tex_leftTime = centerBox:GetChild("Text_Time")
|
2025-06-10 16:11:48 +08:00
|
|
|
self._tex_round = self._view:GetChild("tex_round")
|
|
|
|
|
self._tex_LeftCard = self._view:GetChild("remaining_card")
|
|
|
|
|
self._anchor = self._view:GetChild("mask_tips")
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
------------------渲染桌面信息--------------------------
|
|
|
|
|
|
2025-06-10 19:28:53 +08:00
|
|
|
local use_custom_bg = true
|
|
|
|
|
local default_bg = 1
|
|
|
|
|
if use_custom_bg then
|
|
|
|
|
TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config)
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
local config = ExtendManager.GetExtendConfig(room.game_id)
|
|
|
|
|
local mode = config:GetGameInfo()
|
|
|
|
|
local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config))
|
|
|
|
|
|
|
|
|
|
self._view:GetChild('text_time').text = os.date("%H:%M", os.time())
|
|
|
|
|
self._view:GetChild('text_roomId').text = room.room_id
|
|
|
|
|
self._view:GetChild('wanfa_text').text = gamePlay
|
|
|
|
|
self._ctr_state = self._view:GetController("state")
|
|
|
|
|
|
|
|
|
|
self._text_remined = self._view:GetChild('remaining_card')
|
|
|
|
|
self._text_round = self._view:GetChild('text_round')
|
|
|
|
|
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
|
|
|
|
|
|
2025-06-12 15:17:53 +08:00
|
|
|
self:UpdateRound()
|
2025-06-10 18:48:57 +08:00
|
|
|
self:InitPlayerInfoView()
|
|
|
|
|
self._player_card_info = {}
|
|
|
|
|
local _player_card_info = self._player_card_info
|
|
|
|
|
for i = 1, #room.player_list do
|
|
|
|
|
local p = room.player_list[i]
|
|
|
|
|
local index = self:GetPos(p.seat)
|
2025-06-10 19:49:18 +08:00
|
|
|
print("lingmeng index", index)
|
2025-06-10 18:48:57 +08:00
|
|
|
local info = self._player_info[index]
|
|
|
|
|
local tem = self._view:GetChild("player_card_info" .. index)
|
2025-06-10 19:49:18 +08:00
|
|
|
_player_card_info[index] = self:NewMJPlayerCardInfoView(tem, index)
|
2025-06-10 18:48:57 +08:00
|
|
|
local cardInfo = _player_card_info[index]
|
|
|
|
|
cardInfo:SetPlayer(p)
|
|
|
|
|
cardInfo:UpdateHandCardWitness(false)
|
|
|
|
|
cardInfo:UpdateOutCardList(nil, nil, self._cursor)
|
|
|
|
|
for i = 1, #p.fz_list do
|
|
|
|
|
cardInfo:UpdateFzList(p.fz_list[i], -1)
|
|
|
|
|
end
|
|
|
|
|
info:FillData(p)
|
|
|
|
|
info._view.visible = true
|
|
|
|
|
end
|
2025-06-10 19:28:53 +08:00
|
|
|
|
|
|
|
|
-------------按钮初始化------------------------------
|
|
|
|
|
local changeTable = self._view:GetChild('btn_change')
|
|
|
|
|
if changeTable then
|
|
|
|
|
changeTable.onClick:Set(function()
|
|
|
|
|
default_bg = default_bg + 1 > #bg_config and 1 or default_bg + 1
|
|
|
|
|
TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local btn_rule = self._view:GetChild('btn_rule')
|
|
|
|
|
if btn_rule ~= nil then
|
|
|
|
|
btn_rule.onClick:Set(function()
|
|
|
|
|
if self.RuleView == nil or self.RuleView._is_destroy then
|
|
|
|
|
self.RuleView = RoomInfoView.new(self._room)
|
|
|
|
|
end
|
|
|
|
|
self.RuleView:Show()
|
|
|
|
|
end)
|
|
|
|
|
end
|
2025-06-10 20:36:42 +08:00
|
|
|
|
|
|
|
|
local btn_exit = self._view:GetChild('btn_exitWitness')
|
|
|
|
|
if btn_exit ~= nil then
|
|
|
|
|
btn_exit.onClick:Set(function()
|
|
|
|
|
self._gamectr:ExitWitnessGame()
|
|
|
|
|
ViewManager.ChangeView(ViewManager.View_Family)
|
|
|
|
|
end)
|
|
|
|
|
end
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players')
|
|
|
|
|
viewList_witness:SetVirtual()
|
|
|
|
|
viewList_witness.itemRenderer = function(index, obj)
|
|
|
|
|
obj:GetChild('title').text = room.witness_player_list[index + 1].nick
|
|
|
|
|
ImageLoad.Load(room.witness_player_list[index + 1].portrait, obj:GetChild('btn_head')._iconObject)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local btn_witness = self._view:GetChild('btn_pangGuang')
|
|
|
|
|
if btn_witness then
|
|
|
|
|
btn_witness.onClick:Set(function()
|
|
|
|
|
if room._flag_updateWitness then
|
|
|
|
|
room._flag_updateWitness = false
|
|
|
|
|
if viewList_witness.numItems == #room.witness_player_list then
|
|
|
|
|
viewList_witness:RefreshVirtualList()
|
|
|
|
|
else
|
|
|
|
|
viewList_witness.numItems = #room.witness_player_list
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
self._view:GetController('witness').selectedIndex = 1
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self._view:GetChild('btn_setting').onClick:Add(handler(self, function()
|
|
|
|
|
local settingView = SettingView.new(self, 1)
|
|
|
|
|
settingView:Show()
|
|
|
|
|
end))
|
2025-06-10 18:48:57 +08:00
|
|
|
-------------------------------------------------------
|
2025-06-10 16:11:48 +08:00
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
self._ctr_state.selectedIndex = 4
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:EventInit()
|
|
|
|
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
|
|
|
|
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-06-12 15:17:53 +08:00
|
|
|
_gamectr:AddEventListener(GameEvent.PlayerEnter, function(...)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
print("lingmeng witness PlayerEnter")
|
|
|
|
|
end)
|
|
|
|
|
|
2025-06-10 16:11:48 +08:00
|
|
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
print("lingmeng witness SendLaiZi")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
print("lingmeng witness SendGangZi")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
print("lingmeng witness EventBuGang")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
|
|
|
|
print("lingmeng witness SendCards")
|
2025-06-12 15:17:53 +08:00
|
|
|
-- self:ShowJing()
|
|
|
|
|
if self._clearingView then
|
|
|
|
|
self._clearingView:Destroy()
|
|
|
|
|
self._clearingView = nil
|
|
|
|
|
end
|
|
|
|
|
self:UpdateRound()
|
|
|
|
|
self._ctr_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:UpdateHandCardWitness()
|
|
|
|
|
end
|
2025-06-10 16:11:48 +08:00
|
|
|
end)
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
|
|
|
|
print("lingmeng witness EventTurn")
|
2025-06-10 18:48:57 +08:00
|
|
|
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)]
|
2025-06-10 20:36:42 +08:00
|
|
|
print("lingmeng hand_left_count", info._player.hand_left_count)
|
|
|
|
|
info._player.hand_left_count = info._player.hand_left_count + 1
|
2025-06-10 18:48:57 +08:00
|
|
|
info:UpdateHandCardWitness(true)
|
2025-06-10 16:11:48 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
|
|
|
|
print("lingmeng witness OutHint")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
2025-06-10 19:49:18 +08:00
|
|
|
print("lingmeng witness OutCard")
|
2025-06-10 18:48:57 +08:00
|
|
|
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)]
|
2025-06-10 19:49:18 +08:00
|
|
|
print("lingmeng witness OutCard1", self:GetPos(seat), info)
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
self:RemoveCursor()
|
2025-06-10 19:49:18 +08:00
|
|
|
print("lingmeng witness OutCard1-2")
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
info:UpdateHandCardWitness(false)
|
2025-06-10 19:49:18 +08:00
|
|
|
print("lingmeng witness OutCard2")
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
info:UpdateOutCardList(nil, nil, self._cursor)
|
|
|
|
|
print("ling 2zhihouq")
|
2025-06-25 22:49:44 +08:00
|
|
|
-- self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card))
|
|
|
|
|
-- self:PlayMJSound("chupai.mp3")
|
2025-06-10 18:48:57 +08:00
|
|
|
print("ling 2zhihou")
|
|
|
|
|
if seat == _room.self_player.seat then
|
|
|
|
|
_room.curren_outcard_seat = -1
|
|
|
|
|
end
|
|
|
|
|
print("ling 2zhihou2")
|
2025-06-10 16:11:48 +08:00
|
|
|
end)
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
|
|
|
|
print("lingmeng witness GetCard")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
|
|
|
|
print("lingmeng witness FZTips")
|
|
|
|
|
end)
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
2025-06-10 16:11:48 +08:00
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
|
|
|
|
print("lingmeng witness ZPHuCard")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
|
|
|
|
print("lingmeng witness EventNiao")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
|
|
|
|
print("lingmeng witness ZPResult1")
|
2025-06-11 10:59:32 +08:00
|
|
|
self._popEvent = false
|
|
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
|
|
|
|
self._ctr_cardbox.selectedIndex = 0
|
|
|
|
|
local arg = { ... }
|
2025-07-18 16:28:57 +08:00
|
|
|
self:ShowHand(arg)
|
2025-06-11 10:59:32 +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 = EXClearingView.new(self._root_view)
|
2025-07-29 01:47:38 +08:00
|
|
|
self._clearingView._root_view:GetChild("win_mode").visible = false
|
2025-06-11 10:59:32 +08:00
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._clearingView:Show()
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
print("lingmeng witness ZPResult2")
|
|
|
|
|
|
|
|
|
|
if _room.curren_round ~= _room.room_config.round then
|
|
|
|
|
-- if #niao == 0 then self._view:GetChild("n13").visible = false end
|
2025-06-12 15:17:53 +08:00
|
|
|
for i = 1, #data do
|
|
|
|
|
local p = _room:GetPlayerBySeat(data[i].seat)
|
|
|
|
|
if p then
|
|
|
|
|
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
|
2025-06-11 10:59:32 +08:00
|
|
|
end
|
2025-06-12 15:17:53 +08:00
|
|
|
-- info:UpdateScore()
|
|
|
|
|
info._view:GetChild("zhanji").visible = true
|
|
|
|
|
local num = data[i].hp_info.total_hp
|
|
|
|
|
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.fz_list = {}
|
2025-06-11 10:59:32 +08:00
|
|
|
end
|
2025-06-12 15:17:53 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self._clearingView:InitData(0, _room, result, nil, function(...)
|
2025-06-11 10:59:32 +08:00
|
|
|
DataManager.CurrenRoom.self_player.card_list = {}
|
2025-06-11 16:45:21 +08:00
|
|
|
self._ctr_state.selectedIndex = 2
|
2025-06-11 10:59:32 +08:00
|
|
|
self._clearingView = nil
|
2025-06-11 16:45:21 +08:00
|
|
|
end, 1)
|
2025-06-11 10:59:32 +08:00
|
|
|
end
|
|
|
|
|
print("lingmeng witness ZPResult3")
|
|
|
|
|
|
|
|
|
|
-- self._player_card_info[1]:ShowHuTip()
|
2025-06-10 16:11:48 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
|
|
|
|
print("lingmeng witness ZPResult2")
|
2025-06-12 15:17:53 +08:00
|
|
|
-- self:UnmarkSelfTuoguan()
|
2025-06-11 10:59:32 +08:00
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
|
|
|
|
self._ctr_cardbox.selectedIndex = 0
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
local total_result = arg[2]
|
|
|
|
|
local result = arg[1]
|
|
|
|
|
local over = arg[3]
|
|
|
|
|
self._clearingView = EXClearingView.new()
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._clearingView:Show()
|
|
|
|
|
end)
|
|
|
|
|
self._clearingView:InitData(over, _room, result, total_result)
|
|
|
|
|
ControllerManager.ChangeController(LoddyController)
|
2025-06-10 16:11:48 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
|
|
|
|
|
print("lingmeng witness EvnetPiaoTip")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
|
|
|
|
print("lingmeng witness EvnetPiao")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
|
|
|
|
print("lingmeng witness EventResidueCard")
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:InitPlayerInfoView()
|
|
|
|
|
self._player_info = {}
|
|
|
|
|
local _player_info = self._player_info
|
|
|
|
|
for i = 1, self._room.room_config.people_num do
|
|
|
|
|
local tem = self._view:GetChild(string.format("player_info%d_2", i))
|
|
|
|
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
|
|
|
|
tem.visible = false
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:NewMJPlayerCardInfoView(view, index)
|
|
|
|
|
if index == 1 then
|
|
|
|
|
return MJPlayerSelfCardInfoView.new(view, self)
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
2025-06-10 18:48:57 +08:00
|
|
|
return MJPlayerCardInfoView.new(view, self)
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:RemoveCursor()
|
|
|
|
|
self._cursor:RemoveFromParent()
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:UpdateCardBox(seat)
|
|
|
|
|
local index = seat - 1
|
|
|
|
|
local people_num = self._room.room_config.people_num
|
|
|
|
|
if people_num == 2 and seat == 2 then
|
|
|
|
|
index = 2
|
|
|
|
|
end
|
|
|
|
|
self._ctr_cardbox.selectedIndex = index
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:OnFangziAction(...)
|
2025-06-10 20:36:42 +08:00
|
|
|
print("lingmeng OnFangziAction")
|
|
|
|
|
-- self:__CloseTip()
|
|
|
|
|
print("lingmeng OnFangziAction1")
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
local arg = { ... }
|
|
|
|
|
local _player_card_info = self._player_card_info
|
|
|
|
|
local fz = arg[1]
|
|
|
|
|
local player = arg[2]
|
|
|
|
|
local index = arg[3]
|
|
|
|
|
printlog("OnFangziAction")
|
|
|
|
|
local info = _player_card_info[self:GetPos(player.seat)]
|
|
|
|
|
-- local pNode = info._mask_liangpai
|
2025-06-10 16:11:48 +08:00
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
self:RemoveCursor()
|
|
|
|
|
if (player.seat ~= fz.from_seat) then
|
|
|
|
|
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
|
|
|
|
fs_info:UpdateOutCardList()
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
2025-06-10 20:36:42 +08:00
|
|
|
print("lingmeng OnFangziAction5")
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
info:UpdateFzList(fz, index, true)
|
|
|
|
|
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
|
|
|
|
printlog(getcard)
|
2025-06-10 20:36:42 +08:00
|
|
|
|
|
|
|
|
print("lingmeng hand_left_count", info._player.hand_left_count)
|
|
|
|
|
info._player.hand_left_count = info._player.hand_left_count - 1
|
|
|
|
|
info:UpdateHandCardWitness(true)
|
|
|
|
|
-- self:__CloseTip()
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-12 15:17:53 +08:00
|
|
|
function M:UpdateRound()
|
|
|
|
|
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
|
|
|
|
|
self._room.room_config.round)
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:OnUpdate()
|
|
|
|
|
if (self._popEvent) then
|
|
|
|
|
local func = self._gamectr:PopEvent()
|
|
|
|
|
if (func ~= nil) then
|
2025-06-12 15:17:53 +08:00
|
|
|
local success, result = pcall(func)
|
|
|
|
|
if success then
|
2025-06-10 18:48:57 +08:00
|
|
|
|
|
|
|
|
else
|
2025-06-12 15:17:53 +08:00
|
|
|
print("witness error")
|
|
|
|
|
print(result)
|
2025-06-10 18:48:57 +08:00
|
|
|
-- self._gamectr = ControllerManager.GetController(GameController)
|
|
|
|
|
-- if self._gamectr then
|
|
|
|
|
-- self._gamectr:ResetConnect()
|
|
|
|
|
-- end
|
|
|
|
|
end
|
|
|
|
|
--func()
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-12 15:17:53 +08:00
|
|
|
function M:ResetConnect()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-10 18:48:57 +08:00
|
|
|
function M:GetPos(seat)
|
|
|
|
|
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
2025-06-10 16:11:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M.HandCardSortAndJing(a, b)
|
|
|
|
|
local jing = DataManager.CurrenRoom.jing
|
|
|
|
|
if a == jing or b == jing then
|
|
|
|
|
if a == b then
|
|
|
|
|
return a < b
|
|
|
|
|
end
|
|
|
|
|
return a == jing
|
|
|
|
|
else
|
|
|
|
|
if a < 200 then
|
|
|
|
|
a = a + 1000
|
|
|
|
|
elseif a < 300 then
|
|
|
|
|
a = a + 3000
|
|
|
|
|
elseif a < 400 then
|
|
|
|
|
a = a + 2000
|
|
|
|
|
else
|
|
|
|
|
a = a + 4000
|
|
|
|
|
end
|
|
|
|
|
if b < 200 then
|
|
|
|
|
b = b + 1000
|
|
|
|
|
elseif b < 300 then
|
|
|
|
|
b = b + 3000
|
|
|
|
|
elseif b < 400 then
|
|
|
|
|
b = b + 2000
|
|
|
|
|
else
|
|
|
|
|
b = b + 4000
|
|
|
|
|
end
|
|
|
|
|
return a < b
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|