
DaerPokerClass={
       daer_value    =0,
       poker_scale    =0,
       poker_info     ={},
       m_player       =nil,
       frantSp        =nil,
       m_CanClicke    =false,
       m_offx         =0,
       m_offy         =0,
       daer_derectiom =nil,
       daer_type      =nil,
       weizhi_x       =0,
       weizhi_y       =0,
       m_isOutChuPai  =0,
       m_isNotChu   =false,
       m_xuanzhong  =false,
}

DaerPokerClass.__index  =DaerPokerClass

function DaerPokerClass:Create( p ,daer_value,daer_type,isCanClicke,scale)
    local self = {}
    setmetatable(self, DaerPokerClass)
    if not p then return end
    self.m_pokelayer  =p
    self.frantSp      =nil 
    self.poker_scale  = scale or 1
    self.daer_value  =daer_value or 0
    self.m_CanClicke  =isCanClicke  or   false
    self.daer_derectiom =daer_derectiom
    self.daer_type   =daer_type
    self.cPos   =cPos  or 1
    self.m_offx=0
    self.m_offy=0
    self.m_zoerod =1
    self.weizhi_x =1
    self.weizhi_y =1
    self.m_isOutChuPai= false
    self.m_CanMove  =true
    self.m_isNotChu  =false
    self.m_isNeedChu   =false

    local daer_res = self:GetPokerResName(self.daer_value,self.daer_type,self.cPos)
    self.m_player =cc.NodeRGBA:create()--cc.LayerColor:create(cc.c4b(200,2,200,120))--
    p:addChild(self.m_player)
    self.frantSp =xui.addSprite(self.m_player,daer_res,0,0,sys.ap.leftBottom)
    self.frantSp:setScale(self.poker_scale)
    if  self.m_CanClicke then
        self.m_player:setContentSize({width=86,height=80})
        --CCLOG("self.m_CanClicke")
        self.frantSp:setPositionY(88-150)
    else
        self.m_player:setContentSize(self.frantSp:getContentSize())
    end
    return  self
end
--得到res 
function DaerPokerClass:GetPokerResName( daer_value,daer_type,cPos )
    local resName =nil

    if daer_type =="shou"  then
        resName = "daer_pai_big_"..daer_value
       --resName = "daer_pai_big_"..14
    elseif daer_type =="da"  then
        resName = "daer_pai_small_xiao"..daer_value
        --resName = "daer_pai_small_xiao"..18
    elseif daer_type =="bei" then
        resName="daer_pai_bei"
    elseif daer_type=="myshou" then
        resName="eqs_pai_centre_"..daer_value
    elseif  daer_type=="long" then
        resName="bzcp_xiao_bei"
    end
    if not resName  then CCLOG("资源名字错误",daer_value) return end
    --CCLOG("resName",resName)
    return resName
end
--跟新资源
function DaerPokerClass:UpDatefrantSp( daer_value,cPos )
    local resName =nil
    if not daer_value then return end
    resName="daer_pai_big_"..daer_value
    if self.frantSp then 
       self.daer_type ="shou"
       if cPos  and cPos ==1 then
          resName="eqs_pai_centre_"..daer_value
          self.daer_type ="myshou"
       end
       self.frantSp:setSpriteFrame(resName)
    end
end
function DaerPokerClass:SetChangColor( isCan )
    local color =sys.colors.white
    --self.m_CanMove =true
    if isCan then
        color =sys.creColor3(255,239,162)
        --self.m_CanMove =false
    end
    if self.m_isNotChu then
        color =sys.creColor3(125,125,125)
    end
    if self.frantSp then
        self.frantSp:setColor(color)
    end
end

