diff --git a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua index 31981277..f5100dcf 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua @@ -4,19 +4,18 @@ local FamilyInviteFamilyView = {} local M = FamilyInviteFamilyView -function FamilyInviteFamilyView.new(group, root) - setmetatable(M, { __index = root }) +function FamilyInviteFamilyView.new() + setmetatable(M, { __index = BaseView }) local self = setmetatable({}, { __index = M }) + self.class = "com_numberList" + BaseView.InitView(self ,"ui://Family/com_numberList") + self:initBtn() + return self +end + +function M:Reflash(group) self._group = group local numbers = self._group.members - print("lingmengFamilyInviteFamilyView", self._group.lev) - pt(self._group) - - self._viewList_allNumbers = self._view:GetChild('list_number') - self._btn_numberSearch = self._view:GetChild('btn_search') - self._input_numberSearch = self._view:GetChild('input_search') - - self:initBtn() local fgCtr = ControllerManager.GetController(NewGroupController) if #numbers == 0 then fgCtr:FG_GroupMembers(self._group.id, 0, self._group.total_member_num, false, 1, function(res) @@ -33,10 +32,20 @@ function FamilyInviteFamilyView.new(group, root) else self:FillList(numbers) end - return self +end + +function M:Show(group) + self:Reflash(group) + + BaseView.Show(self) end function M:initBtn() + self._viewList_allNumbers = self._view:GetChild('list_number') + self._btn_numberSearch = self._view:GetChild('btn_search') + self._input_numberSearch = self._view:GetChild('input_search') + self._btn_close = self._view:GetChild("btn_close") + self._btn_numberSearch.onClick:Set(function() local tempNumberList = {} for i = 1, self._group.member_num do @@ -50,13 +59,15 @@ function M:initBtn() self:FillList(tempNumberList) end end) + + self._btn_close.onClick:Set(function() + self:Close() + end) end function M:FillList(numbers) local fgCtr = ControllerManager.GetController(NewGroupController) self._viewList_allNumbers:SetVirtual() - self.familyType.selectedIndex = 4 - self.lastType = 1 self._viewList_allNumbers.itemRenderer = function(index, obj) local i = index + 1 obj:GetController('lev').selectedIndex = numbers[i].lev - 1 @@ -83,7 +94,7 @@ function M:FillList(numbers) end) end) end - + if self._viewList_allNumbers.numItems == #numbers then self._viewList_allNumbers:RefreshVirtualList() else diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua index 776f1dfc..e98659ee 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua @@ -3,6 +3,7 @@ local FamilyRoomCardRecord = import(".FamilyRoomCardRecord") local RoomCardRecord = import(".RoomCardRecord") local FamilyInviteFamilyView = import('.FamilyInviteFamilyView') local FamilyAuditNumber = import(".FamilyAuditNumber") +local FamilyAllNumbers = import(".FamilyAllNumbers") --region LOCAL @@ -138,6 +139,7 @@ function FamilyMyFamily:Close() end function FamilyMyFamily:Refalsh() + self.family = DataManager.groups.groupMap[self.groupId] self.tex_fName.text = Utils.TextOmit(self.family.name, 6) @@ -245,20 +247,13 @@ function FamilyMyFamily:Init() end) self.btn_checkNumber.onClick:Set(function() - local curView = ViewManager.GetCurrenView() - if curView.class == "FamilyMainView" then - curView:OpenAllNumber(self.family) - BaseView.DestroyAll() - else - local view = ViewManager.ChangeView(ViewManager.View_Family, function() - view:OpenAllNumber(self.family) - end) - end + local group = DataManager.groups.groupMap[self.groupId] + local view = FamilyAllNumbers.new() + view:Show(group) end) self.btn_applyMsg.onClick:Set(function() local group = DataManager.groups.groupMap[self.groupId] - local view = FamilyAuditNumber.new() view:Show(group) end) @@ -392,6 +387,8 @@ function FamilyMyFamily:Init() self.cTips.selectedIndex = 0 end) + self.cStyle.selectedIndex = 2 + return self end diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 8a0d9ada..1ca0c742 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -369,8 +369,8 @@ function M:OpenMyFamily(groupId) end function M:AllNumber() - self.lastType = 1 - self._child_familyAllNumbers = FamilyAllNumbers.new(self._group, self) + local view = FamilyAllNumbers.new() + view:Show(self._group) end function M:AuditNumber() @@ -412,8 +412,8 @@ function M:ShowAllRank() end function M:OpenAllNumber(group) - self.lastType = 1 - self._child_familyAllNumbers = FamilyAllNumbers.new(group, self) + local view = FamilyAllNumbers.new() + view:Show(group) end function M:MoreBtn() diff --git a/lua_probject/main_project/main/majiang/MJClearingView.lua b/lua_probject/main_project/main/majiang/MJClearingView.lua new file mode 100644 index 00000000..bd975e3c --- /dev/null +++ b/lua_probject/main_project/main/majiang/MJClearingView.lua @@ -0,0 +1,381 @@ +require("Game.View.ResultView") +local Hu_Type_Name = import(".CS_Win_Type") + +local EXClearingView = {} + +local M = EXClearingView + +function EXClearingView.new(blur_view) + setmetatable(M, { __index = ResultView }) + local self = setmetatable({}, { __index = M }) + self._full = true + ResultView.init(self, "ui://Main_Majiang/clearing") + + self._root_view:GetChild("win_mode").visible = false + + self._currenIndex = 0 + self._blur_view = blur_view + self._close_zone = false + -- self:InitMaPai() + + return self +end + +-- function M:InitMaPai() +-- self.maPaiCtr = self._view:GetController("mapai") +-- self.maPaiCtr.selectedIndex = 0 + +-- self.maPaiList = {} + +-- for i = 1, 8 do +-- local tempMP = self._view:GetChild("niao" .. i) +-- table.insert(self.maPaiList, tempMP) +-- end +-- end + +function M:InitData(over, room, result, total_result, callback, isWitness, witnessCallbak) + -- print("===============================InitData===========================", over, room, result, total_result) + -- pt(room) + -- pt(result) + -- Pt(total_result) + self._callback = callback + self._witnessCallbak = witnessCallbak + local showClearMainBtn = self._view:GetChild("btn_showClearMain") + local nextRoundBtn = self._view:GetChild("btn_nextRound") + local nextRoundBtn2 = self._view:GetChild("Btn_NextRound2") + local endRound = self._view:GetChild("Btn_EndRound") + local _overCtr = self._view:GetController("over") + local mainCtr = self._view:GetController("main") + local playerNum = self._view:GetController("playerNum") + local showBtnTypeCtr = self._view:GetController("showType") + + if result then + result.cardList = json.decode(result.cardList) + --排序 + --table.sort(result.cardList) + end + self.list_lastCard = self._view:GetChild('list_lastCard') + + self.list_lastCard:SetVirtual() + self.list_lastCard.itemRenderer = function(index, obj) + self:RemindCardRender(result.cardList[index + 1], obj) + end + + local peopleNum = room.room_config.people_num + + playerNum.selectedIndex = peopleNum - 2 + + showClearMainBtn.onClick:Set(function() + mainCtr.selectedIndex = 1 + end) + + nextRoundBtn.onClick:Set(function() + if isWitness and isWitness == 1 then + if self._witnessCallbak then + self._witnessCallbak() + end + self:DestroyWithCallback() + else + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + self:DestroyWithCallback() + end + end) + + + + endRound.onClick:Set(function() + ViewManager.ChangeView(ViewManager.View_Family) + end) + + if over == 0 then + showBtnTypeCtr.selectedIndex = 0 + _overCtr.selectedIndex = 0 + self:fillResult0(room, peopleNum, result) + nextRoundBtn2.onClick:Set(function() + if isWitness and isWitness == 1 then + if self._witnessCallbak then + self._witnessCallbak() + end + --self:DestroyWithCallback() + else + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:PlayerReady() + --self:DestroyWithCallback() + end + self:DestroyWithCallback() + end) + elseif over == 1 then + showBtnTypeCtr.selectedIndex = 1 + self:fillResult1(room, peopleNum, total_result) + if result then + self:fillResult0(room, peopleNum, result) + nextRoundBtn2.onClick:Set(function() + _overCtr.selectedIndex = 1 + end) + else + _overCtr.selectedIndex = 1 + end + else --解散房间如果没有开局直接退出不显示结算界面,over=2 + if room.curren_round > 0 then + _overCtr.selectedIndex = 1 + showBtnTypeCtr.selectedIndex = 1 + self:fillResult1(room, peopleNum, total_result) + else + ViewManager.ChangeView(ViewManager.View_Family) + end + end +end + +function M:fillResult0(room, peopleNum, result) + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config)) + self._view:GetChild("Label_GamePlay").title = string.format("第%s/%s局,%s", room.curren_round, + room.room_config.round, gamePlay) + self.list_lastCard.numItems = #result.cardList + self._view:GetChild('n147').text = string.format("剩余%d张未显示", #result.cardList) + for i = 1, peopleNum do + local playerInfoComp = self._view:GetChild(string.format("Comp_Player%d", i)) + + local allCardsList = playerInfoComp:GetChild("list_allCards") + local huCardBtn = playerInfoComp:GetChild("Btn_Card_Hu") + local jiangMaList = playerInfoComp:GetChild("list_JiangMa") + local ziMoCtr = playerInfoComp:GetController("isZiMo") + local dianPaoCtr = playerInfoComp:GetController("isPao") + local isMeCtr = playerInfoComp:GetController("IsMe") + local isZhuang = playerInfoComp:GetController("zhuang") + + local infoList = result.info_list[i] + local infoJiangma = result.niao + local playInfo = room:GetPlayerBySeat(infoList.seat) + local fzCardInfo = playInfo.fz_list + local fzInfoNum = #fzCardInfo + local handInfoNum = #infoList.hand_card + + self:fillHead(playInfo.self_user.head_url, playerInfoComp) + + infoList.jing_score = infoList.jing_score or 0 + infoList.gang_score = infoList.gang_score or 0 + infoList.hu_score = infoList.hu_score or 0 + infoList.round_score = infoList.round_score or 0 + + playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name + playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and + string.format("+%d", infoList.jing_score) or infoList.jing_score + playerInfoComp:GetChild("Text_Gang").text = infoList.gang_score >= 0 and + string.format("+%d", infoList.gang_score) or infoList.gang_score + playerInfoComp:GetChild("Text_Hu").text = infoList.hu_score >= 0 and string.format("+%d", infoList.hu_score) or + infoList.hu_score + playerInfoComp:GetChild("Text_Tatal").text = infoList.round_score >= 0 and + string.format("+%d", infoList.round_score) or infoList.round_score + + for j = 1, fzInfoNum do + if fzCardInfo[j].type == FZType.Peng then + local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_Clearing_FZ_3") + for l = 1, 3 do + local card = item:GetChild(string.format("Btn_Card%d", l)) + card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].card) + print("===============================FZType.Peng", room.jing, fzCardInfo[j].card) + if room.jing == fzCardInfo[j].card then + card:GetController('jing').selectedIndex = 1 + end + end + elseif fzCardInfo[j].type == FZType.Chi then + local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_Clearing_FZ_3") + for l = 1, 3 do + local card = item:GetChild(string.format("Btn_Card%d", l)) + card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].opcard + [l]) + print("===============================FZType.Chi", room.jing, fzCardInfo[j].opcard[l]) + + if room.jing == fzCardInfo[j].opcard[l] then + card:GetController('jing').selectedIndex = 1 + end + end + elseif fzCardInfo[j].type == FZType.Gang or fzCardInfo[j].type == FZType.Gang_An or fzCardInfo[j].type == FZType.Gang_Peng then + local item = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_Clearing_FZ_4") + for l = 1, 4 do + local card = item:GetChild(string.format("Btn_Card%d", l)) + if fzCardInfo[j].type == FZType.Gang_An and j == 4 then + card.icon = "ui://Main_Majiang/b202_00" + else + card.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), fzCardInfo[j].card) + print("===============================FZType.Gang", room.jing, fzCardInfo[j].card) + + if room.jing == fzCardInfo[j].card then + card:GetController('jing').selectedIndex = 1 + end + end + end + end + end + + local handCardItem = allCardsList:AddItemFromPool("ui://Main_Majiang/Comp_HandCard") + local handCardList = handCardItem:GetChild("list") + --手牌排序 + table.sort(infoList.hand_card, self.HandCardSortAndJing) + handCardList:SetVirtual() + handCardList.itemRenderer = function(index, obj) + obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1]) + if room.jing == infoList.hand_card[index + 1] then + obj:GetController('jing').selectedIndex = 1 + end + end + handCardList.numItems = handInfoNum + allCardsList.width = 234 * fzInfoNum + 78 + (handInfoNum - 1) * 74 + 36 * (fzInfoNum) + + if infoList.seat == room.self_player.seat then + isMeCtr.selectedIndex = 1 + end + + if infoList.seat == room.banker_seat then + isZhuang.selectedIndex = 1 + end + + if infoList.is_win then + local winInfo = "" + for j = 1, #infoList.win_list do + local Hu_Type_Name = + winInfo = string.format("%s,%s", winInfo, Hu_Type_Name[infoList.win_list[j].type]) + end + winInfo = string.sub(winInfo, 2, -1) + playerInfoComp:GetChild("text_huShow").text = winInfo + + if room.isZiMoHu then + ziMoCtr.selectedIndex = 1 + end + + + huCardBtn.icon = string.format("ui://Main_Majiang/b202_%d", infoList.win_card) + if room.jing == infoList.win_card then + huCardBtn:GetController('jing').selectedIndex = 1 + end + huCardBtn.visible = true + + jiangMaList.visible = true + jiangMaList:SetVirtual() + jiangMaList.itemRenderer = function(index, obj) + obj.icon = string.format("ui://Main_Majiang/b202_%d", infoJiangma[index + 1].card) + obj:GetController('bg').selectedIndex = infoJiangma[index + 1].score + obj:GetController('jing').selectedIndex = infoJiangma[index + 1].card == room.jing and 1 or 0 + end + jiangMaList.numItems = #infoJiangma + jiangMaList.columnCount = #infoJiangma / 2 + else + playerInfoComp:GetChild("text_huShow").text = "" + if not room.isZiMoHu and playInfo.self_user.account_id == result.active_player then + dianPaoCtr.selectedIndex = 1 + end + + huCardBtn.visible = false + jiangMaList.visible = false + end + end +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(DataManager.SelfUser.games) do + if v.game_id == room.game_id then + gameNameAndRoomIDText.text = string.format("%s 房号:%s", v.name, room.room_id) + end + end + if #gameNameAndRoomIDText.text <= 0 then + gameNameAndRoomIDText.text = string.format("房号:%s", room.room_id) + end + if room.group_id ~= 0 then + familyIDText.text = string.format("俱乐部:%s", room.group_id) + else + familyIDText.visible = false + end + self._view:GetChild("Text_RoundNum").text = string.format("局数:%s/%s", room.curren_round, room.room_config.round) + self._view:GetChild("Text_Time").text = os.date("%Y-%m-%d %H:%M:%S", os.time()) + + for i = 1, peopleNum do + local resultInfoComp = self._view:GetChild(string.format("Comp_ResultInfo%d", i)) + local totalInfoList = total_result.info_list[i] + local playInfo = room:GetPlayerBySeat(totalInfoList.seat) + + self:fillHead(playInfo.self_user.head_url, resultInfoComp) + + resultInfoComp:GetChild('Text_Name').text = playInfo.self_user.nick_name + resultInfoComp:GetChild('Text_ID').text = string.format("ID:%s", playInfo.self_user.account_id) + resultInfoComp:GetChild('Text_TotalScore').text = totalInfoList.total_score >= 0 and + string.format("+%s", totalInfoList.total_score) or totalInfoList.total_score + resultInfoComp:GetChild('Text_ZiMo').text = string.format("自摸 %d次", totalInfoList.settle_log.zimo or 0) + resultInfoComp:GetChild('Text_JiePao').text = string.format("接炮 %d次", totalInfoList.settle_log.jiepao or 0) + resultInfoComp:GetChild('Text_FangPao').text = string.format("放炮 %d次", totalInfoList.settle_log.fangpao or 0) + resultInfoComp:GetChild('Text_AnGang').text = string.format("暗杠 %d次", totalInfoList.settle_log.an_kong or 0) + resultInfoComp:GetChild('Text_MingGang').text = string.format("明杠 %d次", + totalInfoList.settle_log.ming_kong or 0) + resultInfoComp:GetChild('Text_FangGang').text = string.format("放杠 %d次", + totalInfoList.settle_log.fanggang or 0) + + resultInfoComp:GetController("win").selectedIndex = totalInfoList.total_score >= 0 and 1 or 0 + end +end + +function M:fillHead(url, view) + ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) +end + +function M:RemindCardRender(data, obj) + print("小计算 刷新 card = ", data) + local room = DataManager.CurrenRoom + obj.icon = string.format("ui://Main_Majiang/b202_%d", data) + print("lingmeng icon", obj.icon) + if room.jing == data then + obj:GetController('jing').selectedIndex = 1 + end +end + +function M.HandCardSortAndJing(a, b) + local jing = DataManager.CurrenRoom.jing + if a == jing or b == jing then + if a == b then + return a < b + end + return a == jing + else + if a < 200 then + a = a + 1000 + elseif a < 300 then + a = a + 3000 + elseif a < 400 then + a = a + 2000 + else + a = a + 4000 + end + if b < 200 then + b = b + 1000 + elseif b < 300 then + b = b + 3000 + elseif b < 400 then + b = b + 2000 + else + b = b + 4000 + end + return a < b + end +end + +local prefix +function M:GetPrefix() + -- if not prefix then + prefix = get_majiang_prefix(10) + -- end + return prefix +end + +function M:DestroyWithCallback() + if self._callback then + self._callback() + end + self:Destroy() +end + +return M diff --git a/wb_new_ui/assets/Family/Main.xml b/wb_new_ui/assets/Family/Main.xml index 5aac9f18..3571cd5f 100644 --- a/wb_new_ui/assets/Family/Main.xml +++ b/wb_new_ui/assets/Family/Main.xml @@ -1,6 +1,6 @@ - + @@ -22,7 +22,7 @@ - + @@ -140,38 +140,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wb_new_ui/assets/Family/NumberList/com_numberList.xml b/wb_new_ui/assets/Family/NumberList/com_numberList.xml new file mode 100644 index 00000000..0ac22ddf --- /dev/null +++ b/wb_new_ui/assets/Family/NumberList/com_numberList.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wb_new_ui/assets/Family/package.xml b/wb_new_ui/assets/Family/package.xml index 53a1e115..0139089d 100644 --- a/wb_new_ui/assets/Family/package.xml +++ b/wb_new_ui/assets/Family/package.xml @@ -393,6 +393,7 @@ + \ No newline at end of file diff --git a/wb_new_ui/assets/Main_Majiang/images/img_card_arrow.png b/wb_new_ui/assets/Main_Majiang/images/img_card_arrow.png new file mode 100644 index 00000000..d91818db Binary files /dev/null and b/wb_new_ui/assets/Main_Majiang/images/img_card_arrow.png differ diff --git a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes index d8da9fca..3bf41589 100644 Binary files a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes and b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes differ