diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index d16c54d8..02240f8a 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -1071,6 +1071,7 @@ function M:ChangeOther() local otherList = IDENTITY_LIST[i].otherList local list_other = self._view:GetChild('list_other') self._lev = i + self._view:GetController('lev').selectedIndex = self._group.lev - 1 list_other:SetVirtual() list_other.itemRenderer = function(index, obj) local cfg = otherList[index + 1] diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index cde17e18..8b1656b9 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -1375,7 +1375,7 @@ function M:OnUpdate() end if leftTime <= 3 and self._curtime ~= leftTime and leftTime ~= 0 then self._curtime = leftTime - GameApplication.Instance:PlaySound('base/sound/daojishi1.mp3') + GameApplication.Instance:PlaySound('base/common/sound/timeup_alarm.mp3') end else self:onLeftTimeOver() diff --git a/lua_probject/base_project/Game/View/PlayerInfoView2.lua b/lua_probject/base_project/Game/View/PlayerInfoView2.lua index 0adfc2d1..380b61b9 100644 --- a/lua_probject/base_project/Game/View/PlayerInfoView2.lua +++ b/lua_probject/base_project/Game/View/PlayerInfoView2.lua @@ -34,8 +34,9 @@ function M.new(view, main_view, isHideIpAdds) return self end -function M:init() +function M:init(flag_witness) local view = self._view + self.flag_witness = flag_witness UIPackage.AddPackage('base/chat/ui/Chat') self._tex_player_name = view:GetChild('name') -- self._tex_score = view:GetChild('text_jifen') @@ -141,7 +142,7 @@ function M:FillData(player) function() --local headView = HeadView.new(self._main_view._root_view, player.self_user, self._isHideIpAdds) --headView:Show() - local _playerDetailView = playerDetailView.New() + local _playerDetailView = playerDetailView.New(self.flag_witness) _playerDetailView:Show(player) end ) diff --git a/lua_probject/base_project/Game/View/WitnessView.lua b/lua_probject/base_project/Game/View/WitnessView.lua index 8d5e2f39..15d537e2 100644 --- a/lua_probject/base_project/Game/View/WitnessView.lua +++ b/lua_probject/base_project/Game/View/WitnessView.lua @@ -1,4 +1,5 @@ local MJMainView = require("main.majiang.MJMainView") +local MissileSender = import(".MissileSender") local WitnessView = {} @@ -17,9 +18,13 @@ function M:init() self.class = "MainView" self._style = 1 self._popEvent = true + self.Fix_Msg_Chat = ViewUtil.Fix_Msg_Chat -- 自动回复消息列表 self:InitView() end +-- 语音是否禁止 +local record_baned = 0 + function M:InitView(url) local room = self._room BaseView.InitView(self, url) @@ -31,6 +36,181 @@ function M:InitView(url) self.com_notice = self._view:GetChild("com_notice") end +function M:EventInit() + local _gamectr = self._gamectr + local _room = self._room + + _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) + self:PlayMJSound("user_enter.mp3") + local arg = { ... } + local p = arg[1] + local info1 = self._player_info[self:GetPos(p.seat)] + info1:FillData(p) + info1._view.visible = true + + local info2 = self._player_card_info[self:GetPos(p.seat)] + info2:SetPlayer(p) + info2:FillData() + end) + + _gamectr:AddEventListener(GameEvent.PlayerLeave, function(...) + local arg = { ... } + local p = arg[1] + local info1 = self._player_info[self:GetPos(p.seat)] + info1._view.visible = false + self:PlayMJSound("user_leave.mp3") + end) + + _gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...) + self:PlayMJSound("user_enter.mp3") + local arg = { ... } + local witnessPlayerList = arg[1] + self._room.witness_player_list = witnessPlayerList + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end) + + _gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local player = arg[1] + local witnessPlayerList = self._room.witness_player_list + for i, _player in ipairs(witnessPlayerList) do + if _player.aid == player then + table.remove(witnessPlayerList, i) + break + end + end + + local _room = DataManager.CurrenRoom + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end) + + _gamectr:AddEventListener( + GameEvent.TupGuanOpen, + function(...) + ---- print("刷新托管数据=====") + local arg = { ... } + local p = arg[1] + local info = self._player_info[self:GetPos(p.seat)] + self._left_time = tonumber(arg[3]) or 0 + + if info and info.IsShowTGTips then + info:IsShowTGTips(arg[2], arg[3]) + end + + if info and info.SetShowTGTips then + info:SetShowTGTips(arg[2], arg[3]) + end + end + ) + + _gamectr:AddEventListener( + GameEvent.Interaction, + function(...) + local arg = { ... } + local data = arg[1] + local _type = arg[2] + + -- 扔番茄 + if _type == 7 then + local sendSeat = arg[3].sendSeat + local targetSeat = arg[3].targetSeat + local Missile = arg[3].Missile + self:Missile(sendSeat, targetSeat, Missile) + end + + local p = arg[1] + if not p or not p.seat or p.seat == 0 then + return + end + if DataManager.BanInteractRoom == _room.room_id and p.seat ~= _room.self_player.seat then + return + end + local info = self._player_info[self:GetPos(p.seat)] + local ttype = arg[2] + if ttype == 5 then + local parm = arg[3] + local array = split(parm, '_') + local tp = self._room:GetPlayerById(tonumber(array[2])) + if not tp or not tp.seat or tp.seat == 0 then + return + end + local pos = self._view:GlobalToLocal(info._view:LocalToGlobal(info:GetHeadCenter())) + if tp.seat == p.seat then + for i = 1, #_room.player_list do + local player = _room.player_list[i] + if player.seat ~= tp.seat then + tinfo = self._player_info[self:GetPos(player.seat)] + tpos = self._view:GlobalToLocal(tinfo._view:LocalToGlobal(tinfo:GetHeadCenter())) + self:PlayInteractAnimation(array[1], pos, tpos) + end + end + else + local tinfo = self._player_info[self:GetPos(tp.seat)] + local tpos = self._view:GlobalToLocal(tinfo._view:LocalToGlobal(tinfo:GetHeadCenter())) + self:PlayInteractAnimation(array[1], pos, tpos) + end + elseif ttype == 3 then + if record_baned == 0 then + info:ShowInteraction(ttype, arg[3]) + end + else + info:ShowInteraction(ttype, arg[3]) + end + end + ) +end + +function M:PlayChatSound(sex, chat_index) + local sex_path = ViewUtil.Sex_Chat[sex] + local path1 = string.format('base/common/sound/%s/chat_%s.mp3', sex_path, tostring(chat_index - 1)) + GameApplication.Instance:PlaySound('base_chat', path1) + -- GameApplication.Instance:PlaySound(path1) +end + +-- 获取消息使用的语言、序号 +function M:GetChatMsgLanguage(msg_index) + local language = math.modf(msg_index / 100) + local index = math.fmod(msg_index, 100) + return language, index +end + +function M:Missile(seat, targetSeat, Missile) + local animUrl = "" + local url = "" + if Missile == "boom" then + animUrl = "ui://Main_Majiang/bomb" + url = "ui://Common/boom" + elseif Missile == "egg" then + animUrl = "ui://Main_Majiang/egg" + url = "ui://Common/egg" + elseif Missile == "diamo" then + animUrl = "ui://Main_Majiang/jiezhi" + url = "ui://Common/diamo" + elseif Missile == "flower" then + animUrl = "ui://Main_Majiang/flower" + url = "ui://Common/flower" + end + + local send = self._player_info[self:GetPos(seat)] + local target = self._player_info[self:GetPos(targetSeat)] + + MissileSender.Send(url, send, target, self, animUrl, Missile, 5, 1) +end + function M:Show() getmetatable(WitnessView).__index.Show(self) self:DoNoticeAnimation() @@ -65,6 +245,7 @@ function M:DoNoticeAnimation() end function M:OnUpdate() + local deltaTime = Time.deltaTime if (self._popEvent) then local func = self._gamectr:PopEvent() if (func ~= nil) then @@ -83,6 +264,33 @@ function M:OnUpdate() --func() end end + + local _left_time = self._left_time + if _left_time and (_left_time > 0) then + _left_time = _left_time - deltaTime + _left_time = math.max(0, _left_time) + local leftTime = math.floor(_left_time) + self._tex_leftTime.text = string.format("%02d", _left_time) + self._left_time = _left_time + -- 桌面計時器聲音 + if not self._curtime then + self._curtime = 15 + end + if leftTime <= 3 and self._curtime ~= leftTime and leftTime ~= 0 then + self._curtime = leftTime + GameApplication.Instance:PlaySound('base/common/sound/timeup_alarm.mp3') + end + else + if self._tex_leftTime then + self._tex_leftTime.text = '00' + end + for i = 2, 4 do + local text = self["_tex_leftTime" .. i] + if text then + text.text = '00' + end + end + end end function M:DestroyPlayerInfo() diff --git a/lua_probject/base_project/Game/View/playerDetailView.lua b/lua_probject/base_project/Game/View/playerDetailView.lua index 87a9c00e..48bccece 100644 --- a/lua_probject/base_project/Game/View/playerDetailView.lua +++ b/lua_probject/base_project/Game/View/playerDetailView.lua @@ -16,10 +16,11 @@ local function Send(self, Missile) end) end -function playerDetailView.New() +function playerDetailView.New(flag_witness) setmetatable(playerDetailView, { __index = BaseWindow }) local inst = setmetatable({}, { __index = playerDetailView }) inst.class = "playerDetailView" + inst.flag_witness = flag_witness BaseWindow.init(inst, "ui://Common/playerDetail") inst:Init() return inst @@ -33,7 +34,7 @@ function playerDetailView:Refalsh(player) ImageLoad.Load(player.self_user.head_url, self.loader_icon) self.cMissile.selectedIndex = 1 - if self.player.self_user.account_id == DataManager.SelfUser.account_id then + if self.player.self_user.account_id == DataManager.SelfUser.account_id or self.flag_witness then self.cMissile.selectedIndex = 0 end end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index 9c68c34e..90596f8a 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -236,7 +236,9 @@ function M:EventInit() end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) local arg = { ... } - -- self._left_time = 15 + if not self._left_time or self._left_time <= 15 then + self._left_time = 15 + end local seat = arg[1] self:UpdateCardBox(self:GetPos(seat)) -- if seat == self._room.self_player.seat then diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua index ac74d71b..3a8b3a84 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXPlayerInfoView.lua @@ -3,17 +3,17 @@ local PlayerInfoView2 = require("Game.View.PlayerInfoView2") local M = {} -function M.new(view, mainView) +function M.new(view, mainView,flag_witness) setmetatable(M, { __index = PlayerInfoView2 }) local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView - self:init() + self:init(flag_witness) return self end -function M:init() - PlayerInfoView2.init(self) +function M:init(flag_witness) + PlayerInfoView2.init(self,flag_witness) end function M:ShowInteraction(type, str) diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index 7f9ec258..b47719d3 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -336,7 +336,33 @@ 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) + 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].total_score + end + info:UpdateScore() + info._view:GetChild("zhanji").visible = true + local num = data[i].total_score + if num >= 0 then + info._view:GetController("text_color").selectedIndex = 0 + info._view:GetChild("text_jifen").text = "+" .. num + else + info._view:GetController("text_color").selectedIndex = 1 + info._view:GetChild("text_jifen").text = num + end + + info._view:GetChild("mask_piao").title = "" + info._view:GetController("piao_niao").selectedIndex = 0 + p.fz_list = {} + end DataManager.CurrenRoom.self_player.card_list = {} + --self._state.selectedIndex = 2 self._clearingView = nil end) end @@ -382,7 +408,7 @@ function M:InitPlayerInfoView() local _player_info = self._player_info for i = 1, self._room.room_config.people_num do local tem = self._view:GetChild(string.format("player_info%d_2", i)) - _player_info[i] = PlayerInfoView.new(tem, self) + _player_info[i] = PlayerInfoView.new(tem, self,true) tem.visible = false end end diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 10733d39..ba64034f 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -116,6 +116,9 @@ function M:Clear() if self._view:GetChild('List_HandCard2') then self._view:GetChild('List_HandCard2'):RemoveChildren(0, -1, true) end + if self._view:GetChild('Btn_HandCard2') then + self._view:GetChild('Btn_HandCard2'):RemoveChildren(0, -1, true) + end self._viewList_HuEffect:RemoveChildren(0, -1, true) self._view_handCardList.selectedIndex = -1 self._click_index = self._view_handCardList.selectedIndex @@ -189,13 +192,11 @@ function M:UpdateHandCard(getcard, mp) end function M:UpdateHandCardWitness(getcard, isSelf) - print("lingmeng UpdateHandCardWitness") getcard = getcard or false isSelf = isSelf or false self._view_handCardList:RemoveChildren() self._view_getCard:RemoveChildren() - print("lingmeng UpdateHandCardWitness1") for i = 0, self._player.hand_left_count - 1 do local btn_card @@ -208,11 +209,9 @@ function M:UpdateHandCardWitness(getcard, isSelf) self:FillWitnessCard(btn_card) end end - print("lingmeng UpdateHandCardWitness2") self._view_handCardList.touchable = false self._view_getCard.touchable = false - print("lingmeng UpdateHandCardWitness3") self._ctr_getCard.selectedIndex = getcard and 1 or 0 end @@ -492,6 +491,7 @@ function M:ShowHand(cards) local list = self._view_handCardList local cardType = self._viewText_cardInfo["Hand_Card"] if self._viewText_cardInfo['IS_SIDE'] == "true" then + self._view_handCardList:RemoveChildren() list = self._view:GetChild('List_HandCard2') cardType = self._viewText_cardInfo["Hand_Card"] end @@ -515,14 +515,21 @@ end function M:ShowHuCard(card, flag_isme) self.winCard = card self._view_getCard:RemoveChildrenToPool() - local btn_card = self._view_getCard:AddItemFromPool() - self:fillCard2(btn_card, self._viewText_cardInfo['Out_Card'], card, 1) + local list = self._view_getCard + if self._viewText_cardInfo['IS_SIDE'] == "true" then + list = self._view:GetChild('Btn_HandCard2') + end + local btn_card = list:AddItemFromPool() self._ctr_getCard.selectedIndex = 1 + if flag_isme then self._view_getCard:GetChildAt(0):GetController('showhang').selectedIndex = 1 self._view_getCard:GetChildAt(0):GetController('special_jing').selectedIndex = self._view_getCard:GetChildAt(0) :GetController('jing').selectedIndex self._view_getCard:GetChildAt(0):GetController('jing').selectedIndex = 0 + self:fillCard2(btn_card, self._viewText_cardInfo['Out_Card'], card, 1) + else + self:fillCard2(btn_card, self._viewText_cardInfo['Hand_Card'], card, 1) end end diff --git a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua index 58d4415b..646c592b 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerSelfCardInfoView.lua @@ -95,6 +95,7 @@ function M:UpdateHandCard(getcard, mp) self._ctr_getCard.selectedIndex = 0 end self._view_handCardList.onClickItem:Set(function(context) + self._mainView:PlayMJSound("clickCard.mp3") self:__OnClickHandCard(context) end) @@ -110,6 +111,7 @@ function M:onTouchBegin(context) self.touch = true local button = context.sender self.touchPos = Vector2.New(context.inputEvent.x, context.inputEvent.y) + self._last_chooseIndex = -1 end function M:onTouchMove(context) @@ -143,7 +145,10 @@ function M:onTouchMove(context) local cardWidth = button.width; local grap = self._view_handCardList.columnGap local chooseIndex = math.floor(touchPos.x / (cardWidth + grap)) - + if self._last_chooseIndex ~= chooseIndex then + self._last_chooseIndex = chooseIndex + self._mainView:PlayMJSound("clickCard.mp3") + end if chooseIndex >= self._view_handCardList.numItems then self.ischoose = true if touchPos.x > cardWidth + (cardWidth + grap) * (self._view_handCardList.numItems - 1) and self.getcard then diff --git a/lua_probject/main_project/main/majiang/MJWitnessView.lua b/lua_probject/main_project/main/majiang/MJWitnessView.lua index db51daa4..61aabe33 100644 --- a/lua_probject/main_project/main/majiang/MJWitnessView.lua +++ b/lua_probject/main_project/main/majiang/MJWitnessView.lua @@ -72,69 +72,11 @@ function M:PlaySound(group, sex, path) end function M:EventInit() + getmetatable(M).__index.EventInit(self) local _gamectr = self._gamectr local _room = self._room - _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) - self:PlayMJSound("user_enter.mp3") - local arg = { ... } - local p = arg[1] - local info1 = self._player_info[self:GetPos(p.seat)] - info1:FillData(p) - info1._view.visible = true - - local info2 = self._player_card_info[self:GetPos(p.seat)] - info2:SetPlayer(p) - info2:FillData() - end) - - _gamectr:AddEventListener(GameEvent.PlayerLeave, function(...) - local arg = { ... } - local p = arg[1] - local info1 = self._player_info[self:GetPos(p.seat)] - info1._view.visible = false - self:PlayMJSound("user_leave.mp3") - end) - - _gamectr:AddEventListener(GameEvent.WitnessPlayerEnter, function(...) - self:PlayMJSound("user_enter.mp3") - local arg = { ... } - local witnessPlayerList = arg[1] - self._room.witness_player_list = witnessPlayerList - - local _room = DataManager.CurrenRoom - local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') - if viewList_witness.numItems == #_room.witness_player_list then - viewList_witness:RefreshVirtualList() - else - viewList_witness.numItems = #_room.witness_player_list - end - end) - - _gamectr:AddEventListener(GameEvent.WitnessPlayerLeave, function(...) - ---- print("刷新托管数据=====") - local arg = { ... } - local player = arg[1] - local witnessPlayerList = self._room.witness_player_list - for i, _player in ipairs(witnessPlayerList) do - if _player.aid == player then - table.remove(witnessPlayerList, i) - break - end - end - - local _room = DataManager.CurrenRoom - local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') - print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) - if viewList_witness.numItems == #_room.witness_player_list then - viewList_witness:RefreshVirtualList() - else - viewList_witness.numItems = #_room.witness_player_list - end - end) - _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) - print("lingmeng witness SendCards") self:ShowJing() if self._clearingView then self._clearingView:Destroy() @@ -157,21 +99,18 @@ function M:EventInit() end) _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) - print("lingmeng witness EventTurn") local arg = { ... } - -- self._left_time = 15 + if not self._left_time or self._left_time <= 15 then + self._left_time = 15 + end local seat = arg[1] self:UpdateCardBox(self:GetPos(seat)) - local playerInfo = self._player_info[self:GetPos(seat)] local info = self._player_card_info[self:GetPos(seat)] - print("lingmeng hand_left_count", info._player.hand_left_count) info._player.hand_left_count = info._player.hand_left_count + 1 info:UpdateHandCardWitness(true) end) _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) - print("lingmeng witness OutCard") - self._left_time = 0 local arg = { ... } local p = arg[1] local card = arg[2] @@ -188,7 +127,6 @@ function M:EventInit() if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 end - print("ling 2zhihou2") end) end diff --git a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml index 1a3f3d01..b0f2dd61 100644 --- a/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml +++ b/wb_new_ui/assets/Family/ChatRoom/com_chatRoom.xml @@ -7,10 +7,10 @@ - + - + diff --git a/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml b/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml index 28c43798..1592bd4d 100644 --- a/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml +++ b/wb_new_ui/assets/Family/Main/Component/btn_chatRoom.xml @@ -1,18 +1,20 @@ - + - + + - + +