diff --git a/lua_probject/base_project/Game/Controller/GameProtocol.lua b/lua_probject/base_project/Game/Controller/GameProtocol.lua new file mode 100644 index 00000000..035dea56 --- /dev/null +++ b/lua_probject/base_project/Game/Controller/GameProtocol.lua @@ -0,0 +1,68 @@ +local Protocol = { + -- 发牌协议 + GAME_EVT_PLAYER_DEAL = "811", + + -- 出牌 + GAME_DIS_CARD = "611", + + -- 出牌事件 + GAME_EVT_DISCARD = "812", + + -- 出牌提示事件 + GAME_EVT_DISCARD_TIP = "813", + + -- 放子提示事件 + GAME_EVT_FZTIPS = "814", + + -- 提示选择行为 + GAME_ACTION = "612", + + -- action 事件 + GAME_EVT_ACTION = "815", + + -- 胡牌事件 + GAME_EVT_HU = "816", + + -- 小结算 + GAME_EVT_RESULT1 = "817", + + -- 大结算 + GAME_EVT_RESULT2 = "818", + + -- 抓牌 + GAME_EVT_DRAW = "819", + + -- 转盘指向事件 + GAME_EVT_CHANGE_ACTIVE_PLAYER = "820", + + -- 鸟 + GAME_EVT_NIAO = "821", + + -- 起手胡提示 + GAME_EVT_QSTIP = "822", + + -- 起手胡事件 + GAME_EVT_QSWIN = "823", + + -- 开杠 + GAME_EVT_OPENKONG = "824", + + -- 海底 + GAME_EVT_HAIDI = "825", + + -- 飘鸟提示 + GAME_EVT_PIAOTIP = "833", + + -- 飘鸟事件 + GAME_EVT_PIAO = "834", + + GAME_EVT_TING_TIP = "835", + + GAME_EVT_TING = "836", + + GAME_XIPAI = "20836", + GAME_EVENT_XIPAI = "20837", + GAME_EVENT_NOTIFY_XIPAI = "20838", +} + +return Protocol \ No newline at end of file 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..cb79a4f7 --- /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/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index 2bd93ee6..35298d5f 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -84,42 +84,6 @@ function M:InitView(url) end) local btn_closeRoom = self._view:GetChild("btn_setting") - - self._view:GetChild('btn_closeRoom').onClick:Set(function() - ---[[ - --旧 - local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' - local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) - local tipStr = '' - if self._room.agent then - tipStr = '您是否退出房间?' - else - tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip - end - local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) - _curren_msg.onOk:Add( - function() - if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then - ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') - else - ViewUtil.ShowModalWait(self._root_view) - self._gamectr:LevelRoom( - function(res) - ViewUtil.CloseModalWait() - if res.ReturnCode == 0 then - ViewManager.ChangeView(ViewManager.View_Family) - else - ViewUtil.ErrorTip(res.ReturnCode) - end - end - ) - end - end - ) - _curren_msg:Show() - --]] - end) - btn_closeRoom.onClick:Add(handler(self, function() local settingView = SettingView.new(self) settingView:Show(self._room) diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXSettingView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXSettingView.lua index 662eec54..904eb7c2 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXSettingView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXSettingView.lua @@ -13,10 +13,10 @@ function EXSettingView:Show(room) if roomOwner == DataManager.SelfUser.account_id then self.cBtn.selectedIndex = 1 - self.btn_closeRoom_cStyle = 1 + --self.btn_closeRoom_cStyle = 1 else self.cBtn.selectedIndex = 0 - self.btn_closeRoom_cStyle = 0 + --self.btn_closeRoom_cStyle = 0 end BaseWindow.Show(self) @@ -40,7 +40,7 @@ function M:init(url) local btn_music = view:GetChild('btn_vedio_music') local btn_sound = view:GetChild('btn_vedio_sound') local btn_closeRoom = view:GetChild("btn_closeRoom") - self.btn_closeRoom_cStyle = btn_closeRoom:GetController("cStyle") + --self.btn_closeRoom_cStyle = btn_closeRoom:GetController("cStyle") self.cBtn = self._view:GetController('cBtn') diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua index e85e7753..f247fb47 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXMainView.lua @@ -85,45 +85,6 @@ function M:InitView(url) end) local btn_setting = self._view:GetChild("btn_setting") - - self._view:GetChild('btn_closeRoom').onClick:Set(function() - ---[[ - --旧 - local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' - local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) - local tipStr = '' - if self._room.agent then - tipStr = '您是否退出房间?' - else - tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip - end - local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) - _curren_msg.onOk:Add( - function() - if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then - ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') - else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:AskDismissRoom() - --[[ - ViewUtil.ShowModalWait(self._root_view) - self._gamectr:LevelRoom( - function(res) - ViewUtil.CloseModalWait() - if res.ReturnCode == 0 then - ViewManager.ChangeView(ViewManager.View_Family) - else - ViewUtil.ErrorTip(res.ReturnCode) - end - end - )]] - end - end - ) - _curren_msg:Show() - --]] - end) - btn_setting.onClick:Add(handler(self, function() local settingView = SettingView.new(self) settingView:Show(self._room) diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index 4b845a1f..573aeb17 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -87,42 +87,6 @@ function M:InitView(url) end) local btn_closeRoom = self._view:GetChild("btn_setting") - - self._view:GetChild('btn_closeRoom').onClick:Set(function() - ---[[ - --旧 - local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' - local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) - local tipStr = '' - if self._room.agent then - tipStr = '您是否退出房间?' - else - tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip - end - local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) - _curren_msg.onOk:Add( - function() - if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then - ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') - else - ViewUtil.ShowModalWait(self._root_view) - self._gamectr:LevelRoom( - function(res) - ViewUtil.CloseModalWait() - if res.ReturnCode == 0 then - ViewManager.ChangeView(ViewManager.View_Family) - else - ViewUtil.ErrorTip(res.ReturnCode) - end - end - ) - end - end - ) - _curren_msg:Show() - --]] - end) - btn_closeRoom.onClick:Add(handler(self, function() local settingView = SettingView.new(self) settingView:Show(self._room) diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 66483ccd..7e930f74 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -174,6 +174,38 @@ function M:InitView(url, use_custom_bg, custom_bg_config) end) end + self._view:GetChild('btn_closeRoom').onClick:Set(function() + local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)' + local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分) + local tipStr = '' + if self._room.agent then + tipStr = '您是否退出房间?' + else + tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip + end + local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel) + _curren_msg.onOk:Add( + function() + if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then + ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。') + else + ViewUtil.ShowModalWait(self._root_view) + self._gamectr:LevelRoom( + function(res) + ViewUtil.CloseModalWait() + if res.ReturnCode == 0 then + ViewManager.ChangeView(ViewManager.View_Family) + else + ViewUtil.ErrorTip(res.ReturnCode) + end + end + ) + end + end + ) + _curren_msg:Show() + end) + self:InitXiPai() self:InitXiPai1() end @@ -576,10 +608,12 @@ end -- 所有对家显示手牌 function M:ShowHand(msg) local data = msg[1] - for _, infoView in pairs(self._player_card_info) do + + for _, player in pairs(data.info_list) do + local infoView = self._player_card_info[self:GetPos(player.seat)] + if infoView.class ~= "PlayerSelfCardInfoView" then - local cards = data.info_list[_].hand_card - infoView:ShowHand(cards) + infoView:ShowHand(player.hand_card) end end end diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index f108c107..179b6087 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -460,7 +460,6 @@ function M:ResetCardType() end function M:ShowHand(cards) - --self._view_handCardList self._view_handCardList:RemoveChildren() for _,card in pairs(cards) do local obj = self._view_handCardList:AddItemFromPool() 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 @@ + + + + + + + + + + + + + + + + + +