cocos2d-x技术群新群:117871561
c++技术交流群:593010226
--识别动作掩码
function GameViewLayer:recognizecbActionMask(cbActionMask, cbCardData, bOnSubOperate)
print("收到提示操作:", cbActionMask, cbCardData)
if cbActionMask == GameLogic.WIK_NULL or cbActionMask == 32 then
-- assert("false")
self._cbActionMask = 0
self.spGameBtn:setVisible(false)
return false
end
self._scene:autoWin(cbActionMask,cbCardData) then
self._cbActionMask = cbActionMask
local showButtonsTag = {}
if cbCardData then
self.cbActionCard = cbCardData
end
if cbActionMask >= 128 then --放炮
cbActionMask = cbActionMask - 128
self.spGameBtn:getChildByTag(GameViewLayer.BT_WIN)
:setEnabled(true)
end
if cbActionMask >= 64 then --胡
cbActionMask = cbActionMask - 64
showButtonsTag[GameViewLayer.BT_WIN] = true
end
if cbActionMask >= 32 then --听
cbActionMask = cbActionMask - 32
end
if cbActionMask >= 16 then --杠
cbActionMask = cbActionMask - 16
showButtonsTag[GameViewLayer.BT_BRIGDE] = true
end
if cbActionMask >= 8 then --碰
cbActionMask = cbActionMask - 8
showButtonsTag[GameViewLayer.BT_BUMP] = true
end
if cbActionMask > 0 then -- 吃
showButtonsTag[GameViewLayer.BT_CHI] = true
self._cardLayer:showChiTips(cbActionMask,self.cbActionCard)
self._chiActionMask = cbActionMask
end
self._scene:SetGameOperateClock()
local dx = 246
showButtonsTag[GameViewLayer.BT_PASS] = true
local count = table.nums(showButtonsTag)
local len = dx * (count - 1)
local startX = display.cx - len / 2
local y = 85
self.spGameBtn:setVisible(true):setLocalZOrder(4)
for i=GameViewLayer.BT_CHI,GameViewLayer.BT_PASS do
if i ~= GameViewLayer.BT_LISTEN then
self.spGameBtn:getChildByTag(i)
:setVisible(showButtonsTag[i])
:move(startX,y)
if showButtonsTag[i] then
startX = startX + dx
end
end
end
return true
end
网友评论