放炮发动画
|
|
@ -36,7 +36,11 @@ function M:InitView(url)
|
|||
self._full_offset = false
|
||||
local view = self._view
|
||||
|
||||
-- self:InitClip()
|
||||
if self.alldonhua then
|
||||
coroutine.step(1, self.alldonhua)
|
||||
else
|
||||
self:InitClip()
|
||||
end
|
||||
|
||||
local btn_head = view:GetChild("btn_head")
|
||||
ImageLoad.Load(DataManager.SelfUser.head_url, btn_head._iconObject)
|
||||
|
|
@ -342,6 +346,7 @@ function M:OnUpdate()
|
|||
end
|
||||
|
||||
function M:Close()
|
||||
printlog("lingmeng close")
|
||||
BaseView.Close(self)
|
||||
UpdateBeat:Remove(self.OnUpdate, self)
|
||||
coroutine.stopAll()
|
||||
|
|
@ -365,11 +370,22 @@ function M:Destroy()
|
|||
end
|
||||
|
||||
function M:Show()
|
||||
--print("on lobbyView show~~~~~~")
|
||||
print("on lobbyView show~~~~~~")
|
||||
BaseView.Show(self)
|
||||
ViewUtil.PlaySoundBg()
|
||||
UpdateBeat:Add(self.OnUpdate, self)
|
||||
-- self:InitClip()
|
||||
print("lingmeng show1")
|
||||
if self.alldonhua then
|
||||
print("lingmeng show2", coroutine.status(self.alldonhua))
|
||||
if not coroutine.status(self.alldonhua) == "running" then
|
||||
print("lingmeng show2")
|
||||
coroutine.resume(self.alldonhua)
|
||||
print("lingmeng show3")
|
||||
end
|
||||
else
|
||||
print("lingmeng show4")
|
||||
self:InitClip()
|
||||
end
|
||||
-- 如果在圈子内的房间,显示tip
|
||||
local user = DataManager.SelfUser
|
||||
local tem = user.notices
|
||||
|
|
@ -442,57 +458,57 @@ function M:OnApplicationActive()
|
|||
end
|
||||
end
|
||||
|
||||
-- function M:InitClip()
|
||||
-- local taohuaEnd = 114
|
||||
-- local taohuaName = "ui://Lobby/taohua_00"
|
||||
-- local taohua = self._view:GetChild('clip_bg')
|
||||
-- local taohuaIndex = 0
|
||||
function M:InitClip()
|
||||
-- local taohuaEnd = 114
|
||||
-- local taohuaName = "ui://Lobby/taohua_00"
|
||||
-- local taohua = self._view:GetChild('clip_bg')
|
||||
-- local taohuaIndex = 0
|
||||
|
||||
-- local renwuEnd = 140
|
||||
-- local renwuName = "ui://Lobby/renwu-AE_00"
|
||||
-- local renwu = self._view:GetChild('clip_renwu')
|
||||
-- local renwuIndex = 0
|
||||
local renwuEnd = 143
|
||||
local renwuName = "ui://Lobby/renwu-AE_00"
|
||||
local renwu = self._view:GetChild('clip_renwu')
|
||||
local renwuIndex = 0
|
||||
|
||||
-- local pukeEnd = 60
|
||||
-- local pukeName = "ui://Lobby/puke_00"
|
||||
-- local puke = self._view:GetChild('btn_ChuangJian')
|
||||
-- local pukeIndex = 0
|
||||
local pukeEnd = 60
|
||||
local pukeName = "ui://Lobby/puke_00"
|
||||
local puke = self._view:GetChild('btn_ChuangJian')
|
||||
local pukeIndex = 0
|
||||
|
||||
-- local jiangbeiEnd = 180
|
||||
-- local jiangbeiName = "ui://Lobby/jiangbei_00"
|
||||
-- local jiangbei = self._view:GetChild('btn_more_group')
|
||||
-- local jiangbeiIndex = 0
|
||||
-- local jiangbeiEnd = 180
|
||||
-- local jiangbeiName = "ui://Lobby/jiangbei_00"
|
||||
-- local jiangbei = self._view:GetChild('btn_more_group')
|
||||
-- local jiangbeiIndex = 0
|
||||
|
||||
-- local hechengEnd = 96
|
||||
-- local hechengName = "ui://Lobby/hecheng 1_00"
|
||||
-- local hecheng = self._view:GetChild('btn_joinroom')
|
||||
-- local hechengIndex = 0
|
||||
-- self.alldonhua = coroutine.start(
|
||||
-- function()
|
||||
-- while true do
|
||||
-- taohuaIndex = self:ReplaceClip1(taohuaEnd, taohua, taohuaIndex, taohuaName)
|
||||
-- renwuIndex = self:ReplaceClip1(renwuEnd, renwu, renwuIndex, renwuName)
|
||||
-- pukeIndex = self:ReplaceClip2(pukeEnd, puke, pukeIndex, pukeName)
|
||||
-- jiangbeiIndex = self:ReplaceClip2(jiangbeiEnd, jiangbei, jiangbeiIndex, jiangbeiName)
|
||||
-- hechengIndex = self:ReplaceClip2(hechengEnd, hecheng, hechengIndex, hechengName)
|
||||
-- coroutine.wait(0.080)
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
local hechengEnd = 96
|
||||
local hechengName = "ui://Lobby/hecheng 1_00"
|
||||
local hecheng = self._view:GetChild('btn_joinroom')
|
||||
local hechengIndex = 0
|
||||
self.alldonhua = coroutine.start(
|
||||
function()
|
||||
while true do
|
||||
-- taohuaIndex = self:ReplaceClip1(taohuaEnd, taohua, taohuaIndex, taohuaName)
|
||||
renwuIndex = self:ReplaceClip1(renwuEnd, renwu, renwuIndex, renwuName)
|
||||
pukeIndex = self:ReplaceClip2(pukeEnd, puke, pukeIndex, pukeName)
|
||||
-- jiangbeiIndex = self:ReplaceClip2(jiangbeiEnd, jiangbei, jiangbeiIndex, jiangbeiName)
|
||||
hechengIndex = self:ReplaceClip2(hechengEnd, hecheng, hechengIndex, hechengName)
|
||||
coroutine.wait(0.001)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
-- function M:ReplaceClip1(e, t, i, n)
|
||||
-- if i > e then
|
||||
-- i = 0
|
||||
-- end
|
||||
-- t.url = string.format("%s%03d", n, i)
|
||||
-- return i + 4
|
||||
-- end
|
||||
function M:ReplaceClip1(e, t, i, n)
|
||||
if i > e then
|
||||
i = 0
|
||||
end
|
||||
t.url = string.format("%s%03d", n, i)
|
||||
return i + 1
|
||||
end
|
||||
|
||||
-- function M:ReplaceClip2(e, t, i, n)
|
||||
-- if i > e then
|
||||
-- i = 0
|
||||
-- end
|
||||
-- t.icon = string.format("%s%03d", n, i)
|
||||
-- return i + 4
|
||||
-- end
|
||||
function M:ReplaceClip2(e, t, i, n)
|
||||
if i > e then
|
||||
i = 0
|
||||
end
|
||||
t.icon = string.format("%s%03d", n, i)
|
||||
return i + 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ function M:init()
|
|||
self:PhoneLogin()
|
||||
end)
|
||||
|
||||
-- self:InitClip()
|
||||
self:InitClip()
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
|
|
@ -96,7 +96,7 @@ end
|
|||
function M:Show()
|
||||
BaseView.Show(self)
|
||||
self:QuickLogin()
|
||||
-- self:InitClip()
|
||||
self:InitClip()
|
||||
end
|
||||
|
||||
local function __goto_lobby(response)
|
||||
|
|
@ -255,32 +255,26 @@ function M:Destroy()
|
|||
-- ResourcesManager.UnLoad("base/ui/Login.bytes")
|
||||
end
|
||||
|
||||
-- function M:InitClip()
|
||||
-- local yunqueEnd = 120
|
||||
-- local yunqueName = "ui://Login/yunque_00"
|
||||
-- local yunque = self._view:GetChild('clip_yueque')
|
||||
-- local yunqueIndex = 0
|
||||
function M:InitClip()
|
||||
local xuehuaEnd = 120
|
||||
local xuehuaName = "ui://Login/xuehua_00"
|
||||
local xuehua = self._view:GetChild('clip_xuehua')
|
||||
local xuehuaIndex = 0
|
||||
|
||||
-- local xuehuaEnd = 120
|
||||
-- local xuehuaName = "ui://Login/xuehua_00"
|
||||
-- local xuehua = self._view:GetChild('clip_xuehua')
|
||||
-- local xuehuaIndex = 0
|
||||
self.donhua = coroutine.start(
|
||||
function()
|
||||
while true do
|
||||
xuehuaIndex = self:ReplaceClip1(xuehuaEnd, xuehua, xuehuaIndex, xuehuaName)
|
||||
coroutine.wait(0.12)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
-- self.donhua = coroutine.start(
|
||||
-- function()
|
||||
-- while true do
|
||||
-- -- yunqueIndex = self:ReplaceClip1(yunqueEnd, yunque, yunqueIndex, yunqueName)
|
||||
-- xuehuaIndex = self:ReplaceClip1(xuehuaEnd, xuehua, xuehuaIndex, xuehuaName)
|
||||
-- coroutine.wait(0.12)
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
|
||||
-- function M:ReplaceClip1(e, t, i, n)
|
||||
-- if i > e then
|
||||
-- i = 0
|
||||
-- end
|
||||
-- t.url = string.format("%s%03d", n, i)
|
||||
-- return i + 6
|
||||
-- end
|
||||
function M:ReplaceClip1(e, t, i, n)
|
||||
if i > e then
|
||||
i = 0
|
||||
end
|
||||
t.url = string.format("%s%03d", n, i)
|
||||
return i + 6
|
||||
end
|
||||
|
|
|
|||
|
|
@ -571,6 +571,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.PlayerState,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
|
|
@ -587,6 +588,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.DeskBreak,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local code = arg[1]
|
||||
if code == 0 then
|
||||
|
|
@ -616,6 +618,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.Interaction,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
if not p or not p.seat or p.seat == 0 then
|
||||
|
|
@ -661,6 +664,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.OnKicked,
|
||||
function()
|
||||
self._popEvent = true
|
||||
printlog("GameEvent.OnKicked====》》》》》")
|
||||
self:UnmarkSelfTuoguan()
|
||||
local _curren_msg = MsgWindow.new(self._root_view, '由于长时间未准备,你已被踢出房间!', MsgWindow.MsgMode.OnlyOk)
|
||||
|
|
@ -676,6 +680,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.TupGuanOpen,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
--print("刷新托管数据=====")
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
|
|
@ -774,6 +779,7 @@ function M:GetReadyNum()
|
|||
end
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
self._popEvent = true
|
||||
printlog("进入房间222222222222222222++++++++++++++++++++++++++++")
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
|
|
@ -804,6 +810,7 @@ function M:OnPlayerEnter(...)
|
|||
end
|
||||
|
||||
function M:OnPlayerReady(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
|
||||
|
|
@ -839,6 +846,7 @@ function M:OnPlayerReady(...)
|
|||
end
|
||||
|
||||
function M:OnUpdateInfo(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local t = arg[2]
|
||||
|
|
@ -925,6 +933,7 @@ function M:UnmarkSelfTuoguan()
|
|||
end
|
||||
|
||||
function M:OnPlayerLeave(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
|
|
@ -986,11 +995,16 @@ function M:OnUpdate()
|
|||
if (self._popEvent) then
|
||||
local func = self._gamectr:PopEvent()
|
||||
if (func ~= nil) then
|
||||
print("lingmeng self._popEvent1", self._popEvent)
|
||||
if self._flag_fanpaofa then
|
||||
self._popEvent = false
|
||||
end
|
||||
print("lingmeng self._popEvent2", self._popEvent)
|
||||
local result, resultInfo = pcall(func)
|
||||
if result then
|
||||
|
||||
else
|
||||
-- error(resultInfo)
|
||||
print("lingmeng error", resultInfo)
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
if self._gamectr then
|
||||
self._gamectr:ResetConnect()
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ require "Game.View.init"
|
|||
---
|
||||
-- a net ViewManager
|
||||
ViewManager = {
|
||||
|
||||
|
||||
View_Login = 1,
|
||||
|
||||
|
||||
View_Lobby = 2,
|
||||
|
||||
|
||||
View_Main = 3,
|
||||
|
||||
View_PlayBack = 4
|
||||
|
|
@ -28,22 +28,22 @@ local function __NetTip(txt_msg)
|
|||
if _currenView.UnmarkSelfTuoguan then
|
||||
_currenView:UnmarkSelfTuoguan()
|
||||
end
|
||||
_curren_msg = BaseWindow.new("ui://Common/Win_ConnectTip",_currenView._root_view)
|
||||
_curren_msg = BaseWindow.new("ui://Common/Win_ConnectTip", _currenView._root_view)
|
||||
local view = _curren_msg._view
|
||||
view:GetChild("tex_message").text = txt_msg
|
||||
view:GetChild("btn_connect").onClick:Set(function()
|
||||
_curren_msg:Destroy()
|
||||
_curren_msg = nil
|
||||
NetResetConnectWindow.ShowNetReset()
|
||||
ControllerManager.reset_join_room = 0
|
||||
ControllerManager.ResetJionRoom()
|
||||
_curren_msg:Destroy()
|
||||
_curren_msg = nil
|
||||
NetResetConnectWindow.ShowNetReset()
|
||||
ControllerManager.reset_join_room = 0
|
||||
ControllerManager.ResetJionRoom()
|
||||
end)
|
||||
view:GetChild("btn_back").onClick:Set(function()
|
||||
_curren_msg:Destroy()
|
||||
_curren_msg = nil
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
_curren_msg:Destroy()
|
||||
_curren_msg = nil
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end)
|
||||
_curren_msg._close_zone = false
|
||||
_curren_msg._animation = false
|
||||
|
|
@ -54,7 +54,7 @@ local function __OnGameConnectAction(state)
|
|||
--print("state:"..state)
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
if state == SocketCode.Connect then
|
||||
ViewManager.ChangeView(ViewManager.View_Main,DataManager.CurrenRoom.game_id)
|
||||
ViewManager.ChangeView(ViewManager.View_Main, DataManager.CurrenRoom.game_id)
|
||||
return
|
||||
elseif state == SocketCode.DisconnectByServer then
|
||||
__NetTip("网络断开连接!")
|
||||
|
|
@ -70,99 +70,101 @@ local function __OnGameConnectAction(state)
|
|||
end
|
||||
|
||||
function ViewManager.Init()
|
||||
_viewClassMap[ViewManager.View_Login] = LoginView
|
||||
_viewClassMap[ViewManager.View_Lobby] = LobbyView
|
||||
_viewClassMap[ViewManager.View_Login] = LoginView
|
||||
_viewClassMap[ViewManager.View_Lobby] = LobbyView
|
||||
|
||||
ControllerManager.OnGameConnect = __OnGameConnectAction
|
||||
ControllerManager.OnGameConnect = __OnGameConnectAction
|
||||
|
||||
ControllerManager.WebClient.holdCallback = function( response )
|
||||
if response.ReturnCode == Table_Error_code.ERR_LOGOUT then
|
||||
PlayerPrefs.DeleteKey("session_id")
|
||||
PlayerPrefs.Save()
|
||||
end
|
||||
if response.ReturnCode == -1 or response.ReturnCode == Table_Error_code.ERR_LOGOUT then
|
||||
ViewUtil.CloseModalWait()
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
RestartGame()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
ControllerManager.WebClient.holdCallback = function(response)
|
||||
if response.ReturnCode == Table_Error_code.ERR_LOGOUT then
|
||||
PlayerPrefs.DeleteKey("session_id")
|
||||
PlayerPrefs.Save()
|
||||
end
|
||||
if response.ReturnCode == -1 or response.ReturnCode == Table_Error_code.ERR_LOGOUT then
|
||||
ViewUtil.CloseModalWait()
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
RestartGame()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function ViewManager.GetCurrenView()
|
||||
return _currenView
|
||||
return _currenView
|
||||
end
|
||||
|
||||
function ViewManager.ChangeViewByClass(dview_class,callback)
|
||||
if (_currenView ~= nil) then
|
||||
if _currenView._close_destroy then
|
||||
_currenView:Destroy()
|
||||
_viewMap[_currenView.dview_class] = nil
|
||||
else
|
||||
_currenView:Close()
|
||||
end
|
||||
if _currenView._s_callback then
|
||||
_currenView._s_callback()
|
||||
end
|
||||
function ViewManager.ChangeViewByClass(dview_class, callback)
|
||||
print("lingmeng ChangeView", _currenView)
|
||||
if (_currenView ~= nil) then
|
||||
if _currenView._close_destroy then
|
||||
_currenView:Destroy()
|
||||
_viewMap[_currenView.dview_class] = nil
|
||||
else
|
||||
_currenView:Close()
|
||||
end
|
||||
local tem = _viewMap[dview_class]
|
||||
if not tem then
|
||||
tem = dview_class.new()
|
||||
tem._s_callback = callback
|
||||
_viewMap[dview_class] = tem
|
||||
if _currenView._s_callback then
|
||||
_currenView._s_callback()
|
||||
end
|
||||
tem.Id = id
|
||||
tem.dview_class = dview_class
|
||||
tem:Show()
|
||||
_currenView = tem
|
||||
return tem
|
||||
end
|
||||
local tem = _viewMap[dview_class]
|
||||
if not tem then
|
||||
tem = dview_class.new()
|
||||
tem._s_callback = callback
|
||||
_viewMap[dview_class] = tem
|
||||
end
|
||||
tem.Id = id
|
||||
tem.dview_class = dview_class
|
||||
tem:Show()
|
||||
_currenView = tem
|
||||
return tem
|
||||
end
|
||||
|
||||
local last_game_id = 0
|
||||
function ViewManager.ChangeView(id,game_id,callback)
|
||||
-- if id==2 then
|
||||
-- printlog("cccccccccccccccccccccccccccccccc")
|
||||
-- printlog(debug.traceback())
|
||||
--- end
|
||||
local dview_class = _viewClassMap[id]
|
||||
if not dview_class then
|
||||
if last_game_id ~= 0 and last_game_id ~= game_id then
|
||||
ExtendManager.GetExtendConfig(last_game_id):UnAssets()
|
||||
end
|
||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||
dview_class = exconfig:GetView(id)
|
||||
last_game_id = game_id
|
||||
function ViewManager.ChangeView(id, game_id, callback)
|
||||
print("lingmeng ChangeViewq", id, game_id)
|
||||
-- if id==2 then
|
||||
-- printlog("cccccccccccccccccccccccccccccccc")
|
||||
-- printlog(debug.traceback())
|
||||
--- end
|
||||
local dview_class = _viewClassMap[id]
|
||||
if not dview_class then
|
||||
if last_game_id ~= 0 and last_game_id ~= game_id then
|
||||
ExtendManager.GetExtendConfig(last_game_id):UnAssets()
|
||||
end
|
||||
if not dview_class then
|
||||
return
|
||||
end
|
||||
return ViewManager.ChangeViewByClass(dview_class,callback)
|
||||
local exconfig = ExtendManager.GetExtendConfig(game_id)
|
||||
dview_class = exconfig:GetView(id)
|
||||
last_game_id = game_id
|
||||
end
|
||||
if not dview_class then
|
||||
return
|
||||
end
|
||||
return ViewManager.ChangeViewByClass(dview_class, callback)
|
||||
end
|
||||
|
||||
function ViewManager.OnApplicationPause()
|
||||
-- print("game pause")
|
||||
if (_currenView ~= nil) then
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationPause()
|
||||
end
|
||||
end
|
||||
|
||||
function ViewManager.OnApplicationActive()
|
||||
-- print("game active")
|
||||
if (_currenView ~= nil) then
|
||||
if (_currenView ~= nil) then
|
||||
_currenView:OnApplicationActive()
|
||||
end
|
||||
end
|
||||
|
||||
function ViewManager.refreshGameView()
|
||||
NetResetConnectWindow.ShowNetReset()
|
||||
NetResetConnectWindow.ShowNetReset()
|
||||
|
||||
if DataManager.CurrenRoom then
|
||||
ControllerManager.reset_join_room = 0
|
||||
ControllerManager.ResetJionRoom()
|
||||
else
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end
|
||||
if DataManager.CurrenRoom then
|
||||
ControllerManager.reset_join_room = 0
|
||||
ControllerManager.ResetJionRoom()
|
||||
else
|
||||
NetResetConnectWindow.CloseNetReset()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ function M:OnEventFzAction(evt_data)
|
|||
local p = _room:GetPlayerById(playerid)
|
||||
self._cacheEvent:Enqueue(function()
|
||||
local isNeedDelHandCard = 0
|
||||
local flag_pengPao = false
|
||||
p.hu_xi = huxi
|
||||
local fz = {}
|
||||
fz.card = card
|
||||
|
|
@ -445,6 +446,7 @@ function M:OnEventFzAction(evt_data)
|
|||
if p.fz_list[i].card == card then
|
||||
p.fz_list[i].type = RB_FZType.Pao
|
||||
isAddTi = true
|
||||
flag_pengPao = true
|
||||
remove_num = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -459,6 +461,7 @@ function M:OnEventFzAction(evt_data)
|
|||
p.fz_list[i].type = RB_FZType.Pao
|
||||
num = 1
|
||||
remove_num = 0
|
||||
flag_pengPao = true
|
||||
end
|
||||
end
|
||||
if num == 0 then
|
||||
|
|
@ -523,10 +526,10 @@ function M:OnEventFzAction(evt_data)
|
|||
if fz.type == RB_FZType.Pao or fz.type == RB_FZType.Ti then
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.5)
|
||||
DispatchEvent(self._dispatcher, FanPaoFa_GameEvent.FangziAction, fz, p, isNeedDelHandCard)
|
||||
DispatchEvent(self._dispatcher, FanPaoFa_GameEvent.FangziAction, fz, p, isNeedDelHandCard, flag_pengPao)
|
||||
end)
|
||||
else
|
||||
DispatchEvent(self._dispatcher, FanPaoFa_GameEvent.FangziAction, fz, p, isNeedDelHandCard)
|
||||
DispatchEvent(self._dispatcher, FanPaoFa_GameEvent.FangziAction, fz, p, isNeedDelHandCard, flag_pengPao)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ end
|
|||
function M:InitView(url)
|
||||
local _room = self._room
|
||||
self.Fix_Msg_Chat = Fix_Msg_Chat
|
||||
self._flag_fanpaofa = true
|
||||
|
||||
ViewUtil.PlayMuisc('FanPaoFa_ZP', 'extend/zipai/fanpaofa/sound/bg.mp3')
|
||||
UIPackage.AddPackage('extend/zipai/fanpaofa/ui/Extend_Poker_FanPaoFa')
|
||||
|
|
@ -168,20 +169,19 @@ function M:EventInit()
|
|||
local _player_info = self._player_info
|
||||
local _gamectr = self._gamectr
|
||||
_gamectr:AddEventListener(GameEvent.EventXiPai, function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local currentPlayer1 = arg[1]
|
||||
local currentPlayer2 = arg[2]
|
||||
self._popEvent = false
|
||||
self._player_card_info[1]:HideDaNiao(0)
|
||||
if (currentPlayer1) then
|
||||
local xipaiCB = function()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai(xipaiCB)
|
||||
end
|
||||
if (currentPlayer2) then
|
||||
local xipaiCB2 = function()
|
||||
self._popEvent = true
|
||||
|
||||
end
|
||||
self:PlayXiPai1(xipaiCB2)
|
||||
end
|
||||
|
|
@ -189,9 +189,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(GameEvent.OnDaNiaoTips, function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local niao = arg[1]
|
||||
local reload = arg[2]
|
||||
|
||||
if reload == 0 then
|
||||
self._leftcard = 1
|
||||
self._leftcard = 1
|
||||
|
|
@ -222,9 +224,11 @@ function M:EventInit()
|
|||
|
||||
|
||||
_gamectr:AddEventListener(GameEvent.OnEventDaNiao, function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local niao = arg[2]
|
||||
|
||||
if self.seat == seat then
|
||||
self._player_card_info[seat]:HideDaNiao(niao)
|
||||
end
|
||||
|
|
@ -236,7 +240,7 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.SendCards,
|
||||
function(...)
|
||||
self._popEvent = false
|
||||
self._popEvent = true
|
||||
self._leftcard = 1
|
||||
self._leftcard = 1
|
||||
local rightpanel = self._view:GetChild('right_panel')
|
||||
|
|
@ -292,15 +296,28 @@ function M:EventInit()
|
|||
self._left_time = 15
|
||||
self._tex_LeftCard.text = '剩余 ' .. _leftcard .. ' 张牌'
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
|
||||
print("lingmeng GetCard1")
|
||||
info:UpdateOutCardList(card, true, true, self:GetPos(seat))
|
||||
if card ~= 0 then
|
||||
local p = _room:GetPlayerBySeat(seat)
|
||||
print("lingmeng baopai")
|
||||
-- self:PlaySound(p.self_user.sex, 'F_SaoChuan')
|
||||
self:PlaySound(p.self_user.sex, 'F_' .. card)
|
||||
else
|
||||
self._popEvent = false
|
||||
print("lingmeng GetCard2", os.time())
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.5)
|
||||
print("lingmeng GetCard2-1", os.time())
|
||||
self._popEvent = true
|
||||
end
|
||||
)
|
||||
else
|
||||
print("lingmeng GetCard3", os.time())
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.5)
|
||||
print("lingmeng GetCard3-1", os.time())
|
||||
self._popEvent = true
|
||||
info:ClearOutCard()
|
||||
end
|
||||
|
|
@ -314,8 +331,20 @@ function M:EventInit()
|
|||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
self._popEvent = false
|
||||
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.2)
|
||||
if info._area_outcard_list.numChildren > 0 then
|
||||
local outCard = info._area_outcard_list:GetChildAt(0)
|
||||
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()), 0.35)
|
||||
outCard:TweenScale(Vector2.New(0, 0), 0.35)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.5)
|
||||
|
|
@ -332,9 +361,11 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.EventTurn,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local list = _room.player_list
|
||||
|
||||
local readyNum = 0
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
|
|
@ -348,8 +379,10 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.OutHint,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
_room.curren_outcard_seat = _room.self_player.seat
|
||||
--printlog("jefe OutHint view>>>>",card)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.5)
|
||||
|
|
@ -363,9 +396,11 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.FangWei,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
|
||||
--self:__CloseTip()
|
||||
_room.curren_outcard_seat = _room.self_player.seat
|
||||
local _player_card_info = self._player_card_info
|
||||
|
|
@ -409,11 +444,13 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.OutCard,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
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)]
|
||||
|
||||
|
|
@ -433,6 +470,7 @@ function M:EventInit()
|
|||
info._view:GetController('time').selectedIndex = 0
|
||||
self._player_info[self:GetPos(p.seat)]._view:GetController("huxi").selectedIndex = 1
|
||||
end
|
||||
self._view_showPalyerOutCardView = info._area_outcard_list
|
||||
info:UpdateOutCardList(card, true, false, self:GetPos(seat))
|
||||
if self._leftcard == 1 then
|
||||
self._leftcard = 0
|
||||
|
|
@ -449,26 +487,34 @@ function M:EventInit()
|
|||
GameEvent.QiCard,
|
||||
function(...)
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
|
||||
self._left_time = 0
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
local p = _room:GetPlayerBySeat(seat)
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
info:PlayingOutCardAnima(p.DiceCard)
|
||||
p.DiceCard = 0
|
||||
info:UpdateQiPai(p.outcard_list, true, seat)
|
||||
self._popEvent = true
|
||||
info:PlayingOutCardAnima(card, self:GetPos(seat))
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.2)
|
||||
self._popEvent = true
|
||||
info:ClearOutCard()
|
||||
p.DiceCard = 0
|
||||
info:UpdateQiPai(p.outcard_list, false, seat)
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
_gamectr:AddEventListener(
|
||||
GameEvent.FZTips,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
local arg = { ... }
|
||||
local _tip = arg[1]
|
||||
local _uid = arg[2]
|
||||
local _fptype = arg[3]
|
||||
|
||||
self:__FangziTip(_tip, _uid, _fptype)
|
||||
end
|
||||
)
|
||||
|
|
@ -478,9 +524,10 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.ZPHuCard,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
self._left_time = 0
|
||||
self:__CloseTip()
|
||||
self._popEvent = false
|
||||
|
||||
local arg = { ... }
|
||||
local w = arg[1]
|
||||
local l = arg[2]
|
||||
|
|
@ -506,7 +553,6 @@ function M:EventInit()
|
|||
function()
|
||||
coroutine.wait(0.7)
|
||||
he:Dispose()
|
||||
self._popEvent = true
|
||||
end
|
||||
)
|
||||
end
|
||||
|
|
@ -515,8 +561,9 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.ZPResult1,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
--printlog("ZPResult111ssssssttteessssssttt")
|
||||
self._popEvent = false
|
||||
|
||||
self._left_time = 0
|
||||
local arg = { ... }
|
||||
local result = arg[1]
|
||||
|
|
@ -573,7 +620,6 @@ function M:EventInit()
|
|||
_room.player_list[i].hu_xi = 0
|
||||
end
|
||||
end
|
||||
self._popEvent = true
|
||||
end
|
||||
)
|
||||
if _room.curren_round ~= _room.room_config.round then
|
||||
|
|
@ -594,11 +640,13 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.ZPResult2,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
self._left_time = 0
|
||||
local arg = { ... }
|
||||
local total_result = arg[2]
|
||||
local result = arg[1]
|
||||
local over = arg[3]
|
||||
|
||||
local data = result.info_list
|
||||
local x = {}
|
||||
self._hu_tip:FillData(x)
|
||||
|
|
@ -621,10 +669,12 @@ function M:EventInit()
|
|||
_gamectr:AddEventListener(
|
||||
GameEvent.FangPaoOk,
|
||||
function(...)
|
||||
self._popEvent = true
|
||||
self._left_time = 0
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
|
||||
--禁牌 把手上的牌都禁掉
|
||||
-- local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
-- card_info:banHandCards(self._room.self_player.card_list)
|
||||
|
|
@ -948,6 +998,7 @@ function M:OnFangziAction(...)
|
|||
local fz = arg[1]
|
||||
local player = arg[2]
|
||||
local num = arg[3]
|
||||
local flag_pengPao = arg[4]
|
||||
if fz.type == RB_FZType.Peng or fz.type == RB_FZType.Chi or fz.type == RB_FZType.Bi then
|
||||
self:__CloseTip()
|
||||
end
|
||||
|
|
@ -955,18 +1006,17 @@ function M:OnFangziAction(...)
|
|||
local info = _player_card_info[self:GetPos(player.seat)]
|
||||
info:UpdateIsOnClick(false)
|
||||
end
|
||||
self._popEvent = false
|
||||
|
||||
local info = _player_card_info[self:GetPos(player.seat)]
|
||||
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1.2)
|
||||
info:UpdateFzList(player.fz_list, true, player.seat)
|
||||
end)
|
||||
else
|
||||
info:UpdateFzList(player.fz_list, true, player.seat) --更新放子数组
|
||||
end
|
||||
-- if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(1.2)
|
||||
-- info:UpdateFzList(player.fz_list, true, player.seat)
|
||||
-- end)
|
||||
-- else
|
||||
-- info:UpdateFzList(player.fz_list, true, player.seat) --更新放子数组
|
||||
-- end
|
||||
|
||||
|
||||
if (player == self._room.self_player) then
|
||||
|
|
@ -1050,47 +1100,47 @@ function M:OnFangziAction(...)
|
|||
--printlog("jefe self RB_FZType 4=======")
|
||||
elseif fz.type == RB_FZType.Wei then
|
||||
-- effect:GetChild("icon2").icon = UIPackage.GetItemURL("Main_RunBeard", "wei")
|
||||
self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
|
||||
info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(1.0)
|
||||
-- info:PlayingOutCardAnima()
|
||||
self:PlaySound(player.self_user.sex, 'F_GuoSao')
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
|
||||
effect.touchable = false
|
||||
effect.x, effect.y = -250, -200
|
||||
effect:GetTransition('t0'):Play()
|
||||
pNode:AddChild(effect)
|
||||
-- end)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1.0)
|
||||
info:PlayingOutCardAnima()
|
||||
self:PlaySound(player.self_user.sex, 'F_GuoSao')
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
|
||||
effect.touchable = false
|
||||
effect.x, effect.y = -250, -200
|
||||
effect:GetTransition('t0'):Play()
|
||||
pNode:AddChild(effect)
|
||||
end)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(2)
|
||||
coroutine.wait(0.7)
|
||||
effect:Dispose()
|
||||
end
|
||||
)
|
||||
elseif fz.type == RB_FZType.ChouWei then
|
||||
self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(1.2)
|
||||
-- info:PlayingOutCardAnima()
|
||||
self:PlaySound(player.self_user.sex, 'F_GuoSao')
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
|
||||
effect.touchable = false
|
||||
effect.x, effect.y = -250, -200
|
||||
effect:GetTransition('t0'):Play()
|
||||
pNode:AddChild(effect)
|
||||
-- end)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1.2)
|
||||
info:PlayingOutCardAnima()
|
||||
self:PlaySound(player.self_user.sex, 'F_GuoSao')
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'wei')
|
||||
effect.touchable = false
|
||||
effect.x, effect.y = -250, -200
|
||||
effect:GetTransition('t0'):Play()
|
||||
pNode:AddChild(effect)
|
||||
end)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1.7)
|
||||
coroutine.wait(0.7)
|
||||
effect:Dispose()
|
||||
end
|
||||
)
|
||||
|
|
@ -1099,19 +1149,20 @@ function M:OnFangziAction(...)
|
|||
self:PlaySound(player.self_user.sex, 'F_KaiDuo')
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'pao')
|
||||
elseif fz.type == RB_FZType.Ti then
|
||||
self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
-- self:PlaySound(player.self_user.sex, 'F_' .. fz.card)
|
||||
-- info:UpdateOutCardList(fz.card, true, true, fz.from_seat)
|
||||
effect:GetChild('icon1').icon = UIPackage.GetItemURL('Main_RunBeard', 'ti')
|
||||
effect.touchable = false
|
||||
effect.x, effect.y = -250, -200
|
||||
effect:GetTransition('t0'):Play()
|
||||
pNode:AddChild(effect)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(1.2)
|
||||
self:PlaySound(player.self_user.sex, 'F_SaoChuan')
|
||||
info:PlayingOutCardAnima()
|
||||
end)
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(1.2)
|
||||
print("lingmeng tiqi")
|
||||
self:PlaySound(player.self_user.sex, 'F_SaoChuan')
|
||||
-- info:PlayingOutCardAnima()
|
||||
-- end)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
|
|
@ -1145,20 +1196,46 @@ function M:OnFangziAction(...)
|
|||
)
|
||||
end
|
||||
|
||||
local removeOutcard = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
local p = self._room:GetPlayerBySeat(fz.from_seat)
|
||||
|
||||
if p.DiceCard ~= nil and fz.active_card == p.DiceCard then
|
||||
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei or fz.type == RB_FZType.Ti or fz.type == RB_FZType.Pao then
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.8)
|
||||
removeOutcard:ClearOutCard()
|
||||
end)
|
||||
else
|
||||
removeOutcard:ClearOutCard()
|
||||
if fz.type ~= RB_FZType.Kan then
|
||||
local time = 0.01
|
||||
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
|
||||
time = 0.3
|
||||
end
|
||||
p.DiceCard = nil
|
||||
local removeOutcard = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(time)
|
||||
local p = self._room:GetPlayerBySeat(fz.from_seat)
|
||||
if p.DiceCard ~= nil and fz.active_card == p.DiceCard then
|
||||
local outCard
|
||||
if removeOutcard._area_outcard_list.numChildren == 0 then
|
||||
for i = 1, self._room.maxPlayers do
|
||||
if _player_card_info[i]._area_outcard_list.numChildren > 0 then
|
||||
outCard = _player_card_info[i]._area_outcard_list:GetChildAt(0)
|
||||
end
|
||||
end
|
||||
else
|
||||
outCard = removeOutcard._area_outcard_list:GetChildAt(0)
|
||||
end
|
||||
if flag_pengPao then
|
||||
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()) - Vector2.New(outCard.width, 0), 0.25)
|
||||
outCard:TweenScale(Vector2.New(0, 0), 0.25)
|
||||
else
|
||||
outCard:TweenMove(outCard:GlobalToLocal(info:GetFzMove()) - Vector2.New(outCard.width, 0), 0.25)
|
||||
outCard:TweenScale(Vector2.New(0, 0), 0.25)
|
||||
end
|
||||
p.DiceCard = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.2 + time)
|
||||
removeOutcard:ClearOutCard()
|
||||
info:UpdateFzList(player.fz_list, true, player.seat, flag_pengPao) --更新放子数组
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local list = self._room.player_list
|
||||
|
|
@ -1168,10 +1245,19 @@ function M:OnFangziAction(...)
|
|||
info._view:GetChild('huxi').text = p.hu_xi
|
||||
end
|
||||
|
||||
self._popEvent = true
|
||||
local time = 0.01
|
||||
if fz.type ~= RB_FZType.Kan then
|
||||
time = flag_pengPao and 0.3 or 0.7
|
||||
if fz.type == RB_FZType.Wei or fz.type == RB_FZType.ChouWei then
|
||||
time = time + 0.3
|
||||
end
|
||||
end
|
||||
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.3)
|
||||
print("lingmeng OnFangziAction", time, os.time())
|
||||
coroutine.wait(time)
|
||||
self._popEvent = true
|
||||
local info = _player_card_info[1]
|
||||
info:UpdateIsOnClick(true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
local PlayerCardInfoView = import(".main.ZPPlayerCardInfoView")
|
||||
---- 对方上面的牌
|
||||
local M = {}
|
||||
function M.new(view,mainView)
|
||||
|
||||
setmetatable(M, {__index = PlayerCardInfoView})
|
||||
local self = setmetatable({},{__index = M})
|
||||
function M.new(view, mainView)
|
||||
setmetatable(M, { __index = PlayerCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
|
|
@ -12,80 +11,69 @@ function M.new(view,mainView)
|
|||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:UpdateFzList( fz_list ,ispaly,seat)
|
||||
-- print("lingmeng UpdateFzList")
|
||||
-- pt(fz_list)
|
||||
self._area_fz_list:RemoveChildren(0,-1,true)
|
||||
for i = 1,#fz_list do
|
||||
function M:UpdateFzList(fz_list, ispaly, seat, flag_pengPao)
|
||||
-- print("lingmeng UpdateFzList")
|
||||
-- pt(fz_list)
|
||||
self._area_fz_list:RemoveChildren(0, -1, true)
|
||||
for i = 1, #fz_list do
|
||||
local fzitem = nil
|
||||
if fz_list[i].type ~= RB_FZType.Kan then
|
||||
fzitem =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/ComponentNew")
|
||||
if(ispaly == false)then
|
||||
fzitem:RemoveChildren(0,-1,true)
|
||||
fzitem = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/ComponentNew")
|
||||
if (ispaly == false) then
|
||||
fzitem:RemoveChildren(0, -1, true)
|
||||
end
|
||||
end
|
||||
if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
fzcards:GetController("c2").selectedIndex =1
|
||||
fzcards:GetChild("card_"..1).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].active_card)
|
||||
fzcards:GetChild("card_"..2).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[1])
|
||||
fzcards:GetChild("card_"..3).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[2])
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
|
||||
if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
fzcards:GetController("c2").selectedIndex = 1
|
||||
fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].active_card)
|
||||
fzcards:GetChild("card_" .. 2).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[1])
|
||||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[2])
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Peng then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j=1,3 do
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 3 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Wei then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
-- for j=1,3 do
|
||||
-- fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
-- end
|
||||
-- fzcards:GetChild("card_"..3).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)--jefe
|
||||
for j=1,3 do
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
for j = 1, 3 do
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
fzcards:GetChild("card_"..1).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)--jefe
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
|
||||
fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) --jefe
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.ChouWei then
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
-- for j=1,2 do
|
||||
-- fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
-- end
|
||||
-- fzcards:GetChild("card_"..3).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
for j=2,3 do
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
for j = 2, 3 do
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
fzcards:GetChild("card_"..1).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
|
||||
fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Pao then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j=1,4 do
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j = 1, 4 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Ti then
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
if self._mainView._leftcard == 1 then
|
||||
for j=1,4 do
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
if self._mainView._leftcard == 1 then
|
||||
for j = 1, 4 do
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
else
|
||||
-- for j=1,4 do
|
||||
|
|
@ -95,51 +83,52 @@ function M:UpdateFzList( fz_list ,ispaly,seat)
|
|||
-- fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
-- end
|
||||
-- end
|
||||
for j=1,4 do
|
||||
if j==1 then
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
for j = 1, 4 do
|
||||
if j == 1 then
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i]
|
||||
.card)
|
||||
else
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
end
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
self:playAnim(fzitem,fzcards,#fz_list,i,ispaly,seat)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, seat, flag_pengPao)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:playAnim(fzitem,fzcards, size,i,ispaly,seat)
|
||||
if(ispaly == nil)then
|
||||
ispaly =false
|
||||
end
|
||||
function M:playAnim(fzitem, fzcards, size, i, ispaly, seat, flag_pengPao)
|
||||
if (ispaly == nil) then
|
||||
ispaly = false
|
||||
end
|
||||
|
||||
local isaddLast = false
|
||||
if(ispaly and i == size)then --匹配最后一个牌
|
||||
local faArray= fzitem:GetChild("chiwei1")
|
||||
local isaddLast = false
|
||||
if (ispaly and i == size and not flag_pengPao) then --匹配最后一个牌
|
||||
local faArray = fzitem:GetChild("chiwei")
|
||||
|
||||
if(faArray~=nil)then
|
||||
faArray:AddChild(fzcards)
|
||||
else
|
||||
fzitem:AddChild(fzcards)
|
||||
end
|
||||
else
|
||||
if (faArray ~= nil) then
|
||||
faArray:AddChild(fzcards)
|
||||
else
|
||||
fzitem:AddChild(fzcards)
|
||||
end
|
||||
if(seat~=nil)then
|
||||
isaddLast = self:isAddFirst(seat)
|
||||
end
|
||||
-- if(isaddLast)then
|
||||
local index_postion = 0
|
||||
self._area_fz_list:AddChildAt(fzitem,index_postion)
|
||||
-- else
|
||||
-- self._area_fz_list:AddChild(fzitem)
|
||||
-- end
|
||||
end
|
||||
else
|
||||
fzitem:AddChild(fzcards)
|
||||
end
|
||||
if (seat ~= nil) then
|
||||
isaddLast = self:isAddFirst(seat)
|
||||
end
|
||||
-- if(isaddLast)then
|
||||
local index_postion = 0
|
||||
self._area_fz_list:AddChildAt(fzitem, index_postion)
|
||||
-- else
|
||||
-- self._area_fz_list:AddChild(fzitem)
|
||||
-- end
|
||||
end
|
||||
|
||||
function M:isAddFirst(seat)
|
||||
local isaddLast = false
|
||||
--[[if(DataManager.CurrenRoom.room_config.people_num ==3)then
|
||||
--[[if(DataManager.CurrenRoom.room_config.people_num ==3)then
|
||||
if(DataManager.CurrenRoom.self_player.seat == 1)then
|
||||
if(seat == 2)then
|
||||
isaddLast = true
|
||||
|
|
@ -156,111 +145,114 @@ function M:isAddFirst(seat)
|
|||
elseif DataManager.CurrenRoom.room_config.people_num ==2 then
|
||||
isaddLast = true
|
||||
end]]
|
||||
return isaddLast
|
||||
return isaddLast
|
||||
end
|
||||
|
||||
function M:PlayingOutCardAnima(card)
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.1)
|
||||
self:ClearOutCard()
|
||||
end)
|
||||
end
|
||||
--摸牌动画
|
||||
-- function M:PlayingOutCardAnima(card)
|
||||
-- if (self._area_outcard_list ~= nil and self._area_outcard_list.numChildren > 0) then
|
||||
-- self._area_outcard_list:GetChildAt(0):GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/202_', card)
|
||||
-- self._view:GetTransition('t0'):Play()
|
||||
-- end
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(0.1)
|
||||
-- -- self._bgview.selectedIndex = 1
|
||||
-- self:ClearOutCard()
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
|
||||
function M:UpdateOutCardList(outcard,isShow,isMopai,seat)
|
||||
|
||||
if(isShow == nil) then
|
||||
isShow = false
|
||||
function M:UpdateOutCardList(outcard, isShow, isMopai, seat)
|
||||
if (isShow == nil) then
|
||||
isShow = false
|
||||
end
|
||||
if(isMopai == nil) then
|
||||
isMopai = false
|
||||
if (isMopai == nil) then
|
||||
isMopai = false
|
||||
end
|
||||
|
||||
self._area_outcard_list:RemoveChildren(0,-1,true)
|
||||
local outcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
|
||||
if outcard==0 then
|
||||
-- outcards:GetChild("icon").icon ="ui://Main_RunBeard/202_1_300"
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
|
||||
if outcard == 0 then
|
||||
-- outcards:GetChild("icon").icon ="ui://Main_RunBeard/202_1_300"
|
||||
else
|
||||
outcards:GetChild("icon").icon =self:getCardItem("ui://Main_RunBeard/203_",outcard)
|
||||
-- self._bgview.selectedIndex=1
|
||||
outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", outcard)
|
||||
-- self._bgview.selectedIndex=1
|
||||
end
|
||||
outcards.x,outcards.y = 0,0
|
||||
local show_di_bg = outcards:GetChild("show_di_bg")
|
||||
-- show_di_bg.visible = true
|
||||
if(isShow)then
|
||||
if outcard == 0 then
|
||||
show_di_bg.visible = false
|
||||
end
|
||||
if(seat ~= nil and outcards~=nil)then
|
||||
if(DataManager.CurrenRoom.room_config.people_num ==3)then
|
||||
if(seat ==2)then
|
||||
seat = 3
|
||||
elseif(seat == 3)then
|
||||
seat =2
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num ==2 then
|
||||
seat = 3
|
||||
outcards.x, outcards.y = 0, 0
|
||||
local show_di_bg = outcards:GetChild("show_di_bg")
|
||||
-- show_di_bg.visible = true
|
||||
if (isShow) then
|
||||
if outcard == 0 then
|
||||
show_di_bg.visible = false
|
||||
end
|
||||
if(isMopai)then
|
||||
if outcard ~= 0 then
|
||||
outcards:GetTransition("mopai"..seat):Play(function( )
|
||||
-- show_di_bg.visible = true
|
||||
|
||||
end)
|
||||
end
|
||||
if (seat ~= nil and outcards ~= nil) then
|
||||
if (DataManager.CurrenRoom.room_config.people_num == 3) then
|
||||
if (seat == 2) then
|
||||
seat = 3
|
||||
elseif (seat == 3) then
|
||||
seat = 2
|
||||
end
|
||||
elseif DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
seat = 3
|
||||
end
|
||||
if (isMopai) then
|
||||
if outcard ~= 0 then
|
||||
outcards:GetTransition("mopai" .. seat):Play(function()
|
||||
-- show_di_bg.visible = true
|
||||
end)
|
||||
end
|
||||
else
|
||||
show_di_bg.visible = false
|
||||
outcards:GetTransition("cpai"..seat):Play()
|
||||
show_di_bg.visible = false
|
||||
outcards:GetTransition("cpai" .. seat):Play()
|
||||
end
|
||||
else
|
||||
-- show_di_bg.visible = true
|
||||
-- show_di_bg.visible = true
|
||||
end
|
||||
else
|
||||
show_di_bg.visible = false
|
||||
end
|
||||
self._area_outcard_list:AddChild(outcards)
|
||||
|
||||
end
|
||||
|
||||
--弃牌
|
||||
function M:UpdateQiPai( qi_list,ispaly,seat)
|
||||
self._area_qipai_list:RemoveChildren(0,-1,true)
|
||||
for i=1,#qi_list do
|
||||
local qicards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
pt(qicards)
|
||||
qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",qi_list[i])
|
||||
if(ispaly)then
|
||||
if(i == #qi_list) then
|
||||
if(DataManager.CurrenRoom.room_config.people_num ==2)then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
else
|
||||
if(DataManager.CurrenRoom.self_player.seat == 1)then
|
||||
if(seat == 2)then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
function M:UpdateQiPai(qi_list, ispaly, seat)
|
||||
self._area_qipai_list:RemoveChildren(0, -1, true)
|
||||
for i = 1, #qi_list do
|
||||
local qicards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", qi_list[i])
|
||||
if (ispaly) then
|
||||
if (i == #qi_list) then
|
||||
if (DataManager.CurrenRoom.room_config.people_num == 2) then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
else
|
||||
if (DataManager.CurrenRoom.self_player.seat == 1) then
|
||||
if (seat == 2) then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
else
|
||||
qicards:GetTransition("t1"):Play()
|
||||
qicards:GetTransition("t1"):Play()
|
||||
end
|
||||
elseif(DataManager.CurrenRoom.self_player.seat == 2)then
|
||||
if(seat == 3)then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
elseif (DataManager.CurrenRoom.self_player.seat == 2) then
|
||||
if (seat == 3) then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
else
|
||||
qicards:GetTransition("t1"):Play()
|
||||
qicards:GetTransition("t1"):Play()
|
||||
end
|
||||
elseif(DataManager.CurrenRoom.self_player.seat == 3)then
|
||||
if(seat == 1)then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
elseif (DataManager.CurrenRoom.self_player.seat == 3) then
|
||||
if (seat == 1) then
|
||||
qicards:GetTransition("t0"):Play()
|
||||
else
|
||||
qicards:GetTransition("t1"):Play()
|
||||
qicards:GetTransition("t1"):Play()
|
||||
end
|
||||
else
|
||||
qicards:GetTransition("t0"):Play()
|
||||
qicards:GetTransition("t0"):Play()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
self._area_qipai_list:AddChild(qicards)
|
||||
end
|
||||
|
||||
end
|
||||
self._area_qipai_list:AddChild(qicards)
|
||||
end
|
||||
end
|
||||
return M
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ function M:__OnDragEnd(context)
|
|||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
local card = button.data
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
card.btn_card.sortingOrder = 0
|
||||
if (button.y < -380 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
if (button.y < self._data_outLinePos - button.height * 0.66 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
button.touchable = false
|
||||
self.outcard_button = card
|
||||
self:UpdateIsOnClick(false)
|
||||
|
|
@ -78,7 +78,7 @@ function M:__OnDragEnd(context)
|
|||
maxmark = #self.card_list - 1
|
||||
end
|
||||
end
|
||||
if button.x + button.width / 2 < self.card_list[minmark].btn_card.x and #CountCards < 10 and button.y > -380 then
|
||||
if xy.x < self.card_list[minmark].btn_card.x and #CountCards < 10 and xy.y > self._data_outLinePos then
|
||||
list_remove(self.card_list, card)
|
||||
local num = 0
|
||||
for i = 1, #self.card_list do
|
||||
|
|
@ -104,7 +104,7 @@ function M:__OnDragEnd(context)
|
|||
card.index_Y = 1
|
||||
table.insert(self.card_list, 1, card)
|
||||
isChangeCard = true
|
||||
elseif button.x + button.width / 2 > (self.card_list[maxmark].btn_card.x + button.width) and #CountCards < 10 and button.y > -380 then
|
||||
elseif xy.x > (self.card_list[maxmark].btn_card.x + button.width) and #CountCards < 10 and xy.y > self._data_outLinePos then
|
||||
list_remove(self.card_list, card)
|
||||
local num = 0
|
||||
for i = 1, #self.card_list do
|
||||
|
|
@ -133,7 +133,7 @@ function M:__OnDragEnd(context)
|
|||
for i = 1, #CountCards do
|
||||
local card_view = CountCards[i][1]
|
||||
if card_view ~= nil then
|
||||
if button.x + button.width / 2 > card_view.old_postion.x and button.x + button.width / 2 < (card_view.old_postion.x + button.width) and button.y > -380 then
|
||||
if xy.x > card_view.old_postion.x and xy.x < (card_view.old_postion.x + button.width) and xy.y > self._data_outLinePos then
|
||||
if card ~= card_view and #CountCards[i] < 4 and card.index_X ~= card_view.index_X then
|
||||
MoveCardPos = i
|
||||
MoveCardY = #CountCards[i] + 1
|
||||
|
|
@ -145,24 +145,24 @@ function M:__OnDragEnd(context)
|
|||
end
|
||||
local MoveCardindex = 0
|
||||
-- local MoveCardY = 0
|
||||
-- print("lingmeng end", button.y, MoveCard, button.y > -380,
|
||||
-- print("lingmeng end", button.y, MoveCard, button.y > self._data_outLinePos,
|
||||
-- button.x + button.width / 2 > card.old_postion.x and
|
||||
-- button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > -380)
|
||||
if button.x + button.width / 2 > card.old_postion.x and button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > -380 then
|
||||
-- button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > self._data_outLinePos)
|
||||
if xy.x > card.old_postion.x and xy.x < (card.old_postion.x + button.width) and button.y > self._data_outLinePos then
|
||||
if #CountCards[card.index_X] > 1 then
|
||||
for i = 1, #CountCards[card.index_X] do
|
||||
local _cv = CountCards[card.index_X][i]
|
||||
if _cv ~= card then
|
||||
if button.y + button.height / 2 > _cv.btn_card.y and button.y + button.height / 2 < (_cv.btn_card.y + button.height) then
|
||||
if xy.y > _cv.btn_card.y and xy.y < (_cv.btn_card.y + button.height) then
|
||||
--向下移動
|
||||
if ((button.y + button.height / 2) + 20) > (card.old_postion.y + button.height) then
|
||||
if i < card.index_Y then
|
||||
MoveCardindex = -1
|
||||
MoveCardPos = card.index_X
|
||||
MoveCardY = _cv.index_Y
|
||||
MoveCard = true
|
||||
list_remove(self.card_list, card)
|
||||
--向上移動
|
||||
elseif ((button.y + button.height / 2) - 20) < card.old_postion.y then
|
||||
elseif i > card.index_Y then
|
||||
MoveCardindex = 1
|
||||
MoveCardPos = card.index_X
|
||||
MoveCardY = _cv.index_Y
|
||||
|
|
@ -186,7 +186,7 @@ function M:__OnDragEnd(context)
|
|||
end
|
||||
end
|
||||
end
|
||||
-- print("lingmeng end", MoveCard, MoveCardindex)
|
||||
-- print("lingmeng end", MoveCard, MoveCardindex)
|
||||
if MoveCard == true and MoveCardindex == 0 then
|
||||
local num = 0
|
||||
for i = 1, #self.card_list do
|
||||
|
|
@ -315,15 +315,21 @@ function M:UpdateQiPai(qi_list, isplay)
|
|||
end
|
||||
|
||||
--摸牌动画
|
||||
function M:PlayingOutCardAnima(card)
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.1)
|
||||
-- self._bgview.selectedIndex = 1
|
||||
self:ClearOutCard()
|
||||
end)
|
||||
end
|
||||
-- function M:PlayingOutCardAnima(card)
|
||||
-- if (self._area_outcard_list ~= nil and self._area_outcard_list.numChildren > 0) then
|
||||
-- self._area_outcard_list:GetChildAt(0):GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/202_', card)
|
||||
-- self._view:GetTransition('t0'):Play()
|
||||
-- end
|
||||
-- coroutine.start(
|
||||
-- function()
|
||||
-- coroutine.wait(0.1)
|
||||
-- -- self._bgview.selectedIndex = 1
|
||||
-- self:ClearOutCard()
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
|
||||
function M:UpdateFzList(fz_list, ispaly)
|
||||
function M:UpdateFzList(fz_list, ispaly, seat, flag_pengPao)
|
||||
--printlog("UpdateFzList area_fz_list2")
|
||||
self._area_fz_list:RemoveChildren(0, -1, true)
|
||||
for i = 1, #fz_list do
|
||||
|
|
@ -343,14 +349,14 @@ function M:UpdateFzList(fz_list, ispaly)
|
|||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[2])
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Peng then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 3 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Wei then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
fzcards:GetController("c1").selectedIndex = 1
|
||||
|
|
@ -362,7 +368,7 @@ function M:UpdateFzList(fz_list, ispaly)
|
|||
end
|
||||
end
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.ChouWei then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 2 do
|
||||
|
|
@ -370,14 +376,14 @@ function M:UpdateFzList(fz_list, ispaly)
|
|||
end
|
||||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Pao then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j = 1, 4 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
elseif fz_list[i].type == RB_FZType.Ti then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j = 1, 4 do
|
||||
|
|
@ -388,27 +394,42 @@ function M:UpdateFzList(fz_list, ispaly)
|
|||
end
|
||||
end
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly)
|
||||
self:playAnim(fzitem, fzcards, #fz_list, i, ispaly, flag_pengPao)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:playAnim(fzitem, fzcards, size, i, ispaly)
|
||||
function M:playAnim(fzitem, fzcards, size, i, ispaly, flag_pengPao)
|
||||
print("lingmeng playAnim", fzitem, fzcards, size, i, ispaly, flag_pengPao)
|
||||
if (ispaly == nil) then
|
||||
ispaly = false
|
||||
end
|
||||
if (ispaly and i == size) then
|
||||
local faArray = fzitem:GetChild("chiwei")
|
||||
if (faArray ~= nil) then
|
||||
faArray:AddChild(fzcards)
|
||||
else
|
||||
fzitem:AddChild(fzcards)
|
||||
end
|
||||
if (ispaly and i == size and not flag_pengPao) then
|
||||
local fristCard = self.card_list[1].btn_card
|
||||
print("lingmeng btn_card", self.card_list[1].index_X)
|
||||
self._area_handcard_list:AddChild(fzcards)
|
||||
fzcards:SetPivot(0.5, 0.5)
|
||||
fzcards.rotation = 180
|
||||
fzcards.xy = fristCard.xy - Vector2.New(fzcards.width, fzcards.height)
|
||||
fzcards:TweenMove(
|
||||
self._area_fz_list.xy + Vector2.New(fzcards.width, 0) * self._area_fz_list.numItems -
|
||||
self._area_handcard_list.xy, 0.2)
|
||||
fzcards:TweenScale(Vector2.New(0.5, 0.5), 0.2)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.2)
|
||||
fzcards:RemoveFromParent()
|
||||
fzcards.xy = Vector2.zero
|
||||
fzcards.rotation = 0
|
||||
fzcards:SetScale(1, 1)
|
||||
fzitem:AddChild(fzcards)
|
||||
self._area_fz_list:AddChildAt(fzitem, 0)
|
||||
end
|
||||
)
|
||||
else
|
||||
fzitem:AddChild(fzcards)
|
||||
self._area_fz_list:AddChildAt(fzitem, 0)
|
||||
end
|
||||
self._area_fz_list:AddChildAt(fzitem,0)
|
||||
|
||||
end
|
||||
|
||||
--出牌提示动画
|
||||
|
|
|
|||
|
|
@ -1,54 +1,53 @@
|
|||
local PendulumRule = import('.PendulumRule')
|
||||
AreaOderType = {
|
||||
left_right = "left_right",
|
||||
right_left = "right_left",
|
||||
up_down = "up_down",
|
||||
down_up = "down_up"
|
||||
left_right = "left_right",
|
||||
right_left = "right_left",
|
||||
up_down = "up_down",
|
||||
down_up = "down_up"
|
||||
}
|
||||
|
||||
local PlayerCardInfoView = {
|
||||
_view = nil,
|
||||
_mainView = nil,
|
||||
|
||||
_mask_liangpai = nil,
|
||||
_area_outcard_list = nil,
|
||||
_area_handcard_list = nil,
|
||||
_view = nil,
|
||||
_mainView = nil,
|
||||
|
||||
_mask_liangpai = nil,
|
||||
_area_outcard_list = nil,
|
||||
_area_handcard_list = nil,
|
||||
|
||||
|
||||
}
|
||||
local function NewCardView(card,cardItem,index_X,index_Y)
|
||||
local self = {}
|
||||
setmetatable(self,{__index = CardView})
|
||||
self.btn_card = card
|
||||
self.card_item = cardItem
|
||||
self.index_X = index_X
|
||||
self.index_Y = index_Y
|
||||
return self
|
||||
local function NewCardView(card, cardItem, index_X, index_Y)
|
||||
local self = {}
|
||||
setmetatable(self, { __index = CardView })
|
||||
self.btn_card = card
|
||||
self.card_item = cardItem
|
||||
self.index_X = index_X
|
||||
self.index_Y = index_Y
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
local M = PlayerCardInfoView
|
||||
|
||||
function M.new(view,mainView)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = M})
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
return self
|
||||
function M.new(view, mainView)
|
||||
local self = {}
|
||||
setmetatable(self, { __index = M })
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
return self
|
||||
end
|
||||
|
||||
function M:init()
|
||||
|
||||
local view = self._view
|
||||
self._room = DataManager.CurrenRoom
|
||||
self._area_outcard_list = view:GetChild("area_outcard_list")
|
||||
self._bgview = view:GetController("bgview")
|
||||
self._area_handcard_list = view:GetChild("area_handcard_list")
|
||||
self._area_fz_list = view:GetChild("area_fz_list")
|
||||
self._area_qipai_list = view:GetChild("windcard_list")
|
||||
self._mask_liangpai = view:GetChild("mask_liangpai")
|
||||
UIPackage.AddPackage("base/main_zipai/ui/Main_RunBeard")
|
||||
local view = self._view
|
||||
self._room = DataManager.CurrenRoom
|
||||
self._area_outcard_list = view:GetChild("area_outcard_list")
|
||||
self._bgview = view:GetController("bgview")
|
||||
self._area_handcard_list = view:GetChild("area_handcard_list")
|
||||
self._area_fz_list = view:GetChild("area_fz_list")
|
||||
self._area_qipai_list = view:GetChild("windcard_list")
|
||||
self._mask_liangpai = view:GetChild("mask_liangpai")
|
||||
UIPackage.AddPackage("base/main_zipai/ui/Main_RunBeard")
|
||||
end
|
||||
|
||||
function M:SetPlayer(p)
|
||||
|
|
@ -56,7 +55,7 @@ function M:SetPlayer(p)
|
|||
end
|
||||
|
||||
function M:FillData(begin)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
|
|
@ -67,101 +66,88 @@ function M:Clear()
|
|||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
|
||||
function M:fillCard(obj,card_type,card)
|
||||
function M:fillCard(obj, card_type, card)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function M:ClearOutCard()
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
--弃牌
|
||||
function M:UpdateQiPai( qi_list)
|
||||
self._area_qipai_list:RemoveChildren(0,-1,true)
|
||||
for i=1,#qi_list do
|
||||
local qicards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai")
|
||||
qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",qi_list[i])
|
||||
self._area_qipai_list:AddChild(qicards)
|
||||
end
|
||||
|
||||
function M:UpdateQiPai(qi_list)
|
||||
self._area_qipai_list:RemoveChildren(0, -1, true)
|
||||
for i = 1, #qi_list do
|
||||
local qicards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai")
|
||||
qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", qi_list[i])
|
||||
self._area_qipai_list:AddChild(qicards)
|
||||
end
|
||||
end
|
||||
|
||||
--放字
|
||||
function M:UpdateFzList( fz_list )
|
||||
--放字
|
||||
function M:UpdateFzList(fz_list)
|
||||
printlog("UpdateFzList----")
|
||||
self._area_fz_list:RemoveChildren(0,-1,true)
|
||||
for i = 1,#fz_list do
|
||||
self._area_fz_list:RemoveChildren(0, -1, true)
|
||||
for i = 1, #fz_list do
|
||||
local fzitem = nil
|
||||
if fz_list[i].type ~= RB_FZType.Kan then
|
||||
fzitem =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Component1")
|
||||
fzitem:RemoveChildren(0,-1,true)
|
||||
fzitem = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Component1")
|
||||
fzitem:RemoveChildren(0, -1, true)
|
||||
end
|
||||
if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
fzcards:GetController("c2").selectedIndex =1
|
||||
fzcards:GetChild("card_"..1).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].active_card)
|
||||
fzcards:GetChild("card_"..2).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[1])
|
||||
fzcards:GetChild("card_"..3).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[2])
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
fzcards:GetController("c2").selectedIndex = 1
|
||||
fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].active_card)
|
||||
fzcards:GetChild("card_" .. 2).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[1])
|
||||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[2])
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
|
||||
elseif fz_list[i].type == RB_FZType.Peng then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j=1,3 do
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 3 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
|
||||
elseif fz_list[i].type == RB_FZType.Wei then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j=1,2 do
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 2 do
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
fzcards:GetChild("card_"..3).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
|
||||
elseif fz_list[i].type == RB_FZType.ChouWei then
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j=1,2 do
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3")
|
||||
for j = 1, 2 do
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
fzcards:GetChild("card_"..3).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
|
||||
elseif fz_list[i].type == RB_FZType.Pao then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j=1,4 do
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j = 1, 4 do
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
|
||||
elseif fz_list[i].type == RB_FZType.Ti then
|
||||
|
||||
local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j=1,4 do
|
||||
if j==4 then
|
||||
fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card)
|
||||
local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4")
|
||||
for j = 1, 4 do
|
||||
if j == 4 then
|
||||
fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card)
|
||||
else
|
||||
fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300"
|
||||
fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300"
|
||||
end
|
||||
end
|
||||
fzcards.x,fzcards.y = 0,0
|
||||
fzitem:AddChildAt(fzcards,0)
|
||||
fzcards.x, fzcards.y = 0, 0
|
||||
fzitem:AddChildAt(fzcards, 0)
|
||||
self._area_fz_list:AddChild(fzitem)
|
||||
end
|
||||
end
|
||||
|
|
@ -169,30 +155,30 @@ end
|
|||
|
||||
--回放手牌
|
||||
function M:InitHandCard(handcard)
|
||||
self._area_handcard_list:RemoveChildren(0,-1,true)
|
||||
local pokerList =PendulumRule.GetHandCard(handcard) --self:PendulumRule(handcard)
|
||||
self.card_lists ={}
|
||||
for i =1,#pokerList do
|
||||
for j =1,#pokerList[i] do
|
||||
local card_code = pokerList[i][j]
|
||||
local btn_card =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",card_code)
|
||||
|
||||
self._area_handcard_list:AddChild(btn_card)
|
||||
self._area_handcard_list:SetChildIndex(btn_card,5-j)
|
||||
local card_view = NewCardView(btn_card,card_code,i,j)
|
||||
self.card_lists[#self.card_lists+1] = card_view
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
local pokerList = PendulumRule.GetHandCard(handcard) --self:PendulumRule(handcard)
|
||||
self.card_lists = {}
|
||||
for i = 1, #pokerList do
|
||||
for j = 1, #pokerList[i] do
|
||||
local card_code = pokerList[i][j]
|
||||
local btn_card = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", card_code)
|
||||
|
||||
self._area_handcard_list:AddChild(btn_card)
|
||||
self._area_handcard_list:SetChildIndex(btn_card, 5 - j)
|
||||
local card_view = NewCardView(btn_card, card_code, i, j)
|
||||
self.card_lists[#self.card_lists + 1] = card_view
|
||||
end
|
||||
end
|
||||
for j=#self.card_lists,1,-1 do
|
||||
for j = #self.card_lists, 1, -1 do
|
||||
local card_view = self.card_lists[j]
|
||||
card_view.btn_card:RemoveFromParent()
|
||||
self._area_handcard_list:AddChild(card_view.btn_card)
|
||||
card_view.btn_card.xy = self:GetHandCardPos(card_view,#pokerList)
|
||||
end
|
||||
card_view.btn_card.xy = self:GetHandCardPos(card_view, #pokerList)
|
||||
end
|
||||
|
||||
if self._player.fz_list~=nil then
|
||||
for i=1,#self._player.fz_list do
|
||||
if self._player.fz_list ~= nil then
|
||||
for i = 1, #self._player.fz_list do
|
||||
if self._player.fz_list[i].type == RB_FZType.Kan then
|
||||
self:UpdateKan(self._player.fz_list[i].card)
|
||||
end
|
||||
|
|
@ -200,279 +186,274 @@ function M:InitHandCard(handcard)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:UpdateHandCards( list )
|
||||
|
||||
function M:UpdateHandCards(list)
|
||||
self.card_lists = {}
|
||||
self._area_handcard_list:RemoveChildren(0,-1,true)
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
local CountCards = {}
|
||||
for i=1,#list do
|
||||
CountCards[list[i].index_X]=CountCards[list[i].index_X] == nil and 1 or CountCards[list[i].index_X] + 1
|
||||
for i = 1, #list do
|
||||
CountCards[list[i].index_X] = CountCards[list[i].index_X] == nil and 1 or CountCards[list[i].index_X] + 1
|
||||
end
|
||||
for i=1,#list do
|
||||
for i = 1, #list do
|
||||
local card_code = list[i].card_item
|
||||
local btn_card =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",card_code)
|
||||
local card_view = NewCardView(btn_card,card_code,list[i].index_X,list[i].index_Y)
|
||||
--存牌堆
|
||||
self.card_lists[#self.card_lists+1] =card_view
|
||||
local btn_card = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais")
|
||||
btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", card_code)
|
||||
local card_view = NewCardView(btn_card, card_code, list[i].index_X, list[i].index_Y)
|
||||
--存牌堆
|
||||
self.card_lists[#self.card_lists + 1] = card_view
|
||||
end
|
||||
for j=#self.card_lists,1,-1 do
|
||||
for j = #self.card_lists, 1, -1 do
|
||||
local card_view = self.card_lists[j]
|
||||
card_view.btn_card:RemoveFromParent()
|
||||
self._area_handcard_list:AddChild(card_view.btn_card)
|
||||
card_view.btn_card.xy = self:GetHandCardPos(card_view,#CountCards)
|
||||
end
|
||||
|
||||
card_view.btn_card.xy = self:GetHandCardPos(card_view, #CountCards)
|
||||
end
|
||||
end
|
||||
|
||||
--牌位置
|
||||
function M:GetHandCardPos(cards_view,cards)
|
||||
local x,y = 0,0
|
||||
local card_width = 42 -- 牌的宽度
|
||||
function M:GetHandCardPos(cards_view, cards)
|
||||
local x, y = 0, 0
|
||||
local card_width = 42 -- 牌的宽度
|
||||
local middle_x = self._area_handcard_list.width / 2
|
||||
local start_x = middle_x - (cards / 2 * (card_width))
|
||||
x = start_x + (card_width) * (cards_view.index_X - 1)
|
||||
y = 0 - (42*cards_view.index_Y)
|
||||
return Vector2.New(x,y)
|
||||
local start_x = middle_x - (cards / 2 * (card_width))
|
||||
x = start_x + (card_width) * (cards_view.index_X - 1)
|
||||
y = 0 - (42 * cards_view.index_Y)
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:UpdateOutCardList(outcard)
|
||||
printlog("UpdateOutCardList2222")
|
||||
self._area_outcard_list:RemoveChildren(0,-1,true)
|
||||
local outcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
if outcard==0 then
|
||||
outcards:GetChild("icon").icon ="ui://Main_RunBeard/201_1_300"
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
if outcard == 0 then
|
||||
outcards:GetChild("icon").icon = "ui://Main_RunBeard/201_1_300"
|
||||
else
|
||||
outcards:GetChild("icon").icon =self:getCardItem("ui://Main_RunBeard/203_",outcard)
|
||||
outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", outcard)
|
||||
end
|
||||
outcards.x,outcards.y = 0,0
|
||||
outcards.x, outcards.y = 0, 0
|
||||
self._area_outcard_list:AddChild(outcards)
|
||||
-- self._bgview.selectedIndex=1
|
||||
-- self._bgview.selectedIndex=1
|
||||
end
|
||||
|
||||
--摸牌动画
|
||||
function M:PlayingOutCardAnima(card)
|
||||
if(self._area_outcard_list ~=nil and self._area_outcard_list.numChildren>0)then
|
||||
self._area_outcard_list:GetChildAt(0):GetChild("icon").icon =self:getCardItem("ui://Main_RunBeard/202_",card)
|
||||
self._view:GetTransition("t0"):Play()
|
||||
function M:PlayingOutCardAnima(card, seat)
|
||||
local outcards = self._area_outcard_list:GetChildAt(0)
|
||||
if not outcards then
|
||||
local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
local show_di_bg = outcards:GetChild("show_di_bg")
|
||||
show_di_bg.visible = false
|
||||
self._area_outcard_list:AddChild(outcards)
|
||||
end
|
||||
coroutine.start(function()
|
||||
coroutine.wait(0.1)
|
||||
self:ClearOutCard()
|
||||
end)
|
||||
--
|
||||
outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", card)
|
||||
outcards:GetTransition("qipai" .. seat):Play()
|
||||
end
|
||||
|
||||
|
||||
--摆牌规则
|
||||
function M:PendulumRule(handcard)
|
||||
local room = DataManager.CurrenRoom
|
||||
local card_list = handcard
|
||||
local card_count = #card_list
|
||||
local cards_map = {}
|
||||
local CountCards = {}
|
||||
for i=1,#card_list do
|
||||
CountCards[card_list[i]]= CountCards[card_list[i]] == nil and 1 or CountCards[card_list[i]] + 1
|
||||
end
|
||||
--find4
|
||||
for k,v in pairs(CountCards) do
|
||||
if (v == 4) then
|
||||
local room = DataManager.CurrenRoom
|
||||
local card_list = handcard
|
||||
local card_count = #card_list
|
||||
local cards_map = {}
|
||||
local CountCards = {}
|
||||
for i = 1, #card_list do
|
||||
CountCards[card_list[i]] = CountCards[card_list[i]] == nil and 1 or CountCards[card_list[i]] + 1
|
||||
end
|
||||
--find4
|
||||
for k, v in pairs(CountCards) do
|
||||
if (v == 4) then
|
||||
local cs = {}
|
||||
cs[1]= k
|
||||
cs[2]= k
|
||||
cs[3]= k
|
||||
cs[4]= k
|
||||
cards_map[#cards_map+1]=cs
|
||||
cs[1] = k
|
||||
cs[2] = k
|
||||
cs[3] = k
|
||||
cs[4] = k
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[k] = 0
|
||||
card_count =card_count- 4
|
||||
card_count = card_count - 4
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--find3
|
||||
for k,v in pairs(CountCards) do
|
||||
--find3
|
||||
for k, v in pairs(CountCards) do
|
||||
if (v >= 3) then
|
||||
local cs = {}
|
||||
cs[1]= k
|
||||
cs[2]= k
|
||||
cs[3]= k
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[k] = CountCards[k] -3
|
||||
card_count =card_count- 3
|
||||
cs[1] = k
|
||||
cs[2] = k
|
||||
cs[3] = k
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[k] = CountCards[k] - 3
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
--find AAa
|
||||
for i = 201, 210 do
|
||||
if CountCards[i]~=nil and CountCards[i] >= 2 then
|
||||
if CountCards[i-100]~=nil and CountCards[i-100] == 1 then
|
||||
--find AAa
|
||||
for i = 201, 210 do
|
||||
if CountCards[i] ~= nil and CountCards[i] >= 2 then
|
||||
if CountCards[i - 100] ~= nil and CountCards[i - 100] == 1 then
|
||||
local cs = {}
|
||||
cs[1]= i
|
||||
cs[2]= i
|
||||
cs[3]= i-100
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[i] = CountCards[i]- 2;
|
||||
CountCards[i - 100] = CountCards[i - 100]-1
|
||||
card_count = card_count-3
|
||||
cs[1] = i
|
||||
cs[2] = i
|
||||
cs[3] = i - 100
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[i] = CountCards[i] - 2;
|
||||
CountCards[i - 100] = CountCards[i - 100] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
end
|
||||
--find aaA
|
||||
for i = 101, 110 do
|
||||
if CountCards[i]~=nil and (CountCards[i] >= 2) then
|
||||
if CountCards[i + 100]~=nil and (CountCards[i + 100] == 1) then
|
||||
end
|
||||
--find aaA
|
||||
for i = 101, 110 do
|
||||
if CountCards[i] ~= nil and (CountCards[i] >= 2) then
|
||||
if CountCards[i + 100] ~= nil and (CountCards[i + 100] == 1) then
|
||||
local cs = {}
|
||||
cs[1]= i
|
||||
cs[2]= i
|
||||
cs[3]= i+100
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[i] = CountCards[i]- 2;
|
||||
CountCards[i +100] = CountCards[i +100] - 1
|
||||
card_count = card_count-3
|
||||
cs[1] = i
|
||||
cs[2] = i
|
||||
cs[3] = i + 100
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[i] = CountCards[i] - 2;
|
||||
CountCards[i + 100] = CountCards[i + 100] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--find2
|
||||
for k,v in pairs(CountCards) do
|
||||
for k, v in pairs(CountCards) do
|
||||
if (v >= 2) then
|
||||
local cs = {}
|
||||
cs[1] = k
|
||||
cs[2] = k
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[k] = CountCards[k] - 2
|
||||
card_count =card_count- 2
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[k] = CountCards[k] - 2
|
||||
card_count = card_count - 2
|
||||
end
|
||||
end
|
||||
--find 小 2 7 10
|
||||
local counta = CountCards[102]
|
||||
if counta ~=nil and counta>0 then
|
||||
for i=1,counta do
|
||||
if CountCards[102]~=nil and CountCards[107]~=nil and CountCards[110]~=nil and CountCards[102] >0 and CountCards[107] >0 and CountCards[110] >0 then
|
||||
local cs = {}
|
||||
cs[1]= 102
|
||||
cs[2]= 107
|
||||
cs[3]= 110
|
||||
cards_map[#cards_map+1] = cs
|
||||
CountCards[102] = CountCards[102]-1
|
||||
CountCards[107] = CountCards[107]-1
|
||||
CountCards[110] = CountCards[110]-1
|
||||
card_count = card_count - 3
|
||||
if counta ~= nil and counta > 0 then
|
||||
for i = 1, counta do
|
||||
if CountCards[102] ~= nil and CountCards[107] ~= nil and CountCards[110] ~= nil and CountCards[102] > 0 and CountCards[107] > 0 and CountCards[110] > 0 then
|
||||
local cs = {}
|
||||
cs[1] = 102
|
||||
cs[2] = 107
|
||||
cs[3] = 110
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[102] = CountCards[102] - 1
|
||||
CountCards[107] = CountCards[107] - 1
|
||||
CountCards[110] = CountCards[110] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--find 大 2 7 10
|
||||
local countA = CountCards[202]
|
||||
if countA ~=nil and countA>0 then
|
||||
for i=1,countA do
|
||||
if CountCards[202]~=nil and CountCards[207]~=nil and CountCards[210]~=nil and CountCards[202] >0 and CountCards[207] >0 and CountCards[210] >0 then
|
||||
local cs = {}
|
||||
cs[1]= 202
|
||||
cs[2]= 207
|
||||
cs[3]= 210
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[202] = CountCards[202]-1
|
||||
CountCards[207] = CountCards[207]-1
|
||||
CountCards[210] = CountCards[210]-1
|
||||
card_count = card_count - 3
|
||||
if countA ~= nil and countA > 0 then
|
||||
for i = 1, countA do
|
||||
if CountCards[202] ~= nil and CountCards[207] ~= nil and CountCards[210] ~= nil and CountCards[202] > 0 and CountCards[207] > 0 and CountCards[210] > 0 then
|
||||
local cs = {}
|
||||
cs[1] = 202
|
||||
cs[2] = 207
|
||||
cs[3] = 210
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[202] = CountCards[202] - 1
|
||||
CountCards[207] = CountCards[207] - 1
|
||||
CountCards[210] = CountCards[210] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--find abc
|
||||
for i=101,110 do
|
||||
if (CountCards[i] ~=nil and CountCards[i + 1] ~=nil and CountCards[i + 2] ~=nil) and (CountCards[i] > 0 and CountCards[i + 1] > 0 and CountCards[i + 2] > 0) then
|
||||
local cs = {}
|
||||
cs[1]= i
|
||||
cs[2]= i+1
|
||||
cs[3]= i+2
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[i] = CountCards[i]-1
|
||||
CountCards[i+1] = CountCards[i+1]-1
|
||||
CountCards[i+2] = CountCards[i+2]-1
|
||||
card_count = card_count - 3
|
||||
for i = 101, 110 do
|
||||
if (CountCards[i] ~= nil and CountCards[i + 1] ~= nil and CountCards[i + 2] ~= nil) and (CountCards[i] > 0 and CountCards[i + 1] > 0 and CountCards[i + 2] > 0) then
|
||||
local cs = {}
|
||||
cs[1] = i
|
||||
cs[2] = i + 1
|
||||
cs[3] = i + 2
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[i] = CountCards[i] - 1
|
||||
CountCards[i + 1] = CountCards[i + 1] - 1
|
||||
CountCards[i + 2] = CountCards[i + 2] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
end
|
||||
--find ABC
|
||||
for i=201,210 do
|
||||
if (CountCards[i] ~=nil and CountCards[i + 1] ~=nil and CountCards[i + 2] ~=nil) and (CountCards[i] > 0 and CountCards[i + 1] > 0 and CountCards[i + 2] > 0) then
|
||||
local cs = {}
|
||||
cs[1]= i
|
||||
cs[2]= i+1
|
||||
cs[3]= i+2
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[i] = CountCards[i]-1
|
||||
CountCards[i+1] = CountCards[i+1]-1
|
||||
CountCards[i+2] = CountCards[i+2]-1
|
||||
card_count = card_count - 3
|
||||
for i = 201, 210 do
|
||||
if (CountCards[i] ~= nil and CountCards[i + 1] ~= nil and CountCards[i + 2] ~= nil) and (CountCards[i] > 0 and CountCards[i + 1] > 0 and CountCards[i + 2] > 0) then
|
||||
local cs = {}
|
||||
cs[1] = i
|
||||
cs[2] = i + 1
|
||||
cs[3] = i + 2
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[i] = CountCards[i] - 1
|
||||
CountCards[i + 1] = CountCards[i + 1] - 1
|
||||
CountCards[i + 2] = CountCards[i + 2] - 1
|
||||
card_count = card_count - 3
|
||||
end
|
||||
end
|
||||
--find Aa
|
||||
for i = 201, 210 do
|
||||
if CountCards[i]~=nil and CountCards[i] == 1 then
|
||||
if CountCards[i-100]~=nil and CountCards[i-100] == 1 then
|
||||
end
|
||||
--find Aa
|
||||
for i = 201, 210 do
|
||||
if CountCards[i] ~= nil and CountCards[i] == 1 then
|
||||
if CountCards[i - 100] ~= nil and CountCards[i - 100] == 1 then
|
||||
local cs = {}
|
||||
cs[1]= i
|
||||
cs[2]= i-100
|
||||
cards_map[#cards_map+1]=cs
|
||||
CountCards[i] = CountCards[i]- 1;
|
||||
CountCards[i - 100] = CountCards[i - 100]-1
|
||||
card_count = card_count-2
|
||||
cs[1] = i
|
||||
cs[2] = i - 100
|
||||
cards_map[#cards_map + 1] = cs
|
||||
CountCards[i] = CountCards[i] - 1;
|
||||
CountCards[i - 100] = CountCards[i - 100] - 1
|
||||
card_count = card_count - 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local r_count = 9 - #cards_map
|
||||
local merge = false
|
||||
merge = r_count<card_count
|
||||
merge = r_count < card_count
|
||||
local singleList = {}
|
||||
--find else
|
||||
--find else
|
||||
|
||||
for k,v in pairs(CountCards) do
|
||||
for k, v in pairs(CountCards) do
|
||||
if (v == 1) then
|
||||
singleList[#singleList+1] = k
|
||||
CountCards[k] = CountCards[k] -1
|
||||
|
||||
singleList[#singleList + 1] = k
|
||||
CountCards[k] = CountCards[k] - 1
|
||||
end
|
||||
end
|
||||
local index = 0
|
||||
if merge then index = 3 else index=1 end
|
||||
for i=1,#singleList,index do
|
||||
local cs ={}
|
||||
if merge then index = 3 else index = 1 end
|
||||
for i = 1, #singleList, index do
|
||||
local cs = {}
|
||||
if merge then
|
||||
cs[#cs+1] = singleList[i]
|
||||
if i < #singleList then cs[#cs+1] = singleList[i+1] end
|
||||
if i < #singleList - 1 then cs[#cs+1] = singleList[i+2] end
|
||||
cards_map[#cards_map + 1]=cs
|
||||
cs[#cs + 1] = singleList[i]
|
||||
if i < #singleList then cs[#cs + 1] = singleList[i + 1] end
|
||||
if i < #singleList - 1 then cs[#cs + 1] = singleList[i + 2] end
|
||||
cards_map[#cards_map + 1] = cs
|
||||
else
|
||||
cs[#cs+1] = singleList[i]
|
||||
cards_map[#cards_map + 1]=cs
|
||||
cs[#cs + 1] = singleList[i]
|
||||
cards_map[#cards_map + 1] = cs
|
||||
end
|
||||
end
|
||||
--变成9列--这里牌多了也不会报错了
|
||||
for i=9 ,1,-1 do
|
||||
for j = #cards_map , 9,-1 do
|
||||
for i = 9, 1, -1 do
|
||||
for j = #cards_map, 9, -1 do
|
||||
if #cards_map[i] < 3 then
|
||||
cards_map[i][#cards_map[i]+1] = cards_map[j][1]
|
||||
list_remove(cards_map[j],cards_map[j][1])
|
||||
cards_map[i][#cards_map[i] + 1] = cards_map[j][1]
|
||||
list_remove(cards_map[j], cards_map[j][1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return cards_map
|
||||
|
||||
end
|
||||
function M:getCardItem( card_1,card_2 )
|
||||
if self._room.change_card_display ~=nil then
|
||||
return card_1..self._room.change_card_display..card_2
|
||||
|
||||
function M:getCardItem(card_1, card_2)
|
||||
if self._room.change_card_display ~= nil then
|
||||
return card_1 .. self._room.change_card_display .. card_2
|
||||
else
|
||||
return card_1.."6_"..card_2
|
||||
return card_1 .. "6_" .. card_2
|
||||
end
|
||||
end
|
||||
|
||||
function M:GetFzMove()
|
||||
return self._view:LocalToGlobal(Vector2.New(0, self._area_fz_list.height / 2))
|
||||
end
|
||||
|
||||
return M
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -63,11 +63,13 @@ function M:init()
|
|||
-- self._bgview = view:GetController("bgview")
|
||||
self._area_fz_list = view:GetChild('area_fz_list')
|
||||
self._area_qipai_list = view:GetChild('windcard_list')
|
||||
self._view_outLine = view:GetChild('n38')
|
||||
self._mask_liangpai = view:GetChild('mask_liangpai')
|
||||
UIPackage.AddPackage('base/main_zipai/ui/Main_RunBeard')
|
||||
self.ctr_piao = self._view:GetController('piao')
|
||||
self.ctr_niao = self._view:GetController('niao')
|
||||
self.ctr_piao_value = self._view:GetController('piaovalue')
|
||||
self:UpdateOutLine()
|
||||
self:BtnEvent()
|
||||
end
|
||||
|
||||
|
|
@ -344,7 +346,6 @@ function M:banHandCards(list)
|
|||
--printlog("---禁所有手牌----")
|
||||
for i = 1, #list do
|
||||
local card_code = list[i].card_item
|
||||
pt(card_code)
|
||||
-- local btn_card = UIPackage.CreateObjectFromURL('ui://Main_RunBeard/Btn_Card')
|
||||
-- btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_code)
|
||||
-- btn_card:GetChild('icon'):SetScale(self:getCardSize(), self:getCardSize())
|
||||
|
|
@ -485,6 +486,7 @@ function M:UpdateCardDisplay()
|
|||
self._area_handcard_list:AddChild(card_view.btn_card)
|
||||
-- card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3)
|
||||
end
|
||||
self:UpdateOutLine()
|
||||
self:UpdateHandCardsPos()
|
||||
end
|
||||
|
||||
|
|
@ -507,9 +509,21 @@ function M:UpdateCardSize()
|
|||
self._area_handcard_list:AddChild(card_view.btn_card)
|
||||
-- card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3)
|
||||
end
|
||||
self:UpdateOutLine()
|
||||
self:UpdateHandCardsPos()
|
||||
end
|
||||
|
||||
function M:UpdateOutLine()
|
||||
if self:getCardSize() == 1.3 then
|
||||
self._data_outLinePos = 90 - (119 * 4)
|
||||
elseif self:getCardSize() == 1.2 then
|
||||
self._data_outLinePos = 90 - (110 * 4)
|
||||
elseif self:getCardSize() == 0.8 then
|
||||
self._data_outLinePos = 100 - (85 * 4)
|
||||
end
|
||||
self._view_outLine.y = self._data_outLinePos + self._area_handcard_list.height
|
||||
end
|
||||
|
||||
function M:UpdateIsOnClick(isOut)
|
||||
self._view.touchable = isOut
|
||||
end
|
||||
|
|
@ -768,9 +782,7 @@ end
|
|||
--计算手牌位置
|
||||
function M:GetHandCardPos(cards_view, cards)
|
||||
local x, y = 0, 0
|
||||
print("lingmeng change_card_display", card_width)
|
||||
local card_width = self.card_width - (self._room.change_card_display == "8_" and -2 or 5) -- 牌的宽度
|
||||
print("lingmeng change_card_display", self.card_width, self._room.change_card_display == "8_", card_width)
|
||||
|
||||
local middle_x = self._area_handcard_list.width / 2
|
||||
local start_x = middle_x - (cards / 2 * (card_width))
|
||||
|
|
@ -783,7 +795,7 @@ function M:GetHandCardPos(cards_view, cards)
|
|||
elseif self:getCardSize() == 1.2 then
|
||||
y = 90 - (110 * cards_view.index_Y)
|
||||
elseif self:getCardSize() == 0.8 then
|
||||
y = 100 - (65 * cards_view.index_Y)
|
||||
y = 100 - (85 * cards_view.index_Y)
|
||||
end
|
||||
return Vector2.New(x, y)
|
||||
end
|
||||
|
|
@ -897,18 +909,16 @@ function M:UpdateQiPai(qi_list)
|
|||
end
|
||||
|
||||
--摸牌动画
|
||||
function M:PlayingOutCardAnima(card)
|
||||
if (self._area_outcard_list ~= nil and self._area_outcard_list.numChildren > 0) then
|
||||
self._area_outcard_list:GetChildAt(0):GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/202_', card)
|
||||
self._view:GetTransition('t0'):Play()
|
||||
function M:PlayingOutCardAnima(card, seat)
|
||||
local outcards = self._area_outcard_list:GetChildAt(0)
|
||||
if not outcards then
|
||||
local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard")
|
||||
local show_di_bg = outcards:GetChild("show_di_bg")
|
||||
show_di_bg.visible = false
|
||||
self._area_outcard_list:AddChild(outcards)
|
||||
end
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(0.1)
|
||||
-- self._bgview.selectedIndex = 1
|
||||
self:ClearOutCard()
|
||||
end
|
||||
)
|
||||
outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", card)
|
||||
outcards:GetTransition("qipai" .. seat):Play()
|
||||
end
|
||||
|
||||
--得到设置的牌字体
|
||||
|
|
@ -929,4 +939,13 @@ function M:getCardSize()
|
|||
end
|
||||
end
|
||||
|
||||
function M:GetFzMove()
|
||||
if #self.card_list then
|
||||
local fristCard = self.card_list[1].btn_card
|
||||
return self._area_handcard_list:LocalToGlobal(fristCard.xy)
|
||||
else
|
||||
return self._area_fz_list:LocalToGlobal(Vector2.New(0, self._area_fz_list.height / 2))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -14,115 +14,119 @@ local FrameTimer = FrameTimer
|
|||
local CoTimer = CoTimer
|
||||
|
||||
local comap = {}
|
||||
setmetatable(comap, {__mode = "kv"})
|
||||
setmetatable(comap, { __mode = "kv" })
|
||||
|
||||
function coroutine.start(f, ...)
|
||||
function coroutine.start(f, ...)
|
||||
local co = create(f)
|
||||
|
||||
|
||||
if running() == nil then
|
||||
local flag, msg = resume(co, ...)
|
||||
|
||||
if not flag then
|
||||
|
||||
if not flag then
|
||||
error(debug.traceback(co, msg))
|
||||
end
|
||||
else
|
||||
local args = {...}
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
local flag, msg = resume(co, unpack(args))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
local args = { ... }
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
local flag, msg = resume(co, unpack(args))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
end
|
||||
end
|
||||
|
||||
timer = FrameTimer.New(action, 0, 1)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
timer:Start()
|
||||
end
|
||||
|
||||
return co
|
||||
end
|
||||
|
||||
function coroutine.wait(t, co, ...)
|
||||
local args = {...}
|
||||
co = co or running()
|
||||
local args = { ... }
|
||||
co = co or running()
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
|
||||
local action = function()
|
||||
local flag, msg = resume(co, unpack(args))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
timer = CoTimer.New(action, t, 1)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
return yield()
|
||||
end
|
||||
|
||||
function coroutine.step(t, co, ...)
|
||||
local args = {...}
|
||||
co = co or running()
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
local flag, msg = resume(co, unpack(args))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
timer = FrameTimer.New(action, t or 1, 1)
|
||||
timer = CoTimer.New(action, t, 1)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
return yield()
|
||||
end
|
||||
|
||||
function coroutine.www(www, co)
|
||||
co = co or running()
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
if not www.isDone then
|
||||
return
|
||||
end
|
||||
|
||||
timer:Stop()
|
||||
local flag, msg = resume(co)
|
||||
|
||||
if not flag then
|
||||
error(debug.traceback(co, msg))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
timer = FrameTimer.New(action, 1, -1)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
return yield()
|
||||
function coroutine.step(t, co, ...)
|
||||
local args = { ... }
|
||||
print("lingmeng incon1", t, co)
|
||||
co = co or running()
|
||||
print("lingmeng incon2", t, co)
|
||||
local timer = nil
|
||||
print("lingmeng incon3", t, co)
|
||||
local action = function()
|
||||
local flag, msg = resume(co, unpack(args))
|
||||
|
||||
if not flag then
|
||||
timer:Stop()
|
||||
error(debug.traceback(co, msg))
|
||||
return
|
||||
end
|
||||
end
|
||||
print("lingmeng incon4", t, co)
|
||||
timer = FrameTimer.New(action, t or 1, 1)
|
||||
print("lingmeng incon5", t, co)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
print("lingmeng incon6", t, co)
|
||||
return yield()
|
||||
end
|
||||
|
||||
function coroutine.www(www, co)
|
||||
co = co or running()
|
||||
local timer = nil
|
||||
|
||||
local action = function()
|
||||
if not www.isDone then
|
||||
return
|
||||
end
|
||||
|
||||
timer:Stop()
|
||||
local flag, msg = resume(co)
|
||||
|
||||
if not flag then
|
||||
error(debug.traceback(co, msg))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
timer = FrameTimer.New(action, 1, -1)
|
||||
comap[co] = timer
|
||||
timer:Start()
|
||||
return yield()
|
||||
end
|
||||
|
||||
function coroutine.stop(co)
|
||||
local timer = comap[co]
|
||||
local timer = comap[co]
|
||||
|
||||
if timer ~= nil then
|
||||
comap[co] = nil
|
||||
timer:Stop()
|
||||
end
|
||||
if timer ~= nil then
|
||||
comap[co] = nil
|
||||
timer:Stop()
|
||||
end
|
||||
end
|
||||
|
||||
function coroutine.stopAll()
|
||||
for k,v in pairs(comap) do
|
||||
for k, v in pairs(comap) do
|
||||
coroutine.stop(k)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 969 KiB After Width: | Height: | Size: 1.1 MiB |
|
|
@ -1,3 +1,8 @@
|
|||
{
|
||||
"objectStatus": {
|
||||
"n45_j34t": {
|
||||
"collapsed": true
|
||||
}
|
||||
},
|
||||
"fitScreen": "FitSize"
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
"objectStatus": {
|
||||
"n36_k3io": {
|
||||
"collapsed": true
|
||||
},
|
||||
"n34_k3io": {
|
||||
"hidden": true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,34 +10,26 @@
|
|||
"doc.openedDocs": [
|
||||
"ui://v6yvqp7wyfzf1h4",
|
||||
"ui://v6yvqp7wcyprwq",
|
||||
"ui://ppu1wv7699we8b",
|
||||
"ui://v6yvqp7wf55qwa",
|
||||
"ui://v6yvqp7wfgao1dn",
|
||||
"ui://v6yvqp7wvoqg1dy",
|
||||
"ui://v6yvqp7wlvh412c"
|
||||
],
|
||||
"test.device": "720p Phone",
|
||||
"canvasColor": 10066329,
|
||||
"auxline2": true,
|
||||
"doc.activeDoc": "ui://v6yvqp7wcyprwq",
|
||||
"doc.activeDoc": "ui://v6yvqp7wfgao1dn",
|
||||
"libview.twoColumn": false,
|
||||
"libview.expandedNodes": [
|
||||
"v6yvqp7w",
|
||||
"/",
|
||||
"v6yvqp7w",
|
||||
"/component/",
|
||||
"v6yvqp7w",
|
||||
"/component/cards/",
|
||||
"v6yvqp7w",
|
||||
"/component/option/",
|
||||
"v6yvqp7w",
|
||||
"/component/option/component/",
|
||||
"v6yvqp7w",
|
||||
"/component/option/component/card/",
|
||||
"v6yvqp7w",
|
||||
"/image/",
|
||||
"v6yvqp7w",
|
||||
"/images/",
|
||||
"v6yvqp7w",
|
||||
"/images/cards6/",
|
||||
"/images/cards8/",
|
||||
"v6yvqp7w",
|
||||
"/images/cards8/"
|
||||
"/images/clearing/"
|
||||
],
|
||||
"auxline1": true,
|
||||
"snapToGrid": true,
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |