diff --git a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua new file mode 100644 index 00000000..e89095d4 --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua @@ -0,0 +1,64 @@ +local FamilyNumberDetail = import(".FamilyNumberDetail") + +local FamilyInviteFamilyView = {} + +local M = FamilyInviteFamilyView + +function FamilyInviteFamilyView.new(root) + setmetatable(M, { __index = root }) + local self = setmetatable({}, { __index = M }) + local numbers = self._group.members + + 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() + self:FillList(numbers) + return self +end + +function M:initBtn() + self._btn_numberSearch.onClick:Set(function() + local tempNumberList = {} + for i = 1,self._group.member_num do + if string.find(self._group.members[i].nick,self._input_numberSearch.text) then + table.insert(tempNumberList,self._group.members[i]) + end + end + if #tempNumberList == 0 then + ViewUtil.ShowOneChooose("没有找到该成员") + else + self:FillList(tempNumberList) + end + end) +end + +function M:FillList(numbers) + local fgCtr = ControllerManager.GetController(NewGroupController) + + self._viewList_allNumbers:SetVirtual() + self.familyType.selectedIndex = 4 + self._viewList_allNumbers.itemRenderer = function(index, obj) + local i = index + 1 + obj:GetController('lev').selectedIndex = numbers[i].lev - 1 + obj:GetChild('name').text = numbers[i].nick + obj:GetChild('id').text = string.format("ID:%s", numbers[i].uid) + ImageLoad.Load(numbers[i].portrait, obj:GetChild('btn_head')._iconObject) + + obj.onClick:Set(function() + print("lingmengtextBtn_detail") + fgCtr:FG_FindMember(self._group.id,numbers[i].uid,function(res) + local familyNumberDetail = FamilyNumberDetail.new(res) + familyNumberDetail:Show() + end) + end) + end + self._viewList_allNumbers.numItems = #numbers +end + +function M:FillNumberDetail() + +end + +return M diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua new file mode 100644 index 00000000..a2c830f9 --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua @@ -0,0 +1,49 @@ +--设置窗口对象 + +local FamilyNumberDetail = {} + +local M = FamilyNumberDetail +setmetatable(M, { __index = BaseWindow }) + +function FamilyNumberDetail.new(res) + local self = setmetatable({}, { __index = M }) + self.class = 'FamilyNumberDetail' + self._close_destroy = true + + self:init('ui://Family/NumberDetail',res) + return self +end + +function M:init(url,res) + + BaseWindow.init(self, url) + pt(res) + local info = res.Data.members[1] + self._view:GetChild('name').text = string.format("%s(%s)",info.nick,info.uid) + self._view:GetChild('text_allRounds').text = info.total_round + self._view:GetChild('text_joinTime').text = os.date('%Y-%m-%d %H:%M', info.join_time) + self._view:GetChild('text_score_majiang').text = 0 + self._view:GetChild('text_score_poker').text = 0 + + self._view:GetChild('btn_changeTag').onClick:Set(function() + ViewUtil.ShowOneChooose("该功能还未开放") + end) + + self._view:GetChild('btn_changeMJScore').onClick:Set(function() + ViewUtil.ShowOneChooose("该功能还未开放") + end) + + self._view:GetChild('btn_changePokerScore').onClick:Set(function() + ViewUtil.ShowOneChooose("该功能还未开放") + end) + + self._view:GetChild('btn_tick').onClick:Set(function() + + end) + + self._view:GetChild('btn_band').onClick:Set(function() + ViewUtil.ShowOneChooose("该功能还未开放") + end) +end + +return M diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 9e79cdbd..3bf65181 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -2,128 +2,13 @@ local FamilyInviteFamilyView = import('.Family.FamilyInviteFamilyView') local CreatePlayView = import('.Family.CreatePlayView') local GroupGameSettingView = import(".NewGroup.MngView.GroupGameSettingView_jaingxi") ---设置窗口对象 - +---无窗口 +local FamilyAllNumbers = import(".Family.FamilyAllNumbers") +--- FamilyView = {} local M = FamilyView -local IDENTITY_LIST = { - { - level = 0, --圈主 - - }, - { - level = 1, --副圈主 - otherList = { - { - name = "邀请朋友", - Fct = M.ShareWx - }, - { - name = "游戏记录", - Fct = M.ShareWx - }, - { - name = "玩法管理", - Fct = M.PlayEdit - }, - { - name = "充值房卡", - Fct = M.ShareWx - }, - { - name = "申请消息", - Fct = M.ShareWx - }, - { - name = "查看成员", - Fct = M.ShareWx - }, - { - name = "创建亲友圈", - Fct = M.CreateFamily - }, - { - name = "高级选项", - Fct = M.CreateFamily - }, - { - name = "添加助理", - Fct = M.CreateFamily - }, - { - name = "加入亲友圈", - Fct = M.JoinFamily - }, - } - - }, - { - level = 2, --管理员 - otherList = { - { - name = "邀请朋友", - Fct = M.ShareWx - }, - { - name = "游戏记录", - Fct = M.ShareWx - }, - { - name = "玩法管理", - Fct = M.PlayEdit - }, - { - name = "充值房卡", - Fct = M.ShareWx - }, - { - name = "申请消息", - Fct = M.ShareWx - }, - { - name = "查看成员", - Fct = M.ShareWx - }, - { - name = "创建亲友圈", - Fct = M.CreateFamily - }, - { - name = "高级选项", - Fct = M.CreateFamily - }, - { - name = "添加助理", - Fct = M.CreateFamily - }, - { - name = "加入亲友圈", - Fct = M.JoinFamily - }, - } - - }, - { - level = 3, --成员 - otherList = { - { - name = "邀请朋友", - Fct = M.ShareWx - }, - { - name = "创建亲友圈", - Fct = M.CreateFamily - }, - { - name = "加入亲友圈", - Fct = M.JoinFamily - }, - } - - }, -} function FamilyView.new() UIPackage.AddPackage("base/Family/ui/Family") @@ -241,27 +126,18 @@ function M:PlayEdit() self.lastType = 1 end -function M:ChangeOther(i) - local otherList = IDENTITY_LIST[i].otherList - local list_other = self._view:GetChild('list_other') - self._lev = i - list_other:SetVirtual() - list_other.itemRenderer = function(index, obj) - obj:GetChild('text').text = otherList[index + 1].name - -- print("lingmengChangeOther", otherList[index + 1].name, otherList[index + 1].Fct, - -- typeof(otherList[index + 1].Fct)) - obj.onClick:Add(handler(self, otherList[index + 1].Fct)) - end - list_other.numItems = #otherList +function M:AllNumber() + self.lastType = 1 + local familyAllNumbers = FamilyAllNumbers.new(self) end function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type) local list_familyNumber = self._view:GetChild('list_familyNumber') list_familyNumber:SetVirtual() fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res) - local members = res.Data.members + local members = self._group.members -- print("==========================res.Data.members") - pt(res.Data.members) + pt(self._group.members) ViewUtil:CloseModalWait() if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败") @@ -527,4 +403,133 @@ function M:OnUpdate() end end +local IDENTITY_LIST = { + { + level = 0, --圈主 + + }, + { + level = 1, --副圈主 + otherList = { + { + name = "邀请朋友", + Fct = M.ShareWx + }, + { + name = "游戏记录", + Fct = M.ShareWx + }, + { + name = "玩法管理", + Fct = M.PlayEdit + }, + { + name = "充值房卡", + Fct = M.ShareWx + }, + { + name = "申请消息", + Fct = M.ShareWx + }, + { + name = "查看成员", + Fct = M.AllNumber + }, + { + name = "创建亲友圈", + Fct = M.CreateFamily + }, + { + name = "高级选项", + Fct = M.CreateFamily + }, + { + name = "添加助理", + Fct = M.CreateFamily + }, + { + name = "加入亲友圈", + Fct = M.JoinFamily + }, + } + + }, + { + level = 2, --管理员 + otherList = { + { + name = "邀请朋友", + Fct = M.ShareWx + }, + { + name = "游戏记录", + Fct = M.ShareWx + }, + { + name = "玩法管理", + Fct = M.PlayEdit + }, + { + name = "充值房卡", + Fct = M.ShareWx + }, + { + name = "申请消息", + Fct = M.ShareWx + }, + { + name = "查看成员", + Fct = M.AllNumber + }, + { + name = "创建亲友圈", + Fct = M.CreateFamily + }, + { + name = "高级选项", + Fct = M.CreateFamily + }, + { + name = "添加助理", + Fct = M.CreateFamily + }, + { + name = "加入亲友圈", + Fct = M.JoinFamily + }, + } + + }, + { + level = 3, --成员 + otherList = { + { + name = "邀请朋友", + Fct = M.ShareWx + }, + { + name = "创建亲友圈", + Fct = M.CreateFamily + }, + { + name = "加入亲友圈", + Fct = M.JoinFamily + }, + } + + }, +} + +function M:ChangeOther(i) + local otherList = IDENTITY_LIST[i].otherList + local list_other = self._view:GetChild('list_other') + self._lev = i + list_other:SetVirtual() + list_other.itemRenderer = function(index, obj) + obj:GetChild('text').text = otherList[index + 1].name + obj.onClick:Add(handler(self, otherList[index + 1].Fct)) + end + list_other.numItems = #otherList +end + return M diff --git a/lua_probject/base_project/Game/View/ViewUtil.lua b/lua_probject/base_project/Game/View/ViewUtil.lua index c191b345..77cc737c 100644 --- a/lua_probject/base_project/Game/View/ViewUtil.lua +++ b/lua_probject/base_project/Game/View/ViewUtil.lua @@ -318,3 +318,52 @@ function ViewUtil.ShowOneChooose(showText, btnType, callback) end end) end + +function ViewUtil.ShowTwoChooose(showText, leftCallback,rightCallback) + local pop_twoChoose = UIPackage.CreateObjectFromURL("ui://Common/pop_twoChoose") + pop_twoChoose:GetChild('text_show').text = showText + GRoot.inst:AddChild(pop_twoChoose) + pop_twoChoose:Center() + local btn_left = pop_twoChoose:GetChild('btn_leftChoose') + + btn_left.onClick:Add(function() + GRoot.inst:RemoveChild(pop_twoChoose) + if leftCallback then + leftCallback() + end + end) + + local btn_right = pop_twoChoose:GetChild('btn_rightChoose') + + btn_right.onClick:Add(function() + GRoot.inst:RemoveChild(pop_twoChoose) + if rightCallback then + rightCallback() + end + end) +end + +function ViewUtil.ShowOneInput(showText, callback) + local pop_oneInput = UIPackage.CreateObjectFromURL("ui://Common/pop_oneInput") + pop_oneInput:GetChild('label_detial').title = showText + GRoot.inst:AddChild(pop_oneInput) + pop_oneInput:Center() + local btn_center = pop_oneInput:GetChild('btn_center') + -- if type(btnType) == "number" then + -- btn_center.icon = string.format("ui://Common/btn_%d", btnType) + -- else + -- btn_center.icon = btnType + -- end + btn_center.onClick:Add(function() + GRoot.inst:RemoveChild(pop_oneInput) + if callback then + callback(pop_oneInput:GetChild('input_oneInput').text) + end + end) + + local btn_center = pop_oneInput:GetChild('btn_close') + btn_center.onClick:Add(function() + GRoot.inst:RemoveChild(pop_oneInput) + + end) +end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua index d00bade5..97d8e646 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua @@ -36,13 +36,15 @@ function M:init(name) self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang + + self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard end local __pre_delete_card = false -- 发送出牌指令到服务器 --------------------------lingmeng--------------------------- +-------------------------展示牌--------------------------- function M:SendNextCard(card) local _data = {} _data["card"] = tonumber(card) @@ -50,6 +52,13 @@ function M:SendNextCard(card) _client:send(TX_Protocol.GAME_NEXT_CARD, _data) end +function M:ReqResidueCard() + local _data = {} + _data["card"] = 0 + local _client = ControllerManager.GameNetClinet + _client:send(TX_Protocol.GAME_RESIDUE_CARD, _data) +end + ------------------------------------------------------------ function M:SendOutCard(card, callback) @@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data) DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true) end +function M:OnEventResidueCard(evt_data) + printlog("OnEventResidueCard") + pt(evt_data) + if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then + return + end + DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"]) +end + -- 发送放子选择到服务器 function M:SendAction(id) local _data = {} diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index 9503caa8..075c843d 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -69,41 +69,24 @@ function M:InitView(url) self:UpdatePlayerInfoView() end) - local showNextCtr = self._view:GetController('showNext') - local ShowNextConfrimCtr = self._view:GetController('showNextConfrim') - local showNextList = self._view:GetChild('list_showNext') - local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim') + self.showNextCtr = self._view:GetController('showNext') + self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - showNextCtr.selectedIndex = 1 - end) - self._view:GetChild('btn_sendShow').onClick:Set(function() - self:SendShowNext(ShowNextConfrimCtr) + self:reqResidueCard() end) self._view:GetChild('btn_closeShow').onClick:Set(function() - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) - showNextList.onClickItem:Set(function(context) + self.showNextList.onClickItem:Set(function(context) local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(context.data.name, -3)) - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 - self._showNextName = nil - -- self:ClickShowNext(context, ShowNextConfrimCtr) - end) - ShowNextConfrimCtr.onChanged:Set(function() - pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName - end) - pop_showNextConfrim:GetChild("btn_center").onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(self._showNextName, -3)) - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + _gamectr:SendNextCard(context.data.data.card) + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) + local btn_closeRoom = self._view:GetChild("btn_setting") self._view:GetChild('btn_closeRoom').onClick:Set(function() @@ -567,6 +550,31 @@ function M:EventInit() end end end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + local arg = { ... } + local residueCard = arg[1] + local cardMap = {} + local cardSet = {} + self.showNextCtr.selectedIndex = 1 + for i = 1, #residueCard do + local cardNum = residueCard[i] + if not cardMap[cardNum] then + cardMap[cardNum] = 1 + table.insert(cardSet, cardNum) + else + cardMap[cardNum] = cardMap[cardNum] + 1 + end + end + table.sort(cardSet) + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = cardSet[index + 1] + self:FillShowCards(obj, card, cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #cardSet + end) end function M:OutCard(card) @@ -983,7 +991,13 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end ------------------------lingmeng---------------------------- +-----------------------展示牌---------------------------- + +function M:reqResidueCard() + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:ReqResidueCard() +end + function M:SendShowNext(ShowNextConfrimCtr) if not self._showNextName then ViewUtil.ErrorTip(nil, "请先选择一个麻将牌") @@ -1000,6 +1014,28 @@ function M:ClickShowNext(context, ShowNextConfrimCtr) self._showNextName = context.data.name end +function M:FillShowCards(obj, card, num) + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if card == DataManager.CurrenRoom.jing then + obj:GetController('jing').selectedIndex = 1 + else + obj:GetController('jing').selectedIndex = 0 + end + end + end + if obj.icon then + obj.icon = 'ui://Main_Majiang/201_' .. card + else + obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card + end + if obj.title then + obj.title = string.format("%d张", num) + else + obj:GetChild("title").text = string.format("%d张", num) + end +end + ----------------------------------------------------------- diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/GameEvent.lua b/lua_probject/extend_project/extend/majiang/fuzhou/GameEvent.lua index 9180694e..58df4802 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/GameEvent.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/GameEvent.lua @@ -1,6 +1,5 @@ - local TX_GameEvent = { - -- 发牌 + -- 发牌 SendCards = "SendCards", EventTurn = "EventTurn", @@ -22,16 +21,18 @@ local TX_GameEvent = { ZPResult2 = "ZPResult2", EventNiao = "EventNiao", - + EvnetPiaoTip = "EvnetPiaoTip", EvnetPiao = "EvnetPiao", - - - --- - SendLaiZi="SendLaiZi", + + + --- + SendLaiZi = "SendLaiZi", SendGangZi = "SendGangZi", EventBuGang = "EventBuGang", - + + --- + EventResidueCard = "EventResidueCard" } -return TX_GameEvent \ No newline at end of file +return TX_GameEvent diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/Protocol.lua b/lua_probject/extend_project/extend/majiang/fuzhou/Protocol.lua index 909cc4b2..38ab97d4 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/Protocol.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/Protocol.lua @@ -1,7 +1,7 @@ local Protocol = { - -- 发牌协议 - GAME_EVT_PLAYER_DEAL = "811", - + -- 发牌协议 + GAME_EVT_PLAYER_DEAL = "811", + -- 出牌 GAME_DIS_CARD = "611", @@ -28,16 +28,16 @@ local Protocol = { -- 大结算 GAME_EVT_RESULT2 = "818", - - -- 抓牌 + + -- 抓牌 GAME_EVT_DRAW = "819", - -- 转盘指向事件 + -- 转盘指向事件 GAME_EVT_CHANGE_ACTIVE_PLAYER = "820", -- 抓鸟事件 GAME_EVT_NIAO = "821", - + -- 飘鸟提示 GAME_EVT_PIAOTIP = "833", @@ -49,7 +49,9 @@ local Protocol = { GAME_EVT_DOGANG = "839", --送牌 - GAME_NEXT_CARD = "888" + GAME_NEXT_CARD = "888", + GAME_RESIDUE_CARD = "613", + GAME_EVT_RESIDUE_CARD = "889" } -return Protocol \ No newline at end of file +return Protocol diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua index 208fc3b3..7cfb54d2 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua @@ -8,7 +8,7 @@ local M = {} function M.new() setmetatable(M, { __index = GameController }) local self = setmetatable({}, { __index = M }) - self:init("南城麻将") + self:init("金溪麻将") self.class = "TX_GameController" return self end diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index bc084e2f..1c1ab2d4 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -1016,8 +1016,14 @@ function M:ClickShowNext(context, ShowNextConfrimCtr) end function M:FillShowCards(obj, card, num) - if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then - obj:GetController('jing').selectedIndex = 1 + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if card == DataManager.CurrenRoom.jing then + obj:GetController('jing').selectedIndex = 1 + else + obj:GetController('jing').selectedIndex = 0 + end + end end if obj.icon then obj.icon = 'ui://Main_Majiang/201_' .. card diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua index 50503ff6..46118269 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua @@ -36,13 +36,15 @@ function M:init(name) self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang + + self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard end local __pre_delete_card = false -- 发送出牌指令到服务器 --------------------------lingmeng--------------------------- +-------------------------展示牌--------------------------- function M:SendNextCard(card) local _data = {} _data["card"] = tonumber(card) @@ -50,6 +52,13 @@ function M:SendNextCard(card) _client:send(TX_Protocol.GAME_NEXT_CARD, _data) end +function M:ReqResidueCard() + local _data = {} + _data["card"] = 0 + local _client = ControllerManager.GameNetClinet + _client:send(TX_Protocol.GAME_RESIDUE_CARD, _data) +end + ------------------------------------------------------------ function M:SendOutCard(card, callback) @@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data) DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true) end +function M:OnEventResidueCard(evt_data) + printlog("OnEventResidueCard") + pt(evt_data) + if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then + return + end + DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"]) +end + -- 发送放子选择到服务器 function M:SendAction(id) local _data = {} diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index 8d34c984..a3bf90d0 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -69,41 +69,24 @@ function M:InitView(url) self:UpdatePlayerInfoView() end) - local showNextCtr = self._view:GetController('showNext') - local ShowNextConfrimCtr = self._view:GetController('showNextConfrim') - local showNextList = self._view:GetChild('list_showNext') - local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim') + self.showNextCtr = self._view:GetController('showNext') + self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - showNextCtr.selectedIndex = 1 - end) - self._view:GetChild('btn_sendShow').onClick:Set(function() - self:SendShowNext(ShowNextConfrimCtr) + self:reqResidueCard() end) self._view:GetChild('btn_closeShow').onClick:Set(function() - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) - showNextList.onClickItem:Set(function(context) + self.showNextList.onClickItem:Set(function(context) local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(context.data.name, -3)) - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 - self._showNextName = nil - -- self:ClickShowNext(context, ShowNextConfrimCtr) - end) - ShowNextConfrimCtr.onChanged:Set(function() - pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName - end) - pop_showNextConfrim:GetChild("btn_center").onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(self._showNextName, -3)) - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + _gamectr:SendNextCard(context.data.data.card) + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) + local btn_closeRoom = self._view:GetChild("btn_setting") self._view:GetChild('btn_closeRoom').onClick:Set(function() @@ -567,6 +550,31 @@ function M:EventInit() end end end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + local arg = { ... } + local residueCard = arg[1] + local cardMap = {} + local cardSet = {} + self.showNextCtr.selectedIndex = 1 + for i = 1, #residueCard do + local cardNum = residueCard[i] + if not cardMap[cardNum] then + cardMap[cardNum] = 1 + table.insert(cardSet, cardNum) + else + cardMap[cardNum] = cardMap[cardNum] + 1 + end + end + table.sort(cardSet) + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = cardSet[index + 1] + self:FillShowCards(obj, card, cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #cardSet + end) end function M:OutCard(card) @@ -984,7 +992,13 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end ------------------------lingmeng---------------------------- +-----------------------展示牌---------------------------- + +function M:reqResidueCard() + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:ReqResidueCard() +end + function M:SendShowNext(ShowNextConfrimCtr) if not self._showNextName then ViewUtil.ErrorTip(nil, "请先选择一个麻将牌") @@ -1001,6 +1015,28 @@ function M:ClickShowNext(context, ShowNextConfrimCtr) self._showNextName = context.data.name end +function M:FillShowCards(obj, card, num) + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if card == DataManager.CurrenRoom.jing then + obj:GetController('jing').selectedIndex = 1 + else + obj:GetController('jing').selectedIndex = 0 + end + end + end + if obj.icon then + obj.icon = 'ui://Main_Majiang/201_' .. card + else + obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card + end + if obj.title then + obj.title = string.format("%d张", num) + else + obj:GetChild("title").text = string.format("%d张", num) + end +end + ----------------------------------------------------------- diff --git a/lua_probject/extend_project/extend/majiang/lichuan/GameEvent.lua b/lua_probject/extend_project/extend/majiang/lichuan/GameEvent.lua index 9180694e..58df4802 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/GameEvent.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/GameEvent.lua @@ -1,6 +1,5 @@ - local TX_GameEvent = { - -- 发牌 + -- 发牌 SendCards = "SendCards", EventTurn = "EventTurn", @@ -22,16 +21,18 @@ local TX_GameEvent = { ZPResult2 = "ZPResult2", EventNiao = "EventNiao", - + EvnetPiaoTip = "EvnetPiaoTip", EvnetPiao = "EvnetPiao", - - - --- - SendLaiZi="SendLaiZi", + + + --- + SendLaiZi = "SendLaiZi", SendGangZi = "SendGangZi", EventBuGang = "EventBuGang", - + + --- + EventResidueCard = "EventResidueCard" } -return TX_GameEvent \ No newline at end of file +return TX_GameEvent diff --git a/lua_probject/extend_project/extend/majiang/lichuan/Protocol.lua b/lua_probject/extend_project/extend/majiang/lichuan/Protocol.lua index 8f9d4111..38ab97d4 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/Protocol.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/Protocol.lua @@ -49,7 +49,9 @@ local Protocol = { GAME_EVT_DOGANG = "839", --送牌 - GAME_NEXT_CARD = "888" + GAME_NEXT_CARD = "888", + GAME_RESIDUE_CARD = "613", + GAME_EVT_RESIDUE_CARD = "889" } return Protocol diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua index c36054a2..208fc3b3 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua @@ -36,13 +36,15 @@ function M:init(name) self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang + + self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard end local __pre_delete_card = false -- 发送出牌指令到服务器 --------------------------lingmeng--------------------------- +-------------------------展示牌--------------------------- function M:SendNextCard(card) local _data = {} _data["card"] = tonumber(card) @@ -50,6 +52,13 @@ function M:SendNextCard(card) _client:send(TX_Protocol.GAME_NEXT_CARD, _data) end +function M:ReqResidueCard() + local _data = {} + _data["card"] = 0 + local _client = ControllerManager.GameNetClinet + _client:send(TX_Protocol.GAME_RESIDUE_CARD, _data) +end + ------------------------------------------------------------ function M:SendOutCard(card, callback) @@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data) DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true) end +function M:OnEventResidueCard(evt_data) + printlog("OnEventResidueCard") + pt(evt_data) + if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then + return + end + DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"]) +end + -- 发送放子选择到服务器 function M:SendAction(id) local _data = {} diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index ffe3f859..482385ba 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -64,46 +64,28 @@ function M:InitView(url) self._view:GetChild('wanfa_text').text = gamePlay self.jing = self._view:GetChild('jing') - self._state.onChanged:Add(function() self:UpdatePlayerInfoView() end) - local showNextCtr = self._view:GetController('showNext') - local ShowNextConfrimCtr = self._view:GetController('showNextConfrim') - local showNextList = self._view:GetChild('list_showNext') - local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim') + self.showNextCtr = self._view:GetController('showNext') + self.showNextList = self._view:GetChild('list_showNext') self._view:GetChild('btn_showNext').onClick:Set(function() - showNextCtr.selectedIndex = 1 - end) - self._view:GetChild('btn_sendShow').onClick:Set(function() - self:SendShowNext(ShowNextConfrimCtr) + self:reqResidueCard() end) self._view:GetChild('btn_closeShow').onClick:Set(function() - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) - showNextList.onClickItem:Set(function(context) + self.showNextList.onClickItem:Set(function(context) local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(context.data.name, -3)) - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 - self._showNextName = nil - -- self:ClickShowNext(context, ShowNextConfrimCtr) - end) - ShowNextConfrimCtr.onChanged:Set(function() - pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName - end) - pop_showNextConfrim:GetChild("btn_center").onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:SendNextCard(string.sub(self._showNextName, -3)) - ShowNextConfrimCtr.selectedIndex = 0 - showNextCtr.selectedIndex = 0 - showNextList.selectedIndex = -1 + _gamectr:SendNextCard(context.data.data.card) + self.showNextCtr.selectedIndex = 0 + self.showNextList.selectedIndex = -1 self._showNextName = nil end) + local btn_closeRoom = self._view:GetChild("btn_setting") self._view:GetChild('btn_closeRoom').onClick:Set(function() @@ -570,6 +552,31 @@ function M:EventInit() end end end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + local arg = { ... } + local residueCard = arg[1] + local cardMap = {} + local cardSet = {} + self.showNextCtr.selectedIndex = 1 + for i = 1, #residueCard do + local cardNum = residueCard[i] + if not cardMap[cardNum] then + cardMap[cardNum] = 1 + table.insert(cardSet, cardNum) + else + cardMap[cardNum] = cardMap[cardNum] + 1 + end + end + table.sort(cardSet) + self.showNextList:SetVirtual() + self.showNextList.itemRenderer = function(index, obj) + local card = cardSet[index + 1] + self:FillShowCards(obj, card, cardMap[card]) + obj.data = { card = card } + end + self.showNextList.numItems = #cardSet + end) end function M:OutCard(card) @@ -996,7 +1003,13 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end ------------------------lingmeng---------------------------- +-----------------------展示牌---------------------------- + +function M:reqResidueCard() + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:ReqResidueCard() +end + function M:SendShowNext(ShowNextConfrimCtr) if not self._showNextName then ViewUtil.ErrorTip(nil, "请先选择一个麻将牌") @@ -1013,6 +1026,26 @@ function M:ClickShowNext(context, ShowNextConfrimCtr) self._showNextName = context.data.name end +function M:FillShowCards(obj, card, num) + if DataManager.CurrenRoom.jing and obj:GetController('jing') then + if card == DataManager.CurrenRoom.jing then + obj:GetController('jing').selectedIndex = 1 + else + obj:GetController('jing').selectedIndex = 0 + end + end + if obj.icon then + obj.icon = 'ui://Main_Majiang/201_' .. card + else + obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card + end + if obj.title then + obj.title = string.format("%d张", num) + else + obj:GetChild("title").text = string.format("%d张", num) + end +end + ----------------------------------------------------------- diff --git a/lua_probject/extend_project/extend/majiang/nancheng/GameEvent.lua b/lua_probject/extend_project/extend/majiang/nancheng/GameEvent.lua index 9180694e..8d04bfee 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/GameEvent.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/GameEvent.lua @@ -32,6 +32,8 @@ local TX_GameEvent = { SendLaiZi="SendLaiZi", SendGangZi = "SendGangZi", EventBuGang = "EventBuGang", - + + --- + EventResidueCard = "EventResidueCard" } return TX_GameEvent \ No newline at end of file diff --git a/lua_probject/extend_project/extend/majiang/nancheng/Protocol.lua b/lua_probject/extend_project/extend/majiang/nancheng/Protocol.lua index 909cc4b2..72a45bcf 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/Protocol.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/Protocol.lua @@ -49,7 +49,9 @@ local Protocol = { GAME_EVT_DOGANG = "839", --送牌 - GAME_NEXT_CARD = "888" + GAME_NEXT_CARD = "888", + GAME_RESIDUE_CARD = "613", + GAME_EVT_RESIDUE_CARD = "889" } return Protocol \ No newline at end of file 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 8390191f..f431663b 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 diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0.png index bf17c739..a9a62fa4 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_1.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_1.png index 8a2b79a5..8856ed98 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_1.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_1.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_10.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_10.png index a78fab39..6f292e7d 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_10.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_10.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_11.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_11.png index a6bf252f..778e25e2 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_11.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_11.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_12.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_12.png index 3f91fec6..93606030 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_12.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_12.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_13.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_13.png index 6e371e3d..aaa72106 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_13.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_13.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_14.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_14.png index 70425481..1ba33695 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_14.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_14.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_15.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_15.png index 2d5e96f8..9af9d06f 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_15.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_15.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_2.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_2.png index 5ed50ecc..4fa3d0a7 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_2.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_2.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_3.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_3.png index 2058fbc1..3208ba71 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_3.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_3.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_4.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_4.png index 01321cc8..8c4e67ef 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_4.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_4.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_5.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_5.png index 56523fde..c343331f 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_5.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_5.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_6.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_6.png index b81aa35c..770b73bc 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_6.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_6.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_7.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_7.png index 85f37ea1..81908d03 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_7.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_7.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_8.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_8.png index 53cf2cd0..5e96b070 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_8.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_8.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_9.png b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_9.png index 6b57556e..b0748722 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_9.png and b/wb_unity_pro/Assets/ART/base/common/ui/Common_atlas0_9.png differ diff --git a/wb_unity_pro/Assets/ART/base/common/ui/Common_fui.bytes b/wb_unity_pro/Assets/ART/base/common/ui/Common_fui.bytes index d97e7688..a4ce3e7d 100644 Binary files a/wb_unity_pro/Assets/ART/base/common/ui/Common_fui.bytes and b/wb_unity_pro/Assets/ART/base/common/ui/Common_fui.bytes differ