2025-06-25 22:49:44 +08:00
|
|
|
local EXRoomConfig = import(".EXRoomConfig")
|
|
|
|
|
local EXClearingView = import(".EXClearingView")
|
|
|
|
|
local TX_GameEvent = import(".GameEvent")
|
|
|
|
|
local PlayerInfoView = import(".EXPlayerInfoView")
|
|
|
|
|
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
|
|
|
|
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
2025-08-28 19:15:06 +08:00
|
|
|
local SettingView = import(".EXSettingView")
|
2025-06-25 22:49:44 +08:00
|
|
|
local TableBG = require("Game.Data.TableBG")
|
2025-09-09 14:58:47 +08:00
|
|
|
local WitnessView = require("main.majiang.MJWitnessView")
|
2025-08-28 19:15:06 +08:00
|
|
|
local MJMainView = require("main.majiang.MJMainView")
|
2025-09-09 14:58:47 +08:00
|
|
|
local HuCardImg = import(".HuCardImg")
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
local Record_Event = import(".RecordEvent")
|
|
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
--- Create a new
|
|
|
|
|
function M.new()
|
2025-07-25 22:17:17 +08:00
|
|
|
setmetatable(M, { __index = WitnessView })
|
2025-06-25 22:49:44 +08:00
|
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
|
self.class = "EXMJWitness"
|
|
|
|
|
self:init()
|
|
|
|
|
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init()
|
2025-09-09 14:58:47 +08:00
|
|
|
getmetatable(M).__index.init(self)
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
|
2025-09-09 14:58:47 +08:00
|
|
|
function M:InitView()
|
2025-06-25 22:49:44 +08:00
|
|
|
local room = self._room
|
2025-09-09 14:58:47 +08:00
|
|
|
getmetatable(M).__index.InitView(self)
|
2025-06-25 22:49:44 +08:00
|
|
|
UIPackage.AddPackage("extend/majiang/fuzhou/ui/Extend_MJ_FuZhou")
|
|
|
|
|
self:EventInit()
|
|
|
|
|
UpdateBeat:Add(self.OnUpdate, self)
|
2025-09-09 14:58:47 +08:00
|
|
|
|
|
|
|
|
self.HuCardImg = setmetatable(HuCardImg, { __index = self.HuCardImg })
|
2025-09-09 21:06:16 +08:00
|
|
|
self.Sound_path = "extend/majiang/fuzhou/sound/"
|
2025-06-25 22:49:44 +08:00
|
|
|
local centerBox = self._view:GetChild("Comp_ConterBox")
|
|
|
|
|
self._ctr_cardbox = centerBox:GetController("seat")
|
|
|
|
|
self._tex_leftTime = centerBox:GetChild("Text_Time")
|
|
|
|
|
self._tex_round = self._view:GetChild("tex_round")
|
|
|
|
|
self._tex_LeftCard = self._view:GetChild("remaining_card")
|
|
|
|
|
self._anchor = self._view:GetChild("mask_tips")
|
|
|
|
|
|
|
|
|
|
------------------渲染桌面信息--------------------------
|
|
|
|
|
local config = ExtendManager.GetExtendConfig(room.game_id)
|
|
|
|
|
local mode = config:GetGameInfo()
|
2025-08-23 22:23:17 +08:00
|
|
|
local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config), json.encode(room.room_config.hpData))
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
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
|
2025-09-03 16:52:14 +08:00
|
|
|
self._state = self._view:GetController("state")
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
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-09-09 14:58:47 +08:00
|
|
|
-- self._state.onChanged:Add(function()
|
|
|
|
|
-- self:UpdatePlayerInfoView()
|
|
|
|
|
-- end)
|
2025-06-25 22:49:44 +08:00
|
|
|
|
|
|
|
|
self:UpdateRound()
|
|
|
|
|
self:InitPlayerInfoView()
|
|
|
|
|
self._player_card_info = {}
|
|
|
|
|
local _player_card_info = self._player_card_info
|
2025-09-10 21:55:18 +08:00
|
|
|
if room.curren_round > 0 then
|
2025-09-11 16:43:36 +08:00
|
|
|
for i = 1, #room.player_list do
|
2025-09-10 21:55:18 +08:00
|
|
|
local p = room.player_list[i]
|
|
|
|
|
local index = self:GetPos(p.seat)
|
|
|
|
|
print("lingmeng index", index)
|
|
|
|
|
local info = self._player_info[i]
|
|
|
|
|
local tem = self._view:GetChild("player_card_info" .. i)
|
|
|
|
|
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
|
|
|
|
local cardInfo = _player_card_info[i]
|
|
|
|
|
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)
|
2025-09-11 16:43:36 +08:00
|
|
|
info._view.visible = true
|
2025-09-10 21:55:18 +08:00
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
for i = 1, room.room_config.people_num do
|
|
|
|
|
local tem = self._view:GetChild("player_card_info" .. i)
|
|
|
|
|
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #room.player_list do
|
|
|
|
|
local p = room.player_list[i]
|
|
|
|
|
local index = self:GetPos(p.seat)
|
|
|
|
|
local info = self._player_info[i]
|
|
|
|
|
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
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-10 21:55:18 +08:00
|
|
|
|
2025-06-25 22:49:44 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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-08-28 19:15:06 +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()
|
|
|
|
|
self._view:GetController('witness').selectedIndex = 1
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
--直接渲染观战人员
|
|
|
|
|
if viewList_witness.numItems == #room.witness_player_list then
|
|
|
|
|
viewList_witness:RefreshVirtualList()
|
|
|
|
|
else
|
|
|
|
|
viewList_witness.numItems = #room.witness_player_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--展示精牌
|
|
|
|
|
self.jing = self._view:GetChild('jing')
|
|
|
|
|
self:ShowJing()
|
2025-06-25 22:49:44 +08:00
|
|
|
-------------------------------------------------------
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
self._state.selectedIndex = 4
|
2025-07-30 22:31:32 +08:00
|
|
|
self.com_logocType.selectedIndex = 0
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:EventInit()
|
|
|
|
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
2025-09-12 15:36:45 +08:00
|
|
|
getmetatable(M).__index.EventInit(self)
|
2025-06-25 22:49:44 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
_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.OutHint, function(...)
|
|
|
|
|
print("lingmeng witness OutHint")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
|
|
|
|
print("lingmeng witness GetCard")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
|
|
|
|
print("lingmeng witness FZTips")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
2025-09-10 21:55:18 +08:00
|
|
|
self._popEvent = false
|
2025-09-09 14:58:47 +08:00
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
|
|
|
|
local arg = { ... }
|
|
|
|
|
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 scoreData = arg[6]
|
|
|
|
|
local index = self:GetPos(win_seat)
|
|
|
|
|
local info = self._player_card_info[index]
|
|
|
|
|
local player = self._room:GetPlayerBySeat(win_seat)
|
|
|
|
|
info:ShowHuCard(win_card, index == 1)
|
|
|
|
|
|
|
|
|
|
-- self.cHuCardEffect.selectedIndex = 1
|
|
|
|
|
|
|
|
|
|
local loader_HuEffect = info._viewLoader_selfHuCardEffect
|
|
|
|
|
local list_HuCardEffect = info._viewList_HuEffect
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
local isZiMo = win_seat == lose_seat
|
|
|
|
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
|
|
|
|
local hu_sound = isZiMo and ("zimo") or ("hu")
|
|
|
|
|
printlog("声音====>>>", hu_sound)
|
|
|
|
|
self:PlaySound(self.asset_group, player.self_user.sex, hu_sound)
|
|
|
|
|
|
|
|
|
|
local effects = isZiMo and ("tile_zimo") or ("tile_hu")
|
|
|
|
|
loader_HuEffect.visible = true
|
|
|
|
|
loader_HuEffect.url = "ui://Main_Majiang/" .. effects
|
|
|
|
|
loader_HuEffect:SetScale(2, 2)
|
|
|
|
|
loader_HuEffect:TweenScale(Vector2(1, 1), 0.3):SetEase(EaseType.QuartOut)
|
|
|
|
|
|
|
|
|
|
--观战暂时把这个特效去了,现在这个特效位置也不对
|
|
|
|
|
-- self.effect_ZiMo.xy = loader_HuEffect.xy
|
|
|
|
|
-- self.effect_ZiMo:SetPlaySettings(0, -1, 1, -1);
|
|
|
|
|
-- self.effect_ZiMo.visible = true
|
|
|
|
|
-- self.effect_ZiMo.playing = true
|
|
|
|
|
-- self.effect_ZiMo.onPlayEnd:Set(function()
|
|
|
|
|
-- self.effect_ZiMo.visible = false
|
|
|
|
|
-- end)
|
|
|
|
|
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
|
|
|
|
|
loader_HuEffect.visible = false
|
|
|
|
|
local Effects = {}
|
|
|
|
|
for i = 1, #win_list do
|
|
|
|
|
local HuMsg = win_list[i]
|
|
|
|
|
|
|
|
|
|
-- ↓↓↓先排列好特效图片
|
|
|
|
|
if HuMsg.type > 2 and HuMsg.type < 32 then
|
2025-09-09 21:06:16 +08:00
|
|
|
local sound_name = string.format(self.Sound_path .. "%s/%s.mp3",
|
|
|
|
|
ViewUtil.Sex_Chat[player.self_user.sex],
|
|
|
|
|
"he" .. HuMsg.type)
|
|
|
|
|
ViewUtil.PlaySound(self.asset_group, sound_name)
|
|
|
|
|
-- self:PlaySound(self.asset_group, player.self_user.sex, "he" .. HuMsg.type)
|
2025-09-09 14:58:47 +08:00
|
|
|
local imgList = self.HuCardImg[HuMsg.type]
|
|
|
|
|
for _, img in pairs(imgList) do
|
|
|
|
|
local imgPath = "ui://Main_Majiang/" .. img
|
|
|
|
|
local imgObj = list_HuCardEffect:AddItemFromPool()
|
|
|
|
|
local imgLoader = imgObj:GetChild("loader_img")
|
|
|
|
|
imgLoader.url = imgPath
|
|
|
|
|
imgObj.visible = false
|
|
|
|
|
Effects[#Effects + 1] = imgObj
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- ↓↓↓播放动画
|
|
|
|
|
for _, imgObj in pairs(Effects) do
|
|
|
|
|
imgObj.visible = true
|
|
|
|
|
|
|
|
|
|
local effect_xingxing = imgObj:GetChild("effect_xingxing")
|
|
|
|
|
effect_xingxing:SetPlaySettings(0, -1, 1, -1);
|
|
|
|
|
effect_xingxing.visible = true
|
|
|
|
|
effect_xingxing.playing = true
|
|
|
|
|
effect_xingxing.onPlayEnd:Set(function()
|
|
|
|
|
effect_xingxing.visible = false
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
local imgLoader = imgObj:GetChild("loader_img")
|
|
|
|
|
imgLoader:SetScale(2, 2)
|
|
|
|
|
imgLoader:Center()
|
|
|
|
|
imgLoader:TweenScale(Vector2(1, 1), 0.3)
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 扣分动画
|
|
|
|
|
for _, pScore in pairs(scoreData) do
|
|
|
|
|
local infoView = self._player_info[self:GetPos(pScore.seat)]
|
|
|
|
|
infoView:UpdateScore(pScore.total_score, true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
list_HuCardEffect:RemoveChildrenToPool()
|
|
|
|
|
|
|
|
|
|
-- self.cHuCardEffect.selectedIndex = 0
|
|
|
|
|
end)
|
2025-06-25 22:49:44 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
|
|
|
|
print("lingmeng witness EventNiao")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
2025-09-12 15:36:45 +08:00
|
|
|
self:PlayMJSound("end_music.mp3")
|
2025-08-28 19:15:06 +08:00
|
|
|
local _room = self._room
|
2025-06-25 22:49:44 +08:00
|
|
|
self._left_time = 0
|
|
|
|
|
self:UpdateCardBox(0)
|
|
|
|
|
self._ctr_cardbox.selectedIndex = 0
|
|
|
|
|
local arg = { ... }
|
2025-08-28 19:15:06 +08:00
|
|
|
MJMainView.ShowHand(self, arg)
|
2025-06-25 22:49:44 +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
|
2025-09-09 14:58:47 +08:00
|
|
|
-- self:RemoveCursor()
|
2025-06-25 22:49:44 +08:00
|
|
|
if self._clearingView == nil then
|
|
|
|
|
self._clearingView = EXClearingView.new(self._root_view)
|
2025-09-12 15:36:45 +08:00
|
|
|
self._clearingView._view:GetChild('btn_setting').onClick:Set(handler(self,self.ClickSetting))
|
2025-06-25 22:49:44 +08:00
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._clearingView:Show()
|
|
|
|
|
self._popEvent = true
|
|
|
|
|
end)
|
|
|
|
|
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(...)
|
2025-09-12 15:36:45 +08:00
|
|
|
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
|
2025-06-25 22:49:44 +08:00
|
|
|
DataManager.CurrenRoom.self_player.card_list = {}
|
|
|
|
|
self._clearingView = nil
|
2025-08-28 19:15:06 +08:00
|
|
|
end)
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
|
|
|
|
print("lingmeng witness ZPResult2")
|
2025-09-12 15:36:45 +08:00
|
|
|
self:UnmarkSelfTuoguan()
|
2025-06-25 22:49:44 +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()
|
2025-09-10 21:55:18 +08:00
|
|
|
if over ~= 2 or _room.curren_round > 0 then
|
|
|
|
|
coroutine.start(function()
|
|
|
|
|
coroutine.wait(0.5)
|
|
|
|
|
self._clearingView:Show()
|
|
|
|
|
end)
|
|
|
|
|
end
|
2025-06-25 22:49:44 +08:00
|
|
|
self._clearingView:InitData(over, _room, result, total_result)
|
|
|
|
|
ControllerManager.ChangeController(LoddyController)
|
|
|
|
|
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)
|
2025-09-12 15:36:45 +08:00
|
|
|
|
|
|
|
|
--替换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
|
|
|
|
|
)
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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))
|
2025-09-12 15:36:45 +08:00
|
|
|
_player_info[i] = PlayerInfoView.new(tem, self,true)
|
2025-06-25 22:49:44 +08:00
|
|
|
tem.visible = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:NewMJPlayerCardInfoView(view, index)
|
2025-08-19 22:17:52 +08:00
|
|
|
return MJMainView.NewMJPlayerCardInfoView(self, view, index)
|
|
|
|
|
--[[
|
2025-06-25 22:49:44 +08:00
|
|
|
if index == 1 then
|
|
|
|
|
return MJPlayerSelfCardInfoView.new(view, self)
|
|
|
|
|
end
|
|
|
|
|
return MJPlayerCardInfoView.new(view, self)
|
2025-08-19 22:17:52 +08:00
|
|
|
]]
|
2025-06-25 22:49:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:RemoveCursor()
|
|
|
|
|
self._cursor:RemoveFromParent()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
local majiang_asset_path = "base/main_majiang/sound/"
|
|
|
|
|
function M:PlayMJSound(path)
|
|
|
|
|
ViewUtil.PlaySound(self.asset_group, majiang_asset_path .. path)
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-09 14:58:47 +08:00
|
|
|
function M:PlaySound(group, sex, path)
|
|
|
|
|
local sex_path = ViewUtil.Sex_Chat[sex]
|
|
|
|
|
local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
|
|
|
|
|
ViewUtil.PlaySound(group, path1)
|
|
|
|
|
end
|
|
|
|
|
|
2025-06-25 22:49:44 +08:00
|
|
|
function M:UpdateRound()
|
2025-08-06 19:39:06 +08:00
|
|
|
self._view:GetChild("text_round").text = string.format("局数:%d /%d", self._room.curren_round,
|
2025-06-25 22:49:44 +08:00
|
|
|
self._room.room_config.round)
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-03 16:52:14 +08:00
|
|
|
function M:ShowJing()
|
|
|
|
|
if self._room.jing then
|
|
|
|
|
self.jing.visible = true
|
2025-09-09 14:58:47 +08:00
|
|
|
MJPlayerCardInfoView.fillCard2(self, self.jing, "b202_", self._room.jing)
|
2025-09-03 16:52:14 +08:00
|
|
|
else
|
|
|
|
|
self.jing.visible = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-09-09 14:58:47 +08:00
|
|
|
-- function M:UpdatePlayerInfoView()
|
|
|
|
|
-- self._player_info = {}
|
|
|
|
|
-- local _player_info = self._player_info
|
|
|
|
|
-- local list = self._room.player_list
|
|
|
|
|
|
|
|
|
|
-- for i = 1, self._room.room_config.people_num do
|
|
|
|
|
-- local seat = self:GetPos(list[i].seat)
|
|
|
|
|
-- local tem = self._view:GetChild(string.format("player_info%d_%d", seat,
|
|
|
|
|
-- (self._state.selectedIndex == 4 and 1 or 0) + 1))
|
|
|
|
|
-- _player_info[seat] = PlayerInfoView.new(tem, self)
|
|
|
|
|
-- _player_info[seat]:FillData(list[i])
|
|
|
|
|
-- printlog("lingmeng _player_info", tem, seat, list[i].self_user.nick_name)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2025-09-03 16:52:14 +08:00
|
|
|
|
2025-06-25 22:49:44 +08:00
|
|
|
function M:ResetConnect()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetPos(seat)
|
|
|
|
|
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
|
|
|
|
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
|