diff --git a/lua_probject/base_project/Game/View/FGAssistView.lua b/lua_probject/base_project/Game/View/FGAssistView.lua index 0bd12bf6..32ba29fd 100644 --- a/lua_probject/base_project/Game/View/FGAssistView.lua +++ b/lua_probject/base_project/Game/View/FGAssistView.lua @@ -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._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 @@ -27,7 +28,7 @@ function M:ReloadView() end function M:init(url) - BaseWindow.init(self, url) + BaseWindow.init(self, url) self.lst_player = self._view:GetChild("lst_player") local btn_refresh = self._view:GetChild("btn_refresh") btn_refresh.onClick:Set(function() @@ -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 - self:GetOnlinePlayers() - end + -- local mgr_ctr = ControllerManager.GetController(GroupMgrController) + -- if not mgr_ctr._mgr_client then + -- return + -- else + self:GetOnlinePlayers() + -- 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 @@ -101,7 +110,7 @@ function M:ShowOnlinePlayers() end end local btn_auto_invite = self._view:GetChild("btn_auto_invite") - btn_auto_invite.onClick:Set(function() + btn_auto_invite.onClick:Set(function() local mgr_ctr = ControllerManager.GetController(GroupMgrController) local room = DataManager.CurrenRoom for i = 1, #players do @@ -144,10 +153,10 @@ function M:OnUpdate() end function M:Close() - BaseWindow.Close(self) - if self.callback then - self.callback() - end + BaseWindow.Close(self) + if self.callback then + self.callback() + end end -return M \ No newline at end of file +return M diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 5c850954..8fd7c0ab 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -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() diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index 83e85002..c8113257 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -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 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua index aaf6e18b..34c14fa5 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua @@ -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) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index a49e491b..c3f8c62a 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -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,34 +276,35 @@ 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 - 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].hp_info.cur_hp - end - -- info:UpdateScore() - info._view:GetChild("zhanji").visible = true - local num = data[i].hp_info.total_hp - if num >= 0 then - info._view:GetController("text_color").selectedIndex = 0 - info._view:GetChild("text_jifen").text = "+" .. d2ad(num) - else - info._view:GetController("text_color").selectedIndex = 1 - info._view:GetChild("text_jifen").text = d2ad(num) - end - - info._view:GetChild("mask_piao").title = "" - info._view:GetController("piao_niao").selectedIndex = 0 - p.fz_list = {} + for i = 1, #data do + local p = _room:GetPlayerBySeat(data[i].seat) + if p then + 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].hp_info.cur_hp end + -- info:UpdateScore() + info._view:GetChild("zhanji").visible = true + local num = data[i].hp_info.total_hp + if num >= 0 then + info._view:GetController("text_color").selectedIndex = 0 + info._view:GetChild("text_jifen").text = "+" .. d2ad(num) + else + info._view:GetController("text_color").selectedIndex = 1 + info._view:GetChild("text_jifen").text = d2ad(num) + end + + info._view:GetChild("mask_piao").title = "" + info._view:GetController("piao_niao").selectedIndex = 0 + 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 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua index 4b6546df..66029da4 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua @@ -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"] diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua index 4bd6b2b7..ff77cf49 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua @@ -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) diff --git a/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml b/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml index 66414eae..b6002a78 100644 --- a/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml +++ b/wb_new_ui/assets/Main_Majiang/Main_new/Main_new_2_jiangxi.xml @@ -1,6 +1,6 @@ - + @@ -14,17 +14,17 @@ - + - + - + @@ -52,19 +52,19 @@ - + - +