master
DESKTOP-7R8JEQQ\k 2025-07-19 16:32:03 +08:00
parent d990d86d56
commit 0c75adcb2f
10 changed files with 102 additions and 59 deletions

View File

@ -32,6 +32,12 @@ GameEvent = {
--翻字 --翻字
FangziAnimation = "FangziAnimation", FangziAnimation = "FangziAnimation",
--加减分
AddScore = "AddScore",
--推送道具互动
MISSILE = "MISSILE"
} }
--- Base GameController --- Base GameController
@ -81,6 +87,7 @@ function M:init(name)
self._eventmap[Protocol.GAME_EVT_Exit_WITNESS_ROOM] = self.OnEvtExieWitness self._eventmap[Protocol.GAME_EVT_Exit_WITNESS_ROOM] = self.OnEvtExieWitness
self._eventmap[Protocol.GAME_GANGFEN] = self.OnEvtGANGFEN self._eventmap[Protocol.GAME_GANGFEN] = self.OnEvtGANGFEN
self._eventmap[Protocol.GAME_MISSILE] = self.OnEvtMISSILE
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips --self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
end end
@ -231,6 +238,12 @@ function M:SendGPS(str)
_client:send(Protocol.GAME_SEND_GPS, _data) _client:send(Protocol.GAME_SEND_GPS, _data)
end end
function M:SendMissile(_)
local _client = ControllerManager.GameNetClinet
local _data = {}
_client:send(Protocol.GAME_SENDMISSILE, _data)
end
--------------------事件----------------------------------- --------------------事件-----------------------------------
-- 房主退出 房间解散 -- 房主退出 房间解散
@ -636,10 +649,12 @@ end
function M:OnEvtGANGFEN(msg) function M:OnEvtGANGFEN(msg)
print("有人得分了") print("有人得分了")
local detSeat = msg["detSeat"] DispatchEvent(self._dispatcher, GameEvent.AddScore, nil, msg)
local formSeat = msg["formSeat"] end
local score = msg["score"]
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, false, t) function M:OnEvtMISSILE(msg)
print("有人扔番茄了")
DispatchEvent(self._dispatcher, GameEvent.MISSILE, nil, msg)
end end
function M:DispatchEventTuoGuan(p, isShow, t) function M:DispatchEventTuoGuan(p, isShow, t)

View File

@ -503,5 +503,11 @@ Protocol = {
GAME_AUTO_CARD = "1303", --开启游戏托管 GAME_AUTO_CARD = "1303", --开启游戏托管
--加分显示 --加分显示
GAME_GANGFEN = "gangfen", GAME_GANGFEN = "999",
--推送道具互动
GAME_MISSILE = "?",
--发送道具互动
GAME_SENDMISSILE = "?",
} }

View File

@ -320,9 +320,9 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
list_familyNumber:SetVirtual() list_familyNumber:SetVirtual()
fgCtr:FG_GroupMembers12(group_id, limit, num, 2, 2, function(res) fgCtr:FG_GroupMembers12(group_id, limit, num, 2, 2, function(res)
local members = self._group.members local members = self._group.members
-- print("==========================res.Data.members") print("FG_GroupMembers12")
pt(self._group.members) pt(self._group.members)
ViewUtil:CloseModalWait() --ViewUtil:CloseModalWait()
if res.ReturnCode ~= 0 then if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败") ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
else else
@ -557,7 +557,6 @@ function M:UpdateFamilyRoom(fgCtr, id)
end end
function M:ConnetFamily(index, groups, isCreate) function M:ConnetFamily(index, groups, isCreate)
if self._group then if self._group then
FamilyOffline(self._group.id, self) FamilyOffline(self._group.id, self)
end end
@ -673,11 +672,18 @@ function M:OnUpdate()
local HeartbeatTime = 30 local HeartbeatTime = 30
if newTime - self.lastTime > HeartbeatTime then if newTime - self.lastTime > HeartbeatTime then
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
print(res)
end)
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, 1)
--[[
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res) fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false,
1) 1)
pt(res) pt(res)
end) end)
]]
self.lastTime = newTime self.lastTime = newTime
end end
end end

View File

@ -27,6 +27,15 @@ local function RefalshBtnClose(self)
end end
end end
local function GetPlayer(self, playerId)
for _, p in pairs(self._room.player_list) do
if playerId == p.self_user.account_id then
return p
end
end
return nil
end
--lingmeng新全局标记 --lingmeng新全局标记
lingmengxin = false lingmengxin = false
@ -515,7 +524,7 @@ function M:InitView(url, isHideIpAdds)
self:ShowWitnessPlayer() self:ShowWitnessPlayer()
end) end)
end end
RefalshBtnClose(self) RefalshBtnClose(self)
------------------------------------------------------------ ------------------------------------------------------------
end end
@ -726,7 +735,9 @@ function M:EventInit()
_gamectr:AddEventListener(GameEvent.PlayerReady, handler(self, self.OnPlayerReady)) _gamectr:AddEventListener(GameEvent.PlayerReady, handler(self, self.OnPlayerReady))
_gamectr:AddEventListener(GameEvent.FangziAnimation, handler(self, self.OnFangziAnimation)) _gamectr:AddEventListener(GameEvent.AddScore, handler(self, self.OnAddScoreAnimation))
_gamectr:AddEventListener(GameEvent.MISSILE, handler(self, self.))
_gamectr:AddEventListener( _gamectr:AddEventListener(
GameEvent.DeskBreak, GameEvent.DeskBreak,
@ -1013,29 +1024,47 @@ function M:OnPlayerReady(...)
end end
-- 飘字 -- 飘字
function M:OnFangziAnimation(...) function M:OnAddScoreAnimation(...)
print("OnFangziAnimation") print("OnAddScoreAnimation")
local arg = { ... } local arg = { ... }
local totalScoreList = arg[2].totalScoreList
local playerList = arg[2].playerList
local addScoreList = arg[2].addScoreList
pt(arg) pt(arg)
local fz = arg[1]
local playerid = arg[1].playerid
local fromPlayer = arg[1].from_seat
local type = arg[1].type
local gang = arg[1].opengang
local room = self._room local scoreData = {}
for i = 1, #totalScoreList do
local p = {}
if gang then p.totalScore = totalScoreList[i]
local playerView = self:GetPlayerInfo(playerid) p.player = playerList[i]
playerView:ScoreAnimation(4) p.addScore = addScoreList[i]
local player = self:GetPlayer(playerid)
--playerView._view:GetChild('text_jifen').text = playerView._view:GetChild('text_jifen').text + 4
local fplayerView = self._player_info[self:GetPos(fromPlayer)] scoreData[#scoreData + 1] = p
--local nplayer = self:GetPlayer(playerid)
fplayerView:ScoreAnimation(-4)
--playerView._view:GetChild('text_jifen').text = playerView._view:GetChild('text_jifen').text - 4
end end
for _, p in pairs(scoreData) do
local infoView = self:GetPlayerInfo(p.player)
local player = GetPlayer(self, p.player)
player.cur_hp = p.totalScore
if p.addScore ~= 0 then
infoView:ScoreAnimation(p.addScore)
if player.cur_hp >= 0 then
infoView._view:GetChild("text_jifen").text = "+" .. player.cur_hp
else
infoView._view:GetChild("text_jifen").text = player.cur_hp
end
end
end
end
function M:OnMissile(...)
local arg = {...}
print("OnMissile 有人发表情了")
pt(arg)
--self:Missile()
end end
function M:OnUpdateInfo(...) function M:OnUpdateInfo(...)

View File

@ -109,6 +109,8 @@ function M:FillGameData()
local tex_name = self._view:GetChild("tex_name") local tex_name = self._view:GetChild("tex_name")
tex_name.text = self.play.name tex_name.text = self.play.name
end end
self._view:GetChild("tex_times").text = self.play.hp_times / 1000
end end
local tuoguanTimeList = { 10, 30, 60, 120, 180, 240, 300 } local tuoguanTimeList = { 10, 30, 60, 120, 180, 240, 300 }

View File

@ -10,8 +10,10 @@ function playerDetailView.New()
end end
function playerDetailView:Refalsh(player) function playerDetailView:Refalsh(player)
local p = player self.player = player
self.tex_name.text = player.self_user.nick_name
self.tex_ip.text = "网络:" .. player.self_user.host_ip
self.tex_id.text = "编号:" .. player.self_user.account_id
ImageLoad.Load(player.self_user.head_url, self.loader_icon) ImageLoad.Load(player.self_user.head_url, self.loader_icon)
end end
@ -21,6 +23,7 @@ function playerDetailView:Show(player)
end end
function playerDetailView:Init() function playerDetailView:Init()
local selfUser = DataManager.SelfUser
self.tex_name = self._view:GetChild("tex_name") self.tex_name = self._view:GetChild("tex_name")
self.tex_ip = self._view:GetChild("tex_ip") self.tex_ip = self._view:GetChild("tex_ip")
self.tex_id = self._view:GetChild("tex_id") self.tex_id = self._view:GetChild("tex_id")
@ -36,28 +39,28 @@ function playerDetailView:Init()
self.btn_boom.onClick:Set(function() self.btn_boom.onClick:Set(function()
local mainView = BaseView.FindView("MainView") local mainView = BaseView.FindView("MainView")
if mainView then if mainView then
mainView:Missile(1, 2, "ui://Common/boom", "ui://Main_Majiang/Missile_boom") mainView:Missile(1, self.player.seat, "ui://Common/boom", "ui://Main_Majiang/Missile_boom")
end end
end) end)
self.btn_egg.onClick:Set(function() self.btn_egg.onClick:Set(function()
local mainView = BaseView.FindView("MainView") local mainView = BaseView.FindView("MainView")
if mainView then if mainView then
mainView:Missile(1, 2, "ui://Common/egg", "ui://Main_Majiang/Missile_egg") mainView:Missile(1, self.player.seat, "ui://Common/egg", "ui://Main_Majiang/Missile_egg")
end end
end) end)
self.btn_ring.onClick:Set(function() self.btn_ring.onClick:Set(function()
local mainView = BaseView.FindView("MainView") local mainView = BaseView.FindView("MainView")
if mainView then if mainView then
mainView:Missile(1, 2, "ui://Common/diamo", "ui://Main_Majiang/Missile_diamo") mainView:Missile(1, self.player.seat, "ui://Common/diamo", "ui://Main_Majiang/Missile_diamo")
end end
end) end)
self.btn_flower.onClick:Set(function() self.btn_flower.onClick:Set(function()
local mainView = BaseView.FindView("MainView") local mainView = BaseView.FindView("MainView")
if mainView then if mainView then
mainView:Missile(1, 2, "ui://Common/flower", "ui://Main_Majiang/Missile_flower") mainView:Missile(1, self.player.seat, "ui://Common/flower", "ui://Main_Majiang/Missile_flower")
end end
end) end)
end end

View File

@ -21,7 +21,13 @@
<gearDisplay controller="num" pages="0,2"/> <gearDisplay controller="num" pages="0,2"/>
<gearXY controller="num" pages="0" values="108,51" default="108,12"/> <gearXY controller="num" pages="0" values="108,51" default="108,12"/>
</component> </component>
<group id="n29_q2iu" name="n29" xy="12,12" size="186,75"/> <component id="n17_in3i" name="player3" src="86ct7cwk" fileName="Main/Component/btn_head.xml" xy="12,90" size="90,72" group="n29_q2iu">
<gearDisplay controller="num" pages="1,2"/>
</component>
<component id="n18_in3i" name="player4" src="86ct7cwk" fileName="Main/Component/btn_head.xml" xy="108,90" size="90,72" group="n29_q2iu">
<gearDisplay controller="num" pages="1,2"/>
</component>
<group id="n29_q2iu" name="n29" xy="12,51" size="186,111"/>
<text id="n2_in3i" name="game_type" xy="205,13" size="1075,64" group="n30_q2iu" font="ui://27vd145bh35o7ika" fontSize="48" color="#474747" leading="0" autoSize="ellipsis" text="抚州麻将123123456"> <text id="n2_in3i" name="game_type" xy="205,13" size="1075,64" group="n30_q2iu" font="ui://27vd145bh35o7ika" fontSize="48" color="#474747" leading="0" autoSize="ellipsis" text="抚州麻将123123456">
<relation target="" sidePair="width-width"/> <relation target="" sidePair="width-width"/>
</text> </text>
@ -37,29 +43,5 @@
<group id="n30_q2iu" name="n30" xy="205,13" size="1108,151" advanced="true"> <group id="n30_q2iu" name="n30" xy="205,13" size="1108,151" advanced="true">
<relation target="" sidePair="left-left"/> <relation target="" sidePair="left-left"/>
</group> </group>
<image id="n24_jrro" name="n24" src="jrro7cy8" fileName="Main/Image/btn_mainGameNumberHead.png" xy="12,51" group="n31_fz5g">
<gearDisplay controller="num" pages="0,1,2"/>
<gearXY controller="num" pages="0,1" values="12,51|62,12" default="12,12"/>
</image>
<image id="n25_jrro" name="n25" src="jrro7cy8" fileName="Main/Image/btn_mainGameNumberHead.png" xy="108,51" group="n31_fz5g">
<gearDisplay controller="num" pages="0,2"/>
<gearXY controller="num" pages="0" values="108,51" default="108,12"/>
</image>
<image id="n26_jrro" name="n26" src="jrro7cy8" fileName="Main/Image/btn_mainGameNumberHead.png" xy="12,90" group="n31_fz5g">
<gearDisplay controller="num" pages="1,2"/>
<gearXY controller="num" default="12,90"/>
</image>
<image id="n27_jrro" name="n27" src="jrro7cy8" fileName="Main/Image/btn_mainGameNumberHead.png" xy="108,90" group="n31_fz5g">
<gearDisplay controller="num" pages="1,2"/>
</image>
<component id="n17_in3i" name="player3" src="86ct7cwk" fileName="Main/Component/btn_head.xml" xy="12,90" size="90,72" group="n31_fz5g">
<gearDisplay controller="num" pages="1,2"/>
</component>
<component id="n18_in3i" name="player4" src="86ct7cwk" fileName="Main/Component/btn_head.xml" xy="108,90" size="90,72" group="n31_fz5g">
<gearDisplay controller="num" pages="1,2"/>
</component>
<group id="n31_fz5g" name="n31" xy="12,51" size="186,111" advanced="true">
<relation target="" sidePair="left-left"/>
</group>
</displayList> </displayList>
</component> </component>

View File

@ -17,7 +17,7 @@
<text id="n161_10xl7" name="tex_name" xy="924,1027" size="388,76" group="n162_10xl7" font="ui://27vd145bh35o7ilb" fontSize="48" color="#222222" vAlign="middle" autoSize="shrink" autoClearText="true" text="" input="true" prompt="请输入房间名称"/> <text id="n161_10xl7" name="tex_name" xy="924,1027" size="388,76" group="n162_10xl7" font="ui://27vd145bh35o7ilb" fontSize="48" color="#222222" vAlign="middle" autoSize="shrink" autoClearText="true" text="" input="true" prompt="请输入房间名称"/>
<text id="n174_vyn3" name="n174" xy="633,1022" size="299,86" group="n162_10xl7" font="ui://27vd145bh35o7im7" fontSize="66" color="#450f05" vAlign="middle" autoSize="none" text="房间名称:"/> <text id="n174_vyn3" name="n174" xy="633,1022" size="299,86" group="n162_10xl7" font="ui://27vd145bh35o7im7" fontSize="66" color="#450f05" vAlign="middle" autoSize="none" text="房间名称:"/>
<image id="n179_qmc1" name="n179" src="l2997iht" fileName="font/images/win/shurukuang5.png" pkg="27vd145b" xy="1619,1024" size="174,78" group="n162_10xl7"/> <image id="n179_qmc1" name="n179" src="l2997iht" fileName="font/images/win/shurukuang5.png" pkg="27vd145b" xy="1619,1024" size="174,78" group="n162_10xl7"/>
<text id="n180_qmc1" name="tex_times" xy="1619,1025" size="174,78" group="n162_10xl7" font="ui://27vd145bh35o7ilb" fontSize="48" color="#222222" align="center" vAlign="middle" autoSize="shrink" autoClearText="true" text="" input="true" prompt="1"/> <text id="n180_qmc1" name="tex_times" xy="1619,1025" size="174,78" group="n162_10xl7" font="ui://27vd145bh35o7ilb" fontSize="48" color="#222222" align="center" vAlign="middle" autoSize="shrink" text="1" input="true"/>
<text id="n181_qmc1" name="n181" xy="1458,1022" size="169,86" group="n162_10xl7" font="ui://27vd145bh35o7im7" fontSize="66" color="#450f05" vAlign="middle" autoSize="none" text="倍数:"/> <text id="n181_qmc1" name="n181" xy="1458,1022" size="169,86" group="n162_10xl7" font="ui://27vd145bh35o7im7" fontSize="66" color="#450f05" vAlign="middle" autoSize="none" text="倍数:"/>
<group id="n162_10xl7" name="n162" xy="633,991" size="1779,144" group="n163_10xl7" advanced="true"> <group id="n162_10xl7" name="n162" xy="633,991" size="1779,144" group="n163_10xl7" advanced="true">
<relation target="" sidePair="center-center%"/> <relation target="" sidePair="center-center%"/>