同步family

master
罗家炜 2025-06-12 15:17:53 +08:00
parent 9cef826299
commit 46b6313486
9 changed files with 142 additions and 73 deletions

View File

@ -4,19 +4,20 @@ local FGAssistInviteView = import(".FGAssistInviteView")
local FGAssistView = {}
local M = FGAssistView
setmetatable(M, {__index = BaseWindow})
setmetatable(M, { __index = BaseWindow })
function FGAssistView.new(blur_view, callback)
local self = setmetatable({}, {__index = M})
function FGAssistView.new(blur_view, group_id, callback)
local self = setmetatable({}, { __index = M })
self.class = "FGAssistView"
self._blur_view = blur_view
self._full = true
self._anim_pop = 1
self._animation = true
self.group_id = group_id
self.callback = callback
self:init("ui://FGAssist/panel_assist")
print("lingmeng FGAssistView new")
return self
end
@ -35,28 +36,36 @@ function M:init(url)
end)
self._timer = 0
UpdateBeat:Add(self.OnUpdate,self)
UpdateBeat:Add(self.OnUpdate, self)
end
function M:FillData()
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
if not mgr_ctr._mgr_client then
return
else
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
-- if not mgr_ctr._mgr_client then
-- return
-- else
self:GetOnlinePlayers()
end
-- end
end
-- function M:GetOnlinePlayers()
-- local mgr_ctr = ControllerManager.GetController(GroupMgrController)
-- mgr_ctr:FG_GetOnlinePlayers(function(res)
-- if res.ReturnCode ~= 0 then
-- ViewUtil.ErrorTip(res.ReturnCode, "获取在线成员失败")
-- else
-- self.players = res.Data.onlines
-- -- self._view:GetController("empty").selectedIndex = #self.players == 0 and 1 or 0
-- self:ShowOnlinePlayers()
-- end
-- end)
-- end
function M:GetOnlinePlayers()
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
mgr_ctr:FG_GetOnlinePlayers(function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取在线成员失败")
else
self.players = res.Data.onlines
-- self._view:GetController("empty").selectedIndex = #self.players == 0 and 1 or 0
self:ShowOnlinePlayers()
end
print("lingmeng GetOnlinePlayers", self.group_id)
pt(DataManager.groups)
local group = DataManager.groups:get(self.group_id)
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GroupMembers12(self.group_id, 0, group.total_member_num, 2, 2, function(res)
end)
end

View File

@ -234,6 +234,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
-- ViewManager.ChangeView(ViewManager.View_Lobby)
return
else
UpdateBeat:Remove(self.OnUpdate, self)
ViewManager.ChangeView(ViewManager.View_Main, gameId)
end
end,
@ -258,6 +259,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
-- ViewManager.ChangeView(ViewManager.View_Lobby)
return
else
UpdateBeat:Remove(self.OnUpdate, self)
ViewManager.ChangeView(ViewManager.View_Witness, gameId)
end
end,
@ -294,6 +296,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
-- ViewManager.ChangeView(ViewManager.View_Lobby)
return
else
UpdateBeat:Remove(self.OnUpdate, self)
ViewManager.ChangeView(ViewManager.View_Main, playList[newIndex].gameId)
end
end,
@ -379,6 +382,11 @@ function M:ConnetFamily(index, groups, isCreate)
UpdateBeat:Add(self.OnUpdate, self)
end
-- function M:Destroy()
-- UpdateBeat:Remove(self.OnUpdate, self)
-- BaseView:Destroy()
-- end
function M:OnUpdate()
local fgCtr = ControllerManager.GetController(NewGroupController)
local heatTime = os.time()

View File

@ -447,7 +447,7 @@ function M:InitView(url, isHideIpAdds)
end
end
if bShow then
--self:ShowFGAssist()
-- self:ShowFGAssist()
end
end
if self._room.self_player.entrust then
@ -469,6 +469,20 @@ function M:InitView(url, isHideIpAdds)
end--]]
-------------------------lingmeng---------------------------
_view:GetChild('text_roomId').text = string.format("房间:%s", self._room.room_id)
local btn_invite = self._view:GetChild('btn_invite')
if btn_invite then
print("lingmeng init FGAssist", self._room.group_id)
pt(DataManager.groups)
UIPackage.AddPackage('base/newgroup/ui/FGAssist')
btn_invite.onClick:Set(function()
local panel_assist = FGAssistView.new(self._root_view, self._room.group_id, function()
print("lingmeng assistcallback")
end)
panel_assist:ReloadView()
panel_assist:Show()
end)
end
------------------------------------------------------------
end

View File

@ -68,8 +68,6 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne
end
end)
endRound.onClick:Set(function()
ViewManager.ChangeView(ViewManager.View_Family)
end)
@ -258,6 +256,8 @@ end
function M:fillResult1(room, peopleNum, total_result)
local gameNameAndRoomIDText = self._view:GetChild("Text_GameNameAndRoomID")
local familyIDText = self._view:GetChild("Text_FamilyID")
print("lingmeng fillResult1")
pt(room)
for i, v in pairs(room.self_player.self_user.games) do
if v.game_id == room.game_id then
gameNameAndRoomIDText.text = string.format("%s 房号:%s", v.name, room.room_id)

View File

@ -78,6 +78,7 @@ function M:InitView(url)
self._text_round = self._view:GetChild('text_round')
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
self:UpdateRound()
self:InitPlayerInfoView()
self._player_card_info = {}
local _player_card_info = self._player_card_info
@ -139,6 +140,11 @@ function M:EventInit()
local _player_info = self._player_info
local _gamectr = self._gamectr
_gamectr:AddEventListener(GameEvent.PlayerEnter, function(...)
local arg = { ... }
print("lingmeng witness PlayerEnter")
end)
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
local arg = { ... }
print("lingmeng witness SendLaiZi")
@ -156,6 +162,23 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
print("lingmeng witness SendCards")
-- 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
end)
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
print("lingmeng witness EventTurn")
@ -253,7 +276,6 @@ function M:EventInit()
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(...)
for i = 1, #data do
local p = _room:GetPlayerBySeat(data[i].seat)
if p then
@ -281,6 +303,8 @@ function M:EventInit()
p.fz_list = {}
end
end
self._clearingView:InitData(0, _room, result, nil, function(...)
DataManager.CurrenRoom.self_player.card_list = {}
self._ctr_state.selectedIndex = 2
self._clearingView = nil
@ -293,7 +317,7 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
print("lingmeng witness ZPResult2")
self:UnmarkSelfTuoguan()
-- self:UnmarkSelfTuoguan()
self._left_time = 0
self:UpdateCardBox(0)
self._ctr_cardbox.selectedIndex = 0
@ -384,14 +408,21 @@ function M:OnFangziAction(...)
-- self:__CloseTip()
end
function M:UpdateRound()
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
self._room.room_config.round)
end
function M:OnUpdate()
if (self._popEvent) then
local func = self._gamectr:PopEvent()
if (func ~= nil) then
if pcall(func) then
local success, result = pcall(func)
if success then
else
print("错误报错,不准重连")
print("witness error")
print(result)
-- self._gamectr = ControllerManager.GetController(GameController)
-- if self._gamectr then
-- self._gamectr:ResetConnect()
@ -402,6 +433,10 @@ function M:OnUpdate()
end
end
function M:ResetConnect()
end
function M:GetPos(seat)
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
end

View File

@ -183,7 +183,10 @@ function M:FillPlayBackData(pd_data)
end
function M:FillWitnessData(pd_data)
print("==========================FillWitnessData1")
local room = DataManager.CurrenRoom
pt(room)
-- room.self_player =
local _tableInfo = pd_data["tableInfo"]
local _config = _tableInfo["config"]

View File

@ -60,8 +60,6 @@ function M:InitData(over, room, result, total_result, callback)
self:DestroyWithCallback()
end)
endRound.onClick:Set(function()
ViewManager.ChangeView(ViewManager.View_Family)
end)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="2532,1170">
<controller name="state" pages="0,准备状态,1,游戏状态,2,回合间状态,3,回放状态,4,观战状态" selected="4"/>
<controller name="state" pages="0,准备状态,1,游戏状态,2,回合间状态,3,回放状态,4,观战状态" selected="0"/>
<controller name="sdk" pages="0,,1," selected="0"/>
<controller name="action" pages="2,空,0,准备,1,开始" selected="0"/>
<controller name="3d" pages="0,,1," selected="0"/>
@ -14,17 +14,17 @@
<gearSize controller="state" default="144,144,1,1"/>
<relation target="" sidePair="center-center,bottom-bottom"/>
</component>
<component id="n141_lu84" name="player_info1_2" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="69,774" size="144,144">
<component id="n141_lu84" name="player_info1_2" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="737,916" size="144,144">
<gearDisplay controller="state" pages="1,3,4"/>
<gearXY controller="state" pages="1,3,4" values="71,784|71,784|69,774" default="737,916"/>
<relation target="n118_pkx5" sidePair="right-left,top-top"/>
</component>
<component id="n150_kxhm" name="player_info2_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,909" size="144,144">
<component id="n150_kxhm" name="player_info2_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,274" size="144,144">
<gearDisplay controller="state" pages="0,2"/>
<gearXY controller="state" pages="0,1,2" values="1188,274|1867,27|1188,274" default="1188,909"/>
<relation target="" sidePair="center-center,top-top"/>
</component>
<component id="n152_kxhm" name="player_info2_2" src="o8k813y" fileName="Main_new/Main_new_2/PlayerHead2_2.xml" xy="1897,43" size="108,108">
<component id="n152_kxhm" name="player_info2_2" src="o8k813y" fileName="Main_new/Main_new_2/PlayerHead2_2.xml" xy="2031,519" size="108,108">
<gearDisplay controller="state" pages="1,3,4"/>
<gearXY controller="state" pages="0,1,3,4" values="2031,519|1885,27|1885,27|1897,43" default="1337,909"/>
<relation target="n155_gi99" sidePair="left-right,top-top"/>
@ -52,19 +52,19 @@
<relation target="n90_8sat" sidePair="right-right"/>
</component>
<component id="n86_8sat" name="roominfo_panel1" src="gq7m8g" fileName="Main_style_2/RoomInfoPanel1.xml" xy="118,-382" size="274,41" scale="2,2" touchable="false"/>
<component id="n34_k3io" name="btn_ready--" src="gq7m8w" fileName="Main_style_2/btn_ready.xml" xy="3264,798" group="n36_k3io">
<component id="n34_k3io" name="btn_ready--" src="gq7m8w" fileName="Main_style_2/btn_ready.xml" xy="3267,798" group="n36_k3io">
<gearDisplay controller="action" pages="0,1"/>
<gearXY controller="action" pages="2,0,1" values="3264,798|-1716,120|2415,120"/>
<gearXY controller="action" pages="2,0,1" values="3267,798|-1716,120|2415,120"/>
<Button icon="ui://v0j9abjygq7m48"/>
</component>
<component id="n35_k3io" name="btn_start" src="gq7m8y" fileName="Main_style_2/Btn_Yellow.xml" xy="2794,-240" group="n36_k3io" visible="false">
<component id="n35_k3io" name="btn_start" src="gq7m8y" fileName="Main_style_2/Btn_Yellow.xml" xy="2797,-240" group="n36_k3io" visible="false">
<Button icon="ui://v0j9abjygq7m49"/>
</component>
<component id="n104_mncc" name="btn_xipai--" src="gq7m8y" fileName="Main_style_2/Btn_Yellow.xml" xy="3204,-233" group="n36_k3io" scale="0.9,1">
<component id="n104_mncc" name="btn_xipai--" src="gq7m8y" fileName="Main_style_2/Btn_Yellow.xml" xy="3207,-233" group="n36_k3io" scale="0.9,1">
<gearDisplay controller="action" pages="1"/>
<Button icon="ui://v0j9abjygq7m4i"/>
</component>
<group id="n36_k3io" name="n36" xy="2794,-240" size="736,1138" visible="false" advanced="true">
<group id="n36_k3io" name="n36" xy="2797,-240" size="736,1138" visible="false" advanced="true">
<relation target="" sidePair="bottom-bottom,center-center"/>
</group>
<component id="n57_rayb" name="panel_record" src="gq7m4t" fileName="Main_style_2/record/Record.xml" xy="978,435" group="n59_v38k" alpha="0.5">
@ -133,7 +133,7 @@
<relation target="" sidePair="center-center,bottom-bottom"/>
</component>
<text id="n176_eqmd" name="remaining_card" xy="897,469" size="215,74" group="n179_eqmd" font="ui://27vd145bh35o7ik0" fontSize="56" color="#cccccc" align="center" vAlign="middle" bold="true" text="余999张">
<gearDisplay controller="state" pages="1,3,4"/>
<gearDisplay controller="state" pages="1,3"/>
<relation target="n159_ckvb" sidePair="right-left"/>
</text>
<text id="n177_eqmd" name="wanfa_text" xy="418,599" pivot="0.5,0" size="1696,56" group="n179_eqmd" fontSize="42" color="#ffffff" align="center" vAlign="middle" autoSize="shrink" singleLine="true" text="玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍&#xA;">
@ -229,7 +229,9 @@
<group id="n168_qz7i" name="showNext" xy="-125,-102" size="2832,1436" advanced="true">
<gearDisplay controller="showNext" pages="1"/>
</group>
<graph id="n182_kw9h" name="n182" xy="874,1024" size="784,100" type="rect" lineSize="0" fillColor="#4c000000"/>
<graph id="n182_kw9h" name="n182" xy="874,1024" size="784,100" type="rect" lineSize="0" fillColor="#4c000000">
<gearDisplay controller="state" pages="4"/>
</graph>
<text id="n181_kw9h" name="n181" xy="1114,1035" size="304,79" fontSize="60" color="#ffffff" text="正在旁观中">
<gearDisplay controller="state" pages="4"/>
</text>