|
- --[[local CardNode = class("CardNode", function()
- return cc.ImageView:create()
- end)--]]
- local PokerUtil = require("zp_doushisi.luaScript.Views.Room.doushisiPokerUtil")
- local DoushisiRoomConfig = require("zp_doushisi.luaScript.Views.Room.doushisiRoomConfig")
- local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
-
- local doushisiQiPaiView = class("doushisiQiPaiView", function ()
- local node = cc.Node:create()
- return node
- end)
-
- function doushisiQiPaiView:ctor(viewId)
- self._viewId = viewId
- self._qiPaiValue = {}
- self._qiPaiNode = {}
- self.littleCardScale = 0.42
- end
-
- function doushisiQiPaiView:addQiPaiCard(card,isShowAni)
- local mSprite = cc.ImageView:createNode()
- mSprite:setScale(self.littleCardScale)
- local finalFileName = PokerUtil.pokerPng(card,ZPDef.CardType.CARD_TYPE_GROUP_OUT)
- mSprite:loadTextureFromPlist(finalFileName)
- mSprite:setVisible(not isShowAni)
- mSprite:setAnchorPoint(cc.p(0,0))
- mSprite.value = card
- self:addChild(mSprite)
- local pos = self:getQiPiaPosition()
- mSprite:setPosition(pos)
- table.insert(self._qiPaiNode,mSprite)
- table.insert(self._qiPaiValue,card)
- end
-
-
-
- function doushisiQiPaiView:getQiPiaPosition()
- local count = table.nums(self._qiPaiValue)
-
- local width = DoushisiRoomConfig.QICARD_WIDTH* self.littleCardScale;
- local height = DoushisiRoomConfig.QICARD_HEIGHT* self.littleCardScale;
-
- local getHeightCount = function (count)
- if count >= 6 then
- return math.floor(count/6)
- else
- return 0
- end
- end
-
- local x = 0
-
- x = count % 6
-
- local tarPos
- if self._viewId == 1 then
- local adjustPos = cc.p(width * x,height * getHeightCount(count))
- tarPos = cc.p(adjustPos.x,0 - adjustPos.y)
- elseif self._viewId == 2 then
- local adjustPos = cc.p(width * x,getHeightCount(count) * height)
- tarPos = cc.p(adjustPos.x,0 - adjustPos.y)
- elseif self._viewId == 3 then
- local adjustPos = cc.p(width * x,height * getHeightCount(count))
- tarPos = cc.p(0 + adjustPos.x,0 - adjustPos.y)
- elseif self._viewId == 4 then
- local adjustPos = cc.p(width * x,height * getHeightCount(count))
- tarPos = cc.p(adjustPos.x,0 - adjustPos.y)
- end
-
- return tarPos
- end
-
-
-
- function doushisiQiPaiView:showAllQiPaiCard()
- for k,v in pairs(self._qiPaiNode) do
- if not tolua.isnull(v) then
- v:setVisible(true)
- end
- end
- end
-
-
- function doushisiQiPaiView:reset()
- self._qiPaiValue = {}
- for k,v in pairs(self._qiPaiNode) do
- if not tolua.isnull(v) then
- v:removeFromParent()
- end
- end
- self._qiPaiNode = {}
- end
-
- return doushisiQiPaiView
|