Files
wnmj-normal/Classes/Games/SparrowBase/SparrowCardBase.h
2026-03-03 13:56:44 +08:00

59 lines
1.4 KiB
C++

/************************************************************************/
/* 麻将单例,获取麻将资源 */
/************************************************************************/
#pragma once
#include "cocos2d.h"
#include "ui/CocosGUI.h"
#include "Define.h"
USING_NS_CC;
using namespace ui;
using namespace std;
//////////////////////////////////////////////////////////////////////////
enum EN_SPARROW_TYPE
{
SP_NULL = -1, //初始牌
SP_OPPSTAND = 0, //对家站立牌
SP_RSTAND, //右站立的牌
SP_SELFSTAND, //自己站立的牌
SP_LSTAND, //左站立的牌
SP_O_OUT, //对家出牌(精牌,结束牌都用)
SP_R_OUT, //右家出牌
SP_S_OUT, //自己出牌
SP_L_OUT, //左家出牌
SP_ENDCARD,
SP_SELF_SHOW, //自己摊牌
};
//////////////////////////////////////////////////////////////////////////
// 麻将控件
class SparrowCardBase : public Node
{
CREATE_SINGLETON_MUTEX_CLEAR(SparrowCardBase, s_pInstance, nullptr);
private:
static SparrowCardBase *s_pInstance;
private:
virtual bool init();
virtual void clear();
virtual void onExit(); // 场景退出回调
public:
ImageView* GetSparrowCard(EN_SPARROW_TYPE sptype); // 根据类型获取麻将牌
// 子元素
public:
Node* m_pRootNode; // 根节点
ImageView* m_HandCard[4]; // 手牌节点
ImageView* m_OutCard[4]; // 丢弃牌节点
ImageView* m_SelfShowCard;
};