65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
|
|
#ifndef __DDZ_HandCardLayer__
|
|
#define __DDZ_HandCardLayer__
|
|
|
|
#include "DDZ_BigCardSprite.h"
|
|
|
|
class DDZHandCardLayer : public LayerColor
|
|
{
|
|
public:
|
|
DDZHandCardLayer();
|
|
virtual ~DDZHandCardLayer();
|
|
|
|
static DDZHandCardLayer* create(Size csParentSize, const std::function<void(uint8*, uint8)>& fnCallback);
|
|
|
|
virtual bool init(Size csParentSize, const std::function<void(uint8*, uint8)>& fnCallback);
|
|
virtual void onEnter();
|
|
virtual void onExit();
|
|
|
|
virtual bool onTouchBegan(Touch *pTouch, Event *pEvent);
|
|
virtual void onTouchEnded(Touch *pTouch, Event *pEvent);
|
|
virtual void onTouchMoved(Touch *pTouch, Event *pEvent);
|
|
void setChooseCardCallback(const std::function<void(uint8*, uint8)>& fnCallback) { _fnDoUserChooseCard = fnCallback; }
|
|
|
|
public:
|
|
//初始数据
|
|
void initUIData();
|
|
//所有牌落下
|
|
void downAllCard();
|
|
//弹起指定牌
|
|
void shootCardData(uint8 cbCardData[DDZ_MAX_COUNT], uint8 cbCardCount);
|
|
//获取弹起的牌
|
|
void getShootCardData(uint8 cbCardData[DDZ_MAX_COUNT], uint8 &cbCardCount);
|
|
|
|
//设置地主
|
|
void setLordMode(bool bLordMode) { _bLordMode = bLordMode; }
|
|
//发牌到面板
|
|
void addSendCard2Panel();
|
|
//显示牌
|
|
void redrawHandCard(uint8 cbCardData[DDZ_MAX_COUNT], uint8 cbCardCount);
|
|
|
|
//获取手牌间距
|
|
uint16 getHandCardSpace(uint8 cbCardCount);
|
|
//获取手牌宽度
|
|
uint16 getHandCardWidth(uint8 cbCardCount);
|
|
|
|
uint8 isInCardSpriteRect(Vec2 ptTouch);
|
|
|
|
void onSelectCardAction(int iEndSelectIndex);
|
|
|
|
bool isInSelectCardIndex(int iIndex, int iEndSelectIndex);
|
|
|
|
private:
|
|
|
|
int _iSentCardCount;
|
|
int _iBeginSelectIndex;
|
|
bool _bLordMode;
|
|
|
|
Size _csParentSize;
|
|
|
|
std::function<void(uint8*, uint8)> _fnDoUserChooseCard;
|
|
std::vector<DDZBigCardSprite *> _vecHandCardArray; //手牌扑克数组
|
|
};
|
|
|
|
#endif /* defined(__HandCardLayer__) */
|