diff --git a/lua_probject/base_project/Game/View/Family/FamilAllRank.lua b/lua_probject/base_project/Game/View/Family/FamilAllRank.lua index 0b13e499..2d20c442 100644 --- a/lua_probject/base_project/Game/View/Family/FamilAllRank.lua +++ b/lua_probject/base_project/Game/View/Family/FamilAllRank.lua @@ -14,7 +14,7 @@ function M:init() local root = self._father self._lastTpe = root.familyType.selectedIndex root.familyType.selectedIndex = 0 - local comp_rank = UIPackage.CreateObjectFromURL("ui://Family/comp_rank") + local comp_rank = UIPackage.CreateObjectFromURL("ui://Family/Comp_Rank") root._view:AddChild(comp_rank) comp_rank.width = root._view.width comp_rank.height = root._view.height diff --git a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua index 4aabd4ea..fcc1ca95 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyRecord.lua @@ -6,6 +6,7 @@ function FamilAllRank.New(root, groupId) local self = setmetatable({}, { __index = M }) self._father = root self.group_id = groupId + self.currenGroup = DataManager.groups:get(groupId) self:init() return self end @@ -20,23 +21,170 @@ function M:init() com_Record.height = root._view.height com_Record:Center() self._view = com_Record + self._ctr_cWindow = self._view:GetController('cWindow') + + local ViewBox_Time = self._view:GetChild('combBox_time') + local serverDayValues, serverDayItems = self:InitTime() + ViewBox_Time.items = serverDayItems + ViewBox_Time.values = serverDayValues + self.selectTimes = tonumber(serverDayValues[1]) + ViewBox_Time.onChanged:Set(function() + self.selectTimes = tonumber(ViewBox_Time.value) + self:ShowNumberRecord() + end) + + self._viewList_record = self._view:GetChild('list_record_family') + self._viewList_record:SetVirtual() + self._viewList_record.itemRenderer = function(index, obj) + self:RecordItemRenderer(self.records[index + 1], obj) + end + + self._viewList_recordDetail = self._view:GetChild('list_record_detail') + + self._viewList_players = self._view:GetChild('list_players') + + self._view:GetChild('btn_close').onClick:Set(function() + if self._ctr_cWindow.selectedIndex == 1 then + self._ctr_cWindow.selectedIndex = 0 + else + self._father.familyType.selectedIndex = self._lastTpe + self._lastTpe = nil + self._view.visible = false + end + end) + + + self:ShowNumberRecord() +end + +function M:InitTime() + local timeTable = os.date("*t", os.time()) + timeTable.hour = 0 + timeTable.min = 0 + timeTable.sec = 0 + + local serverDayItems = { "今天", "昨天", "前天" } + local serverDayValues = {} + for i = 0, 6 do + local tempValue = os.time(timeTable) - 86400 * i + print(tempValue) + local tempItems = os.date("%Y-%m-%d", tempValue) + if i > 2 then + table.insert(serverDayItems, tempItems) + end + table.insert(serverDayValues, tostring(tempValue)) + end + + return serverDayValues, serverDayItems end function M:ShowNumberRecord() local fgCtr = ControllerManager.GetController(NewGroupController) self.records = {} - local uid = DataManager - local timeTable = os.date("*t", os.time()) - timeTable.hour = 0 - timeTable.min = 0 - timeTable.sec = 0 - local leftTime = os.time(timeTable) - local rightTime = os.time(timeTable) + 86399 - self:RecursionRecord(fgCtr, 0, uid, leftTime, rightTime) + local uid = DataManager.SelfUser.account_id + + self:RecursionRecord(fgCtr, 0, uid, self.selectTimes, self.selectTimes + 86399) +end + +function M:RecordItemDetailRender(round, allDate, rdata, obj) + obj:GetChild('text_round').text = round + obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(allDate.createTime)) + local list = obj:GetChild('list_score') + rdata = json.decode(rdata) + list:RemoveChildrenToPool(); + for i = 1, #rdata do + local obj2 = list:AddItemFromPool() + obj2:GetChild('title').text = rdata[i].score + end + + local btn_play = obj:GetChild("n10") + btn_play.onClick:Set(function() + local group = self.currenGroup + if DataManager.SelfUser.playback[allDate.military_id] ~= nil and DataManager.SelfUser.playback[allDate.military_id][round] ~= nil then + local room = ExtendManager.GetExtendConfig(allDate.game_info.game_id):NewRoom() + DataManager.CurrenRoom = room + room.lev = group.lev + room.game_id = allDate.game_info.game_id + local extend = ExtendManager.GetExtendConfig(allDate.game_info.game_id) + extend:FillPlayBackData(DataManager.SelfUser.playback[allDate.military_id][round]) + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end + local main = self:GenaratePlayBack(ViewManager.View_PlayBack, allDate.game_info.game_id) + main._currentId = allDate.military_id + main._currentRound = round + main._totalRound = tonumber(rdata.round) + main:FillRoomData(DataManager.SelfUser.playback[allDate.military_id][round]) + else + ViewUtil.ShowModalWait(self._view) + local _data = {} + _data["military_id"] = allDate.military_id + _data["round"] = tostring(round) + local loddyCtr1 = ControllerManager.GetController(LoddyController) + loddyCtr1:RequestPlayBack(_data, function(code, data) + ViewUtil.CloseModalWait() + if code == 0 then + if DataManager.SelfUser.playback[allDate.military_id] ~= nil then + DataManager.SelfUser.playback[allDate.military_id][round] = data + else + local playback_data = {} + playback_data[round] = data + DataManager.SelfUser.playback[allDate.military_id] = playback_data + end + + local main = self:GenaratePlayBack(ViewManager.View_PlayBack, allDate.game_info.game_id) + main._currentId = allDate.military_id + main._currentRound = round + main._totalRound = tonumber(allDate.round) + main:FillRoomData(data) + main._room.lev = group.lev + elseif code == 25 then + ViewUtil.ErrorTip(-1, "回放未找到!") + -- btn_play_back.grayed = true + end + end, allDate.game_info) + end + end) +end + +function M:RecordItemPlayersRender(data, obj) + obj:GetChild('n2').text = data.nick +end + +function M:RecordItemRenderer(data, obj) + obj:GetChild('text_gameName').text = data.game_info.name + obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(data.create_time)) + obj:GetChild('text_roomId').text = data.room_id + obj:GetChild('text_useDiamond').text = 0 + obj:GetChild('btn_detail').onClick:Set(function() + self._viewList_recordDetail:RemoveChildrenToPool() + for i = 1, tonumber(data.round) do + local obj = self._viewList_recordDetail:AddItemFromPool() + self:RecordItemDetailRender(i, data, data[string.format("round_%d", i)], obj) + end + self._viewList_players:RemoveChildrenToPool() + for j = 1, #data.totalScore do + local obj = self._viewList_players:AddItemFromPool() + self:RecordItemPlayersRender(json.decode(data.round_1), obj) + end + self._ctr_cWindow.selectedIndex = 1 + end) + -- obj:GetChild('text_playName').text = .name + local resultDetailList = obj:GetChild('list_familyPlayer') + resultDetailList:SetVirtual() + resultDetailList.itemRenderer = function(index, obj) + local resultInfo = data.totalScore[index + 1] + ImageLoad.Load(resultInfo.portrait, obj:GetChild('btn_head')._iconObject) + obj:GetChild('text_name').text = resultInfo.nick + obj:GetChild('text_score').text = resultInfo.score + obj:GetController('colour').selectedIndex = resultInfo.score >= 0 and 1 or 0 + end + resultDetailList.numItems = #data.totalScore end function M:RecursionRecord(fgCtr, index, uid, leftTime, rightTime) - fgCtr:FG_GetGroupRecordSpe(self.group_id, GetPlatform(), uid, 0, index * 60, 60, leftTime, rightTime, 3, + print("lingmeng RecursionRecord", self.group_id, GetPlatform(), uid, 0, index * 60, 60, leftTime, rightTime, 3) + fgCtr:FG_GetGroupRecordSpe(self.group_id, GetPlatform(), uid, 0, index * 60, 60, leftTime, rightTime, 0, function(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "查看个人战绩失败") @@ -46,14 +194,32 @@ function M:RecursionRecord(fgCtr, index, uid, leftTime, rightTime) local records = res.Data.records if records and #records > 0 then for i = 1, #records do + records[i].totalScore = json.decode(records[i].totalScore) table.insert(self.records, records[i]) end self:RecursionRecord(fgCtr, index + 1, uid, leftTime, rightTime) else - + self._viewList_record.numItems = #self.records end end end) end +function M:GenaratePlayBack(id, game_id, ...) + local tem = nil + local dview_class = nil + if not dview_class then + local exconfig = ExtendManager.GetExtendConfig(game_id) + dview_class = exconfig:GetView(id) + end + if not dview_class then + return + end + local arg = { ... } + tem = dview_class.new(...) + tem.Id = id + tem:Show() + return tem +end + return M diff --git a/lua_probject/base_project/Game/View/PlayBackView.lua b/lua_probject/base_project/Game/View/PlayBackView.lua index 2ce322b2..3efa8e0d 100644 --- a/lua_probject/base_project/Game/View/PlayBackView.lua +++ b/lua_probject/base_project/Game/View/PlayBackView.lua @@ -4,7 +4,7 @@ -- local MainRightPanelView = import('.MainRightPanelView') -local PlayerInfoView = import('.PlayerInfoView') +local PlayerInfoView = import('.PlayerInfoView2') PlayBackView = { _currentStep = 0, @@ -50,11 +50,13 @@ function M:InitView(url) local btn_NextStep = panel_record:GetChild('btn_NextStep') local btn_return = panel_record:GetChild('btn_return') local btn_play = panel_record:GetChild('btn_play') - btn_return.onClick:Add(handler(self, self.CmdBackToLobby)) + local btn_restart = panel_record:GetChild('btn_restart') + btn_return.onClick:Add(handler(self, self.MaxSpeedArriws)) btn_LastStep.onClick:Add(handler(self, self.CmdLeftArrows)) btn_NextStep.onClick:Add(handler(self, self.CmdRightArrows)) btn_LastRound.onClick:Add(handler(self, self.LastRecordPlay)) btn_NextRound.onClick:Add(handler(self, self.NextRecordPlay)) + btn_restart.onClick:Add(handler(self, self.RestartRecordPlay)) btn_play.onClick:Add(handler(self, self.Play)) local _view = self._view @@ -63,7 +65,7 @@ function M:InitView(url) local _player_info = self._player_info for i = 1, _room.room_config.people_num do - local tem = _view:GetChild('player_info' .. i) + local tem = _view:GetChild(string.format("player_info%d_%d", i, 2)) _player_info[i] = PlayerInfoView.new(tem, self) tem.visible = false end @@ -83,6 +85,17 @@ function M:InitView(url) btn_back_lobby.onClick:Set(handler(self, self.CmdBackToLobby)) end + + local btn_rule = self._view:GetChild('btn_rule_back') + if btn_rule ~= nil then + btn_rule.onClick:Set(function() + if self.RuleView == nil or self.RuleView._is_destroy then + self.RuleView = RoomInfoView.new(self._room) + end + self.RuleView:Show() + end) + end + if self._style == 1 then local rightpanel = self._view:GetChild('right_panel') local btn_rule = self._view:GetChild('btn_rule') @@ -107,31 +120,31 @@ function M:InitView(url) local tex_time = com_roominfo:GetChild('tex_time') self._co_timer = coroutine.start( - function() - tex_time.text = os.date('%m-%d %H:%M') - local _client = ControllerManager.GameNetClinet - if not _client then - return + function() + tex_time.text = os.date('%m-%d %H:%M') + local _client = ControllerManager.GameNetClinet + if not _client then + return + end + local ping = _client:getAveragePingTime() + if not ping then + return + end + local ctr_xh = com_roominfo:GetChild('gcm_xinhao'):GetController('c1') + ping = math.floor(ping / 2) + if ping > 300 then + ping = 300 + end + if ping <= 100 then + ctr_xh.selectedIndex = 0 + elseif ping <= 300 then + ctr_xh.selectedIndex = 1 + else + ctr_xh.selectedIndex = 2 + end + coroutine.wait(10) end - local ping = _client:getAveragePingTime() - if not ping then - return - end - local ctr_xh = com_roominfo:GetChild('gcm_xinhao'):GetController('c1') - ping = math.floor(ping / 2) - if ping > 300 then - ping = 300 - end - if ping <= 100 then - ctr_xh.selectedIndex = 0 - elseif ping <= 300 then - ctr_xh.selectedIndex = 1 - else - ctr_xh.selectedIndex = 2 - end - coroutine.wait(10) - end - ) + ) end self._eventmap = {} @@ -153,9 +166,16 @@ end function M:CmdLeftArrows() end +function M:MaxSpeedArriws() + +end + function M:CmdRightArrows() end +function M:RestartRecordPlay() +end + function M:NextCmdAction() self._lastStep = self._currentStep self._currentStep = self._currentStep + 1 @@ -308,7 +328,7 @@ function M:CmdBackToLobby() _curren_msg:Show() end -function M:GetPos(seat,myseat) +function M:GetPos(seat, myseat) local my_seat = 1 if myseat == nil then for i = 1, #self._room.player_list do @@ -317,7 +337,7 @@ function M:GetPos(seat,myseat) end end else - my_seat = myseat + my_seat = myseat end return ViewUtil.GetPos(my_seat, seat, self._room.room_config.people_num) end @@ -351,12 +371,12 @@ function M:ChangeAlpha(...) end self._record_alpha = coroutine.start( - function() - self._record.alpha = 1 - coroutine.wait(2) - self._record.alpha = 0.5 - end - ) + function() + self._record.alpha = 1 + coroutine.wait(2) + self._record.alpha = 0.5 + end + ) end function M:Show() diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua index 2740042d..2f77274f 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayBackView.lua @@ -20,7 +20,7 @@ end function M:InitView(url) local room = self._room UIPackage.AddPackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan") - MJPlayBackView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num) + MJPlayBackView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) local _cardbox = self._view:GetChild("cardbox") --self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false self._ctr_cardbox = _cardbox:GetController("c1") @@ -58,7 +58,7 @@ function M:FillRoomData(data) for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] - card_info:Clear() + -- card_info:Clear() table.sort(p.card_list, self.HandCardSortAndJing) card_info:UpdateHandCard(false, true) self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 @@ -110,7 +110,7 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") local info = self._player_card_info[self:GetPos(step.win)] - info._mask_liangpai:AddChild(self._win_pic) + info._view:AddChild(self._win_pic) self._win_pic:Center() else if self._win_pic then @@ -286,8 +286,9 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end -function M:UpdateRound(round) - self._tex_round.text = "第 " .. round .. "/" .. self._room.room_config.round .. " 局" +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:UpdateStep(step) diff --git a/lua_probject/main_project/main/majiang/MJPlayBackView.lua b/lua_probject/main_project/main/majiang/MJPlayBackView.lua index 25f24dea..7ffeaf53 100644 --- a/lua_probject/main_project/main/majiang/MJPlayBackView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayBackView.lua @@ -2,38 +2,38 @@ local MJPlayerCardInfoView = import(".MJPlayerCardInfoView") local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") local TableBG = import('Game.Data.TableBG') - --- +--- local M = {} -setmetatable(M,{__index = PlayBackView}) +setmetatable(M, { __index = PlayBackView }) local bg_config = { - {id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01"} + { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" } } function M:InitView(url) UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") - PlayBackView.InitView(self,url) + PlayBackView.InitView(self, url) local _view = self._view self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") - TableBG.LoadTableBG(1, nil, self._root_view,bg_config) + TableBG.LoadTableBG(1, nil, self._root_view, bg_config) - UpdateBeat:Add(self.OnUpdate,self) + UpdateBeat:Add(self.OnUpdate, self) end function M:FillRoomData() local _room = self._room - if self._player_card_info == nil or #self._player_card_info == 0 then + if self._player_card_info == nil or #self._player_card_info == 0 then self._player_card_info = {} local _player_card_info = self._player_card_info for i = 1, _room.room_config.people_num do local tem = self._view:GetChild("player_card_info" .. i) - _player_card_info[i] = self:NewMJPlayerCardInfoView(tem,i) + _player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i) end end local list = _room.player_list - for i=1,#list do + for i = 1, #list do local p = list[i] local info = self._player_card_info[self:GetPos(p.seat)] info:SetPlayer(p) @@ -42,7 +42,7 @@ function M:FillRoomData() self:SetCardBoxPosition() local list = _room.player_list - for i=1,#list do + for i = 1, #list do local p = list[i] local info = self._player_info[self:GetPos(p.seat)] info._view.visible = true @@ -51,17 +51,17 @@ function M:FillRoomData() end function M:SetCardBoxPosition() - local _room = self._room - for i = 1, _room.room_config.people_num do - local tex = self._view:GetChild("cardbox"):GetChild("direction"..i) - local index = _room.self_player.seat + i - 1 - index = index > 4 and index - 4 or index - tex.text = self._gamectr:GetPosString(index) - end + local _room = self._room + for i = 1, _room.room_config.people_num do + local tex = self._view:GetChild("cardbox"):GetChild("direction" .. i) + local index = _room.self_player.seat + i - 1 + index = index > 4 and index - 4 or index + tex.text = self._gamectr:GetPosString(index) + end end -function M:NewMJPlayerCardInfoView(view,index) - return MJPlayerCardInfoView.new(view,self) +function M:NewMJPlayerCardInfoView(view, index) + return MJPlayerCardInfoView.new(view, self) end function M:NextRecordPlay() @@ -84,6 +84,15 @@ function M:LastRecordPlay() self:ChangeTextSpeed() end +function M:RestartRecordPlay() + self:ChangeAlpha() + self._currentStep = 0 + self._speed = 1 + self._playFoward = true + self:ChangeTextSpeed() + self:ChangePlayState(true) +end + function M:Play() self:ChangeAlpha() self:ChangePlayState(not self._play) @@ -108,20 +117,22 @@ function M:ChangePlayState(state) end function M:ChangeTextSpeed() - local str1 = self._play and self._speed or "" - self._view:GetChild("panel_record"):GetChild("tex_speed").text = str1 - local str2 = not self._play and (self._playFoward and "播放暂停" or "回退暂停") or self._playFoward and (self._speed == 1 and "播放" or "快进") or (self._speed == 1 and "回退" or "快退") - self._view:GetChild("panel_record"):GetChild("tex_2").text = str2 - local str3 = self._play and "倍速度" or "" - self._view:GetChild("panel_record"):GetChild("tex_1").text = str3 + -- local str1 = self._play and self._speed or "" + -- self._view:GetChild("panel_record"):GetChild("tex_speed").text = str1 + -- local str2 = not self._play and (self._playFoward and "播放暂停" or "回退暂停") or + -- self._playFoward and (self._speed == 1 and "播放" or "快进") or (self._speed == 1 and "回退" or "快退") + -- self._view:GetChild("panel_record"):GetChild("tex_2").text = str2 + -- local str3 = self._play and "倍速度" or "" + -- self._view:GetChild("panel_record"):GetChild("tex_1").text = str3 + self._record:GetChild('tex_speed').text = self._speed end function M:CmdLeftArrows() self:ChangeAlpha() self:ChangePlayState(true) if not self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 + if self._speed < 5 then + self._speed = self._speed + 1 else self._speed = 1 end @@ -137,8 +148,8 @@ function M:CmdRightArrows() self:ChangeAlpha() self:ChangePlayState(true) if self._playFoward then - if self._speed < 16 then - self._speed = self._speed * 2 + if self._speed < 5 then + self._speed = self._speed + 1 else self._speed = 1 end @@ -150,15 +161,21 @@ function M:CmdRightArrows() end end +function M:MaxSpeedArriws() + self:ChangeAlpha() + self:ChangePlayState(true) + self._speed = 30 +end + function M:OnUpdate() if self._play then if (self._currentStep == #self.cmdList and self._playFoward) then self:ChangePlayState(false) - ViewUtil.ErrorTip(nil,"当前已是录像结尾了,再次点击播放按钮可重新播放") + ViewUtil.ErrorTip(nil, "当前已是录像结尾了,再次点击播放按钮可重新播放") return elseif (self._currentStep == 0 and not self._playFoward) then self:ChangePlayState(false) - ViewUtil.ErrorTip(nil,"当前已是录像开头了,再次点击播放按钮可重新播放") + ViewUtil.ErrorTip(nil, "当前已是录像开头了,再次点击播放按钮可重新播放") return end self._timer = self._timer + Time.deltaTime @@ -171,21 +188,21 @@ function M:OnUpdate() end end -function M:RemoveCursor() - if self._cursor.parent then - self._cursor.parent:GetController("color").selectedIndex = 0 - end - self._cursor:RemoveFromParent() +function M:RemoveCursor() + -- if self._cursor.parent then + -- self._cursor.parent:GetController("color").selectedIndex = 0 + -- end + self._cursor:RemoveFromParent() end function M:GetPrefix() - return get_majiang_prefix(DataManager.CurrenRoom.game_id) + return get_majiang_prefix(DataManager.CurrenRoom.game_id) end function M:Destroy() if self._cursor then self._cursor:Dispose() end - UpdateBeat:Remove(self.OnUpdate,self) + UpdateBeat:Remove(self.OnUpdate, self) PlayBackView.Destroy(self) end -return M \ No newline at end of file +return M diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 0854e0cc..99193a48 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -15,6 +15,24 @@ local PlayerCardInfoView = { _current_card_type = -1 } +local CardView = { + card = nil, + -- 牌序号 + card_item = 0, + -- 索引 + index = 0, + -- 原始位置 + old_postion = Vector2.zero +} + +local function NewCardView(card, cardItem) + local self = {} + setmetatable(self, { __index = CardView }) + self.card = card + self.card_item = cardItem + return self +end + local M = PlayerCardInfoView --- Create a new PlayerCardInfoView @@ -34,7 +52,8 @@ function M:init() self._view_handCardList = self._view:GetChild('List_HandCard') self._view_FZList = self._view:GetChild('List_FZ') self._view_outCardList = self._view:GetChild('List_OutCard') - self._view_getCard = self._view:GetChild('Comp_HandCard') + + self._view_getCard = self._view:GetChild('Btn_HandCard') self._ctr_getCard = self._view:GetController('getCard') end @@ -123,11 +142,16 @@ function M:UpdateHandCard(getcard, mp) self._view_handCardList:RemoveChildren() self._view_getCard:RemoveChildren() + local btn_card for i = 0, self._player.hand_left_count - 1 do if getcard and i == self._player.hand_left_count - 1 then - self._view_getCard:AddItemFromPool() + btn_card = self._view_getCard:AddItemFromPool() else - self._view_handCardList:AddItemFromPool() + btn_card = self._view_handCardList:AddItemFromPool() + end + if mp then + local tem_card = self._player.card_list[i + 1] + self:FillHandCard(i, btn_card, tem_card, true) end end self._ctr_getCard.selectedIndex = getcard and 1 or 0 @@ -207,6 +231,22 @@ function M:adjust3dOutPut(obj, area, oder, num, index) end end +function M:FillHandCard(i, btn_card, tem_card, event) + local handCardName = self._viewText_cardInfo['Hand_Card'] + + self:fillCard2(btn_card, handCardName, tem_card) + local c_v = NewCardView(btn_card, tem_card) + c_v.index = i + c_v.old_postion = btn_card.xy + c_v.touch_pos = Vector2.New(btn_card.width / 2, btn_card.height / 2) + btn_card.data = c_v + if event then + btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin)) + btn_card.onTouchMove:Set(handler(self, self.onTouchMove)) + btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd)) + end +end + function M:UpdateOutCardList(outcard, card_item, cursor) outcard = outcard or nil card_item = card_item or 0 @@ -258,7 +298,7 @@ end function M:UpdateFzList(fz, index, show_card) local room = DataManager.CurrenRoom -- local seat = (room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1 - local seat = ViewUtil.GetPos(room.self_player.seat, fz.from_seat, room.room_config.people_num) + local seat = ViewUtil.GetPos(room.self_player.seat, fz.from_seat or 1, room.room_config.people_num) seat = (room.room_config.people_num == 2 and seat == 2) and 2 or seat - 1 print("lingmengUpdateFzList", fz, index, show_card, seat) local FZame = self._viewText_cardInfo['FZ_Card'] diff --git a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua index 9ef55635..b89eaa35 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua @@ -1,23 +1,5 @@ local MJPlayerCardInfoView = import(".MJPlayerCardInfoView") -local CardView = { - card = nil, - -- 牌序号 - card_item = 0, - -- 索引 - index = 0, - -- 原始位置 - old_postion = Vector2.zero -} - -local function NewCardView(card, cardItem) - local self = {} - setmetatable(self, { __index = CardView }) - self.card = card - self.card_item = cardItem - return self -end - local PlayerSelfView = { _dragCom = nil, _carViewList = {} @@ -118,22 +100,6 @@ function M:UpdateHandCard(getcard, mp) self:ClearMove() end -function M:FillHandCard(i, btn_card, tem_card, event) - local handCardName = self._viewText_cardInfo['Hand_Card'] - - self:fillCard2(btn_card, handCardName, tem_card) - local c_v = NewCardView(btn_card, tem_card) - c_v.index = i - c_v.old_postion = btn_card.xy - c_v.touch_pos = Vector2.New(btn_card.width / 2, btn_card.height / 2) - btn_card.data = c_v - if event then - btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin)) - btn_card.onTouchMove:Set(handler(self, self.onTouchMove)) - btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd)) - end -end - function M:UpdateHandCardWitness(getcard) self._view_handCardList.columnGap = -10 MJPlayerCardInfoView.UpdateHandCardWitness(self, getcard, true) diff --git a/wb_new_ui/assets/Common/package.xml b/wb_new_ui/assets/Common/package.xml index 6d0d381b..309200a3 100644 --- a/wb_new_ui/assets/Common/package.xml +++ b/wb_new_ui/assets/Common/package.xml @@ -1210,6 +1210,7 @@ + diff --git a/wb_new_ui/assets/Family/Record/Component/Item_familyRecord.xml b/wb_new_ui/assets/Family/Record/Component/Item_familyRecord.xml index c21b09c9..6a8aadca 100644 --- a/wb_new_ui/assets/Family/Record/Component/Item_familyRecord.xml +++ b/wb_new_ui/assets/Family/Record/Component/Item_familyRecord.xml @@ -2,22 +2,25 @@ - - - - - - - - - - - - + + + + + + + + + + + + + +