未完成,上传保存
|
|
@ -10,7 +10,7 @@ local FGAssistView = import('.FGAssistView')
|
||||||
MainView = {}
|
MainView = {}
|
||||||
|
|
||||||
-- 继承 BaseView
|
-- 继承 BaseView
|
||||||
setmetatable(MainView, {__index = BaseView})
|
setmetatable(MainView, { __index = BaseView })
|
||||||
|
|
||||||
local M = MainView
|
local M = MainView
|
||||||
|
|
||||||
|
|
@ -18,49 +18,48 @@ local M = MainView
|
||||||
local record_baned = 0
|
local record_baned = 0
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
TimerManager.Clear()
|
TimerManager.Clear()
|
||||||
self._gamectr = ControllerManager.GetController(GameController)
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
self._room = DataManager.CurrenRoom
|
self._room = DataManager.CurrenRoom
|
||||||
self._allow_dissmiss = true -- 游戏开始后显示解散房间按钮
|
self._allow_dissmiss = true -- 游戏开始后显示解散房间按钮
|
||||||
self._multilingual = false -- 游戏支持多语言切换
|
self._multilingual = false -- 游戏支持多语言切换
|
||||||
self._language = 0 -- 语言默认0,1可以设为需要的方言
|
self._language = 0 -- 语言默认0,1可以设为需要的方言
|
||||||
self._style = 1 -- 游戏风格
|
self._style = 1 -- 游戏风格
|
||||||
self._hide_assist = false -- 是否隐藏牌友圈助手
|
self._hide_assist = false -- 是否隐藏牌友圈助手
|
||||||
self._gps_style = 1
|
self._gps_style = 1
|
||||||
self.dismiss_cd = 0
|
self.dismiss_cd = 0
|
||||||
UIPackage.AddPackage('base/chat/ui/Chat')
|
UIPackage.AddPackage('base/chat/ui/Chat')
|
||||||
self.Fix_Msg_Chat = ViewUtil.Fix_Msg_Chat -- 自动回复消息列表
|
self.Fix_Msg_Chat = ViewUtil.Fix_Msg_Chat -- 自动回复消息列表
|
||||||
self.Fix_Msg_Chat2 = nil -- 自动回复列表2
|
self.Fix_Msg_Chat2 = nil -- 自动回复列表2
|
||||||
self:InitView()
|
self:InitView()
|
||||||
self:SetTuoGuanState()
|
self:SetTuoGuanState()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetTuoGuanState()
|
function M:SetTuoGuanState()
|
||||||
--printlog("初始化设置托管状态")
|
--printlog("初始化设置托管状态")
|
||||||
if ControllerManager.enterPlayerData and #ControllerManager.enterPlayerData>0 then
|
if ControllerManager.enterPlayerData and #ControllerManager.enterPlayerData > 0 then
|
||||||
--pt(ControllerManager.enterPlayerData)
|
--pt(ControllerManager.enterPlayerData)
|
||||||
for i=1,#ControllerManager.enterPlayerData do
|
for i = 1, #ControllerManager.enterPlayerData do
|
||||||
local p =self._player_info[self:GetPos(ControllerManager.enterPlayerData[i].seat)]
|
local p = self._player_info[self:GetPos(ControllerManager.enterPlayerData[i].seat)]
|
||||||
--p.seat=ControllerManager.enterPlayerData[i].seat
|
--p.seat=ControllerManager.enterPlayerData[i].seat
|
||||||
local t=ControllerManager.enterPlayerData[i].entrust_time
|
local t = ControllerManager.enterPlayerData[i].entrust_time
|
||||||
--local isShow=ControllerManager.enterPlayerData[i].entrust
|
--local isShow=ControllerManager.enterPlayerData[i].entrust
|
||||||
--if isShow==nil then return end
|
--if isShow==nil then return end
|
||||||
|
|
||||||
if t and t>0 then
|
if t and t > 0 then
|
||||||
p:IsShowTGTips(true,t)
|
p:IsShowTGTips(true, t)
|
||||||
else
|
else
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
ControllerManager.enterPlayerData = nil
|
||||||
ControllerManager.enterPlayerData=nil
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:InitView(url, isHideIpAdds)
|
function M:InitView(url, isHideIpAdds)
|
||||||
--print("url===>>>")
|
--print("url===>>>")
|
||||||
--print(url)
|
--print(url)
|
||||||
--print(debug.traceback())
|
--print(debug.traceback())
|
||||||
BaseView.InitView(self, url)
|
BaseView.InitView(self, url)
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
@ -78,7 +77,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
|
|
||||||
self._gcm_chat = self._view:GetChild('gcm_chat')
|
self._gcm_chat = self._view:GetChild('gcm_chat')
|
||||||
if self._gcm_chat then
|
if self._gcm_chat then
|
||||||
if self._room.ban_chat2 then
|
if self._room.ban_chat2 then
|
||||||
self._gcm_chat:GetController('sdk').selectedIndex = 1
|
self._gcm_chat:GetController('sdk').selectedIndex = 1
|
||||||
self._gcm_chat.visible = false
|
self._gcm_chat.visible = false
|
||||||
end
|
end
|
||||||
|
|
@ -90,7 +89,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
self._state = _view:GetController('state')
|
self._state = _view:GetController('state')
|
||||||
self._ctr_action = _view:GetController("action")
|
self._ctr_action = _view:GetController("action")
|
||||||
|
|
||||||
self:InitPlayerInfoView(isHideIpAdds)
|
self:InitPlayerInfoView(isHideIpAdds)
|
||||||
|
|
||||||
|
|
@ -111,7 +110,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
|
|
||||||
-- 显示玩家距离
|
-- 显示玩家距离
|
||||||
self.btn_distance = self._view:GetChild('btn_distance')
|
self.btn_distance = self._view:GetChild('btn_distance')
|
||||||
--self.btn_distance.displayObject.gameObject:SetActive(false)
|
--self.btn_distance.displayObject.gameObject:SetActive(false)
|
||||||
if self.btn_distance then
|
if self.btn_distance then
|
||||||
self.btn_distance.onClick:Add(function()
|
self.btn_distance.onClick:Add(function()
|
||||||
if self._room.self_player.seat == 0 then
|
if self._room.self_player.seat == 0 then
|
||||||
|
|
@ -120,7 +119,8 @@ function M:InitView(url, isHideIpAdds)
|
||||||
self.distance_view = PlayerDistanceView.new(false, self._gps_style, function(v)
|
self.distance_view = PlayerDistanceView.new(false, self._gps_style, function(v)
|
||||||
self:continue_game(v)
|
self:continue_game(v)
|
||||||
end)
|
end)
|
||||||
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and self._state.selectedIndex < 3 and 1 or 0
|
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and
|
||||||
|
self._state.selectedIndex < 3 and 1 or 0
|
||||||
self.distance_view:Show()
|
self.distance_view:Show()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -149,7 +149,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
str_des = string.format('%s %s', str_des, _room.room_config:GetDes())
|
str_des = string.format('%s %s', str_des, _room.room_config:GetDes())
|
||||||
com_roominfo:GetChild('tex_detail').text = str_des
|
com_roominfo:GetChild('tex_detail').text = str_des
|
||||||
local tex_time = com_roominfo:GetChild('tex_time')
|
local tex_time = com_roominfo:GetChild('tex_time')
|
||||||
self._co_timer =coroutine.start(function()
|
self._co_timer = coroutine.start(function()
|
||||||
while true do
|
while true do
|
||||||
tex_time.text = os.date('%m-%d %H:%M')
|
tex_time.text = os.date('%m-%d %H:%M')
|
||||||
local _client = ControllerManager.GameNetClinet
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
|
@ -189,7 +189,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
|
|
||||||
-- 语音Stard
|
-- 语音Stard
|
||||||
local gcm_chat = _view:GetChild('gcm_chat')
|
local gcm_chat = _view:GetChild('gcm_chat')
|
||||||
--gcm_chat.displayObject.gameObject:SetActive(false)
|
--gcm_chat.displayObject.gameObject:SetActive(false)
|
||||||
if gcm_chat then
|
if gcm_chat then
|
||||||
gcm_chat.visible = false
|
gcm_chat.visible = false
|
||||||
local _btn_chat = gcm_chat:GetChild('n1')
|
local _btn_chat = gcm_chat:GetChild('n1')
|
||||||
|
|
@ -208,7 +208,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
self._ctr_voice = gcm_chat:GetController('voice')
|
self._ctr_voice = gcm_chat:GetController('voice')
|
||||||
|
|
||||||
self._btn_record = gcm_chat:GetChild('btn_record')
|
self._btn_record = gcm_chat:GetChild('btn_record')
|
||||||
self._btn_record.displayObject.gameObject:SetActive(false)
|
self._btn_record.displayObject.gameObject:SetActive(false)
|
||||||
self.ctr_record_ban = self._btn_record:GetController('ban')
|
self.ctr_record_ban = self._btn_record:GetController('ban')
|
||||||
self.ctr_record_ban.selectedIndex = record_baned
|
self.ctr_record_ban.selectedIndex = record_baned
|
||||||
self._record_time = 0
|
self._record_time = 0
|
||||||
|
|
@ -232,18 +232,18 @@ function M:InitView(url, isHideIpAdds)
|
||||||
self._gamectr:PlayerReady()
|
self._gamectr:PlayerReady()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local btn_xipai = _view:GetChild('btn_xipai')
|
-- local btn_xipai = _view:GetChild('btn_xipai')
|
||||||
if btn_xipai then
|
-- if btn_xipai then
|
||||||
btn_xipai.onClick:Set(function()
|
-- btn_xipai.onClick:Set(function()
|
||||||
self._gamectr:PlayerXiPai()
|
-- self._gamectr:PlayerXiPai()
|
||||||
end)
|
-- end)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
local btn_start = _view:GetChild('btn_start')
|
-- local btn_start = _view:GetChild('btn_start')
|
||||||
btn_start.onClick:Set(function()
|
-- btn_start.onClick:Set(function()
|
||||||
self._gamectr:StartGame()
|
-- self._gamectr:StartGame()
|
||||||
end)
|
-- end)
|
||||||
|
|
||||||
local _btn_wxyqhy = _view:GetChild('btn_wxyqhy')
|
local _btn_wxyqhy = _view:GetChild('btn_wxyqhy')
|
||||||
if _btn_wxyqhy then
|
if _btn_wxyqhy then
|
||||||
|
|
@ -255,7 +255,7 @@ function M:InitView(url, isHideIpAdds)
|
||||||
self._left_time = 0
|
self._left_time = 0
|
||||||
self.dismiss_room_cd_time = 0
|
self.dismiss_room_cd_time = 0
|
||||||
local btn_back_exit = _view:GetChild('btn_back_exit')
|
local btn_back_exit = _view:GetChild('btn_back_exit')
|
||||||
--btn_back_exit.displayObject.gameObject:SetActive(false)
|
--btn_back_exit.displayObject.gameObject:SetActive(false)
|
||||||
if btn_back_exit ~= nil then
|
if btn_back_exit ~= nil then
|
||||||
btn_back_exit.onClick:Set(
|
btn_back_exit.onClick:Set(
|
||||||
function()
|
function()
|
||||||
|
|
@ -291,42 +291,42 @@ function M:InitView(url, isHideIpAdds)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
local btn_back_lobby = _view:GetChild('btn_back_lobby')
|
local btn_back_lobby = _view:GetChild('btn_back_lobby')
|
||||||
if btn_back_lobby ~= nil then
|
if btn_back_lobby ~= nil then
|
||||||
btn_back_lobby.onClick:Set(
|
btn_back_lobby.onClick:Set(
|
||||||
function()
|
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
|
end
|
||||||
local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel)
|
local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel)
|
||||||
_curren_msg.onOk:Add(
|
_curren_msg.onOk:Add(
|
||||||
function()
|
function()
|
||||||
if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then
|
if self._state.selectedIndex > 0 and self._state.selectedIndex < 3 then
|
||||||
ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。')
|
ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。')
|
||||||
else
|
else
|
||||||
ViewUtil.ShowModalWait(self._root_view)
|
ViewUtil.ShowModalWait(self._root_view)
|
||||||
self._gamectr:LevelRoom(
|
self._gamectr:LevelRoom(
|
||||||
function(res)
|
function(res)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
if res.ReturnCode == 0 then
|
if res.ReturnCode == 0 then
|
||||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
else
|
else
|
||||||
ViewUtil.ErrorTip(res.ReturnCode)
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
_curren_msg:Show()
|
_curren_msg:Show()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
--[[local btn_back_lobby = _view:GetChild('btn_back_lobby')
|
--[[local btn_back_lobby = _view:GetChild('btn_back_lobby')
|
||||||
btn_back_lobby.displayObject.gameObject:SetActive(false)
|
btn_back_lobby.displayObject.gameObject:SetActive(false)
|
||||||
if btn_back_lobby ~= nil then
|
if btn_back_lobby ~= nil then
|
||||||
|
|
@ -350,27 +350,25 @@ function M:InitView(url, isHideIpAdds)
|
||||||
|
|
||||||
-- 显示牌友圈助手
|
-- 显示牌友圈助手
|
||||||
if self._room.group_id ~= 0 and not self._hide_assist then
|
if self._room.group_id ~= 0 and not self._hide_assist then
|
||||||
|
local bShow = true
|
||||||
local bShow = true
|
|
||||||
local l_groups = DataManager.groups
|
local l_groups = DataManager.groups
|
||||||
local group = l_groups:get(self._room.group_id)
|
local group = l_groups:get(self._room.group_id)
|
||||||
if group ~= nil then
|
if group ~= nil then
|
||||||
local option = group.option or 0
|
local option = group.option or 0
|
||||||
if bit:_and(option,8) > 0 then
|
if bit:_and(option, 8) > 0 then
|
||||||
bShow = false
|
bShow = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if bShow then
|
if bShow then
|
||||||
--self:ShowFGAssist()
|
--self:ShowFGAssist()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
if self._room.self_player.entrust then
|
if self._room.self_player.entrust then
|
||||||
self:MarkSelfTuoguan()
|
self:MarkSelfTuoguan()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[local gameCommonBtn = UIPackage.CreateObjectFromURL('ui://Common/gameCommonPanel')
|
--[[local gameCommonBtn = UIPackage.CreateObjectFromURL('ui://Common/gameCommonPanel')
|
||||||
if gameCommonBtn then
|
if gameCommonBtn then
|
||||||
self._view:AddChild(gameCommonBtn)
|
self._view:AddChild(gameCommonBtn)
|
||||||
local shuaxingameBtn=gameCommonBtn:GetChild("shuaxinbtn")
|
local shuaxingameBtn=gameCommonBtn:GetChild("shuaxinbtn")
|
||||||
|
|
@ -382,11 +380,6 @@ function M:InitView(url, isHideIpAdds)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end--]]
|
end--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:continue_game(continue)
|
function M:continue_game(continue)
|
||||||
|
|
@ -444,16 +437,15 @@ function M:ShowFGAssist()
|
||||||
self._view:AddChild(btn_assist)
|
self._view:AddChild(btn_assist)
|
||||||
local panel_assist =
|
local panel_assist =
|
||||||
FGAssistView.new(
|
FGAssistView.new(
|
||||||
self._root_view,
|
self._root_view,
|
||||||
function()
|
function()
|
||||||
btn_assist.touchable = true
|
btn_assist.touchable = true
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
if self._full then
|
if self._full then
|
||||||
btn_assist.x = 40
|
btn_assist.x = 40
|
||||||
else
|
else
|
||||||
btn_assist.x = (GRoot.inst.width - 1334) * -0.5 + 40
|
btn_assist.x = (GRoot.inst.width - 1334) * -0.5 + 40
|
||||||
|
|
||||||
end
|
end
|
||||||
btn_assist.y = panel_assist._root_view.height / 3 - 0.5 * btn_assist.height
|
btn_assist.y = panel_assist._root_view.height / 3 - 0.5 * btn_assist.height
|
||||||
|
|
||||||
|
|
@ -568,7 +560,7 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.PlayerState,
|
GameEvent.PlayerState,
|
||||||
function(...)
|
function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = _player_info[self:GetPos(p.seat)]
|
local info = _player_info[self:GetPos(p.seat)]
|
||||||
info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0
|
info._ctr_offline.selectedIndex = p.line_state == 0 and 1 or 0
|
||||||
|
|
@ -584,7 +576,7 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.DeskBreak,
|
GameEvent.DeskBreak,
|
||||||
function(...)
|
function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local code = arg[1]
|
local code = arg[1]
|
||||||
if code == 0 then
|
if code == 0 then
|
||||||
if self.dismissWin == nil then
|
if self.dismissWin == nil then
|
||||||
|
|
@ -613,7 +605,7 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.Interaction,
|
GameEvent.Interaction,
|
||||||
function(...)
|
function(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
if not p or not p.seat or p.seat == 0 then
|
if not p or not p.seat or p.seat == 0 then
|
||||||
return
|
return
|
||||||
|
|
@ -658,7 +650,7 @@ function M:EventInit()
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.OnKicked,
|
GameEvent.OnKicked,
|
||||||
function()
|
function()
|
||||||
printlog("GameEvent.OnKicked====》》》》》")
|
printlog("GameEvent.OnKicked====》》》》》")
|
||||||
self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
local _curren_msg = MsgWindow.new(self._root_view, '由于长时间未准备,你已被踢出房间!', MsgWindow.MsgMode.OnlyOk)
|
local _curren_msg = MsgWindow.new(self._root_view, '由于长时间未准备,你已被踢出房间!', MsgWindow.MsgMode.OnlyOk)
|
||||||
_curren_msg.onOk:Add(
|
_curren_msg.onOk:Add(
|
||||||
|
|
@ -670,26 +662,23 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
_gamectr:AddEventListener(
|
_gamectr:AddEventListener(
|
||||||
GameEvent.TupGuanOpen,
|
GameEvent.TupGuanOpen,
|
||||||
function(...)
|
function(...)
|
||||||
--print("刷新托管数据=====")
|
--print("刷新托管数据=====")
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
|
||||||
if info and info.IsShowTGTips then
|
if info and info.IsShowTGTips then
|
||||||
info:IsShowTGTips(arg[2],arg[3])
|
info:IsShowTGTips(arg[2], arg[3])
|
||||||
end
|
end
|
||||||
|
|
||||||
if info and info.SetShowTGTips then
|
|
||||||
info:SetShowTGTips(arg[2],arg[3])
|
|
||||||
end
|
|
||||||
|
|
||||||
|
if info and info.SetShowTGTips then
|
||||||
|
info:SetShowTGTips(arg[2], arg[3])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 设置能否互动,1允许,0禁止
|
-- 设置能否互动,1允许,0禁止
|
||||||
|
|
@ -720,45 +709,45 @@ function M:PlayInteractAnimation(str, mypos, pos)
|
||||||
local total_rotation = (offsetY + offsetX) / 100 * 50
|
local total_rotation = (offsetY + offsetX) / 100 * 50
|
||||||
self._run_move =
|
self._run_move =
|
||||||
TweenUtils.TweenFloat(
|
TweenUtils.TweenFloat(
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0.5,
|
0.5,
|
||||||
function(value)
|
function(value)
|
||||||
myEff.x = mypos.x + offsetX * value
|
myEff.x = mypos.x + offsetX * value
|
||||||
myEff.y = mypos.y + offsetY * value
|
myEff.y = mypos.y + offsetY * value
|
||||||
if str == '2' then
|
if str == '2' then
|
||||||
myEff.rotation = total_rotation * value
|
myEff.rotation = total_rotation * value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
)
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self._run_eff =
|
self._run_eff =
|
||||||
coroutine.start(
|
coroutine.start(
|
||||||
function()
|
function()
|
||||||
if str ~= '1' then
|
if str ~= '1' then
|
||||||
coroutine.wait(0.5)
|
coroutine.wait(0.5)
|
||||||
else
|
else
|
||||||
local degree = math.atan2(offsetX, offsetY) * 180 / math.pi - 90
|
local degree = math.atan2(offsetX, offsetY) * 180 / math.pi - 90
|
||||||
if degree < -180 then
|
if degree < -180 then
|
||||||
degree = 360 + degree
|
degree = 360 + degree
|
||||||
|
end
|
||||||
|
degree = degree * -1
|
||||||
|
if degree > 90 or degree < -90 then
|
||||||
|
degree = degree + 180 * (degree > 90 and -1 or 1)
|
||||||
|
myEff.scaleX = -1
|
||||||
|
end
|
||||||
|
myEff.rotation = degree
|
||||||
|
coroutine.wait(0.2)
|
||||||
end
|
end
|
||||||
degree = degree * -1
|
self._view:AddChild(eff)
|
||||||
if degree > 90 or degree < -90 then
|
eff.x = pos.x
|
||||||
degree = degree + 180 * (degree > 90 and -1 or 1)
|
eff.y = pos.y
|
||||||
myEff.scaleX = -1
|
coroutine.wait(1.5)
|
||||||
end
|
eff:Dispose()
|
||||||
myEff.rotation = degree
|
myEff:Dispose()
|
||||||
coroutine.wait(0.2)
|
|
||||||
end
|
end
|
||||||
self._view:AddChild(eff)
|
)
|
||||||
eff.x = pos.x
|
|
||||||
eff.y = pos.y
|
|
||||||
coroutine.wait(1.5)
|
|
||||||
eff:Dispose()
|
|
||||||
myEff:Dispose()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetReadyNum()
|
function M:GetReadyNum()
|
||||||
|
|
@ -775,13 +764,13 @@ end
|
||||||
|
|
||||||
function M:OnPlayerEnter(...)
|
function M:OnPlayerEnter(...)
|
||||||
printlog("进入房间222222222222222222++++++++++++++++++++++++++++")
|
printlog("进入房间222222222222222222++++++++++++++++++++++++++++")
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
if
|
if
|
||||||
p ~= self._room.self_player and self._room.room_config.people_num <= 4 and
|
p ~= self._room.self_player and self._room.room_config.people_num <= 4 and
|
||||||
self._room.room_config.people_num >= 3 and
|
self._room.room_config.people_num >= 3 and
|
||||||
self._gamectr:CheckGPS()
|
self._gamectr:CheckGPS()
|
||||||
then
|
then
|
||||||
if self._room.self_player.seat == 0 then
|
if self._room.self_player.seat == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -791,7 +780,8 @@ function M:OnPlayerEnter(...)
|
||||||
self.distance_view = PlayerDistanceView.new(true, self._gps_style, function(v)
|
self.distance_view = PlayerDistanceView.new(true, self._gps_style, function(v)
|
||||||
self:continue_game(v)
|
self:continue_game(v)
|
||||||
end)
|
end)
|
||||||
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and self._state.selectedIndex < 3 and 1 or 0
|
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and
|
||||||
|
self._state.selectedIndex < 3 and 1 or 0
|
||||||
self.distance_view:Show()
|
self.distance_view:Show()
|
||||||
if self.btn_distance then
|
if self.btn_distance then
|
||||||
self.btn_distance:GetController("state").selectedIndex = 1
|
self.btn_distance:GetController("state").selectedIndex = 1
|
||||||
|
|
@ -803,29 +793,29 @@ function M:OnPlayerEnter(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerReady(...)
|
function M:OnPlayerReady(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
|
|
||||||
if p.isSendCardState~=nil and p.isSendCardState==true then
|
if p.isSendCardState ~= nil and p.isSendCardState == true then
|
||||||
p.isSendCardState=false
|
p.isSendCardState = false
|
||||||
ControllerManager.IsSendCard=false
|
ControllerManager.IsSendCard = false
|
||||||
--print("进入设置计时器控制==========")
|
--print("进入设置计时器控制==========")
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
--print("计时器倒计时5s=============")
|
--print("计时器倒计时5s=============")
|
||||||
coroutine.wait(5)
|
coroutine.wait(5)
|
||||||
--print("当前状态==============")
|
--print("当前状态==============")
|
||||||
--print(ControllerManager.IsSendCard)
|
--print(ControllerManager.IsSendCard)
|
||||||
if ControllerManager.IsSendCard==true then
|
if ControllerManager.IsSendCard == true then
|
||||||
--print("以发送开牌======================")
|
--print("以发送开牌======================")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
--print("开始断线重连")
|
--print("开始断线重连")
|
||||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||||
ViewManager.refreshGameView()
|
ViewManager.refreshGameView()
|
||||||
end
|
end
|
||||||
ControllerManager.IsSendCard=false
|
ControllerManager.IsSendCard = false
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if p.seat == self._room.self_player.seat then
|
if p.seat == self._room.self_player.seat then
|
||||||
if self._ctr_action then
|
if self._ctr_action then
|
||||||
|
|
@ -838,7 +828,7 @@ function M:OnPlayerReady(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnUpdateInfo(...)
|
function M:OnUpdateInfo(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local t = arg[2]
|
local t = arg[2]
|
||||||
-- 托管状态变化
|
-- 托管状态变化
|
||||||
|
|
@ -902,14 +892,14 @@ function M:MarkSelfTuoguan()
|
||||||
_msg_view = nil
|
_msg_view = nil
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
local roate=GRoot.inst.width/GRoot.inst.height
|
local roate = GRoot.inst.width / GRoot.inst.height
|
||||||
local num=100
|
local num = 100
|
||||||
if roate<1.9 then
|
if roate < 1.9 then
|
||||||
num=250
|
num = 250
|
||||||
end
|
end
|
||||||
com_tuoguan:AddChild(_msg_view)
|
com_tuoguan:AddChild(_msg_view)
|
||||||
_msg_view:GetChild('tex_message').text = '确定要取消托管吗?'
|
_msg_view:GetChild('tex_message').text = '确定要取消托管吗?'
|
||||||
_msg_view.x = (com_tuoguan.width - _msg_view.width) * 0.5-num
|
_msg_view.x = (com_tuoguan.width - _msg_view.width) * 0.5 - num
|
||||||
_msg_view.y = (com_tuoguan.height - com_tuoguan.y - _msg_view.height) * 0.5
|
_msg_view.y = (com_tuoguan.height - com_tuoguan.y - _msg_view.height) * 0.5
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
@ -924,7 +914,7 @@ function M:UnmarkSelfTuoguan()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerLeave(...)
|
function M:OnPlayerLeave(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = self._player_info[self:GetPos(p.seat)]
|
local info = self._player_info[self:GetPos(p.seat)]
|
||||||
info._view.visible = false
|
info._view.visible = false
|
||||||
|
|
@ -985,14 +975,14 @@ function M:OnUpdate()
|
||||||
if (self._popEvent) then
|
if (self._popEvent) then
|
||||||
local func = self._gamectr:PopEvent()
|
local func = self._gamectr:PopEvent()
|
||||||
if (func ~= nil) then
|
if (func ~= nil) then
|
||||||
if pcall(func) then
|
if pcall(func) then
|
||||||
|
|
||||||
else
|
else
|
||||||
self._gamectr = ControllerManager.GetController(GameController)
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
if self._gamectr then
|
if self._gamectr then
|
||||||
self._gamectr:ResetConnect()
|
self._gamectr:ResetConnect()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--func()
|
--func()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1006,16 +996,16 @@ function M:OnUpdate()
|
||||||
local leftTime = math.floor(_left_time)
|
local leftTime = math.floor(_left_time)
|
||||||
if leftTime < 10 then
|
if leftTime < 10 then
|
||||||
self._tex_leftTime.text = '0' .. tostring(leftTime)
|
self._tex_leftTime.text = '0' .. tostring(leftTime)
|
||||||
for i=2,4 do
|
for i = 2, 4 do
|
||||||
local text = self["_tex_leftTime"..i]
|
local text = self["_tex_leftTime" .. i]
|
||||||
if text then
|
if text then
|
||||||
text.text = '0' .. tostring(leftTime)
|
text.text = '0' .. tostring(leftTime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self._tex_leftTime.text = tostring(leftTime)
|
self._tex_leftTime.text = tostring(leftTime)
|
||||||
for i=2,4 do
|
for i = 2, 4 do
|
||||||
local text = self["_tex_leftTime"..i]
|
local text = self["_tex_leftTime" .. i]
|
||||||
if text then
|
if text then
|
||||||
text.text = tostring(leftTime)
|
text.text = tostring(leftTime)
|
||||||
end
|
end
|
||||||
|
|
@ -1035,8 +1025,8 @@ function M:OnUpdate()
|
||||||
if self._tex_leftTime then
|
if self._tex_leftTime then
|
||||||
self._tex_leftTime.text = '00'
|
self._tex_leftTime.text = '00'
|
||||||
end
|
end
|
||||||
for i=2,4 do
|
for i = 2, 4 do
|
||||||
local text = self["_tex_leftTime"..i]
|
local text = self["_tex_leftTime" .. i]
|
||||||
if text then
|
if text then
|
||||||
text.text = '00'
|
text.text = '00'
|
||||||
end
|
end
|
||||||
|
|
@ -1060,16 +1050,18 @@ function M:OnUpdate()
|
||||||
-- self.dismissWin = nil
|
-- self.dismissWin = nil
|
||||||
-- else
|
-- else
|
||||||
self.dismissWin:OnUpdate(deltaTime)
|
self.dismissWin:OnUpdate(deltaTime)
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.OnMuShiUpdate then
|
if self.OnMuShiUpdate then
|
||||||
self:OnMuShiUpdate()
|
self:OnMuShiUpdate()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:onLeftTimeOver()
|
function M:onLeftTimeOver()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear()
|
function M:Clear()
|
||||||
-- self:__CloseTip()
|
-- self:__CloseTip()
|
||||||
for i = 1, #self._player_info do
|
for i = 1, #self._player_info do
|
||||||
|
|
@ -1077,14 +1069,12 @@ function M:Clear()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:DestroyPlayerInfo()
|
function M:DestroyPlayerInfo()
|
||||||
for i = 1, #self._player_info do
|
for i = 1, #self._player_info do
|
||||||
self._player_info[i]:Destroy()
|
self._player_info[i]:Destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:GetPos(seat)
|
function M:GetPos(seat)
|
||||||
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num)
|
||||||
end
|
end
|
||||||
|
|
@ -1104,7 +1094,7 @@ end
|
||||||
|
|
||||||
--游戏激活
|
--游戏激活
|
||||||
function M:OnApplicationActive()
|
function M:OnApplicationActive()
|
||||||
--print("游戏激活================")
|
--print("游戏激活================")
|
||||||
if os.time() - last_pause_time > 15 then
|
if os.time() - last_pause_time > 15 then
|
||||||
last_pause_time = os.time()
|
last_pause_time = os.time()
|
||||||
ControllerManager.WebClient:clearActionQueue()
|
ControllerManager.WebClient:clearActionQueue()
|
||||||
|
|
@ -1124,16 +1114,17 @@ function M:Show()
|
||||||
self.distance_view = PlayerDistanceView.new(true, self._gps_style, function(v)
|
self.distance_view = PlayerDistanceView.new(true, self._gps_style, function(v)
|
||||||
self:continue_game(v)
|
self:continue_game(v)
|
||||||
end)
|
end)
|
||||||
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and self._state.selectedIndex < 3 and 1 or 0
|
self.distance_view._view:GetController("state").selectedIndex = self._state.selectedIndex > 0 and
|
||||||
|
self._state.selectedIndex < 3 and 1 or 0
|
||||||
self.distance_view:Show()
|
self.distance_view:Show()
|
||||||
self.btn_distance:GetController("state").selectedIndex = 1
|
self.btn_distance:GetController("state").selectedIndex = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Destroy()
|
function M:Destroy()
|
||||||
TimerManager.Clear()
|
TimerManager.Clear()
|
||||||
self:UnmarkSelfTuoguan()
|
self:UnmarkSelfTuoguan()
|
||||||
self:DestroyPlayerInfo()
|
self:DestroyPlayerInfo()
|
||||||
DSTweenManager.ClearTween()
|
DSTweenManager.ClearTween()
|
||||||
|
|
||||||
NetResetConnectWindow.CloseNetReset()
|
NetResetConnectWindow.CloseNetReset()
|
||||||
|
|
@ -1148,5 +1139,4 @@ function M:Destroy()
|
||||||
BaseView.Destroy(self)
|
BaseView.Destroy(self)
|
||||||
BaseWindow.DestroyAll()
|
BaseWindow.DestroyAll()
|
||||||
ResourcesManager.UnLoadGroup('base_chat')
|
ResourcesManager.UnLoadGroup('base_chat')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,317 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
local PlayerInfoView = {
|
||||||
|
_view = nil,
|
||||||
|
_main_view = nil,
|
||||||
|
_tex_player_name = nil,
|
||||||
|
_tex_player_id = nil,
|
||||||
|
_tex_score = nil,
|
||||||
|
_ctr_offline = nil,
|
||||||
|
_ctr_bank = nil,
|
||||||
|
_ctr_room_owner = nil,
|
||||||
|
_ctr_mask_voice = nil,
|
||||||
|
_btn_head = nil,
|
||||||
|
_biaoqing = nil,
|
||||||
|
_chat = nil,
|
||||||
|
_player = nil,
|
||||||
|
__runwait_voice = nil,
|
||||||
|
_isHideIpAdds = false
|
||||||
|
}
|
||||||
|
|
||||||
|
local M = PlayerInfoView
|
||||||
|
|
||||||
|
function M.new(view, main_view, isHideIpAdds)
|
||||||
|
local self = {}
|
||||||
|
setmetatable(self, { __index = PlayerInfoView })
|
||||||
|
self._view = view
|
||||||
|
self._main_view = main_view
|
||||||
|
self._isHideIpAdds = isHideIpAdds
|
||||||
|
self.isShowTGTimer = false
|
||||||
|
self.currentTime = 0
|
||||||
|
self.totalTime = 0
|
||||||
|
--self.isShow = fasle
|
||||||
|
self:init()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init()
|
||||||
|
local view = self._view
|
||||||
|
UIPackage.AddPackage('base/chat/ui/Chat')
|
||||||
|
self._tex_player_name = view:GetChild('name')
|
||||||
|
|
||||||
|
|
||||||
|
self._biaoqing = view:GetChild('face')
|
||||||
|
self._chat = view:GetChild('chat')
|
||||||
|
|
||||||
|
self._ctr_read = view:GetController('read')
|
||||||
|
self._ctr_offline = view:GetController('offline')
|
||||||
|
|
||||||
|
self._btn_head = view:GetChild('btn_head')
|
||||||
|
self._ctr_bank = view:GetController('bank')
|
||||||
|
self._ctr_room_owner = view:GetController('room_owner')
|
||||||
|
self._ctr_mask_voice = view:GetController('mask_voice')
|
||||||
|
self._ctr_dismiss_room = view:GetController('dismiss_room')
|
||||||
|
|
||||||
|
self.PlayerTGTips = view:GetChild('tuoguanTips')
|
||||||
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
|
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:IsShowTGTips(isShow, time)
|
||||||
|
--printlog("isShowisShowisShow==== ",isShow," time ",time)
|
||||||
|
if time == nil then time = 0 end
|
||||||
|
|
||||||
|
self.isShowTGTimer = isShow
|
||||||
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
|
self.PlayerTGTips.displayObject.gameObject:SetActive(isShow)
|
||||||
|
end
|
||||||
|
self.currentTime = 0
|
||||||
|
if isShow then
|
||||||
|
if self.PlayerTGTips then
|
||||||
|
self.PlayerTGTips.text = "开启托管剩余时间" .. time .. "s"
|
||||||
|
end
|
||||||
|
self.totalTime = time
|
||||||
|
TimerManager.AddTimer(self.OnUpdate, self)
|
||||||
|
else
|
||||||
|
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:OnUpdate()
|
||||||
|
--printlog("OnUpdate=====================")
|
||||||
|
if self.isShowTGTimer then
|
||||||
|
self.currentTime = self.currentTime + Time.deltaTime
|
||||||
|
if self.currentTime >= 1 then
|
||||||
|
self.currentTime = 0
|
||||||
|
self.totalTime = self.totalTime - 1
|
||||||
|
--printlog("当前计时器===>>>",self.totalTime)
|
||||||
|
if self.PlayerTGTips then
|
||||||
|
self.PlayerTGTips.text = "开启托管剩余时间" .. self.totalTime .. "s"
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.totalTime <= 0 then
|
||||||
|
self.isShowTGTimer = false
|
||||||
|
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||||
|
self.PlayerTGTips.displayObject.gameObject:SetActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.muShiPlayerUpdate then
|
||||||
|
self:muShiPlayerUpdate()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillData(player)
|
||||||
|
self._player = player
|
||||||
|
if player == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local isHidden = false
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
if room and room.playback ~= true and room.room_config and room.room_config.isHidden then
|
||||||
|
isHidden = room.room_config.isHidden == 1
|
||||||
|
end
|
||||||
|
if isHidden == false then
|
||||||
|
ImageLoad.Load(player.self_user.head_url, self._btn_head._iconObject)
|
||||||
|
self._btn_head.onClick:Set(
|
||||||
|
function()
|
||||||
|
--local headView = HeadView.new(self._main_view._root_view, player.self_user, self._isHideIpAdds)
|
||||||
|
--headView:Show()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
else
|
||||||
|
local ctr = self._btn_head:GetController("hidden")
|
||||||
|
if ctr then
|
||||||
|
ctr.selectedIndex = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print("============================playinfoview")
|
||||||
|
pt(player)
|
||||||
|
|
||||||
|
if isHidden
|
||||||
|
--and player.self_user.account_id ~= room.self_player.self_user.account_id
|
||||||
|
then
|
||||||
|
if player.orgSeat and player.orgSeat > 0 then
|
||||||
|
self._tex_player_name.text = "玩家" .. player.orgSeat
|
||||||
|
else
|
||||||
|
self._tex_player_name.text = "玩家" .. player.seat
|
||||||
|
player.orgSeat = membe_clone(player.seat)
|
||||||
|
end
|
||||||
|
if self._tex_player_id then
|
||||||
|
self._tex_player_id.text = ""
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self._tex_player_name.text = player.self_user.nick_name
|
||||||
|
if self._tex_player_id then
|
||||||
|
self._tex_player_id.text = "ID:" .. player.self_user.account_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self._ctr_room_owner.selectedIndex = room.owner_id == player.self_user.account_id and 1 or 0
|
||||||
|
if (DataManager.CurrenRoom.self_player ~= player) then
|
||||||
|
self._ctr_offline.selectedIndex = player.line_state == 0 and 1 or 0
|
||||||
|
end
|
||||||
|
-- self:UpdateScore()
|
||||||
|
self:Ready(player.ready)
|
||||||
|
|
||||||
|
if player.entrust and player ~= room.self_player then
|
||||||
|
self:MarkTuoguan()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:DismissRoom(state)
|
||||||
|
state = state or false
|
||||||
|
self._ctr_dismiss_room.selectedIndex = state == true and 1 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateLineState(state)
|
||||||
|
self._ctr_offline.selectedIndex = state == 0 and 1 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Ready(isread)
|
||||||
|
self._ctr_read.selectedIndex = isread and 1 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:MarkBank(isbank)
|
||||||
|
self._ctr_bank.selectedIndex = isbank and 1 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 表情 语音
|
||||||
|
function M:ShowInteraction(type, str)
|
||||||
|
if type == 3 then
|
||||||
|
Voice.DownLoad(
|
||||||
|
str,
|
||||||
|
function(clip)
|
||||||
|
if (clip) then
|
||||||
|
self:ShowMaskVoice(clip.length)
|
||||||
|
GameApplication.Instance:PlayVoice(clip)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
elseif type == 4 then
|
||||||
|
self:SetChat(str)
|
||||||
|
elseif type == 2 then
|
||||||
|
local chat_index = tonumber(str)
|
||||||
|
self._main_view:PlayChatSound(self._player.self_user.sex, chat_index)
|
||||||
|
local language, index = self._main_view:GetChatMsgLanguage(chat_index)
|
||||||
|
if language ~= 0 then
|
||||||
|
local msgs = self._main_view['Fix_Msg_Chat' .. language + 1]
|
||||||
|
self:SetChat(msgs[index])
|
||||||
|
else
|
||||||
|
self:SetChat(self._main_view.Fix_Msg_Chat[chat_index])
|
||||||
|
end
|
||||||
|
elseif type == 1 then
|
||||||
|
self:SetBiaoqing('ui://Chat/' .. str)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:SetBiaoqing(url)
|
||||||
|
if (self.__runwait_biaoqing ~= nil) then
|
||||||
|
if self._biaoqing.numChildren > 0 then
|
||||||
|
self._biaoqing:RemoveChildAt(0, true)
|
||||||
|
end
|
||||||
|
coroutine.stop(self.__runwait_biaoqing)
|
||||||
|
end
|
||||||
|
self._biaoqing.alpha = 1
|
||||||
|
local bq = UIPackage.CreateObjectFromURL(url)
|
||||||
|
self._biaoqing:AddChild(bq)
|
||||||
|
bq:Center()
|
||||||
|
-- self._biaoqing:GetChild("n1").icon = url
|
||||||
|
self.__runwait_biaoqing = nil
|
||||||
|
self.__runwait_biaoqing = coroutine.start(self.__WaitBiaoqing, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__WaitBiaoqing()
|
||||||
|
coroutine.wait(2)
|
||||||
|
self._biaoqing.alpha = 0
|
||||||
|
-- self._biaoqing:GetChild("n1").icon = nil
|
||||||
|
self._biaoqing:GetChildAt(0):Dispose()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:SetChat(msg)
|
||||||
|
-- body
|
||||||
|
self._chat.alpha = 1
|
||||||
|
self._chat:GetChild('title').text = msg
|
||||||
|
if (self.__runwait_chat ~= nil) then
|
||||||
|
coroutine.stop(self.__runwait_chat)
|
||||||
|
end
|
||||||
|
self.__runwait_chat = nil
|
||||||
|
self.__runwait_chat = coroutine.start(self.__WaitChat, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__WaitChat()
|
||||||
|
coroutine.wait(2)
|
||||||
|
self._chat.alpha = 0
|
||||||
|
self._chat:GetChild('title').text = ''
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ShowMaskVoice(time, mask)
|
||||||
|
mask = mask or true
|
||||||
|
|
||||||
|
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic + 1
|
||||||
|
if (mask) then
|
||||||
|
self._ctr_mask_voice.selectedIndex = 1
|
||||||
|
end
|
||||||
|
if (self.__runwait_voice ~= nil) then
|
||||||
|
coroutine.stop(self.__runwait_voice)
|
||||||
|
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic - 1
|
||||||
|
end
|
||||||
|
self.__runwait_voice = nil
|
||||||
|
self.__runwait_voice = coroutine.start(self.__WaitMaskVoice, self, time)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__WaitMaskVoice(time)
|
||||||
|
coroutine.wait(time)
|
||||||
|
self._ctr_mask_voice.selectedIndex = 0
|
||||||
|
self.__runwait_voice = nil
|
||||||
|
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GetHeadCenter()
|
||||||
|
local btn_head = self._view:GetChild('btn_head')
|
||||||
|
local pt = Vector2(btn_head.x + 1 / 2 * btn_head.width, btn_head.y + 1 / 2 * btn_head.height)
|
||||||
|
return pt
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 添加、移除托管标记
|
||||||
|
function M:MarkTuoguan()
|
||||||
|
local com_tuoguan = UIPackage.CreateObjectFromURL('ui://Common/com_tuoguan')
|
||||||
|
self:AddMarkToHead(com_tuoguan, 'mark_tuoguan')
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UnmarkTuoguan()
|
||||||
|
self:RemoveMarkFromHead('mark_tuoguan')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 动态的往头像上加载组件
|
||||||
|
function M:AddMarkToHead(com, key)
|
||||||
|
if key then
|
||||||
|
if self[key] then
|
||||||
|
self[key]:Dispose()
|
||||||
|
end
|
||||||
|
self[key] = com
|
||||||
|
end
|
||||||
|
self._view:AddChild(com)
|
||||||
|
com.touchable = false
|
||||||
|
com.xy = self:GetHeadCenter()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 动态移除组件
|
||||||
|
function M:RemoveMarkFromHead(key)
|
||||||
|
if self[key] then
|
||||||
|
self[key]:Dispose()
|
||||||
|
self[key] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Destroy()
|
||||||
|
self.isShowTGTimer = false
|
||||||
|
TimerManager.RemoveTimer(self.OnUpdate, self)
|
||||||
|
self.OnUpdate = nil
|
||||||
|
self.muShiPlayerUpdate = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
local PlayerInfoView = require("Game.View.PlayerInfoView copy")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.new(view, mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(M, {__index = PlayerInfoView})
|
setmetatable(M, { __index = PlayerInfoView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self._view = view
|
self._view = view
|
||||||
self._main_view = mainView
|
self._main_view = mainView
|
||||||
self:init()
|
self:init()
|
||||||
|
|
@ -13,15 +13,12 @@ end
|
||||||
|
|
||||||
function M:init()
|
function M:init()
|
||||||
PlayerInfoView.init(self)
|
PlayerInfoView.init(self)
|
||||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
|
||||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
|
||||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowInteraction(type,str)
|
function M:ShowInteraction(type, str)
|
||||||
if type == 3 then
|
if type == 3 then
|
||||||
Voice.DownLoad(str, function(clip)
|
Voice.DownLoad(str, function(clip)
|
||||||
if (clip ) then
|
if (clip) then
|
||||||
self:ShowMaskVoice(clip.length)
|
self:ShowMaskVoice(clip.length)
|
||||||
GameApplication.Instance:PlayVoice(clip)
|
GameApplication.Instance:PlayVoice(clip)
|
||||||
end
|
end
|
||||||
|
|
@ -30,47 +27,25 @@ function M:ShowInteraction(type,str)
|
||||||
self:SetChat(str)
|
self:SetChat(str)
|
||||||
elseif type == 2 then
|
elseif type == 2 then
|
||||||
local chat_index = tonumber(str)
|
local chat_index = tonumber(str)
|
||||||
self._main_view:PlayChatSound(self._player.self_user.sex,chat_index)
|
self._main_view:PlayChatSound(self._player.self_user.sex, chat_index)
|
||||||
local language, index = self._main_view:GetChatMsgLanguage(chat_index)
|
local language, index = self._main_view:GetChatMsgLanguage(chat_index)
|
||||||
self:SetChat(self._main_view.Fix_Msg_Chat[index])
|
self:SetChat(self._main_view.Fix_Msg_Chat[index])
|
||||||
elseif type == 1 then
|
elseif type == 1 then
|
||||||
self:SetBiaoqing("ui://Chat/"..str)
|
self:SetBiaoqing("ui://Chat/" .. str)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateRemainCard(card_num, hide)
|
function M:UpdateRemainCard(card_num, hide)
|
||||||
if hide then
|
if hide then
|
||||||
self._view:GetController("show_remain").selectedIndex = 0
|
self._view:GetController("show_remain").selectedIndex = 0
|
||||||
else
|
else
|
||||||
self._view:GetController("show_remain").selectedIndex = 1
|
self._view:GetController("show_remain").selectedIndex = 1
|
||||||
end
|
end
|
||||||
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
|
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillData(player)
|
function M:FillData(player)
|
||||||
PlayerInfoView.FillData(self, player)
|
PlayerInfoView.FillData(self, player)
|
||||||
self:UpdateScore(player.total_score)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M:UpdateScore()
|
|
||||||
local score = self._player.total_score
|
|
||||||
local room = DataManager.CurrenRoom
|
|
||||||
if room:checkHpNonnegative() then
|
|
||||||
score = d2ad(self._player.cur_hp)
|
|
||||||
end
|
|
||||||
if not score then
|
|
||||||
score = 0
|
|
||||||
end
|
|
||||||
if score < 0 then
|
|
||||||
self._ct_score.selectedIndex = 1
|
|
||||||
self._tex_score2.text = score
|
|
||||||
else
|
|
||||||
self._ct_score.selectedIndex = 0
|
|
||||||
if not room:checkHpNonnegative() then
|
|
||||||
score = "+" .. score
|
|
||||||
end
|
|
||||||
self._tex_score.text = score
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@ local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(M, {__index = MJPlayerCardInfoView})
|
setmetatable(M, { __index = MJPlayerCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerCardInfoView"
|
self.class = "PlayerCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
self:init()
|
self:init()
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local function CardPos(obj, area, oder, loc, offset)
|
local function CardPos(obj, area, oder, loc, offset)
|
||||||
|
|
@ -32,85 +32,86 @@ local function CardPos(obj, area, oder, loc, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard, mp, opcard)
|
function M:UpdateHandCard(getcard, mp, opcard)
|
||||||
-- mp 是否明牌
|
-- mp 是否明牌
|
||||||
-- 如果不明牌,但是有 opcard 表示是起手胡
|
-- 如果不明牌,但是有 opcard 表示是起手胡
|
||||||
getcard = getcard or false
|
getcard = getcard or false
|
||||||
mp = mp or false
|
mp = mp or false
|
||||||
local handcard_list = self._mask_data["handcard_list"]
|
local handcard_list = self._mask_data["handcard_list"]
|
||||||
local oder = handcard_list["oder"]
|
local oder = handcard_list["oder"]
|
||||||
local _player = self._player
|
local _player = self._player
|
||||||
|
local comp_back = handcard_list["comp_back"]
|
||||||
|
local comp = handcard_list["comp"]
|
||||||
|
local outcard_list = self._mask_data["outcard_list"]
|
||||||
|
local card = outcard_list["card"]
|
||||||
|
|
||||||
|
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||||
|
local opnum = opcard and #opcard or -1
|
||||||
|
if not mp and opnum > -1 then
|
||||||
|
-- 起手胡板牌记录,手牌变化两次后,板牌收回
|
||||||
|
self.__show_qs_hu_times = 1
|
||||||
|
self.__qs_hu_cards = opcard
|
||||||
|
elseif self.__qs_hu_cards and opnum == -1 and self.__show_qs_hu_times > 0 then
|
||||||
|
self.__show_qs_hu_times = self.__show_qs_hu_times - 1
|
||||||
|
opcard = self.__qs_hu_cards
|
||||||
|
opnum = #opcard
|
||||||
|
end
|
||||||
|
local loc = 0
|
||||||
|
print("===============================UpdateHandCard", getcard, mp, opcard, comp)
|
||||||
|
if not mp then
|
||||||
local comp_back = handcard_list["comp_back"]
|
local comp_back = handcard_list["comp_back"]
|
||||||
local comp = handcard_list["comp"]
|
if self._current_card_type == 2 then
|
||||||
|
comp_back = comp_back .. "_3d"
|
||||||
|
end
|
||||||
|
for i = 0, _player.hand_left_count - 1 do
|
||||||
|
local obj
|
||||||
|
local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0)
|
||||||
|
if i < opnum then
|
||||||
|
obj = UIPackage.CreateObject("Main_Majiang", comp)
|
||||||
|
self:fillCard(obj, card, opcard[i + 1])
|
||||||
|
else
|
||||||
|
obj = UIPackage.CreateObject("Main_Majiang", comp_back)
|
||||||
|
end
|
||||||
|
if opnum ~= -1 then
|
||||||
|
loc = CardPos(obj, self._area_handcard_list, oder, loc, offset)
|
||||||
|
else
|
||||||
|
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||||
|
end
|
||||||
|
--改变左右两边的手牌的x值
|
||||||
|
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||||
|
obj.x = i * -7.0
|
||||||
|
end
|
||||||
|
if (oder == AreaOderType.down_up) then
|
||||||
|
self._area_handcard_list:AddChildAt(obj, 0)
|
||||||
|
else
|
||||||
|
self._area_handcard_list:AddChild(obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
local outcard_list = self._mask_data["outcard_list"]
|
local outcard_list = self._mask_data["outcard_list"]
|
||||||
|
local comp = handcard_list["comp"]
|
||||||
local card = outcard_list["card"]
|
local card = outcard_list["card"]
|
||||||
|
--print("comp"..comp)
|
||||||
|
-- print(vardump(_player.card_list))
|
||||||
|
|
||||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
if self._current_card_type == 2 then
|
||||||
local opnum = opcard and #opcard or -1
|
comp = comp .. "_3d"
|
||||||
if not mp and opnum > -1 then
|
|
||||||
-- 起手胡板牌记录,手牌变化两次后,板牌收回
|
|
||||||
self.__show_qs_hu_times = 1
|
|
||||||
self.__qs_hu_cards = opcard
|
|
||||||
elseif self.__qs_hu_cards and opnum == -1 and self.__show_qs_hu_times > 0 then
|
|
||||||
self.__show_qs_hu_times = self.__show_qs_hu_times - 1
|
|
||||||
opcard = self.__qs_hu_cards
|
|
||||||
opnum = #opcard
|
|
||||||
end
|
end
|
||||||
local loc = 0
|
for i = 0, #_player.card_list - 1 do
|
||||||
if not mp then
|
local obj = UIPackage.CreateObject("Main_Majiang", comp)
|
||||||
local comp_back = handcard_list["comp_back"]
|
self:fillCard(obj, card, _player.card_list[i + 1])
|
||||||
if self._current_card_type == 2 then
|
local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0)
|
||||||
comp_back = comp_back.."_3d"
|
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||||
end
|
--改变左右两边的手牌的x值
|
||||||
for i = 0, _player.hand_left_count -1 do
|
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||||
local obj
|
obj.x = i * -7
|
||||||
local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0)
|
end
|
||||||
if i < opnum then
|
if (oder == AreaOderType.down_up) then
|
||||||
obj = UIPackage.CreateObject("Main_Majiang", comp)
|
self._area_handcard_list:AddChildAt(obj, 0)
|
||||||
self:fillCard(obj, card, opcard[i + 1])
|
else
|
||||||
else
|
self._area_handcard_list:AddChild(obj)
|
||||||
obj = UIPackage.CreateObject("Main_Majiang", comp_back)
|
end
|
||||||
end
|
|
||||||
if opnum ~= -1 then
|
|
||||||
loc = CardPos(obj, self._area_handcard_list, oder, loc, offset)
|
|
||||||
else
|
|
||||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
|
||||||
end
|
|
||||||
--改变左右两边的手牌的x值
|
|
||||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
|
||||||
obj.x = i * -7.0
|
|
||||||
end
|
|
||||||
if (oder == AreaOderType.down_up) then
|
|
||||||
self._area_handcard_list:AddChildAt(obj, 0)
|
|
||||||
else
|
|
||||||
self._area_handcard_list:AddChild(obj)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local outcard_list = self._mask_data["outcard_list"]
|
|
||||||
local comp = handcard_list["comp"]
|
|
||||||
local card = outcard_list["card"]
|
|
||||||
--print("comp"..comp)
|
|
||||||
-- print(vardump(_player.card_list))
|
|
||||||
|
|
||||||
if self._current_card_type == 2 then
|
|
||||||
comp = comp.."_3d"
|
|
||||||
end
|
|
||||||
for i = 0, #_player.card_list -1 do
|
|
||||||
local obj = UIPackage.CreateObject("Main_Majiang", comp)
|
|
||||||
self:fillCard(obj,card,_player.card_list[i+1])
|
|
||||||
local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0)
|
|
||||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
|
||||||
--改变左右两边的手牌的x值
|
|
||||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
|
||||||
obj.x = i * -7
|
|
||||||
end
|
|
||||||
if (oder == AreaOderType.down_up) then
|
|
||||||
self._area_handcard_list:AddChildAt(obj, 0)
|
|
||||||
else
|
|
||||||
self._area_handcard_list:AddChild(obj)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -109,6 +109,7 @@ function M:FillRoomData(s2croom)
|
||||||
p.fz_list[#p.fz_list + 1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
|
print("=======================在此进入")
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local EXGameInfo = import(".EXGameInfo")
|
||||||
local EXMainView = import(".EXMainView")
|
local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView =import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -13,14 +13,14 @@ local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
function ExtendConfig.new()
|
function ExtendConfig.new()
|
||||||
setmetatable(M, {__index = IExtendConfig})
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "ExtendConfig"
|
self.class = "ExtendConfig"
|
||||||
self.extend_id = 33
|
self.extend_id = 33
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--卸载资源
|
--卸载资源
|
||||||
|
|
@ -45,30 +45,30 @@ end
|
||||||
|
|
||||||
local _ctr_game = nil
|
local _ctr_game = nil
|
||||||
function M:GetGameController()
|
function M:GetGameController()
|
||||||
if _ctr_game == nil then
|
if _ctr_game == nil then
|
||||||
_ctr_game = EXGameController.new()
|
_ctr_game = EXGameController.new()
|
||||||
end
|
end
|
||||||
return _ctr_game
|
return _ctr_game
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewRoom()
|
function M:NewRoom()
|
||||||
return MJRoom.new()
|
return MJRoom.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomConfig(room,_config)
|
function M:FillRoomConfig(room, _config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillRoomData(s2croom)
|
function M:FillRoomData(s2croom)
|
||||||
local room = DataManager.CurrenRoom
|
local room = DataManager.CurrenRoom
|
||||||
|
|
||||||
|
|
||||||
local reload = s2croom["reload"]
|
local reload = s2croom["reload"]
|
||||||
local _tableInfo = s2croom["tableInfo"]
|
local _tableInfo = s2croom["tableInfo"]
|
||||||
|
|
||||||
local _config = _tableInfo["config"]
|
local _config = _tableInfo["config"]
|
||||||
|
|
||||||
pt(_config)
|
pt(_config)
|
||||||
room.room_config = EXRoomConfig.new(_config)
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
|
|
||||||
local playerList = _tableInfo["playerData"]
|
local playerList = _tableInfo["playerData"]
|
||||||
|
|
@ -91,24 +91,25 @@ function M:FillRoomData(s2croom)
|
||||||
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"]
|
||||||
room.last_outcard_seat = last_outcard_seat
|
room.last_outcard_seat = last_outcard_seat
|
||||||
room.playing = playing
|
room.playing = playing
|
||||||
for i=1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local tem = _info_list[i]
|
local tem = _info_list[i]
|
||||||
local playerid = tem["playerid"]
|
local playerid = tem["playerid"]
|
||||||
local p = room:GetPlayerById(playerid)
|
local p = room:GetPlayerById(playerid)
|
||||||
local outcard_list = tem["outcard_list"]
|
local outcard_list = tem["outcard_list"]
|
||||||
p.outcard_list = outcard_list
|
p.outcard_list = outcard_list
|
||||||
p.total_score = tem["score"]
|
p.total_score = tem["score"]
|
||||||
p.hand_left_count = tem["card_count"]
|
p.hand_left_count = tem["card_count"]
|
||||||
p.piao_niao = tem["piao_niao"] or 0
|
p.piao_niao = tem["piao_niao"] or 0
|
||||||
local opcard = tem["opcard"]
|
local opcard = tem["opcard"]
|
||||||
for k=1,#opcard do
|
for k = 1, #opcard do
|
||||||
local op = opcard[k]
|
local op = opcard[k]
|
||||||
local fz = {}
|
local fz = {}
|
||||||
fz.type = op["type"]
|
fz.type = op["type"]
|
||||||
fz.card = op["card"]
|
fz.card = op["card"]
|
||||||
p.fz_list[#p.fz_list+1] = fz
|
p.fz_list[#p.fz_list + 1] = fz
|
||||||
end
|
end
|
||||||
if not playing and room.curren_round > 0 then
|
if not playing and room.curren_round > 0 then
|
||||||
|
print("=======================================自动开始")
|
||||||
self.GetGameController():PlayerReady()
|
self.GetGameController():PlayerReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -131,7 +132,7 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.curren_round = _tableInfo["round"]
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
local _info_list = _tableInfo["playerData"]
|
local _info_list = _tableInfo["playerData"]
|
||||||
for i = 1,#_info_list do
|
for i = 1, #_info_list do
|
||||||
local _jp = _info_list[i]
|
local _jp = _info_list[i]
|
||||||
local p = room:NewPlayer()
|
local p = room:NewPlayer()
|
||||||
p.seat = _jp["seat"]
|
p.seat = _jp["seat"]
|
||||||
|
|
@ -146,12 +147,12 @@ function M:FillPlayBackData(pd_data)
|
||||||
-- p.self_user = DataManager.SelfUser
|
-- p.self_user = DataManager.SelfUser
|
||||||
-- else
|
-- else
|
||||||
if p.seat == 1 then room.self_player = p end
|
if p.seat == 1 then room.self_player = p end
|
||||||
local u = User.new()
|
local u = User.new()
|
||||||
u.account_id = pid
|
u.account_id = pid
|
||||||
p.self_user = u
|
p.self_user = u
|
||||||
u.nick_name = _jp["nick"]
|
u.nick_name = _jp["nick"]
|
||||||
u.head_url = _jp["portrait"]
|
u.head_url = _jp["portrait"]
|
||||||
u.sex = _jp["sex"]
|
u.sex = _jp["sex"]
|
||||||
-- end
|
-- end
|
||||||
p.self_user.host_ip = p.self_user.host_ip
|
p.self_user.host_ip = p.self_user.host_ip
|
||||||
local _hand_card = _jp["hand_card"]
|
local _hand_card = _jp["hand_card"]
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ local TableBG = require("Game.Data.TableBG")
|
||||||
local MJSettingView = import(".MJSettingViewNew")
|
local MJSettingView = import(".MJSettingViewNew")
|
||||||
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
local MJMainRightPanelView = import(".MJMainRightPanelView")
|
||||||
|
|
||||||
local bg_config = {
|
local bg_config = {
|
||||||
{id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01"},
|
{ id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" },
|
||||||
{id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02"},
|
{ id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" },
|
||||||
{id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03"}
|
{ id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" }
|
||||||
}
|
}
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
setmetatable(M,{__index = MainView})
|
setmetatable(M, { __index = MainView })
|
||||||
|
|
||||||
local default_bg = 1
|
local default_bg = 1
|
||||||
function M:InitView(url, use_custom_bg)
|
function M:InitView(url, use_custom_bg)
|
||||||
|
|
@ -28,8 +28,7 @@ function M:InitView(url, use_custom_bg)
|
||||||
self._room.card_type = DataManager.CardTypeList[tostring(self._room.game_id)] or 1
|
self._room.card_type = DataManager.CardTypeList[tostring(self._room.game_id)] or 1
|
||||||
|
|
||||||
UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang")
|
UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang")
|
||||||
|
MainView.InitView(self, url)
|
||||||
MainView.InitView(self,url)
|
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
|
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
|
||||||
if not use_custom_bg then
|
if not use_custom_bg then
|
||||||
|
|
@ -40,7 +39,7 @@ function M:InitView(url, use_custom_bg)
|
||||||
|
|
||||||
local _cardbox = _view:GetChild("cardbox")
|
local _cardbox = _view:GetChild("cardbox")
|
||||||
|
|
||||||
self._zhuanpanCtr=_cardbox:GetController("zuozi")
|
self._zhuanpanCtr = _cardbox:GetController("zuozi")
|
||||||
self._ctr_cardbox = _cardbox:GetController("c1")
|
self._ctr_cardbox = _cardbox:GetController("c1")
|
||||||
self._tex_leftTime = _cardbox:GetChild("tex_leftnum")
|
self._tex_leftTime = _cardbox:GetChild("tex_leftnum")
|
||||||
|
|
||||||
|
|
@ -52,27 +51,26 @@ function M:InitView(url, use_custom_bg)
|
||||||
end
|
end
|
||||||
|
|
||||||
local rightpanel = self._view:GetChild("com_roominfo")
|
local rightpanel = self._view:GetChild("com_roominfo")
|
||||||
if self._rightPanelView ~= nil then
|
if self._rightPanelView ~= nil then
|
||||||
self._rightPanelView:Destroy()
|
self._rightPanelView:Destroy()
|
||||||
end
|
end
|
||||||
self._rightPanelView = MJMainRightPanelView.new(self, rightpanel)
|
self._rightPanelView = MJMainRightPanelView.new(self, rightpanel)
|
||||||
|
|
||||||
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
--local tempdsaf=self._view:GetChild("btn_back_jiesan")
|
||||||
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
--tempdsaf:GetChild("n3").displayObject.gameObject:SetActive(false)
|
||||||
|
|
||||||
--print("2222222222222222222222")
|
--print("2222222222222222222222")
|
||||||
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
--print(self._view:GetChild("btn_back_jiesan").displayObject.gameObject.name)
|
||||||
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
--self._view:GetChild("btn_back_jiesan").displayObject.gameObject:SetActive(false)
|
||||||
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
--local temp111=self._view:GetChild("btn_back_jiesan").displayObject.gameObject
|
||||||
--temp111:SetActive(false)
|
--temp111:SetActive(false)
|
||||||
self._view:GetChild("btn_back_jiesan").onClick:Set(function ()
|
self._view:GetChild("btn_back_jiesan").onClick:Set(function()
|
||||||
if self.dismiss_room_cd_time > 0 then
|
if self.dismiss_room_cd_time > 0 then
|
||||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||||
else
|
else
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:AskDismissRoom()
|
_gamectr:AskDismissRoom()
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -83,11 +81,11 @@ function M:InitView(url, use_custom_bg)
|
||||||
local _player_card_info = self._player_card_info
|
local _player_card_info = self._player_card_info
|
||||||
for i = 1, _room.room_config.people_num do
|
for i = 1, _room.room_config.people_num do
|
||||||
local tem = _view:GetChild("player_card_info" .. i)
|
local tem = _view:GetChild("player_card_info" .. i)
|
||||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem,i)
|
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
||||||
end
|
end
|
||||||
|
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
local info = _player_card_info[self:GetPos(p.seat)]
|
local info = _player_card_info[self:GetPos(p.seat)]
|
||||||
info:SetPlayer(p)
|
info:SetPlayer(p)
|
||||||
|
|
@ -96,143 +94,130 @@ function M:InitView(url, use_custom_bg)
|
||||||
|
|
||||||
local list = _room.player_list
|
local list = _room.player_list
|
||||||
local readyNum = 0
|
local readyNum = 0
|
||||||
for i=1,#list do
|
for i = 1, #list do
|
||||||
local p = list[i]
|
local p = list[i]
|
||||||
if p.ready then readyNum = readyNum + 1 end
|
if p.ready then readyNum = readyNum + 1 end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#_room.player_list do
|
for i = 1, #_room.player_list do
|
||||||
|
|
||||||
local p = _room.player_list[i]
|
local p = _room.player_list[i]
|
||||||
local zi,icon = self:GetPosString(p.seat)
|
local zi, icon = self:GetPosString(p.seat)
|
||||||
if self._room.card_type == 2 then
|
if self._room.card_type == 2 then
|
||||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||||
end
|
end
|
||||||
|
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
end
|
end
|
||||||
|
|
||||||
self._ctr_action = _view:GetController("action")
|
self._ctr_action = _view:GetController("action")
|
||||||
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
||||||
--self._ctr_action.selectedIndex = 2
|
--self._ctr_action.selectedIndex = 2
|
||||||
elseif not _room.self_player.ready then
|
elseif not _room.self_player.ready then
|
||||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||||
if xpconfig then
|
if xpconfig then
|
||||||
if round>1 then
|
if round > 1 then
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 2
|
self._ctr_action.selectedIndex = 2
|
||||||
end
|
end
|
||||||
|
else
|
||||||
else
|
self._ctr_action.selectedIndex = 1
|
||||||
self._ctr_action.selectedIndex = 1
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 0
|
self._ctr_action.selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self:InitXiPai()
|
self:InitXiPai()
|
||||||
self:InitXiPai1()
|
self:InitXiPai1()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:InitXiPai()
|
function M:InitXiPai()
|
||||||
self._xipaiPanel = UIPackage.CreateObjectFromURL("ui://Common/panel_handanim")
|
self._xipaiPanel = UIPackage.CreateObjectFromURL("ui://Common/panel_handanim")
|
||||||
self._xipaiPanel.visible=false
|
self._xipaiPanel.visible = false
|
||||||
self._root_view:AddChild(self._xipaiPanel)
|
self._root_view:AddChild(self._xipaiPanel)
|
||||||
|
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
|
|
||||||
self._xipaiPanel.width = GRoot.inst.width - (offset * 2)
|
self._xipaiPanel.width = GRoot.inst.width - (offset * 2)
|
||||||
self._xipaiPanel.height = GRoot.inst.height
|
self._xipaiPanel.height = GRoot.inst.height
|
||||||
self._xipaiPanel.x = offset
|
self._xipaiPanel.x = offset
|
||||||
|
|
||||||
self._handAnimCtr=self._xipaiPanel:GetController("anim")
|
self._handAnimCtr = self._xipaiPanel:GetController("anim")
|
||||||
self._handAnimCtr.selectedIndex=0
|
self._handAnimCtr.selectedIndex = 0
|
||||||
--self:PlayXiPai()
|
--self:PlayXiPai()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:InitXiPai1()
|
function M:InitXiPai1()
|
||||||
self._xipaiPanel1 = UIPackage.CreateObjectFromURL("ui://Common/panel_handanim02")
|
self._xipaiPanel1 = UIPackage.CreateObjectFromURL("ui://Common/panel_handanim02")
|
||||||
self._xipaiPanel1.visible=false
|
self._xipaiPanel1.visible = false
|
||||||
self._root_view:AddChild(self._xipaiPanel1)
|
self._root_view:AddChild(self._xipaiPanel1)
|
||||||
|
|
||||||
local offset = get_offset(self._full_offset)
|
local offset = get_offset(self._full_offset)
|
||||||
|
|
||||||
self._xipaiPanel1.width = GRoot.inst.width - (offset * 2)
|
self._xipaiPanel1.width = GRoot.inst.width - (offset * 2)
|
||||||
self._xipaiPanel1.height = GRoot.inst.height
|
self._xipaiPanel1.height = GRoot.inst.height
|
||||||
self._xipaiPanel1.x = offset
|
self._xipaiPanel1.x = offset
|
||||||
|
|
||||||
self._handAnimCtr1=self._xipaiPanel1:GetController("anim1")
|
self._handAnimCtr1 = self._xipaiPanel1:GetController("anim1")
|
||||||
self._handAnimCtr1.selectedIndex=0
|
self._handAnimCtr1.selectedIndex = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:PlayXiPai(xipaiCallBack)
|
function M:PlayXiPai(xipaiCallBack)
|
||||||
if self._xipaiPanel then
|
if self._xipaiPanel then
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
self._xipaiPanel.visible=true
|
self._xipaiPanel.visible = true
|
||||||
self._xipaiPanel:GetTransition("XiPai"):Play()
|
self._xipaiPanel:GetTransition("XiPai"):Play()
|
||||||
self._handAnimCtr.selectedIndex=1
|
self._handAnimCtr.selectedIndex = 1
|
||||||
coroutine.wait(3)
|
coroutine.wait(3)
|
||||||
self._handAnimCtr.selectedIndex=0
|
self._handAnimCtr.selectedIndex = 0
|
||||||
self._xipaiPanel.visible=false
|
self._xipaiPanel.visible = false
|
||||||
if xipaiCallBack then
|
if xipaiCallBack then
|
||||||
xipaiCallBack()
|
xipaiCallBack()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:PlayXiPai1(xipaiCallBack)
|
function M:PlayXiPai1(xipaiCallBack)
|
||||||
if self._xipaiPanel1 then
|
if self._xipaiPanel1 then
|
||||||
coroutine.start(function()
|
coroutine.start(function()
|
||||||
self._xipaiPanel1.visible=true
|
self._xipaiPanel1.visible = true
|
||||||
self._xipaiPanel1:GetTransition("XiPai"):Play()
|
self._xipaiPanel1:GetTransition("XiPai"):Play()
|
||||||
self._handAnimCtr1.selectedIndex=1
|
self._handAnimCtr1.selectedIndex = 1
|
||||||
coroutine.wait(3)
|
coroutine.wait(3)
|
||||||
self._handAnimCtr1.selectedIndex=0
|
self._handAnimCtr1.selectedIndex = 0
|
||||||
self._xipaiPanel1.visible=false
|
self._xipaiPanel1.visible = false
|
||||||
if xipaiCallBack then
|
if xipaiCallBack then
|
||||||
xipaiCallBack()
|
xipaiCallBack()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function M:EventInit()
|
function M:EventInit()
|
||||||
MainView.EventInit(self)
|
MainView.EventInit(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Change3d(flag)
|
function M:Change3d(flag)
|
||||||
|
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
|
|
||||||
local _cardbox = _view:GetChild("cardbox")
|
local _cardbox = _view:GetChild("cardbox")
|
||||||
|
|
||||||
for i=1,#_room.player_list do
|
for i = 1, #_room.player_list do
|
||||||
|
local p = _room.player_list[i]
|
||||||
|
local zi, icon = self:GetPosString(p.seat)
|
||||||
|
if self._room.card_type == 2 then
|
||||||
|
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||||
|
end
|
||||||
|
|
||||||
local p = _room.player_list[i]
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
local zi,icon = self:GetPosString(p.seat)
|
end
|
||||||
if self._room.card_type == 2 then
|
|
||||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
|
||||||
end
|
|
||||||
|
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
-- 如果要切换3d牌桌的cardbox位置及上方文字(剩余牌,回合数)显示不错乱,需要做以下改动
|
||||||
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
-- 取消文字组合的3d控制器的位置, 并设置对cardbox的关联,左左,顶顶
|
||||||
if flag == true then
|
if flag == true then
|
||||||
|
|
||||||
if _view:GetController("3d") ~= nil then
|
if _view:GetController("3d") ~= nil then
|
||||||
_view:GetController("3d").selectedIndex = 1
|
_view:GetController("3d").selectedIndex = 1
|
||||||
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
_cardbox.x = (_view.width - _cardbox.width) * 0.5
|
||||||
|
|
@ -285,9 +270,9 @@ function M:NewSettingView()
|
||||||
-- gear:Apply()
|
-- gear:Apply()
|
||||||
-- settingView.Change3d = function() end
|
-- settingView.Change3d = function() end
|
||||||
|
|
||||||
settingView:FillBgSection(function(url,index)
|
settingView:FillBgSection(function(url, index)
|
||||||
LoadGameBg(url, self._root_view)
|
LoadGameBg(url, self._root_view)
|
||||||
self._zhuanpanCtr.selectedIndex=index-1
|
self._zhuanpanCtr.selectedIndex = index - 1
|
||||||
end, self._room.game_id, 1, bg_config)
|
end, self._room.game_id, 1, bg_config)
|
||||||
|
|
||||||
settingView.onChangeCardCallback:Add(function()
|
settingView.onChangeCardCallback:Add(function()
|
||||||
|
|
@ -316,30 +301,29 @@ function M:GetIndex(seat)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetPosString(seat)
|
function M:GetPosString(seat)
|
||||||
|
|
||||||
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
if DataManager.CurrenRoom.room_config.people_num == 4 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "南","dir_2"
|
return "南", "dir_2"
|
||||||
elseif seat == 3 then
|
elseif seat == 3 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
elseif seat == 4 then
|
elseif seat == 4 then
|
||||||
return "北","dir_4"
|
return "北", "dir_4"
|
||||||
end
|
end
|
||||||
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
elseif DataManager.CurrenRoom.room_config.people_num == 3 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "南","dir_2"
|
return "南", "dir_2"
|
||||||
elseif seat == 3 then
|
elseif seat == 3 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
end
|
end
|
||||||
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||||
if seat == 1 then
|
if seat == 1 then
|
||||||
return "东","dir_1"
|
return "东", "dir_1"
|
||||||
elseif seat == 2 then
|
elseif seat == 2 then
|
||||||
return "西","dir_3"
|
return "西", "dir_3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -347,7 +331,7 @@ end
|
||||||
function M:SetCardBoxPosition()
|
function M:SetCardBoxPosition()
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
for i = 1, _room.room_config.people_num do
|
for i = 1, _room.room_config.people_num do
|
||||||
local tex = self._view:GetChild("cardbox"):GetChild("direction"..i)
|
local tex = self._view:GetChild("cardbox"):GetChild("direction" .. i)
|
||||||
local index = _room.self_player.seat + i - 1
|
local index = _room.self_player.seat + i - 1
|
||||||
index = index > 4 and index - 4 or index
|
index = index > 4 and index - 4 or index
|
||||||
tex.text = self._gamectr:GetPosString(index)
|
tex.text = self._gamectr:GetPosString(index)
|
||||||
|
|
@ -373,16 +357,16 @@ function M:markOutCards(showTip, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerEnter(...)
|
function M:OnPlayerEnter(...)
|
||||||
MainView.OnPlayerEnter(self,...)
|
MainView.OnPlayerEnter(self, ...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local info = self._player_card_info[self:GetPos(p.seat)]
|
local info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
info:SetPlayer(p)
|
info:SetPlayer(p)
|
||||||
info:FillData()
|
info:FillData()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerReady( ... )
|
function M:OnPlayerReady(...)
|
||||||
local arg = {...}
|
local arg = { ... }
|
||||||
local p = arg[1]
|
local p = arg[1]
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
local _view = self._view
|
local _view = self._view
|
||||||
|
|
@ -402,38 +386,36 @@ function M:OnPlayerReady( ... )
|
||||||
|
|
||||||
if readyNum == _room.room_config.people_num then
|
if readyNum == _room.room_config.people_num then
|
||||||
local _cardbox = _view:GetChild("cardbox")
|
local _cardbox = _view:GetChild("cardbox")
|
||||||
for i=1,#_room.player_list do
|
for i = 1, #_room.player_list do
|
||||||
|
|
||||||
local p = _room.player_list[i]
|
local p = _room.player_list[i]
|
||||||
local zi,icon = self:GetPosString(p.seat)
|
local zi, icon = self:GetPosString(p.seat)
|
||||||
_cardbox:GetChild("3d_direction"..self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/"..icon
|
_cardbox:GetChild("3d_direction" .. self:GetIndex(self:GetPos(p.seat))).icon = "ui://MajiangCard3d/" .. icon
|
||||||
_cardbox:GetChild("direction"..self:GetIndex(self:GetPos(p.seat))).text = zi
|
_cardbox:GetChild("direction" .. self:GetIndex(self:GetPos(p.seat))).text = zi
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
if _room.banker_seat == _room.self_player.seat and readyNum == _room.room_config.people_num then
|
||||||
if self._state.selectedIndex == 2 then
|
if self._state.selectedIndex == 2 then
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:StartGame()
|
_gamectr:StartGame()
|
||||||
end
|
end
|
||||||
|
|
||||||
--self._ctr_action.selectedIndex = 2
|
--self._ctr_action.selectedIndex = 2
|
||||||
elseif not _room.self_player.ready then
|
elseif not _room.self_player.ready then
|
||||||
--self._ctr_action.selectedIndex = 1
|
--self._ctr_action.selectedIndex = 1
|
||||||
local round=DataManager.CurrenRoom.room_config.config.times or 1
|
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||||
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
|
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||||
if xpconfig then
|
if xpconfig then
|
||||||
if round>1 then
|
if round > 1 then
|
||||||
self._ctr_action.selectedIndex = 1
|
self._ctr_action.selectedIndex = 1
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 2
|
self._ctr_action.selectedIndex = 2
|
||||||
end
|
end
|
||||||
|
else
|
||||||
else
|
self._ctr_action.selectedIndex = 1
|
||||||
self._ctr_action.selectedIndex = 1
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
self._ctr_action.selectedIndex = 0
|
self._ctr_action.selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -474,42 +456,42 @@ function M:CountCardLeftNum(card)
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OnPlayerLeave( ... )
|
function M:OnPlayerLeave(...)
|
||||||
MainView.OnPlayerLeave(self, ...)
|
MainView.OnPlayerLeave(self, ...)
|
||||||
local _room = self._room
|
local _room = self._room
|
||||||
if _room.banker_seat == _room.self_player.seat then
|
if _room.banker_seat == _room.self_player.seat then
|
||||||
self._ctr_action.selectedIndex = 0
|
self._ctr_action.selectedIndex = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:PlayerChangeLineState()
|
function M:PlayerChangeLineState()
|
||||||
local isOutCard = true
|
local isOutCard = true
|
||||||
local str = "玩家 "
|
local str = "玩家 "
|
||||||
for _ , player in ipairs(self._room.player_list) do
|
for _, player in ipairs(self._room.player_list) do
|
||||||
if player.line_state == 0 then
|
if player.line_state == 0 then
|
||||||
isOutCard = false
|
isOutCard = false
|
||||||
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
-- str = str .. self._gamectr:GetPosString(player.seat) .. "、"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
-- if not isOutCard then
|
||||||
-- if not isOutCard then
|
-- str = str.sub(str, 1, string.len(str) - string.len("、"))
|
||||||
-- str = str.sub(str, 1, string.len(str) - string.len("、"))
|
-- str = str .. " 正在赶来,请稍等"
|
||||||
-- str = str .. " 正在赶来,请稍等"
|
-- if self._room.curren_round > 0 then
|
||||||
-- if self._room.curren_round > 0 then
|
-- self._waitingView = ModalWaitingView.new(self._view, str)
|
||||||
-- self._waitingView = ModalWaitingView.new(self._view, str)
|
-- end
|
||||||
-- end
|
-- else
|
||||||
-- else
|
-- if self._waitingView then
|
||||||
-- if self._waitingView then
|
-- self._waitingView:CloseWaitingView()
|
||||||
-- self._waitingView:CloseWaitingView()
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
|
||||||
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
self._player_card_info[1]._area_handcard_list.touchable = isOutCard
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:NewMJPlayerCardInfoView(view,index)
|
function M:NewMJPlayerCardInfoView(view, index)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return MJPlayerSelfCardInfoView.new(view,self)
|
return MJPlayerSelfCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
return MJPlayerCardInfoView.new(view,self)
|
return MJPlayerCardInfoView.new(view, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:RemoveCursor()
|
function M:RemoveCursor()
|
||||||
|
|
@ -523,7 +505,7 @@ function M:Destroy()
|
||||||
UIPackage.RemovePackage("base/main_majiang/ui/Main_Majiang")
|
UIPackage.RemovePackage("base/main_majiang/ui/Main_Majiang")
|
||||||
MainView.Destroy(self)
|
MainView.Destroy(self)
|
||||||
self._cursor:Dispose()
|
self._cursor:Dispose()
|
||||||
self._xipaiPanel:Dispose()
|
self._xipaiPanel:Dispose()
|
||||||
end
|
end
|
||||||
|
|
||||||
local majiang_asset_path = "base/main_majiang/sound/"
|
local majiang_asset_path = "base/main_majiang/sound/"
|
||||||
|
|
@ -535,10 +517,10 @@ function M:PlayMJMusic(path)
|
||||||
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
ViewUtil.PlayMuisc(self.asset_group, majiang_asset_path .. path)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:PlaySound(group,sex,path)
|
function M:PlaySound(group, sex, path)
|
||||||
local sex_path = ViewUtil.Sex_Chat[sex]
|
local sex_path = ViewUtil.Sex_Chat[sex]
|
||||||
local path1 = majiang_asset_path .. string.format("%s/%s.mp3",sex_path,path)
|
local path1 = majiang_asset_path .. string.format("%s/%s.mp3", sex_path, path)
|
||||||
ViewUtil.PlaySound(group,path1)
|
ViewUtil.PlaySound(group, path1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:GetPrefix()
|
function M:GetPrefix()
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 4.0 MiB After Width: | Height: | Size: 3.8 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 553 KiB After Width: | Height: | Size: 966 KiB |
|
Before Width: | Height: | Size: 894 KiB After Width: | Height: | Size: 481 KiB |