diff --git a/lua_probject/base_project/Game/View/MissileSender.lua b/lua_probject/base_project/Game/View/MissileSender.lua new file mode 100644 index 00000000..e6e3d2fd --- /dev/null +++ b/lua_probject/base_project/Game/View/MissileSender.lua @@ -0,0 +1,86 @@ +local MissileSender = {} +local pool = {} +local curView = {} +local MovieClipPool = {} + +local function GetObj() + if #pool > 0 then + local re = pool[#pool] + re.visible = true + pool[#pool] = nil + return re + end + + return UIPackage.CreateObjectFromURL("ui://Main_Majiang/Missile") +end + +local function BackObj(obj) + pool[#pool + 1] = obj + obj.visible = false +end + +local function GetMovieClip(url) + local _pool = MovieClipPool[url] + + if _pool and #_pool > 0 then + local re = _pool[#_pool] + re.visible = true + _pool[#_pool] = nil + return re + end + + return UIPackage.CreateObjectFromURL(url) +end + +local function BackMovieClip(obj, url) + if MovieClipPool[url] == nil then + MovieClipPool[url] = {} + end + + local _pool = MovieClipPool[url] + _pool[#_pool + 1] = obj + obj.visible = false +end + +function MissileSender.Send(url, send, target, view, animUrl, num, time) + if curView ~= view then + pool = {} + end + + curView = view + + local sendPos = send.xy--Vector2.New(send.x + send.width/2, send.y + send.height/2) + local targetPos = target.xy--Vector2.New(target.x + target.width/2, target.y + target.height/2) + + for i = 1, num do + local obj = GetObj() + obj:GetChild("loader").url = url + view:AddChild(obj) + obj.xy = sendPos + + -- 间隔 + obj:TweenMove(obj.xy, i * 0.1):OnComplete(function() + obj:TweenMove(targetPos, time):OnComplete(function() + BackObj(obj) + if i == num then + MissileSender.Animation(target, animUrl, view) + end + end) + end) + end +end + +function MissileSender.Animation(target, animUrl, view) + local e = GetMovieClip(animUrl) + e:SetPlaySettings(1, -1, 1, -1) + e.onPlayEnd:Set(function() + e.visible = false + BackMovieClip(e, animUrl) + end) + view:AddChild(e) + e.width = target.width + e.height = target.height + e.xy = target.xy +end + +return MissileSender diff --git a/lua_probject/base_project/Game/View/playerDetailView.lua b/lua_probject/base_project/Game/View/playerDetailView.lua new file mode 100644 index 00000000..6d0cd861 --- /dev/null +++ b/lua_probject/base_project/Game/View/playerDetailView.lua @@ -0,0 +1,65 @@ +local playerDetailView = {} + +function playerDetailView.New() + setmetatable(playerDetailView, { __index = BaseWindow }) + local inst = setmetatable({}, { __index = playerDetailView }) + inst.class = "playerDetailView" + BaseWindow.init(inst, "ui://Common/playerDetail") + inst:Init() + return inst +end + +function playerDetailView:Refalsh(player) + local p = player + + ImageLoad.Load(player.self_user.head_url, self.loader_icon) +end + +function playerDetailView:Show(player) + self:Refalsh(player) + BaseWindow.Show(self) +end + +function playerDetailView:Init() + self.tex_name = self._view:GetChild("tex_name") + self.tex_ip = self._view:GetChild("tex_ip") + self.tex_id = self._view:GetChild("tex_id") + + self.btn_boom = self._view:GetChild("btn_boom") + self.btn_egg = self._view:GetChild("btn_egg") + self.btn_ring = self._view:GetChild("btn_ring") + self.btn_flower = self._view:GetChild("btn_flower") + self.btn_close = self._view:GetChild("btn_close") + + self.loader_icon = self._view:GetChild("loader_icon") + + self.btn_boom.onClick:Set(function() + local mainView = BaseView.FindView("MainView") + if mainView then + mainView:Missile(1, 2, "ui://Common/boom", "ui://Main_Majiang/Missile_boom") + end + end) + + self.btn_egg.onClick:Set(function() + local mainView = BaseView.FindView("MainView") + if mainView then + mainView:Missile(1, 2, "ui://Common/egg", "ui://Main_Majiang/Missile_egg") + end + end) + + self.btn_ring.onClick:Set(function() + local mainView = BaseView.FindView("MainView") + if mainView then + mainView:Missile(1, 2, "ui://Common/diamo", "ui://Main_Majiang/Missile_diamo") + end + end) + + self.btn_flower.onClick:Set(function() + local mainView = BaseView.FindView("MainView") + if mainView then + mainView:Missile(1, 2, "ui://Common/flower", "ui://Main_Majiang/Missile_flower") + end + end) +end + +return playerDetailView diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua index 7b1ba9e8..6149e9f0 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXClearingView.lua @@ -31,12 +31,13 @@ end -- end -- end -function M:InitData(over, room, result, total_result, callback) +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") @@ -46,6 +47,15 @@ function M:InitData(over, room, result, total_result, callback) local playerNum = self._view:GetController("playerNum") local showBtnTypeCtr = self._view:GetController("showType") + result.cardList = json.decode(result.cardList) + table.sort(result.cardList) + 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 @@ -55,9 +65,16 @@ function M:InitData(over, room, result, total_result, callback) end) nextRoundBtn.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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) @@ -71,9 +88,16 @@ function M:InitData(over, room, result, total_result, callback) _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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) elseif over == 1 then showBtnTypeCtr.selectedIndex = 1 @@ -127,6 +151,7 @@ function M:fillResult0(room, peopleNum, result) infoList.gang_score = infoList.gang_score or 0 infoList.hu_score = infoList.hu_score or 0 infoList.round_score = infoList.round_score or 0 + self.list_lastCard.numItems = #result.cardList playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and @@ -244,7 +269,9 @@ end function M:fillResult1(room, peopleNum, total_result) local gameNameAndRoomIDText = self._view:GetChild("Text_GameNameAndRoomID") local familyIDText = self._view:GetChild("Text_FamilyID") - for i, v in pairs(room.self_player.self_user.games) do + 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 @@ -288,6 +315,14 @@ function M:fillHead(url, view) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) end +function M:RemindCardRender(data, obj) + local room = DataManager.CurrenRoom + obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data) + 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 diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua index 551791a5..ab82a79f 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXGameController.lua @@ -332,6 +332,7 @@ function M:OneventResult1(evt_data) --0:小结算 1:小大结算 2:大结算 self._room._reload_flag = false self._room.playing = false + evt_data.result.cardList = evt_data.cardList if 0 == over then local result = evt_data.result self._cacheEvent:Enqueue(function() diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua index 1dc1b601..3b443c33 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXClearingView.lua @@ -31,12 +31,13 @@ end -- end -- end -function M:InitData(over, room, result, total_result, callback) +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") @@ -46,6 +47,15 @@ function M:InitData(over, room, result, total_result, callback) local playerNum = self._view:GetController("playerNum") local showBtnTypeCtr = self._view:GetController("showType") + result.cardList = json.decode(result.cardList) + table.sort(result.cardList) + 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 @@ -55,9 +65,16 @@ function M:InitData(over, room, result, total_result, callback) end) nextRoundBtn.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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) @@ -71,9 +88,16 @@ function M:InitData(over, room, result, total_result, callback) _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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) elseif over == 1 then showBtnTypeCtr.selectedIndex = 1 @@ -127,6 +151,7 @@ function M:fillResult0(room, peopleNum, result) infoList.gang_score = infoList.gang_score or 0 infoList.hu_score = infoList.hu_score or 0 infoList.round_score = infoList.round_score or 0 + self.list_lastCard.numItems = #result.cardList playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and @@ -240,7 +265,9 @@ end function M:fillResult1(room, peopleNum, total_result) local gameNameAndRoomIDText = self._view:GetChild("Text_GameNameAndRoomID") local familyIDText = self._view:GetChild("Text_FamilyID") - for i, v in pairs(room.self_player.self_user.games) do + 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 @@ -284,6 +311,14 @@ function M:fillHead(url, view) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) end +function M:RemindCardRender(data, obj) + local room = DataManager.CurrenRoom + obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data) + 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 diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua index 1fd228f1..eebf2f38 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXGameController.lua @@ -332,6 +332,7 @@ function M:OneventResult1(evt_data) --0:小结算 1:小大结算 2:大结算 self._room._reload_flag = false self._room.playing = false + evt_data.result.cardList = evt_data.cardList if 0 == over then local result = evt_data.result self._cacheEvent:Enqueue(function() diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua index 0b43c9a7..7d269374 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXClearingView.lua @@ -47,6 +47,15 @@ function M:InitData(over, room, result, total_result, callback, isWitness, witne local playerNum = self._view:GetController("playerNum") local showBtnTypeCtr = self._view:GetController("showType") + result.cardList = json.decode(result.cardList) + table.sort(result.cardList) + 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 @@ -140,6 +149,7 @@ function M:fillResult0(room, peopleNum, result) infoList.gang_score = infoList.gang_score or 0 infoList.hu_score = infoList.hu_score or 0 infoList.round_score = infoList.round_score or 0 + self.list_lastCard.numItems = #result.cardList playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and @@ -302,6 +312,14 @@ function M:fillHead(url, view) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) end +function M:RemindCardRender(data, obj) + local room = DataManager.CurrenRoom + obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data) + 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 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua index 985c8c40..450714d4 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXGameController.lua @@ -333,6 +333,7 @@ function M:OneventResult1(evt_data) --0:小结算 1:小大结算 2:大结算 self._room._reload_flag = false self._room.playing = false + evt_data.result.cardList = evt_data.cardList if 0 == over then local result = evt_data.result self._cacheEvent:Enqueue(function() diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua index 0349b8a3..e305144d 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXClearingView.lua @@ -31,12 +31,13 @@ end -- end -- end -function M:InitData(over, room, result, total_result, callback) +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") @@ -46,6 +47,15 @@ function M:InitData(over, room, result, total_result, callback) local playerNum = self._view:GetController("playerNum") local showBtnTypeCtr = self._view:GetController("showType") + result.cardList = json.decode(result.cardList) + table.sort(result.cardList) + 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 @@ -55,9 +65,16 @@ function M:InitData(over, room, result, total_result, callback) end) nextRoundBtn.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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() @@ -69,9 +86,16 @@ function M:InitData(over, room, result, total_result, callback) _overCtr.selectedIndex = 0 self:fillResult0(room, peopleNum, result) nextRoundBtn2.onClick:Set(function() - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:PlayerReady() - self:DestroyWithCallback() + 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) elseif over == 1 then showBtnTypeCtr.selectedIndex = 1 @@ -125,6 +149,7 @@ function M:fillResult0(room, peopleNum, result) infoList.gang_score = infoList.gang_score or 0 infoList.hu_score = infoList.hu_score or 0 infoList.round_score = infoList.round_score or 0 + self.list_lastCard.numItems = #result.cardList playerInfoComp:GetChild("text_name").text = playInfo.self_user.nick_name playerInfoComp:GetChild("Text_BoJing").text = infoList.jing_score >= 0 and @@ -184,8 +209,7 @@ function M:fillResult0(room, peopleNum, result) 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]) + 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 @@ -240,7 +264,9 @@ end function M:fillResult1(room, peopleNum, total_result) local gameNameAndRoomIDText = self._view:GetChild("Text_GameNameAndRoomID") local familyIDText = self._view:GetChild("Text_FamilyID") - for i, v in pairs(room.self_player.self_user.games) do + 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 @@ -284,6 +310,14 @@ function M:fillHead(url, view) ImageLoad.Load(url, view:GetChild("Btn_Head")._iconObject) end +function M:RemindCardRender(data, obj) + local room = DataManager.CurrenRoom + obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), data) + 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 diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua index d885a18a..99a225d0 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXGameController.lua @@ -332,6 +332,7 @@ function M:OneventResult1(evt_data) --0:小结算 1:小大结算 2:大结算 self._room._reload_flag = false self._room.playing = false + evt_data.result.cardList = evt_data.cardList if 0 == over then local result = evt_data.result self._cacheEvent:Enqueue(function() diff --git a/wb_new_ui/assets/Common/bg/loginBg.png b/wb_new_ui/assets/Common/bg/loginBg.png new file mode 100644 index 00000000..d8579a0c Binary files /dev/null and b/wb_new_ui/assets/Common/bg/loginBg.png differ diff --git a/wb_new_ui/assets/Common/buttons/btn_bg.xml b/wb_new_ui/assets/Common/buttons/btn_bg.xml new file mode 100644 index 00000000..7cb61a9d --- /dev/null +++ b/wb_new_ui/assets/Common/buttons/btn_bg.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + +