修改同步桌面

master
罗家炜 2025-06-10 20:36:42 +08:00
parent a23c13d366
commit fb86fe4259
6 changed files with 43 additions and 37 deletions

View File

@ -133,6 +133,15 @@ function M:WitnessGame(group_id, player_id, room_id)
_client:send(Protocol.GAME_WITNESS_ROOM, _data) _client:send(Protocol.GAME_WITNESS_ROOM, _data)
end end
function M:ExitWitnessGame()
local _client = ControllerManager.GameNetClinet
if not _client then
return
end
local _data = {}
_client:send(Protocol.GAME_Exit_WITNESS_ROOM, _data)
end
--聊天 --聊天
--<param name="playid"></param> --<param name="playid"></param>
--<param name="type">1表情 2固定语音 3语音 4文本 5互动</param> --<param name="type">1表情 2固定语音 3语音 4文本 5互动</param>

View File

@ -375,8 +375,10 @@ Protocol = {
--end::::::::::::::牌友圈协议:::::::::::::::::::: --end::::::::::::::牌友圈协议::::::::::::::::::::
-------------------Game ---------------------------- -------------------Game ----------------------------
-- 进入房间 -- 观战进入房间
GAME_WITNESS_ROOM = "3013", GAME_WITNESS_ROOM = "3013",
-- 观战退出房间
GAME_Exit_WITNESS_ROOM = "3023",
-- 进入房间 -- 进入房间
GAME_JOIN_ROOM = "1002", GAME_JOIN_ROOM = "1002",

View File

@ -117,6 +117,14 @@ function M:InitView(url)
self.RuleView:Show() self.RuleView:Show()
end) end)
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
------------------------------------------------------- -------------------------------------------------------
self._ctr_state.selectedIndex = 4 self._ctr_state.selectedIndex = 4
@ -156,8 +164,9 @@ function M:EventInit()
local seat = arg[1] local seat = arg[1]
self:UpdateCardBox(self:GetPos(seat)) self:UpdateCardBox(self:GetPos(seat))
local playerInfo = self._player_info[self:GetPos(seat)] local playerInfo = self._player_info[self:GetPos(seat)]
playerInfo.hand_left_count = info.hand_left_count + 1
local info = self._player_card_info[self:GetPos(seat)] local info = self._player_card_info[self:GetPos(seat)]
print("lingmeng hand_left_count", info._player.hand_left_count)
info._player.hand_left_count = info._player.hand_left_count + 1
info:UpdateHandCardWitness(true) info:UpdateHandCardWitness(true)
end) end)
@ -262,7 +271,10 @@ function M:UpdateCardBox(seat)
end end
function M:OnFangziAction(...) function M:OnFangziAction(...)
self:__CloseTip() print("lingmeng OnFangziAction")
-- self:__CloseTip()
print("lingmeng OnFangziAction1")
local arg = { ... } local arg = { ... }
local _player_card_info = self._player_card_info local _player_card_info = self._player_card_info
local fz = arg[1] local fz = arg[1]
@ -271,44 +283,22 @@ function M:OnFangziAction(...)
printlog("OnFangziAction") printlog("OnFangziAction")
local info = _player_card_info[self:GetPos(player.seat)] local info = _player_card_info[self:GetPos(player.seat)]
-- local pNode = info._mask_liangpai -- local pNode = info._mask_liangpai
local effect = UIPackage.CreateObject("Extend_MJ_LiChuan", "FzEffect")
if fz.type == FZType.Peng then
self:PlaySound("LiChuan_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
elseif fz.type == FZType.Chi then
self:PlaySound("LiChuan_MJ", player.self_user.sex, "chi" .. math.random(1, 3))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
else
self:PlaySound("LiChuan_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "")
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "")
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
end
effect.touchable = false
effect:GetTransition("t2"):Play()
-- pNode:AddChild(effect)
coroutine.start(function()
coroutine.wait(0.3)
self._popEvent = true
end)
coroutine.start(function()
coroutine.wait(2)
effect:Dispose()
end)
self:RemoveCursor() self:RemoveCursor()
if (player.seat ~= fz.from_seat) then if (player.seat ~= fz.from_seat) then
local fs_info = _player_card_info[self:GetPos(fz.from_seat)] local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
fs_info:UpdateOutCardList() fs_info:UpdateOutCardList()
end end
print("lingmeng OnFangziAction5")
info:UpdateFzList(fz, index, true) info:UpdateFzList(fz, index, true)
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
printlog(getcard) printlog(getcard)
info:UpdateHandCard(getcard)
self:__CloseTip() 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()
end end
function M:OnUpdate() function M:OnUpdate()

View File

@ -32,7 +32,7 @@ function M:InitView(url, use_custom_bg, custom_bg_config)
local _view = self._view local _view = self._view
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
bg_config = custom_bg_config == nil and bg_config or custom_bg_config bg_config = custom_bg_config == nil and bg_config or custom_bg_config
if not use_custom_bg then if use_custom_bg then
TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config)
end end

View File

@ -6,7 +6,7 @@
<controller name="3d" pages="0,,1," selected="0"/> <controller name="3d" pages="0,,1," selected="0"/>
<controller name="showNext" pages="0,不展示,1,展示" selected="0"/> <controller name="showNext" pages="0,不展示,1,展示" selected="0"/>
<controller name="showNextConfrim" pages="0,不展示,1,展示" selected="0"/> <controller name="showNextConfrim" pages="0,不展示,1,展示" selected="0"/>
<controller name="more" pages="0,,1," selected="1"/> <controller name="more" pages="0,,1," selected="0"/>
<displayList> <displayList>
<component id="n115_pkx5" name="player_info1_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,897" size="144,144"> <component id="n115_pkx5" name="player_info1_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,897" size="144,144">
<gearDisplay controller="state" pages="0,2"/> <gearDisplay controller="state" pages="0,2"/>
@ -152,10 +152,12 @@
<gearDisplay controller="state" pages="1,3,4"/> <gearDisplay controller="state" pages="1,3,4"/>
</component> </component>
<group id="n169_gmbn" name="conter_box" xy="1136,375" size="258,258"/> <group id="n169_gmbn" name="conter_box" xy="1136,375" size="258,258"/>
<component id="n137_lu84" name="btn_setting" src="t6zvw5" fileName="Main_new/Main/Component/btn_setting.xml" xy="2232,36" group="n138_lu84"/> <component id="n137_lu84" name="btn_setting" src="t6zvw5" fileName="Main_new/Main/Component/btn_setting.xml" xy="2232,36" group="n138_lu84">
<component id="n170_gmbn" name="btn_more" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2412,60" pivot="0.5,0.5" size="72,72" group="n138_lu84" rotation="180"> <gearDisplay controller="state" pages="0,1,2,3"/>
</component>
<component id="n170_gmbn" name="btn_more" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2412,60" pivot="0.5,0.5" size="72,72" group="n138_lu84">
<gearLook controller="more" pages="1" values="1,180,0,1" default="1,0,0,1"/> <gearLook controller="more" pages="1" values="1,180,0,1" default="1,0,0,1"/>
<Button checked="true" icon="ui://v0j9abjygmbn13t" controller="more" page="1"/> <Button icon="ui://v0j9abjygmbn13t" controller="more" page="1"/>
</component> </component>
<component id="n171_gmbn" name="btn_change" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2031,33" pivot="0.5,0.5" size="102,119" group="n138_lu84"> <component id="n171_gmbn" name="btn_change" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2031,33" pivot="0.5,0.5" size="102,119" group="n138_lu84">
<gearDisplay controller="more" pages="1"/> <gearDisplay controller="more" pages="1"/>
@ -173,6 +175,9 @@
<gearDisplay controller="more" pages="1"/> <gearDisplay controller="more" pages="1"/>
<Button icon="ui://v0j9abjygmbn13r"/> <Button icon="ui://v0j9abjygmbn13r"/>
</component> </component>
<component id="n180_vum1" name="btn_exitWitness" src="t6zvw5" fileName="Main_new/Main/Component/btn_setting.xml" xy="2275,42" group="n138_lu84">
<gearDisplay controller="state" pages="4"/>
</component>
<group id="n138_lu84" name="top_right" xy="2031,33" size="468,453"/> <group id="n138_lu84" name="top_right" xy="2031,33" size="468,453"/>
<graph id="n146_l15a" name="btn_showNext" xy="1121,424" size="208,165" type="rect" lineSize="0" fillColor="#00ffffff"> <graph id="n146_l15a" name="btn_showNext" xy="1121,424" size="208,165" type="rect" lineSize="0" fillColor="#00ffffff">
<gearDisplay controller="state" pages="1"/> <gearDisplay controller="state" pages="1"/>