61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#pragma once
|
||
#include "cocos2d.h"
|
||
#include <vector>
|
||
#include "Types.h"
|
||
|
||
USING_NS_CC;
|
||
using namespace std;
|
||
|
||
#define BombToGun 50 //定义枪和枪火的距离;
|
||
#define FadeOutTime 0.5 //淡出时间;
|
||
#define DanHenPadding 30 //弹痕间距;
|
||
#define GunTime 0.1 //打枪时间;
|
||
|
||
struct tagSSSGunInfo
|
||
{
|
||
Vec2 ptPos; //位置坐标;
|
||
uint16 wViewID; //用户椅子视图;
|
||
uint8 cbGender; //性别;
|
||
int nScore; //积分;
|
||
};
|
||
|
||
struct tagSSSTwoGunInfos
|
||
{
|
||
tagSSSGunInfo* pWinnerInfo;
|
||
tagSSSGunInfo* pLoserInfo;
|
||
bool isPlayed;
|
||
tagSSSTwoGunInfos()
|
||
{
|
||
isPlayed = false;
|
||
pWinnerInfo = NULL;
|
||
pLoserInfo = NULL;
|
||
}
|
||
};
|
||
|
||
//使用此类时,需调用其create方法,然后将其添加进父节点,进而调用showAnimation方法;
|
||
class CGameOverAni : public Node
|
||
{
|
||
public:
|
||
CGameOverAni();
|
||
~CGameOverAni();
|
||
virtual bool init();
|
||
|
||
//根据赢家、输家坐标和椅子号播放打枪动画;
|
||
void showAnimation(const std::function<void(tagSSSTwoGunInfos*)>& fnCallback);
|
||
|
||
void addGunPlay(tagSSSTwoGunInfos* pTwoGunInfo);
|
||
//释放指针;
|
||
bool deleteInfo(tagSSSTwoGunInfos* pInfo);
|
||
bool eraseInfo(int index);
|
||
//判断是否已经存在打枪者和被打枪者,避免重复;
|
||
bool isExist(int winId,int loseId);
|
||
tagSSSTwoGunInfos* getNoPlayInfo();
|
||
CREATE_FUNC(CGameOverAni);
|
||
|
||
private:
|
||
Animation* m_pAnimation;
|
||
bool m_bIsPlaying;
|
||
|
||
vector<tagSSSTwoGunInfos*> m_VecGunInfos;
|
||
};
|