黎川添加全球人,showNext只点击一次,结束时展示小结算

master
罗家炜 2025-04-16 15:52:21 +08:00
parent 0d39226ccb
commit ddf0979dbe
19 changed files with 478 additions and 213 deletions

View File

@ -448,9 +448,7 @@ function M:Show()
if user.group_id ~= 0 then if user.group_id ~= 0 then
local msg_tip = MsgWindow.new(self._root_view, "还在圈子的房间中,现在重连吗?", MsgWindow.MsgMode.OkAndCancel) local msg_tip = MsgWindow.new(self._root_view, "还在圈子的房间中,现在重连吗?", MsgWindow.MsgMode.OkAndCancel)
msg_tip.onOk:Add(function() msg_tip.onOk:Add(function()
if self.groupMainView ~= nil then self:ReconnectRoom(user.group_id)
self.groupMainView:Show(user.group_id)
end
end) end)
msg_tip:Show() msg_tip:Show()
tem.auto_show = false tem.auto_show = false
@ -513,3 +511,35 @@ function M:OnApplicationActive()
end end
end end
end end
-----------------------lingmeng----------------------------
function M:ReconnectRoom(groupId)
local roomId = DataManager.SelfUser.room_id
print("===============================ReconnectRoom", roomId, 1)
if roomId and #roomId > 0 then
local roomCtr = ControllerManager.GetController(RoomController)
roomCtr:PublicJoinRoom(
Protocol.WEB_FG_JOIN_ROOM,
roomId,
false,
function(response)
if (response.ReturnCode == -1) then
ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, 'response.ReturnCode == -1')
RestartGame()
return
end
if response.ReturnCode ~= 0 then
ViewUtil.ErrorMsg(self._root_view, response.ReturnCode, '进入房间失败')
ViewManager.ChangeView(ViewManager.View_Family)
return
else
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
end
end,
groupId
)
end
end
-----------------------------------------------------------

View File

@ -6,6 +6,9 @@ local SettingView = import('.SettingView')
local PlayerDistanceView = import('.PlayerDistanceView') local PlayerDistanceView = import('.PlayerDistanceView')
local FGAssistView = import('.FGAssistView') local FGAssistView = import('.FGAssistView')
--lingmeng新全局标记
lingmengxin = true
-- MainView -- MainView
MainView = {} MainView = {}

View File

@ -11,5 +11,6 @@ local CS_Win_Type = {
"德国", "德国",
"抢杠胡", "抢杠胡",
"杠上花", "杠上花",
"全求人"
} }
return CS_Win_Type return CS_Win_Type

View File

@ -40,6 +40,7 @@ function M:InitData(over, room, result, total_result, callback)
local _overCtr = self._view:GetController("over") local _overCtr = self._view:GetController("over")
local mainCtr = self._view:GetController("main") local mainCtr = self._view:GetController("main")
local playerNum = self._view:GetController("playerNum") local playerNum = self._view:GetController("playerNum")
local showBtnTypeCtr = self._view:GetController("showType")
local peopleNum = room.room_config.people_num local peopleNum = room.room_config.people_num
@ -55,22 +56,27 @@ function M:InitData(over, room, result, total_result, callback)
self:DestroyWithCallback() self:DestroyWithCallback()
end) end)
nextRoundBtn2.onClick:Set(function()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:PlayerReady()
self:DestroyWithCallback()
end)
endRound.onClick:Set(function() endRound.onClick:Set(function()
ViewManager.ChangeView(ViewManager.View_Family) ViewManager.ChangeView(ViewManager.View_Family)
end) end)
if over == 0 then
_overCtr.selectedIndex = 0
self:fillResult0(room, peopleNum, result) self:fillResult0(room, peopleNum, result)
if over == 0 then
showBtnTypeCtr.selectedIndex = 0
_overCtr.selectedIndex = 0
nextRoundBtn2.onClick:Set(function()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:PlayerReady()
self:DestroyWithCallback()
end)
else else
_overCtr.selectedIndex = 1 showBtnTypeCtr.selectedIndex = 1
self:fillResult1(room, peopleNum, total_result) self:fillResult1(room, peopleNum, total_result)
nextRoundBtn2.onClick:Set(function()
_overCtr.selectedIndex = 1
end)
end end
end end

View File

@ -66,7 +66,12 @@ function M:InitView(url)
self._showNextName = nil self._showNextName = nil
end) end)
showNextList.onClickItem:Set(function(context) showNextList.onClickItem:Set(function(context)
self:ClickShowNext(context, ShowNextConfrimCtr) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendNextCard(string.sub(context.data.name, -3))
showNextCtr.selectedIndex = 0
showNextList.selectedIndex = -1
self._showNextName = nil
-- self:ClickShowNext(context, ShowNextConfrimCtr)
end) end)
ShowNextConfrimCtr.onChanged:Set(function() ShowNextConfrimCtr.onChanged:Set(function()
pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName
@ -405,7 +410,6 @@ function M:EventInit()
local tem = win_list[i] local tem = win_list[i]
if tem.type > 0 and tem.type < 32 then if tem.type > 0 and tem.type < 32 then
local com_name = "he" .. tem.type local com_name = "he" .. tem.type
-- print("===================================com_name", com_name)
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name) local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
coroutine.wait(0.3) coroutine.wait(0.3)
end end

View File

@ -1,5 +1,5 @@
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") local MJPlayerCardInfoView = require(".MJPlayerCardInfoView")
local MJMainView = require("main.majiang.MJMainView") local MJMainView = require("main.majiang.MJMainView")
local EXClearingView = import(".EXClearingView") local EXClearingView = import(".EXClearingView")
local TX_GameEvent = import(".GameEvent") local TX_GameEvent = import(".GameEvent")
@ -54,6 +54,10 @@ function M:InitView(url)
local showNextList = self._view:GetChild('list_showNext') local showNextList = self._view:GetChild('list_showNext')
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim') local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
local btn_closeRoom = self._view:GetChild("btn_setting") local btn_closeRoom = self._view:GetChild("btn_setting")
local conterBoxComp = self._view:GetChild("Comp_ConterBox")
self._ctr_cardbox = conterBoxComp:GetController("type")
self._tex_leftTime = conterBoxComp:GetChild("Text_Time")
self._view:GetChild('btn_closeRoom').onClick:Set(function() self._view:GetChild('btn_closeRoom').onClick:Set(function()
---[[ ---[[
@ -199,8 +203,9 @@ function M:InitPlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = self._player_info local _player_info = self._player_info
for i = 1, self._room.room_config.people_num do for i = 1, self._room.room_config.people_num do
print("================================InitPlayerInfoView", string.format("player_info%d_1", i)) print("================================InitPlayerInfoView",
local tem = self._view:GetChild(string.format("player_info%d_1", i)) string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
local tem = self._view:GetChild(string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
_player_info[i] = PlayerInfoView.new(tem, self) _player_info[i] = PlayerInfoView.new(tem, self)
tem.visible = false tem.visible = false
end end
@ -877,17 +882,6 @@ function M:PlayerChangeLineState()
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard -- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
end 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
-----------------------lingmeng---------------------------- -----------------------lingmeng----------------------------
function M:SendShowNext(ShowNextConfrimCtr) function M:SendShowNext(ShowNextConfrimCtr)
if not self._showNextName then if not self._showNextName then
@ -908,15 +902,20 @@ end
function M:UpdatePlayerInfoView() function M:UpdatePlayerInfoView()
self._player_info = {} self._player_info = {}
local _player_info = 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 for i = 1, self._room.room_config.people_num do
print("==============================UpdatePlayerInfoView",
string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
local tem = self._view:GetChild(string.format("player_info%d_%d", i, self._state.selectedIndex + 1)) local tem = self._view:GetChild(string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
_player_info[i] = PlayerInfoView.new(tem, self) _player_info[i] = PlayerInfoView.new(tem, self)
_player_info[i]:FillData(list[i])
end end
end end
function M:UpdateCardBox(seat)
local index = seat
self._ctr_cardbox.selectedIndex = index - 1
end
----------------------------------------------------------- -----------------------------------------------------------

View File

@ -60,7 +60,9 @@ function M:FillRoomConfig(room, _config)
end end
function M:FillRoomData(s2croom) function M:FillRoomData(s2croom)
print("==========================FillRoomData1")
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
pt(room)
local reload = s2croom["reload"] local reload = s2croom["reload"]
@ -108,8 +110,10 @@ function M:FillRoomData(s2croom)
fz.card = op["card"] fz.card = op["card"]
p.fz_list[#p.fz_list + 1] = fz p.fz_list[#p.fz_list + 1] = fz
end end
print("=======================在此进入", playing)
if not playing and room.curren_round > 0 then if not playing and room.curren_round > 0 then
-- print("=======================在此进入") print("=======================在此进入")
self.GetGameController():PlayerReady() self.GetGameController():PlayerReady()
end end
end end

View File

@ -0,0 +1,213 @@
local MJPlayerSelfCardInfoView = require("main.majiang.MJPlayerSelfCardInfoView")
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
local CardCheck = import(".CardCheck")
local M = {}
--
function M.new(view, mainView)
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
local self = setmetatable({}, { __index = M })
self.class = "PlayerSelfCardInfoView"
self._view = view
self._mainView = mainView
self:init()
return self
end
function M:ShowHuTip(card_list)
printlog("ShowHuTip")
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
DataManager.CurrenRoom.room_config.Laizi)
pt(tingList)
if #tingList > 0 then
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
for i = 1, #DataManager.CurrenRoom.laiziInfo do
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
end
end
end
end
self._mainView._hu_tip:FillData(tingList)
end
function M:UpdateHandCard(getcard, mp)
print("====================================UpdateHandCard1", mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
for i = 1, #self._carViewList do
local obj = self._carViewList[i]
if obj and obj.card then
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
if obj.card.GetController then
if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex = 1
end
end
else
if obj.card.GetController then
if obj.card:GetController("laizi") then
obj.card:GetController("laizi").selectedIndex = 0
end
end
end
end
end
end
print("====================================UpdateHandCard3")
local card_list = DataManager.CurrenRoom.self_player.card_list
self:ShowHuTip(card_list)
if getcard then
self._out_card = true
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
-- 记录需要标记听牌提示的牌
local lst_mark = {}
local total_num = 0
for i = 1, #_carViewList do
local btn = _carViewList[i].card
local card = self:GetCard(btn)
list_remove(card_list, card)
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
if #tingList > 0 then
local count = 0
for j = 1, #tingList do
count = count + self._mainView:CountCardLeftNum(tingList[j])
end
local tem = {}
tem.item = btn
tem.count = count
total_num = total_num + count
table.insert(lst_mark, tem)
end
table.insert(card_list, card)
end
table.sort(lst_mark, function(a, b)
return a.count > b.count
end)
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
for i = 1, #lst_mark do
local tem = lst_mark[i]
if all_same or tem.count < lst_mark[1].count then
tem.item:GetController("mark_ting").selectedIndex = 1
else
tem.item:GetController("mark_ting").selectedIndex = 2
end
end
else
for i = 1, #_carViewList do
local btn = _carViewList[i].card
if btn:GetController("mark_ting").selectedIndex ~= 0 then
btn:GetController("mark_ting").selectedIndex = 0
end
end
self._out_card = false
end
end
function M:__OnClickHandCard(context)
-- print("==========================__OnClickHandCard")
local button = context.sender
local _carViewList = self._carViewList
local refresh = true
local card_list = {}
for i = 1, #_carViewList do
local btn = _carViewList[i].card
local card = self:GetCard(btn)
if btn ~= button and btn.selected == true then
if button.data.card_item == card then
refresh = false
else
self._mainView:markOutCards(false, card)
end
btn.selected = false
end
if not btn.selected then
table.insert(card_list, card)
end
end
if self._out_card then
self:ShowHuTip(card_list)
end
-- 标记出牌
if refresh then
if button.selected then
self._mainView:markOutCards(true, button.data.card_item)
else
self._mainView:markOutCards(false, button.data.card_item)
end
end
local _room = DataManager.CurrenRoom
if not button.selected and _room.curren_outcard_seat == _room.self_player.seat then
local card = button.data
self._mainView:OutCard(card.card_item)
end
end
function M:__OnDragStart(card)
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
list_remove(card_list, card)
self:ShowHuTip(card_list)
end
function M:__OnDragEnd(context)
if self.outcard_button then
self.outcard_button:Dispose()
self.outcard_button = nil
end
local button = context.sender
--button:RemoveFromParent()
local card = button.data
local _room = DataManager.CurrenRoom
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
self._mainView:OutCard(card.card_item)
button.touchable = false
self.outcard_button = button
else
self._area_handcard_list:AddChildAt(button, card.index)
button:TweenMove(card.old_postion, 0.2)
end
end
function M:CheckPlayerOnlineState()
local room = DataManager.CurrenRoom
for i = 1, #room.player_list do
if room.player_list[i].line_state == 0 then
return false
end
end
return true
end
function M:Clear(bskip)
--self._ctr_state.selectedIndex = 0
self._area_fz_list.x = self._src_fz_list.x
self._area_fz_list.y = self._src_fz_list.y
self._area_fz_list.width = self._src_fz_list.z
self._area_fz_list.height = self._src_fz_list.w
self._area_fz_list:RemoveChildren(0, -1, true)
self._area_handcard_list:RemoveChildren(0, -1, true)
self._area_outcard_list:RemoveChildren(0, -1, true)
if bskip == nil or bskip == false then
self._mask_liangpai:RemoveChildren(0, -1, true)
end
for i = 1, #self._carViewList do
self._carViewList[i].card:Dispose()
end
self._carViewList = {}
end
return M

View File

@ -33,6 +33,7 @@ function M:ShowHuTip(card_list)
end end
function M:UpdateHandCard(getcard, mp) function M:UpdateHandCard(getcard, mp)
print("====================================UpdateHandCard1", mp)
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp) MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
local _carViewList = self._carViewList local _carViewList = self._carViewList
@ -57,7 +58,7 @@ function M:UpdateHandCard(getcard, mp)
end end
end end
print("====================================UpdateHandCard3")
local card_list = DataManager.CurrenRoom.self_player.card_list local card_list = DataManager.CurrenRoom.self_player.card_list
self:ShowHuTip(card_list) self:ShowHuTip(card_list)
if getcard then if getcard then

View File

@ -138,6 +138,8 @@ function M:GetCard(btn)
end end
function M:UpdateHandCard(getcard, mp) function M:UpdateHandCard(getcard, mp)
print("====================================UpdateHandCard4")
getcard = getcard or false getcard = getcard or false
mp = mp or false mp = mp or false
local handcard_list = self._mask_data['handcard_list'] local handcard_list = self._mask_data['handcard_list']

View File

@ -65,6 +65,8 @@ function M:setHandCardPos(btn_card, i, getcard)
end end
function M:UpdateHandCard(getcard, mp) function M:UpdateHandCard(getcard, mp)
print("====================================UpdateHandCard2")
if self.outcard_button then if self.outcard_button then
self.outcard_button:Dispose() self.outcard_button:Dispose()
self.outcard_button = nil self.outcard_button = nil

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 KiB

After

Width:  |  Height:  |  Size: 820 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 256 KiB