新二人界面兼容四人
|
|
@ -5,55 +5,55 @@
|
||||||
---
|
---
|
||||||
--@type BaseView
|
--@type BaseView
|
||||||
BaseView = {
|
BaseView = {
|
||||||
-- Id View ID
|
-- Id View ID
|
||||||
Id = 0,
|
Id = 0,
|
||||||
-- View 是否被销毁
|
-- View 是否被销毁
|
||||||
_is_destroy = false,
|
_is_destroy = false,
|
||||||
--关闭摧毁
|
--关闭摧毁
|
||||||
_close_destroy = false,
|
_close_destroy = false,
|
||||||
-- 全屏
|
-- 全屏
|
||||||
_full = false,
|
_full = false,
|
||||||
--全屏偏移
|
--全屏偏移
|
||||||
_full_offset = true,
|
_full_offset = true,
|
||||||
--view description
|
--view description
|
||||||
_view = nil,
|
_view = nil,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local M = BaseView
|
local M = BaseView
|
||||||
|
|
||||||
local view_url = {
|
local view_url = {
|
||||||
"ui://Common/Gcm_BaseView",
|
"ui://Common/Gcm_BaseView",
|
||||||
"ui://Common/Gcm_BaseView_Full"
|
"ui://Common/Gcm_BaseView_Full"
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
--@function [parent=#BaseView] InitView
|
--@function [parent=#BaseView] InitView
|
||||||
--@param self
|
--@param self
|
||||||
--@param #string url
|
--@param #string url
|
||||||
function M:InitView(url)
|
function M:InitView(url)
|
||||||
self._root_view = UIPackage.CreateObjectFromURL(self._full and view_url[2] or view_url[1])
|
self._root_view = UIPackage.CreateObjectFromURL(self._full and view_url[2] or view_url[1])
|
||||||
local contentPane = self._root_view:GetChild("contentPane")
|
local contentPane = self._root_view:GetChild("contentPane")
|
||||||
self._view = UIPackage.CreateObjectFromURL(url)
|
self._view = UIPackage.CreateObjectFromURL(url)
|
||||||
printlog(self._view)
|
printlog(self._view)
|
||||||
self._close_destroy = true
|
self._close_destroy = true
|
||||||
-- self._view.fairyBatching = true
|
-- self._view.fairyBatching = true
|
||||||
self._view:AddRelation(contentPane, RelationType.Size)
|
self._view:AddRelation(contentPane, RelationType.Size)
|
||||||
contentPane:AddChild(self._view)
|
contentPane:AddChild(self._view)
|
||||||
self._contentPane = contentPane
|
self._contentPane = contentPane
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Show()
|
function M:Show()
|
||||||
self._root_view.visible = true
|
self._root_view.visible = true
|
||||||
if not self._root_view.parent then
|
if not self._root_view.parent then
|
||||||
AddPanel(self._root_view)
|
AddPanel(self._root_view)
|
||||||
if self._full then
|
if self._full then
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
|
|
||||||
self._contentPane.width = GRoot.inst.width - (offset * 2)
|
self._contentPane.width = GRoot.inst.width - (offset * 2)
|
||||||
self._contentPane.height = GRoot.inst.height
|
self._contentPane.height = GRoot.inst.height
|
||||||
self._contentPane.x = offset
|
self._contentPane.x = offset
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Close()
|
function M:Close()
|
||||||
|
|
@ -74,6 +74,6 @@ end
|
||||||
--@function [parent=#BaseView] Destroy
|
--@function [parent=#BaseView] Destroy
|
||||||
--@param self
|
--@param self
|
||||||
function M:Destroy()
|
function M:Destroy()
|
||||||
self._is_destroy = true
|
self._is_destroy = true
|
||||||
self._root_view:Dispose()
|
self._root_view:Dispose()
|
||||||
end
|
end
|
||||||
|
|
@ -60,6 +60,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
---- print("url===>>>")
|
---- print("url===>>>")
|
||||||
---- print(url)
|
---- print(url)
|
||||||
---- print(debug.traceback())
|
---- print(debug.traceback())
|
||||||
|
print("=============================InitView2", self, url)
|
||||||
BaseView.InitView(self, url)
|
BaseView.InitView(self, url)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
@ -348,7 +349,8 @@ function M:InitView(url, isHideIpAdds)
|
||||||
|
|
||||||
UpdateBeat:Add(self.OnUpdate, self)
|
UpdateBeat:Add(self.OnUpdate, self)
|
||||||
if self._room.room_config.people_num <= 4 and self._room.room_config.people_num >= 3 and self._gamectr:CheckGPS() then
|
if self._room.room_config.people_num <= 4 and self._room.room_config.people_num >= 3 and self._gamectr:CheckGPS() then
|
||||||
self._show_distance = true
|
------lingmeng-----暂时去除gps位置判定
|
||||||
|
-- self._show_distance = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 显示牌友圈助手
|
-- 显示牌友圈助手
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ function M:init()
|
||||||
UIPackage.AddPackage('base/chat/ui/Chat')
|
UIPackage.AddPackage('base/chat/ui/Chat')
|
||||||
self._tex_player_name = view:GetChild('name')
|
self._tex_player_name = view:GetChild('name')
|
||||||
|
|
||||||
|
|
||||||
self._biaoqing = view:GetChild('face')
|
self._biaoqing = view:GetChild('face')
|
||||||
self._chat = view:GetChild('chat')
|
self._chat = view:GetChild('chat')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function EXClearingView.new(blur_view)
|
||||||
setmetatable(M, { __index = ResultView })
|
setmetatable(M, { __index = ResultView })
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self._full = true
|
self._full = true
|
||||||
ResultView.init(self, "ui://Main_Majiang/clearing_jiangxi")
|
ResultView.init(self, "ui://Main_Majiang/clearing")
|
||||||
|
|
||||||
self._currenIndex = 0
|
self._currenIndex = 0
|
||||||
self._blur_view = blur_view
|
self._blur_view = blur_view
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ local __pre_delete_card = false
|
||||||
-------------------------lingmeng---------------------------
|
-------------------------lingmeng---------------------------
|
||||||
function M:SendNextCard(card)
|
function M:SendNextCard(card)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["seat"] = self._room.self_player.seat
|
|
||||||
_data["card"] = card
|
_data["card"] = card
|
||||||
local _client = ControllerManager.GameNetClinet
|
local _client = ControllerManager.GameNetClinet
|
||||||
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ function M:InitView(url)
|
||||||
if self._room.room_config.people_num == 2 then
|
if self._room.room_config.people_num == 2 then
|
||||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||||
else
|
else
|
||||||
|
print("=============================InitView", self,
|
||||||
|
"ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||||
end
|
end
|
||||||
self._hu_tip = HuTipView.new(self)
|
self._hu_tip = HuTipView.new(self)
|
||||||
|
|
@ -43,84 +45,87 @@ function M:InitView(url)
|
||||||
self.bugangnum = self._view:GetChild("bugangnum")
|
self.bugangnum = self._view:GetChild("bugangnum")
|
||||||
|
|
||||||
--lingmeng
|
--lingmeng
|
||||||
---[[
|
--[[
|
||||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
self.jing = self._view:GetChild('jing')
|
self.jing = self._view:GetChild('jing')
|
||||||
|
|
||||||
local showNextCtr = self._view:GetController('showNext')
|
if self._room.room_config.people_num == 2 then
|
||||||
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
|
local showNextCtr = self._view:GetController('showNext')
|
||||||
local showNextList = self._view:GetChild('list_showNext')
|
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
|
||||||
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
|
local showNextList = self._view:GetChild('list_showNext')
|
||||||
local btn_closeRoom = self._view:GetChild("btn_setting")
|
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
|
||||||
|
local btn_closeRoom = self._view:GetChild("btn_setting")
|
||||||
|
|
||||||
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
||||||
---[[
|
---[[
|
||||||
--旧
|
--旧
|
||||||
local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)'
|
local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)'
|
||||||
local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分)
|
local tip = '您是否退出房间?' -- \n (请注意,申请洗牌后退出,不会返还洗牌分)
|
||||||
local tipStr = ''
|
local tipStr = ''
|
||||||
if self._room.agent then
|
if self._room.agent then
|
||||||
tipStr = '您是否退出房间?'
|
tipStr = '您是否退出房间?'
|
||||||
else
|
else
|
||||||
tipStr = self._room.owner_id == self._room.self_player.self_user.account_id and tip_owner or tip
|
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_Lobby)
|
|
||||||
else
|
|
||||||
ViewUtil.ErrorTip(res.ReturnCode)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
)
|
local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel)
|
||||||
_curren_msg:Show()
|
_curren_msg.onOk:Add(
|
||||||
--]]
|
function()
|
||||||
end)
|
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_Lobby)
|
||||||
|
else
|
||||||
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
_curren_msg:Show()
|
||||||
|
--]]
|
||||||
|
end)
|
||||||
|
|
||||||
self._view:GetChild('btn_showNext').onClick:Set(function()
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
showNextCtr.selectedIndex = 1
|
showNextCtr.selectedIndex = 1
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
||||||
|
self:SendShowNext(ShowNextConfrimCtr)
|
||||||
|
end)
|
||||||
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
|
ShowNextConfrimCtr.selectedIndex = 0
|
||||||
|
showNextCtr.selectedIndex = 0
|
||||||
|
showNextList.selectedIndex = -1
|
||||||
|
self._showNextName = nil
|
||||||
|
end)
|
||||||
|
showNextList.onClickItem:Set(function(context)
|
||||||
|
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
|
||||||
|
self._showNextName = nil
|
||||||
|
end)
|
||||||
|
btn_closeRoom.onClick:Add(handler(self, function()
|
||||||
|
local settingView = SettingView.new(self)
|
||||||
|
settingView:Show()
|
||||||
|
end))
|
||||||
|
end
|
||||||
|
|
||||||
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
|
||||||
self:SendShowNext(ShowNextConfrimCtr)
|
|
||||||
end)
|
|
||||||
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
|
||||||
showNextCtr.selectedIndex = 0
|
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
|
||||||
end)
|
|
||||||
showNextList.onClickItem:Set(function(context)
|
|
||||||
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
|
|
||||||
self._showNextName = nil
|
|
||||||
end)
|
|
||||||
btn_closeRoom.onClick:Add(handler(self, function()
|
|
||||||
local settingView = SettingView.new(self)
|
|
||||||
settingView:Show()
|
|
||||||
end))
|
|
||||||
--------
|
--------
|
||||||
self:PlayerChangeLineState()
|
self:PlayerChangeLineState()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,949 @@
|
||||||
|
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
||||||
|
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||||
|
local MJMainView = require("main.majiang.MJMainView")
|
||||||
|
local EXClearingView = import(".EXClearingView")
|
||||||
|
local TX_GameEvent = import(".GameEvent")
|
||||||
|
local HuTipView = import("main.majiang.HuTipView")
|
||||||
|
local SettingView = import(".EXSettingView")
|
||||||
|
local PlayerInfoView = import(".EXPlayerInfoView")
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- Create a new ZZ_MainView
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = MJMainView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = "MainView"
|
||||||
|
self.asset_group = "LiChuan_MJ"
|
||||||
|
self:init()
|
||||||
|
ViewUtil.PlayMuisc(self.asset_group, "extend/majiang/lichuan/sound/bg.mp3")
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitView(url)
|
||||||
|
local room = self._room
|
||||||
|
self._style = 1
|
||||||
|
self._gps_style = 1
|
||||||
|
self._full = true
|
||||||
|
UIPackage.AddPackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan")
|
||||||
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||||
|
self._hu_tip = HuTipView.new(self)
|
||||||
|
|
||||||
|
self._view:GetChild('wanfa_text').text = room.room_config.people_num .. '人黎川麻将 ' .. room.score_times .. '倍'
|
||||||
|
|
||||||
|
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||||
|
self.Laizi1Btn = self._view:GetChild('selectgang1')
|
||||||
|
self.Laizi2Btn = self._view:GetChild('selectgang2')
|
||||||
|
self._view:GetChild("n108").visible = true
|
||||||
|
self.Laizi1Btn.visible = true
|
||||||
|
self.Laizi2Btn.visible = true
|
||||||
|
self.bugangnum = self._view:GetChild("bugangnum")
|
||||||
|
|
||||||
|
--lingmeng
|
||||||
|
---[[
|
||||||
|
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||||
|
--]]
|
||||||
|
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')
|
||||||
|
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_Lobby)
|
||||||
|
else
|
||||||
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
_curren_msg:Show()
|
||||||
|
--]]
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
|
showNextCtr.selectedIndex = 1
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
||||||
|
self:SendShowNext(ShowNextConfrimCtr)
|
||||||
|
end)
|
||||||
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
|
ShowNextConfrimCtr.selectedIndex = 0
|
||||||
|
showNextCtr.selectedIndex = 0
|
||||||
|
showNextList.selectedIndex = -1
|
||||||
|
self._showNextName = nil
|
||||||
|
end)
|
||||||
|
showNextList.onClickItem:Set(function(context)
|
||||||
|
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
|
||||||
|
self._showNextName = nil
|
||||||
|
end)
|
||||||
|
btn_closeRoom.onClick:Add(handler(self, function()
|
||||||
|
local settingView = SettingView.new(self)
|
||||||
|
settingView:Show()
|
||||||
|
end))
|
||||||
|
--------
|
||||||
|
self:PlayerChangeLineState()
|
||||||
|
|
||||||
|
if room.playing or room.curren_round > 0 then
|
||||||
|
self:ReloadRoom()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__BuGang(cardInfo, callback)
|
||||||
|
local _gang_tip_choice = UIPackage.CreateObject("Extend_MJ_LiChuan", "Gang_tip_choice")
|
||||||
|
_gang_tip_choice.visible = true
|
||||||
|
|
||||||
|
local list_card = _gang_tip_choice:GetChild("list_card")
|
||||||
|
list_card:SetVirtual()
|
||||||
|
list_card.itemRenderer = function(index, obj)
|
||||||
|
obj.icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" .. cardInfo[index + 1])
|
||||||
|
end
|
||||||
|
list_card.numItems = #cardInfo
|
||||||
|
list_card.onClickItem:Set(function(context)
|
||||||
|
local item = context.data
|
||||||
|
local index = list_card:GetChildIndex(item)
|
||||||
|
callback(cardInfo[index + 1])
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gang_tip_choice.xy = Vector2((self._view.width - _gang_tip_choice.width) / 2,
|
||||||
|
(self._view.height - _gang_tip_choice.height) / 2)
|
||||||
|
self._view:AddChild(_gang_tip_choice)
|
||||||
|
self._gang_tip_choice = _gang_tip_choice
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:SetShowGangZiProcess(currentLaizi1ID, currentLaizi2ID, bugangnum, isShowAnim)
|
||||||
|
--zhongid=currentLaizi1ID
|
||||||
|
if isShowAnim == nil then isShowAnim = false end
|
||||||
|
|
||||||
|
self:SetGangZiCard(self.Laizi1Btn, currentLaizi1ID)
|
||||||
|
-- self:SetGangZiCard(self.Laizi2Btn, currentLaizi2ID)
|
||||||
|
self:IsShowGangZi(self.Laizi1Btn, true)
|
||||||
|
-- self:IsShowGangZi(self.Laizi2Btn, true)
|
||||||
|
self.bugangnum.text = "当前 " .. bugangnum .. " 杠"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:HideAllGangZiCard()
|
||||||
|
self.Laizi1Btn.visible = false
|
||||||
|
-- self.Laizi2Btn.visible = false
|
||||||
|
self.selectLaiziBtn.visible = false
|
||||||
|
--self.LaiziBG.visible=false
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:SetGangZiCard(btn, cardId)
|
||||||
|
btn.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. cardId
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:IsShowGangZi(btn, isShow)
|
||||||
|
btn.visible = isShow
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateRound()
|
||||||
|
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
|
||||||
|
self._room.room_config.round)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ShowJing()
|
||||||
|
if self._room.jing then
|
||||||
|
self.jing.icon = 'ui://Main_Majiang/' ..
|
||||||
|
get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. self._room.jing
|
||||||
|
self.jing.visible = true
|
||||||
|
if self.jing:GetController('jing') then
|
||||||
|
self.jing:GetController('jing').selectedIndex = 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.jing.visible = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitPlayerInfoView()
|
||||||
|
self._player_info = {}
|
||||||
|
local _player_info = self._player_info
|
||||||
|
for i = 1, self._room.room_config.people_num do
|
||||||
|
print("================================InitPlayerInfoView", string.format("player_info%d_1", i))
|
||||||
|
local tem = self._view:GetChild(string.format("player_info%d_1", i))
|
||||||
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||||
|
tem.visible = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
|
if index == 1 then
|
||||||
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
|
end
|
||||||
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:EventInit()
|
||||||
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||||
|
MainView.EventInit(self)
|
||||||
|
local _room = self._room
|
||||||
|
local _view = self._view
|
||||||
|
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||||
|
local _player_info = self._player_info
|
||||||
|
local _gamectr = self._gamectr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
self:SetShowLaiZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
self:SetShowGangZiProcess(arg[1], arg[2], arg[3], arg[4])
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
_gamectr:SendGangCard(arg[1][1])
|
||||||
|
-- self:__BuGang(arg[1],
|
||||||
|
-- function(id)
|
||||||
|
-- printlog(id)
|
||||||
|
-- _gamectr:SendGangCard(id)
|
||||||
|
-- self:__CloseGangTip()
|
||||||
|
-- end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
|
-- self:ShowHuTip()
|
||||||
|
self:UpdateRound()
|
||||||
|
self._state.selectedIndex = 1
|
||||||
|
self:ShowJing()
|
||||||
|
local list = _room.player_list
|
||||||
|
for i = 1, #list do
|
||||||
|
local p = list[i]
|
||||||
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
info:FillData(p)
|
||||||
|
info:MarkBank(p.seat == _room.banker_seat)
|
||||||
|
info:Ready(false)
|
||||||
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
card_info:UpdateHandCard()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
self._left_time = 15
|
||||||
|
local seat = arg[1]
|
||||||
|
self:UpdateCardBox(self:GetPos(seat))
|
||||||
|
-- if seat == self._room.self_player.seat then
|
||||||
|
-- self:ShowHuTip()
|
||||||
|
-- end
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
||||||
|
local info = self._player_card_info[self:GetPos(_room.self_player.seat)]
|
||||||
|
info:UpdateHandCard(true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
|
self:__CloseTip()
|
||||||
|
self._left_time = 0
|
||||||
|
local arg = { ... }
|
||||||
|
local p = arg[1]
|
||||||
|
local card = arg[2]
|
||||||
|
local seat = p.seat
|
||||||
|
local info = self._player_card_info[self:GetPos(seat)]
|
||||||
|
self:RemoveCursor()
|
||||||
|
info:UpdateHandCard()
|
||||||
|
local outcard = UIPackage.CreateObjectFromURL(_gcm_outcard_url)
|
||||||
|
info:UpdateOutCardList(outcard, card, self._cursor)
|
||||||
|
self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card))
|
||||||
|
self:PlayMJSound("chupai.mp3")
|
||||||
|
if seat == _room.self_player.seat then
|
||||||
|
_room.curren_outcard_seat = -1
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
|
self:__CloseTip()
|
||||||
|
local arg = { ... }
|
||||||
|
local seat = arg[1]
|
||||||
|
local card = arg[2]
|
||||||
|
-- self._tex_leftTime.text = arg[3]
|
||||||
|
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3])
|
||||||
|
-- self:UpdateRoomInfo()
|
||||||
|
local info = self._player_card_info[self:GetPos(seat)]
|
||||||
|
info:UpdateHandCard(true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
|
print("========================OnEventFzTips1")
|
||||||
|
local arg = { ... }
|
||||||
|
local _tip = arg[1]
|
||||||
|
local weight = arg[2]
|
||||||
|
self:__FangziTip(_tip, weight)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction))
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
|
self._left_time = 0
|
||||||
|
self:UpdateCardBox(0)
|
||||||
|
self:__CloseTip()
|
||||||
|
self._popEvent = false
|
||||||
|
local arg = { ... }
|
||||||
|
local win_seat = arg[1]
|
||||||
|
local lose_seat = arg[2]
|
||||||
|
local win_card = arg[3]
|
||||||
|
local cards = arg[4]
|
||||||
|
local win_list = arg[5]
|
||||||
|
local index = self:GetPos(win_seat)
|
||||||
|
local info = self._player_card_info[index]
|
||||||
|
self:RemoveCursor()
|
||||||
|
info:UpdateHandCard(true, true)
|
||||||
|
|
||||||
|
local obj_win_card = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Btn_Card_jiangxi")
|
||||||
|
obj_win_card.icon = "ui://Main_Majiang/202_" .. win_card
|
||||||
|
obj_win_card:GetController("bg").selectedIndex = 1
|
||||||
|
info._view:AddChild(obj_win_card)
|
||||||
|
obj_win_card:Center()
|
||||||
|
|
||||||
|
local url, pNode
|
||||||
|
local player = _room:GetPlayerBySeat(win_seat)
|
||||||
|
if win_seat ~= _room.self_player.seat then
|
||||||
|
url = "ui://Main_Majiang/别人胡"
|
||||||
|
pNode = info._mask_liangpai
|
||||||
|
elseif win_seat == _room.self_player.seat then
|
||||||
|
url = "ui://Main_Majiang/自己胡牌"
|
||||||
|
pNode = self._view
|
||||||
|
end
|
||||||
|
if win_seat == lose_seat then
|
||||||
|
url = "ui://Main_Majiang/eff_zimo"
|
||||||
|
end
|
||||||
|
|
||||||
|
local he = UIPackage.CreateObjectFromURL(url)
|
||||||
|
pNode:AddChild(he)
|
||||||
|
he:GetTransition("t2"):Play()
|
||||||
|
he:Center()
|
||||||
|
if _room.room_config.people_num == 2 then
|
||||||
|
if win_seat ~= _room.self_player.seat then
|
||||||
|
he.scaleY = 0.4
|
||||||
|
he.scaleX = 0.4
|
||||||
|
he.x = he.width * 0.4 * 0.5 * -1
|
||||||
|
he.y = he.height * 0.4 * 0.5 * -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if win_seat == _room.self_player.seat then
|
||||||
|
printlog("自己位置=====")
|
||||||
|
he:Center()
|
||||||
|
elseif url == "ui://Main_Majiang/eff_zimo" then
|
||||||
|
printlog("自摸地址==========")
|
||||||
|
he.scaleY = 0.4
|
||||||
|
he.scaleX = 0.4
|
||||||
|
he.x = he.width * 0.4 * 0.5 * -1
|
||||||
|
he.y = he.height * 0.4 * 0.5 * -1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
local isZiMo = win_seat == lose_seat
|
||||||
|
DataManager.CurrenRoom.isZiMoHu = isZiMo
|
||||||
|
local hu_sound = isZiMo and ("zimo" .. math.random(1, 3)) or ("hu" .. math.random(1, 2))
|
||||||
|
printlog("声音====>>>", hu_sound)
|
||||||
|
self:PlaySound("LiChuan_MJ", player.self_user.sex, hu_sound)
|
||||||
|
|
||||||
|
local pNode = info._view
|
||||||
|
local url = "eff_list1"
|
||||||
|
local he_list = UIPackage.CreateObjectFromURL("ui://Extend_MJ_LiChuan/" .. url)
|
||||||
|
he_list.touchable = false
|
||||||
|
pNode:AddChild(he_list)
|
||||||
|
he_list:Center()
|
||||||
|
|
||||||
|
coroutine.start(function()
|
||||||
|
for i = 1, #win_list do
|
||||||
|
local tem = win_list[i]
|
||||||
|
if tem.type > 0 and tem.type < 32 then
|
||||||
|
local com_name = "he" .. tem.type
|
||||||
|
-- print("===================================com_name", com_name)
|
||||||
|
local item = he_list:GetChild("list"):AddItemFromPool("ui://Extend_MJ_LiChuan/" .. com_name)
|
||||||
|
coroutine.wait(0.3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
coroutine.wait(2)
|
||||||
|
obj_win_card:Dispose()
|
||||||
|
he:Dispose()
|
||||||
|
he_list:Dispose()
|
||||||
|
self._popEvent = true
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
self._popEvent = false
|
||||||
|
local list = arg[1]
|
||||||
|
local start_seat = arg[2]
|
||||||
|
-- ViewUtil.PlaySound("LiChuan_MJ", "extend/majiang/chaozhou/sound/zhuaniao.mp3")
|
||||||
|
coroutine.start(self.RunNiao, self, list, start_seat)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
self._popEvent = false
|
||||||
|
self:__CloseTip()
|
||||||
|
self._left_time = 0
|
||||||
|
self:UpdateCardBox(0)
|
||||||
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
|
local arg = { ... }
|
||||||
|
local result = arg[1]
|
||||||
|
local liuju = result.liuju
|
||||||
|
local data = result.info_list
|
||||||
|
local niao = result.niao
|
||||||
|
if liuju then
|
||||||
|
local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu")
|
||||||
|
self._view:AddChild(le)
|
||||||
|
le:Center()
|
||||||
|
le:GetTransition("t0"):Play()
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(1)
|
||||||
|
le:Dispose()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
self:RemoveCursor()
|
||||||
|
if self._clearingView == nil then
|
||||||
|
self._clearingView = EXClearingView.new(self._root_view)
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(0.5)
|
||||||
|
self._clearingView:Show()
|
||||||
|
self._popEvent = true
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
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].hp_info.cur_hp
|
||||||
|
end
|
||||||
|
-- info:UpdateScore()
|
||||||
|
info._view:GetChild("zhanji").visible = true
|
||||||
|
local num = data[i].hp_info.total_hp
|
||||||
|
if num >= 0 then
|
||||||
|
info._view:GetController("text_color").selectedIndex = 0
|
||||||
|
info._view:GetChild("text_jifen").text = "+" .. d2ad(num)
|
||||||
|
else
|
||||||
|
info._view:GetController("text_color").selectedIndex = 1
|
||||||
|
info._view:GetChild("text_jifen").text = d2ad(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
|
||||||
|
self._player_card_info[1]:ShowHuTip()
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
||||||
|
self:UnmarkSelfTuoguan()
|
||||||
|
self._left_time = 0
|
||||||
|
self:UpdateCardBox(0)
|
||||||
|
self._ctr_cardbox.selectedIndex = 0
|
||||||
|
local arg = { ... }
|
||||||
|
local total_result = arg[2]
|
||||||
|
local result = arg[1]
|
||||||
|
local over = arg[3]
|
||||||
|
self._clearingView = EXClearingView.new()
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(0.5)
|
||||||
|
self._clearingView:Show()
|
||||||
|
end)
|
||||||
|
self._clearingView:InitData(over, _room, result, total_result)
|
||||||
|
ControllerManager.ChangeController(LoddyController)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
|
||||||
|
self:UpdateRound()
|
||||||
|
self._tex_LeftCard.text = "剩余0张牌"
|
||||||
|
self._state.selectedIndex = 1
|
||||||
|
self:__PiaoNiaoTip()
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
local seat = arg[1]
|
||||||
|
local num = arg[2]
|
||||||
|
if num > 0 then
|
||||||
|
local head_info = self._player_info[self:GetPos(seat)]
|
||||||
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. num
|
||||||
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
end
|
||||||
|
if seat == _room.self_player.seat then
|
||||||
|
if self._com_piao and _room.self_player.entrust then
|
||||||
|
self._com_piao:Dispose()
|
||||||
|
self._com_piao = nil
|
||||||
|
_room.curren_round = _room.curren_round - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:OutCard(card)
|
||||||
|
if card ~= 0 then
|
||||||
|
printlog("当前出牌为===>>>" .. card)
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
self._room.curren_outcard_seat = -1
|
||||||
|
_gamectr:SendOutCard(card, function()
|
||||||
|
local info = self._player_card_info[1]
|
||||||
|
self:RemoveCursor()
|
||||||
|
info:UpdateHandCard()
|
||||||
|
|
||||||
|
info:UpdateOutCardList(nil, card, self._cursor)
|
||||||
|
self:PlaySound("LiChuan_MJ", self._room.self_player.self_user.sex, tostring(card))
|
||||||
|
self:PlayMJSound("chupai.mp3")
|
||||||
|
-- self:ShowHuTip()
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
printlog("鬼牌不能出===>>>" .. card)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__FangziTip(tip, weight)
|
||||||
|
print("========================OnEventFzTips2", tip, weight)
|
||||||
|
local _gamectr = self._gamectr
|
||||||
|
local _chipeng_tip = UIPackage.CreateObject("Main_Majiang", "Gcm_action_tips")
|
||||||
|
_chipeng_tip:GetController("hide_bg").selectedIndex = 1
|
||||||
|
self._chipeng_tip = _chipeng_tip
|
||||||
|
local p = self._room.self_player
|
||||||
|
-- self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
|
||||||
|
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
|
||||||
|
_lit_fanzi:RemoveChildrenToPool()
|
||||||
|
local _tlist = table.keys(tip.tip_map_type)
|
||||||
|
printlog(tip.tip_map_type)
|
||||||
|
pt(_tlist)
|
||||||
|
local tip_hu = false
|
||||||
|
local count = #_tlist
|
||||||
|
table.sort(_tlist)
|
||||||
|
local isHu = false
|
||||||
|
for k = 1, #_tlist do
|
||||||
|
local td = tip.tip_map_type[_tlist[k]][1]
|
||||||
|
local url = "ui://Main_Majiang/Btn_fztip"
|
||||||
|
local td_weight = td.weight
|
||||||
|
if td_weight == 16 then td_weight = 8 end
|
||||||
|
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
|
||||||
|
local btn_t = _lit_fanzi:AddItemFromPool(url)
|
||||||
|
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
|
||||||
|
btn_t.data = { tip, td }
|
||||||
|
btn_t.onClick:Add(self.__TipAction, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if not (tonumber(weight) >= 16) then
|
||||||
|
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
|
||||||
|
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
|
||||||
|
_btn_pass.onClick:Set(function()
|
||||||
|
if tonumber(weight) >= 8 then
|
||||||
|
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||||
|
guo_msg.onOk:Add(function()
|
||||||
|
_gamectr:SendAction(0)
|
||||||
|
_chipeng_tip:Dispose()
|
||||||
|
self._chipeng_tip = nil
|
||||||
|
guo_msg:Close()
|
||||||
|
end)
|
||||||
|
guo_msg:Show()
|
||||||
|
else
|
||||||
|
_gamectr:SendAction(0)
|
||||||
|
_chipeng_tip:Dispose()
|
||||||
|
self._chipeng_tip = nil
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
self._view:AddChild(_chipeng_tip)
|
||||||
|
_chipeng_tip:Center()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__TipAction(context)
|
||||||
|
local data = context.sender.data
|
||||||
|
local _gamectr = self._gamectr
|
||||||
|
local tip = data[1]
|
||||||
|
local td = data[2]
|
||||||
|
local list = tip.tip_map_type[td.weight]
|
||||||
|
printlog("__TipAction")
|
||||||
|
pt(list)
|
||||||
|
if (#list > 1) then
|
||||||
|
self:_ChiView(list, function(id)
|
||||||
|
_gamectr:SendAction(id)
|
||||||
|
self:__CloseTip()
|
||||||
|
end)
|
||||||
|
self._chipeng_tip.visible = false
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
_gamectr:SendAction(td.id)
|
||||||
|
if (self._chipeng_tip == nil) then return end
|
||||||
|
self._chipeng_tip:Dispose()
|
||||||
|
self._chipeng_tip = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:_ChiView(tiplist, callback)
|
||||||
|
self._chipeng_tip.visible = false
|
||||||
|
printlog("_ChiView")
|
||||||
|
pt(tiplist)
|
||||||
|
local _pop_tip_choice = UIPackage.CreateObject("Extend_MJ_LiChuan", "Pop_tip_choice")
|
||||||
|
local list_choose1 = _pop_tip_choice:GetChild("Lst_choose")
|
||||||
|
local list_choose2 = _pop_tip_choice:GetChild("Lst_choose2")
|
||||||
|
local crossCtr = _pop_tip_choice:GetController("state")
|
||||||
|
crossCtr.selectedIndex = #tiplist == 3 and 0 or
|
||||||
|
(#tiplist == 2 and 1 or (#tiplist == 4 and 2 or (#tiplist == 5 and 3 or 4)))
|
||||||
|
_pop_tip_choice:GetChild("Btn_cross").onClick:Add(function()
|
||||||
|
_pop_tip_choice:Dispose()
|
||||||
|
self._chipeng_tip.visible = true
|
||||||
|
end)
|
||||||
|
list_choose1:RemoveChildrenToPool()
|
||||||
|
list_choose2:RemoveChildrenToPool()
|
||||||
|
for i = 1, #tiplist do
|
||||||
|
local list_choose = i <= 3 and list_choose1 or list_choose2
|
||||||
|
local item_choose = list_choose:AddItemFromPool()
|
||||||
|
item_choose:GetController("type").selectedIndex = (1 == tiplist[i].weight or 2 == tiplist[i].weight) and 1 or 0
|
||||||
|
if tiplist[i].weight ~= 1 then
|
||||||
|
for j = 1, 4 do
|
||||||
|
item_choose:GetChild("card" .. j).icon = UIPackage.GetItemURL("Main_Majiang",
|
||||||
|
self:GetPrefix() .. "202_" .. tiplist[i].card)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local tem = {}
|
||||||
|
table.insert(tem, tiplist[i].opcard[1])
|
||||||
|
table.insert(tem, tiplist[i].opcard[2])
|
||||||
|
local tcard = tiplist[i].card
|
||||||
|
table.insert(tem, tcard)
|
||||||
|
table.sort(tem, function(a, b)
|
||||||
|
return a < b
|
||||||
|
end)
|
||||||
|
item_choose:GetChild("card1").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
||||||
|
tem[1])
|
||||||
|
item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
||||||
|
tem[2])
|
||||||
|
item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_" ..
|
||||||
|
tem[3])
|
||||||
|
local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2)
|
||||||
|
item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1
|
||||||
|
end
|
||||||
|
item_choose.onClick:Add(function()
|
||||||
|
callback(tiplist[i].id)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
_pop_tip_choice.xy = Vector2((self._view.width - _pop_tip_choice.width) / 2,
|
||||||
|
(self._view.height - _pop_tip_choice.height) / 2)
|
||||||
|
self._view:AddChild(_pop_tip_choice)
|
||||||
|
self._pop_tip_choice = _pop_tip_choice
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:OnFangziAction(...)
|
||||||
|
self:__CloseTip()
|
||||||
|
local arg = { ... }
|
||||||
|
local _player_card_info = self._player_card_info
|
||||||
|
local fz = arg[1]
|
||||||
|
local player = arg[2]
|
||||||
|
local index = arg[3]
|
||||||
|
printlog("OnFangziAction")
|
||||||
|
local info = _player_card_info[self:GetPos(player.seat)]
|
||||||
|
local pNode = info._mask_liangpai
|
||||||
|
local effect = UIPackage.CreateObject("Extend_MJ_LiChuan", "FzEffect")
|
||||||
|
if fz.type == FZType.Peng then
|
||||||
|
self:PlaySound("LiChuan_MJ", player.self_user.sex, "peng" .. math.random(1, 3))
|
||||||
|
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "碰")
|
||||||
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "碰框")
|
||||||
|
elseif fz.type == FZType.Chi then
|
||||||
|
self:PlaySound("LiChuan_MJ", player.self_user.sex, "chi" .. math.random(1, 3))
|
||||||
|
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "吃")
|
||||||
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "吃")
|
||||||
|
else
|
||||||
|
self:PlaySound("LiChuan_MJ", player.self_user.sex, "gang" .. math.random(1, 2))
|
||||||
|
effect:GetChild("word1").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
|
effect:GetChild("word2").icon = UIPackage.GetItemURL("Main_Majiang", "杠")
|
||||||
|
-- effect:GetChild("kuang").icon = UIPackage.GetItemURL("Main_Majiang", "杠框")
|
||||||
|
end
|
||||||
|
effect.touchable = false
|
||||||
|
effect:GetTransition("t2"):Play()
|
||||||
|
pNode:AddChild(effect)
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(0.3)
|
||||||
|
self._popEvent = true
|
||||||
|
end)
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(2)
|
||||||
|
effect:Dispose()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self:RemoveCursor()
|
||||||
|
if (player.seat ~= fz.from_seat) then
|
||||||
|
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
||||||
|
fs_info:UpdateOutCardList()
|
||||||
|
end
|
||||||
|
info:UpdateFzList(fz, index, true)
|
||||||
|
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
||||||
|
printlog(getcard)
|
||||||
|
info:UpdateHandCard(getcard)
|
||||||
|
self:__CloseTip()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:RunNiao(list, start_seat)
|
||||||
|
local _room = self._room
|
||||||
|
--local _niao_View = self._niao_View
|
||||||
|
self._niao_View = UIPackage.CreateObject("Extend_MJ_LiChuan", "Panel_Birds")
|
||||||
|
self._view:AddChild(self._niao_View)
|
||||||
|
self._niao_View:Center()
|
||||||
|
local _niao_View = self._niao_View
|
||||||
|
local list_niao_card = self._niao_View:GetChild("Lst_birds")
|
||||||
|
list_niao_card:RemoveChildrenToPool()
|
||||||
|
for i = 1, #list do
|
||||||
|
--添加背面的麻將
|
||||||
|
local item = list_niao_card:AddItemFromPool()
|
||||||
|
item.icon = UIPackage.GetItemURL("Main_Majiang", "202_00")
|
||||||
|
item:GetChild("tex_score").text = "+" .. list[i].score
|
||||||
|
end
|
||||||
|
for i = 1, #list do
|
||||||
|
--顯示正面
|
||||||
|
local item = list_niao_card:GetChildAt(i - 1)
|
||||||
|
local card = list[i].card
|
||||||
|
coroutine.wait(0.3)
|
||||||
|
item:GetTransition("appear"):Play()
|
||||||
|
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||||
|
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||||
|
end
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(1)
|
||||||
|
_niao_View:Dispose()
|
||||||
|
self._popEvent = true
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- function M:markOutCards(showTip, data)
|
||||||
|
-- for i = 1, #self._room.player_list do
|
||||||
|
-- local p = self._room.player_list[i]
|
||||||
|
-- local info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
-- for j = 1, #p.outcard_list do
|
||||||
|
-- local card = p.outcard_list[j]
|
||||||
|
-- if card == data then
|
||||||
|
-- local obj = info:GetOutCardByIndex(j)
|
||||||
|
-- obj:GetController("gray").selectedIndex = showTip and 1 or 0
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
function M:__PiaoNiaoTip()
|
||||||
|
local obj_piao = UIPackage.CreateObject("Main_Majiang", "panel_piao_niao")
|
||||||
|
self._view:AddChild(obj_piao)
|
||||||
|
obj_piao.x = (self._view.width - obj_piao.width) * 0.5
|
||||||
|
obj_piao.y = self._view.height * 0.6
|
||||||
|
for i = 1, 4 do
|
||||||
|
obj_piao:GetChild("btn_" .. i).onClick:Add(function()
|
||||||
|
self._gamectr:SendAction(i - 1)
|
||||||
|
obj_piao:Dispose()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
self._com_piao = obj_piao
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ReloadRoom(bskip)
|
||||||
|
local room = self._room
|
||||||
|
-- if not room.playing then
|
||||||
|
-- self._state.selectedIndex = 2
|
||||||
|
-- else
|
||||||
|
-- self._state.selectedIndex = 1
|
||||||
|
-- self._room._reload_flag = true
|
||||||
|
-- end
|
||||||
|
|
||||||
|
if bskip == nil or bskip == false then
|
||||||
|
if not room.playing then
|
||||||
|
self._state.selectedIndex = 2
|
||||||
|
else
|
||||||
|
self._state.selectedIndex = 1
|
||||||
|
self._room._reload_flag = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1, #room.player_list do
|
||||||
|
local p = room.player_list[i]
|
||||||
|
local info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
for i = 1, #p.fz_list do
|
||||||
|
info:UpdateFzList(p.fz_list[i], -1)
|
||||||
|
end
|
||||||
|
info:UpdateHandCard()
|
||||||
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
-- head_info:UpdateScore()
|
||||||
|
head_info._view:GetChild('zhanji').visible = true
|
||||||
|
local num = p.total_hp or 0
|
||||||
|
if num > 0 then
|
||||||
|
head_info._view:GetController('text_color').selectedIndex = 0
|
||||||
|
head_info._view:GetChild('text_jifen').text = "+" .. d2ad(num)
|
||||||
|
else
|
||||||
|
head_info._view:GetController('text_color').selectedIndex = 1
|
||||||
|
head_info._view:GetChild('text_jifen').text = d2ad(num)
|
||||||
|
end
|
||||||
|
|
||||||
|
if p.seat == room.last_outcard_seat then
|
||||||
|
local card = p.outcard_list[#p.outcard_list]
|
||||||
|
info:UpdateOutCardList(nil, card, self._cursor)
|
||||||
|
elseif p.seat == room.curren_outcard_seat then
|
||||||
|
info:UpdateHandCard(true)
|
||||||
|
info:UpdateOutCardList()
|
||||||
|
else
|
||||||
|
info:UpdateOutCardList()
|
||||||
|
end
|
||||||
|
if p.seat == room.banker_seat then
|
||||||
|
head_info:MarkBank(true)
|
||||||
|
end
|
||||||
|
-- if p.ready then
|
||||||
|
-- self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
|
-- end
|
||||||
|
if bskip == nil or bskip == false then
|
||||||
|
if p.ready and room.playing == false then
|
||||||
|
self._player_info[self:GetPos(p.seat)]:Ready(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if p.piao_niao ~= nil and p.piao_niao > 0 then
|
||||||
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- self:ShowHuTip()
|
||||||
|
|
||||||
|
if bskip == nil or bskip == false then
|
||||||
|
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
|
||||||
|
self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count)
|
||||||
|
self:UpdateRound()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:PlayerChangeLineState()
|
||||||
|
-- local isOutCard = true
|
||||||
|
-- local str = "玩家 "
|
||||||
|
-- for _ , player in ipairs(self._room.player_list) do
|
||||||
|
-- if player.line_state == 0 then
|
||||||
|
-- isOutCard = false
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateCardBox(seat)
|
||||||
|
local index = seat
|
||||||
|
local people_num = self._room.room_config.people_num
|
||||||
|
if people_num == 2 and seat == 2 then
|
||||||
|
index = 3
|
||||||
|
elseif people_num == 3 and seat == 3 then
|
||||||
|
index = 4
|
||||||
|
end
|
||||||
|
self._ctr_cardbox.selectedIndex = index
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------lingmeng----------------------------
|
||||||
|
function M:SendShowNext(ShowNextConfrimCtr)
|
||||||
|
if not self._showNextName then
|
||||||
|
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
ShowNextConfrimCtr.selectedIndex = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
|
if self._showNextName == context.data.name then
|
||||||
|
self:SendShowNext(ShowNextConfrimCtr)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self._showNextName = context.data.name
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdatePlayerInfoView()
|
||||||
|
self._player_info = {}
|
||||||
|
local _player_info = self._player_info
|
||||||
|
|
||||||
|
for i = 1, self._room.room_config.people_num do
|
||||||
|
print("==============================UpdatePlayerInfoView",
|
||||||
|
string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
|
||||||
|
local tem = self._view:GetChild(string.format("player_info%d_%d", i, self._state.selectedIndex + 1))
|
||||||
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
function M:__CloseTip()
|
||||||
|
if self._chipeng_tip then
|
||||||
|
self._chipeng_tip:Dispose()
|
||||||
|
self._chipeng_tip = nil
|
||||||
|
end
|
||||||
|
if self._pop_tip_choice then
|
||||||
|
self._pop_tip_choice:Dispose()
|
||||||
|
self._pop_tip_choice = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__CloseGangTip()
|
||||||
|
if self._gang_tip_choice then
|
||||||
|
self._gang_tip_choice:Dispose()
|
||||||
|
self._gang_tip_choice = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:closeTipOnTuoguan()
|
||||||
|
self:__CloseTip()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Destroy()
|
||||||
|
MJMainView.Destroy(self)
|
||||||
|
UIPackage.RemovePackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan")
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -10,7 +10,6 @@ function M.new(view, mainView)
|
||||||
setmetatable(M, { __index = PlayerInfoView })
|
setmetatable(M, { __index = PlayerInfoView })
|
||||||
end
|
end
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
print("===========================???view", view)
|
|
||||||
self._view = view
|
self._view = view
|
||||||
self._main_view = mainView
|
self._main_view = mainView
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -18,7 +17,6 @@ function M.new(view, mainView)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
print("===========================???", self, self._view)
|
|
||||||
if self._main_view._room.room_config.people_num ~= 2 then
|
if self._main_view._room.room_config.people_num ~= 2 then
|
||||||
PlayerInfoView.init(self)
|
PlayerInfoView.init(self)
|
||||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 478 KiB |
|
Before Width: | Height: | Size: 483 KiB After Width: | Height: | Size: 808 KiB |
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
pSDShowRemoveMatteOption: 0
|
pSDShowRemoveMatteOption: 0
|
||||||
userData:
|
userData:
|
||||||
assetBundleName: base/main_majiang/abf0e2af8fb6daf78fa8ebcdd8acc4f0
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 859 KiB |
|
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 4.0 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 885 KiB After Width: | Height: | Size: 888 KiB |