本文整理汇总了C++中CCLabelTTF::getTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelTTF::getTag方法的具体用法?C++ CCLabelTTF::getTag怎么用?C++ CCLabelTTF::getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelTTF
的用法示例。
在下文中一共展示了CCLabelTTF::getTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ccTouchesBegan
void LCCrossMatchGame::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
// 멀티터치 금지
if (singleTouch != NULL)
{
return;
}
CCTouch *touch = (CCTouch*)pTouches->anyObject();
singleTouch = touch;
prevTouchLocation = touch->locationInView( touch->view() );
moveAmount = 0;
m_pTouchedDotSprite = NULL;
for (int i=0; i<m_pDotSprites->count(); i++) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (LCUtil::isTouchInside(dotSprite, pTouches)) {
m_pTouchedDotSprite = dotSprite;
break;
}
}
// image touch 및 text label touch 구역 추가 on 11.10.17
if (!m_pTouchedDotSprite) {
for (int i=0; i<m_pImageArray->count(); i++) {
CCSprite *imageSprite = (CCSprite *)m_pImageArray->objectAtIndex(i);
if (LCUtil::isTouchInside(imageSprite, pTouches)) {
// dotArray에 이미지 부분부터 추가되므로
for (int i=0; i<m_pDotSprites->count(); i++) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (dotSprite->getTag() == imageSprite->getTag()) {
m_pTouchedDotSprite = dotSprite;
break;
}
}
}
}
}
if (!m_pTouchedDotSprite) {
for (int i=0; i<m_pTextArray->count(); i++) {
CCLabelTTF *textLabel = (CCLabelTTF*)m_pTextArray->objectAtIndex(i);
if (LCUtil::isTouchInside(textLabel, pTouches)) {
// dotArray에 이미지 부분부터 추가되므로 뒤에서부터 탐색
for (int i=m_pDotSprites->count()-1; i>=0; i--) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (dotSprite->getTag() == textLabel->getTag()) {
m_pTouchedDotSprite = dotSprite;
break;
}
}
}
}
}
}
示例2: ccTouchesEnded
void LCCrossMatchGame::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
{
if (m_pTouchedDotSprite) {
CCSprite *matchedDotSprite = NULL;
bool isTouchedIncorrectly = false;
// 다른 점을 터치 했는지 체크
for (int i=0; i<m_pDotSprites->count(); i++) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (m_pTouchedDotSprite == dotSprite) {
continue;
}
if (LCUtil::isTouchInside(dotSprite, pTouches)) {
//move dots from dot array to finished dot array
if (dotSprite->getTag() == m_pTouchedDotSprite->getTag()) {
matchedDotSprite = dotSprite;
}else {
isTouchedIncorrectly = true;
}
break;
}
}
// image touch 및 text label touch 구역 추가 on 11.10.17
if (!matchedDotSprite && !isTouchedIncorrectly) {
int index = m_pDotSprites->indexOfObject(m_pTouchedDotSprite);
if (index < m_pDotSprites->count() / 2) {
// 앞쪽에 있는 것은 image 부분에 있는 점 => text부분 터치 체크
for (int i=0; i<m_pTextArray->count(); i++) {
CCLabelTTF *textLabel = (CCLabelTTF*)m_pTextArray->objectAtIndex(i);
if (LCUtil::isTouchInside(textLabel, pTouches)) {
if (textLabel->getTag() == m_pTouchedDotSprite->getTag()) {
// dotArray에 이미지 부분부터 추가되므로 뒤에서부터 탐색
for (int i=m_pDotSprites->count()-1; i>=0; i--) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (dotSprite->getTag() == textLabel->getTag()) {
matchedDotSprite = dotSprite;
break;
}
}
}else {
isTouchedIncorrectly = true;
}
break;
}
}
}
else {
// 뒤쪽에 있는 것은 text부분에 있는 점 => image 부분 터치 체크
for (int i=0; i<m_pImageArray->count(); i++) {
CCSprite *imageSprite = (CCSprite *)m_pImageArray->objectAtIndex(i);
if (LCUtil::isTouchInside(imageSprite, pTouches)) {
if (imageSprite->getTag() == m_pTouchedDotSprite->getTag()) {
// dotArray에 이미지 부분부터 추가되므로
for (int i=0; i<m_pDotSprites->count(); i++) {
CCSprite *dotSprite = (CCSprite *)m_pDotSprites->objectAtIndex(i);
if (dotSprite->getTag() == imageSprite->getTag()) {
matchedDotSprite = dotSprite;
break;
}
}
}else {
isTouchedIncorrectly = true;
}
}
}
}
}
// 올바르게 터치된 점이 있다면
if (matchedDotSprite) {
m_pFinishedDotSprites->addObject(m_pTouchedDotSprite);
m_pFinishedDotSprites->addObject(matchedDotSprite);
m_pDotSprites->removeObject(m_pTouchedDotSprite);
m_pDotSprites->removeObject(matchedDotSprite);
// 터치된 스프라이트 찾기
CCSprite* matchedSprite = NULL;
for (int i=0; i<m_pImageArray->count(); i++) {
CCSprite* sprite = (CCSprite*)m_pImageArray->objectAtIndex(i);
if (sprite->getTag() == matchedDotSprite->getTag()) {
matchedSprite = sprite;
break;
}
}
this->didMatchWord();
this->didMatchWord(matchedSprite, m_pIndexArray, matchedDotSprite->getTag());
drawMatchedLines();
if (m_pDotSprites->count() == 0) {
//CCLog("finished");
this->didFinishedStage();
//load
CCSequence* seq = CCSequence::actions(CCDelayTime::actionWithDuration(this->delayTimeOfChangeWord(m_pIndexArray, m_iIndex)),
CCCallFunc::actionWithTarget(this, callfunc_selector(LCCrossMatchGame::didDelayedChangeWord)) ,NULL);
this->runAction(seq);
//.........这里部分代码省略.........