bool NetHttpClient::onConnectRetry(CHttpInfo* pHttpInfo)
{
    CCLog("[NetHttpClient::OnConnectRetry]");

    return true;
}
Example #2
0
void BaseSprite::onExit()
{
	CCLog("BaseSprite onExit invoke : remove touch delegate");
    CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
    CCSprite::onExit();
}
Example #3
0
void SchedulerPauseResumeAll::tick2(float dt)
{
    CCLog("tick2");
}
Example #4
0
void SpiritsPlayer::Spirits_talkabout_hid()
{
	CCLog(FontChina::G2U("************调用了*****************"));
}
void TouchEventTest::touchEventAction(LsTouch* touch) {
	CCLog("touch event action id: %d", touch->getEventId());
}
void ThirdViewController::setAllowsSelection(CAButton* btn, CCPoint point)
{
    CCLog("%f   %f", point.x, point.y);
}
Example #7
0
void CCMessageBox(const char * pszMsg, const char * pszTitle)
{
	CCLog("%s: %s", pszTitle, pszMsg);
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    // タイルマップ呼び出し
    _tileMap = CCTMXTiledMap::create("th_cobit_rouka_1f.tmx");
    this->addChild(_tileMap, 0, kTagTileMap);
    
    CCSize CC_UNUSED tileSize = _tileMap->getContentSize();
    CCLOG("ContentSize: %f, %f", tileSize.width,tileSize.height);
    
    
    
    
    CCTMXObjectGroup *objectGroup = _tileMap->objectGroupNamed("Objects");
    if (objectGroup == NULL) {
        CCLog("tile map has no objects object layer");
        return false;
    }
    
    // tmx上のSpawnPointの座標を取得
    CCDictionary *spawnPoint = objectGroup->objectNamed("SpawnPoint");
    
    int x = ((CCString)*spawnPoint->valueForKey("x")).intValue();
    int y = ((CCString)*spawnPoint->valueForKey("y")).intValue();
    
    // テクスチャアトラスからのキャラ生成
    CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
//    CCSize size = CCDirector::sharedDirector()->getWinSize();
    frameCache->addSpriteFramesWithFile("character.plist");
    
//    _player = CCSprite::create("Player.png");
    
    _player = CCSprite::createWithSpriteFrameName("male_walkcycle_e_01.png");
    
    
    // プレイヤーをタグ識別
    _player->setTag(kTagPlayer);
    _player->retain();
    
    // スプライトに座標セット
//    _player->setPosition(ccp(size.width/2, size.height/2));
    _player->setPosition(ccp(x,y));
    _player->setScale(1);
    _player->setAnchorPoint(ccp(0.5,0));
    
    _tileMap->addChild(_player, 1);
    
    CCPoint playerPos = _player->getPosition();
    
    // メタレイヤー
    _meta = _tileMap->layerNamed("Meta");
    // プレイヤーの目からは見えなくする
    _meta->setVisible(false);
    
    // 画面の表示座標をセット
    this->setViewPlayerCenter();
    this->schedule(schedule_selector(HelloWorld::setViewPlayerCenter));
    
    // タッチを有効化
    this->setTouchEnabled(true);
    
    return true;
}
Example #9
0
void Palette::ccTouchMoved(CCTouch* touch, CCEvent* event)
{
	CCLog ("Palette ccTouchMoved");
}
void NetHttpClient::onConnectFailed(CHttpInfo* pHttpInfo)
{
    CCLog("[NetHttpClient::OnConnectFailed]");
}
void HelloWorld::ccTouchEnded(CCTouch *touch, CCEvent *event)
{
    CCLog("TouchEnd!");
}
void NetHttpClient::onConnect(CHttpInfo* pHttpInfo)
{
    CCLog("[NetHttpClient::OnConnect]:%s", m_strUrl.c_str());
}
void NetHttpClient::onReconnect(CHttpInfo* pHttpInfo)
{
    CCLog("[NetHttpClient::OnReconnect]");
}
void NetHttpClient::onConnectTimeout(CHttpInfo* pHttpInfo)
{
    CCLog("[NetHttpClient::OnConnectTimeout]");
}
Example #15
0
void WelcomeScene::createItems(int type,float offset){
	CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("shop.plist","shop.png");

	if(scroll){
		removeChild(scroll,true);
	}
	itemsLayer = CCLayer::create();

	int x = 0;
	int count = 0;
	int max = 0;
	bool next = true;
	int value = 0;
	if(!itemsArray){
		itemsArray = CCArray::create();
		itemsArray->retain();
	}else{
		itemsArray->removeAllObjects();
	}

	while(next){
		count++;
		//CCSprite* bg = CCSprite::createWithSpriteFrameName("item_bg.png");
		ShopItem* item = NULL;
		char name[20];
		switch(type){
		case WEAPON:
			max = 7;
			sprintf(name,"weapon/weapon%d.png",count - 1);
			value = 1000 * count;
			break;
		case TREASURE:
			max = 1;
			return;
			break;
		case TIP:
			max = 3;
			sprintf(name,"tip/tip%d.png",count * 3);
			value = 1500 * count;
			break;	
		case CLOTHES:
			max = 4;
			sprintf(name,"hero_%d.png",(count - 1));
			value = 800 * count;
			break;
		default:
			CCLog("type %d error",type);
			break;
		}
		item = new ShopItem(x,0,name,value,type,count - 1);
		itemsLayer->addChild(item->getLayer());
		itemsArray->addObject(item);
		x += item->getWidth() + 10;
		if(count >= max){
			next = false;
		}
	}
	itemsLayer->setContentSize(CCSizeMake(x,480 - 150));
	SETANCHPOS(itemsLayer,0,0,0,0);

	scroll = CCScrollView::create();
	SETANCHPOS(scroll,175,150,0,0);
	scroll->setDirection(kCCScrollViewDirectionHorizontal);
	scroll->setViewSize(CCSizeMake(max > 3 ? 854 - 150 : x,480 - 150));
	scroll->setContentSize(CCSizeMake(x,480 - 150));
	scroll->setContainer(itemsLayer);
	scroll->setContentOffset(ccp(offset,0));

	addChild(scroll);
}
Example #16
0
Palette::~Palette(void)
{
	CCLog("Palette()");
}
Example #17
0
void Challenge2048Arrow::onDirectionAction(cocos2d::CCObject *pSender)
{
    CCNotificationCenter::sharedNotificationCenter()->postNotification(NotificationArrowDirection, this);
    CCLog("direction : %d", direction);
}
Example #18
0
Palette::Palette(void)
{
	CCLog("Palette()");
	nPrevTag = BrushBlack;
}
    CCNode* CCJsonReader::createObject(cs::CSJsonDictionary * inputFiles, CCNode* parenet)
    {
        const char* className = inputFiles->getItemStringValue("classname"); 

        if(strcmp(className, "CCNode") == 0)
        {
            CCNode* gb = NULL;
            if(NULL == parenet)
            {
                gb = CCNode::create();
            }
            else
            {
                gb = CCNode::create();
                parenet->addChild(gb);
            }
            
            setPropertyFromJsonDict(gb, inputFiles);
    
            int count = inputFiles->getArrayItemCount("components");
            for (int i = 0; i < count; i++)
            {
                cs::CSJsonDictionary * subDict = inputFiles->getSubItemFromArray("components", i);
                if (!subDict)
                   break;
                const char* comName = subDict->getItemStringValue("classname");
                const char *file = subDict->getItemStringValue("file");
                const char *name = subDict->getItemStringValue("name");
                if (file == NULL)
                {
                    continue;
                }
                CCAssert(file != NULL, "file must be not NULL!");
                std::string pPath = cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(file);

                if (strcmp(comName, "CCSprite") == 0)
                {
                    cocos2d::CCSprite *pSprite = CCSprite::create(pPath.c_str());
                    CCComRender *pRender = CCComRender::create(pSprite, "CCSprite");
                    if (name != NULL)
                    {
                        pRender->setName(name);
                    }
                    
                    gb->addComponent(pRender);
                }
                else if(strcmp(comName, "CCTMXTiledMap") == 0)
                {
                    cocos2d::CCTMXTiledMap *pTmx = CCTMXTiledMap::create(pPath.c_str());
                    CCComRender *pRender = CCComRender::create(pTmx, "CCTMXTiledMap");
                    if (name != NULL)
                    {
                        pRender->setName(name);
                    }
                    gb->addComponent(pRender);
                }
                else if(strcmp(comName, "CCParticleSystemQuad") == 0)
                {
                    std::string::size_type pos =  pPath.find(".plist");
                    if (pos  == pPath.npos)
                    {
                        continue;
                    }
                    cocos2d::CCParticleSystemQuad *pParticle = CCParticleSystemQuad::create(pPath.c_str());
					pParticle->setPosition(0, 0);
                    CCComRender *pRender = CCComRender::create(pParticle, "CCParticleSystemQuad");
                    if (name != NULL)
                    {
                        pRender->setName(name);
                    }
                    gb->addComponent(pRender);
                }
                else if(strcmp(comName, "CCArmature") == 0)
                {
                    std::string reDir = pPath;
                    std::string file_path = "";
                    size_t pos = reDir.find_last_of('/');
                    if (pos != std::string::npos)
                    {
                        file_path = reDir.substr(0, pos+1);
                    }
                    unsigned long size = 0;
                    const char *des = (char*)(cocos2d::CCFileUtils::sharedFileUtils()->getFileData(pPath.c_str(),"r" , &size));
			        cs::CSJsonDictionary *jsonDict = new cs::CSJsonDictionary();
			        jsonDict->initWithDescription(des);
                    if(NULL == des || strcmp(des, "") == 0)
                    {
                        CCLog("read json file[%s] error!\n", pPath.c_str());
                    }
                    
                    int childrenCount = DICTOOL->getArrayCount_json(jsonDict, "armature_data");
                    cs::CSJsonDictionary* subData = DICTOOL->getDictionaryFromArray_json(jsonDict, "armature_data", 0);
                    const char *name = DICTOOL->getStringValue_json(subData, "name");

                    childrenCount = DICTOOL->getArrayCount_json(jsonDict, "config_file_path");
                    for (int i = 0; i < childrenCount; ++i)
                    {
                        const char* plist = DICTOOL->getStringValueFromArray_json(jsonDict, "config_file_path", i);
                        std::string plistpath;
                        plistpath += file_path;
                        plistpath.append(plist);
                        cocos2d::CCDictionary *root = CCDictionary::createWithContentsOfFile(plistpath.c_str());
                        CCDictionary* metadata = DICTOOL->getSubDictionary(root, "metadata");
                        const char* textureFileName = DICTOOL->getStringValue(metadata, "textureFileName");

                        std::string textupath;
                        textupath += file_path;
                        textupath.append(textureFileName);

                        CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo(textupath.c_str(), plistpath.c_str(), pPath.c_str());
                        
                    }
                    
                    CCArmature *pAr = CCArmature::create(name);
                    CCComRender *pRender = CCComRender::create(pAr, "CCArmature");
                    if (name != NULL)
                    {
                        pRender->setName(name);
                    }
                    gb->addComponent(pRender);

                    CC_SAFE_DELETE(jsonDict);
                }
                else if(strcmp(comName, "CCComAudio") == 0)
                {
                    CCComAudio *pAudio = CCComAudio::create();
                    pAudio->preloadEffect(pPath.c_str());
                    gb->addComponent(pAudio);
                }
                else if(strcmp(comName, "CCComAttribute") == 0)
                {
                    CCComAttribute *pAttribute = CCComAttribute::create();
                    gb->addComponent(pAttribute);
                }
                else if (strcmp(comName, "CCBackgroundAudio") == 0)
                {
                    CCComAudio *pAudio = CCComAudio::create();
                    pAudio->preloadBackgroundMusic(pPath.c_str());
                    gb->addComponent(pAudio);
                }
                
                CC_SAFE_DELETE(subDict);
            }

            for (int i = 0; i < inputFiles->getArrayItemCount("gameobjects"); i++)
            {
                cs::CSJsonDictionary * subDict = inputFiles->getSubItemFromArray("gameobjects", i);
                if (!subDict)
                {
                    break;
                }
                createObject(subDict, gb);
                CC_SAFE_DELETE(subDict);
            }
            
            return gb;
        }
        
        return NULL;
    }
Example #20
0
static bool glew_dynamic_binding()
{
	const char *gl_extensions = (const char*)glGetString(GL_EXTENSIONS);

	// If the current opengl driver doesn't have framebuffers methods, check if an extension exists
	if (glGenFramebuffers == NULL)
	{
		CCLog("OpenGL: glGenFramebuffers is NULL, try to detect an extension");
		if (strstr(gl_extensions, "ARB_framebuffer_object"))
		{
			CCLog("OpenGL: ARB_framebuffer_object is supported");

			glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) wglGetProcAddress("glIsRenderbuffer");
			glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbuffer");
			glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffers");
			glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffers");
			glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorage");
			glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) wglGetProcAddress("glGetRenderbufferParameteriv");
			glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) wglGetProcAddress("glIsFramebuffer");
			glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebuffer");
			glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffers");
			glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffers");
			glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatus");
			glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) wglGetProcAddress("glFramebufferTexture1D");
			glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2D");
			glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) wglGetProcAddress("glFramebufferTexture3D");
			glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbuffer");
			glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) wglGetProcAddress("glGetFramebufferAttachmentParameteriv");
			glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) wglGetProcAddress("glGenerateMipmap");
		}
		else
		if (strstr(gl_extensions, "EXT_framebuffer_object"))
		{
			CCLog("OpenGL: EXT_framebuffer_object is supported");
			glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) wglGetProcAddress("glIsRenderbufferEXT");
			glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbufferEXT");
			glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffersEXT");
			glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffersEXT");
			glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorageEXT");
			glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) wglGetProcAddress("glGetRenderbufferParameterivEXT");
			glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) wglGetProcAddress("glIsFramebufferEXT");
			glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebufferEXT");
			glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffersEXT");
			glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffersEXT");
			glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatusEXT");
			glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) wglGetProcAddress("glFramebufferTexture1DEXT");
			glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2DEXT");
			glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) wglGetProcAddress("glFramebufferTexture3DEXT");
			glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbufferEXT");
			glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) wglGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
			glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) wglGetProcAddress("glGenerateMipmapEXT");
		}
		else
		{
			CCLog("OpenGL: No framebuffers extension is supported");
			CCLog("OpenGL: Any call to Fbo will crash!");
			return false;
		}
	}
	return true;
}
Example #21
0
SpiritsPlayer::SpiritsPlayer(MainRoledata roledata,int zOrder,bool zhujiaoflag)
{

	//先初始化部分数据
	thisroledata = roledata;
	act_moveto_zi =NULL;
	act_moveto_npc =NULL;
	act_moveto_yinzi =NULL;
	actall=NULL;
	thiszhujiao_flag = zhujiaoflag;
	p_ui_name = new PublicShowUI();
	flag = 0;

	npc = SpiritsPlayer::create(roledata.spiritUrl->getCString());
	if(npc==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}
	//设置NPC初始位置坐标(该坐标取决于当前画层)
	npc->setPosition(roledata.nowpoint);
	//NPC动画设置
	playdonghua = SpiritsPlayer::updateNowAnt(roledata);
	npc->runAction(playdonghua);

	/**开始添加角色各部件**/
	//添加角色名称
	CCLabelTTF* label = CCLabelTTF::create(roledata.spiritname->getCString(), "微软雅黑",12);
	label->setColor(ccWHITE);
	label->setDirty(true);
	label->setPosition(ccp(npc->getContentSize().width/2,npc->getContentSize().height+6));

	CCLabelTTF* labelback = CCLabelTTF::create(roledata.spiritname->getCString(), "微软雅黑",12);
	labelback->setColor(ccBLACK);
	labelback->setDirty(true);
	labelback->setPosition(ccp(npc->getContentSize().width/2+1,npc->getContentSize().height+6-1));

	//添加NPC人物脚下阴影
	yinzi = CCSprite::create(p_yinzi);
	if(yinzi==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}
	if(zhujiaoflag==true)
	{
		yinzi->setPosition(ccp(npc->getContentSize().width/2,12));
	}
	else
	{
		yinzi->setPosition(ccp(npc->getContentSize().width/2,5));
	}

	//MakeNumbers* makenumber = new  MakeNumbers(149);
	//
	//npc->addChild(makenumber->numbers,9,113);

	npc->addChild(yinzi,-1,110);
	npc->addChild(label,2,111);
	npc->addChild(labelback,1,112);
	
}
Example #22
0
EffectsCommen::EffectsCommen(CCPoint basepoint,CCString* imgurl,float actiontime,float maxnum,int showtype,int zOrder)
{

	#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	CCString* publictouming = CCString::create("0049-ecd97d89-");
	
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	CCString* publictouming = CCString::create("/effects/part1/shentan1/0049-ecd97d89-");
#endif

	act_moveto = NULL;
	char indeximg[100] = {0};
	sprintf(indeximg,"%s00000.png",publictouming->getCString());
	effects_main = EffectsCommen::create(indeximg);
	effects_main->setPosition(basepoint);
	if(effects_main==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}

	CCAnimation* thisdonghua = CCAnimation::create();
	CCAnimation* thisdonghua_return = CCAnimation::create();

	for(int i = 0; i<= maxnum ; i++)
	{
		char donghuaurl[100] = {0};
		sprintf(donghuaurl,"%s00%03d.png",imgurl->getCString(),i);
		thisdonghua->addSpriteFrameWithFileName(donghuaurl);
	}

	if(actiontime>0)
	{
		thisdonghua->setDelayPerUnit(actiontime/maxnum);
	}
	else  
	{
		thisdonghua->setDelayPerUnit(2.0f/15.0f);//执行默认时间
	}
	thisdonghua->setRestoreOriginalFrame(true);

	//特效显示方式
	if(showtype==0)
	{
		//无限循环
		thisdonghua->setLoops(-1);
		CCAnimate* playdonghua = CCAnimate::create(thisdonghua);
		actall = CCSequence::create(playdonghua,NULL);
	}
	else if(showtype==1)
	{
		//只播放一次
		thisdonghua->setLoops(1);
		CCAnimate* playdonghua = CCAnimate::create(thisdonghua);
		actall = CCSequence::create(playdonghua,NULL);
	}
	else if(showtype==2)
	{
		//循环一次之后消失
		thisdonghua->setLoops(1);
		CCFiniteTimeAction *actbackfun = CCCallFunc::create(this, callfunc_selector(EffectsCommen::moveoverCallBack_setvisible));
	    CCAnimate* playdonghua = CCAnimate::create(thisdonghua);
		actall = CCSequence::create(playdonghua,actbackfun,NULL);
	}
	else if(showtype==3)
	{
		//循环一次之后消失
		thisdonghua->setLoops(2);
		CCFiniteTimeAction *actbackfun = CCCallFunc::create(this, callfunc_selector(EffectsCommen::moveoverCallBack_setvisible));
	    CCAnimate* playdonghua = CCAnimate::create(thisdonghua);
		actall = CCSequence::create(playdonghua,actbackfun,NULL);
	}
	
	effects_main->runAction(actall);

}
Example #23
0
string ConfigManager::GetConfigS(const char* msk){
	CCLog(">[ConfigManager] GetConfiS(%s)", msk);
	return ((CCString*) strtable->objectForKey(msk))->getCString();
}
Example #24
0
EffectsCommen::EffectsCommen(CCString* imgurl0,CCString* imgurl,int num1, CCString* imgurl2,int num2,CCString* imgurl3,int num3,CCPoint newpoint)
{
	#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	CCString* publictouming = CCString::create("0049-ecd97d89-");
	
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	CCString* publictouming = CCString::create("/effects/part1/shentan1/0049-ecd97d89-");
#endif
	act_moveto = NULL;
	char indeximg[100] = {0};
	sprintf(indeximg,"%s00000.png",publictouming->getCString());
	effects_main = EffectsCommen::create(indeximg);
	effects_main->setPosition(newpoint);
	if(effects_main==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}

	CCAnimation* thisdonghua = CCAnimation::create();

	for(int i = 0; i<= num1 ; i++)
	{
		char donghuaurl2[100] = {0};
		sprintf(donghuaurl2,"%s00%03d.png",imgurl->getCString(),i);
		thisdonghua->addSpriteFrameWithFileName(donghuaurl2);
	}
	thisdonghua->setDelayPerUnit(3.0f/18.0f);//执行默认时间
	thisdonghua->setRestoreOriginalFrame(true);
	CCAnimate* playdonghua = CCAnimate::create(thisdonghua);
	thisdonghua->setLoops(1);

	CCAnimation* thisdonghua2 = CCAnimation::create();

	for(int i = 0; i<= num2 ; i++)
	{
		char donghuaurl[100] = {0};
		sprintf(donghuaurl,"%s00%03d.png",imgurl2->getCString(),i);
		thisdonghua2->addSpriteFrameWithFileName(donghuaurl);
	}
	thisdonghua2->setDelayPerUnit(2.0f/18.0f);//执行默认时间
	thisdonghua2->setRestoreOriginalFrame(true);
	CCAnimate* playdonghua2 = CCAnimate::create(thisdonghua2);
	thisdonghua2->setLoops(1);

	CCAnimation* thisdonghua3 = CCAnimation::create();

	for(int i = 0; i<= num3 ; i++)
	{
		char donghuaurl[100] = {0};
		sprintf(donghuaurl,"%s00%03d.png",imgurl3->getCString(),i);
		thisdonghua3->addSpriteFrameWithFileName(donghuaurl);
	}
	thisdonghua3->setDelayPerUnit(2.5f/18.0f);//执行默认时间
	thisdonghua3->setRestoreOriginalFrame(true);
	thisdonghua3->setLoops(1);
	CCAnimate* playdonghua3 = CCAnimate::create(thisdonghua3);
	CCFiniteTimeAction *actbackfun = CCCallFunc::create(this, callfunc_selector(EffectsCommen::moveoverCallBack_setvisible));
	actall = CCSequence::create(playdonghua,playdonghua2,playdonghua3,actbackfun,NULL);
	actall->retain();
	effects_main->runAction(actall);

}
Example #25
0
//成功分享的回调
void Share :: shareback()
{
	CCLog("shareback");
}
Example #26
0
void CastCommandState::onCastComplete()
{
	if( m_state != CCS_CASTING ) return;

	CastWorldModel* world = CastWorldModel::get();
	if( !world->isValid( m_iOwner ) ) return;

	//check for cost (but dont apply it yet)
	if( m_costVal != 0 ) {
		float res = m_iOwner->getProperty( m_costStat );

		//checking cost>0 so that if a tricky user wants cost to be 'negative' to 'add' value
		//  we can do that even if it is below resource (ex: cost = increased heat)
		if( m_costVal > 0 && m_costVal > res ) {
			//not enough of resource to cast spell, so abort
			//todo: send aborted cast because of no resource
			CCLog("CCS: could not pay %f of %s to cast, aborting", m_costVal, m_costStat.c_str() );
			onCooldownStart();
			return;
		}

	}

	double currTime = CastCommandTime::get();
	m_timeStart = currTime;
	
	//spawn effects
	CastTarget* target = m_iOwner->getTarget();
	//target->validateTargets();
	bool hasTargetInRange = target->hasTargetsAtRangeFromEntity(m_pModel->getRange(), m_iOwner);
	if(!hasTargetInRange) {
		CCLOG("CCS: no targets in range on cast of %s", m_pModel->getName().c_str() );
		onCooldownStart();
		return;
	}


	bool foundTarget = false; //ensure we actually reach at least one target



	for( int i=0; i< m_pModel->getNumEffectsOnCast(); i++ )
	{
		//TODO: check for range
		//world->getPhysicsInterface()->GetVecBetween( m_iOwner, 

		

		CastEffect* effect = new CastEffect( );
		effect->init(this, i, m_iOwner, false );

		
		
		//TODO: send all effects as one array so only one "packet" has to travel? //[Optimisation]

		world->addEffectInTransit(m_iOwner, effect, m_iOwner->getTarget(), CastCommandTime::get());

		foundTarget = true;
	}

	if( foundTarget && m_costVal != 0 ) {
		//apply cost
		m_iOwner->incProperty( m_costStat, -1*m_costVal, NULL );
	}

	if( m_pModel->channelTime > 0.0f ) {
		//begin channeling
		m_state = CCS_CHANNELING;
		int numTicks = (m_pModel->channelTime / m_pModel->channelFreq) + 1;
		CastCommandScheduler::get()->scheduleSelector( schedule_selector(CastCommandState::onSchedulerTick), this, m_pModel->channelFreq, numTicks, 0.0f, false);
	}else {
		//CCLog("Cast %s complete!", m_pModel->getName().c_str());
		onCooldownStart();
	}
}
void CDUIShowAutoCollectionView::collectionViewDidDeselectCellAtIndexPath(CAAutoCollectionView *collectionView, unsigned int section, unsigned int item)
{
    CCLog("取消选中");
}
Example #28
0
void CCLuaLog(const char *pszFormat)
{
    CCLog(pszFormat);
}
Example #29
0
void SchedulerPauseResumeAllUser::tick1(float dt)
{
    CCLog("tick1");
}
Example #30
0
void Map::createData(int l){
	if(l > 1){
		for(int i = 0; i < 13; i++){
			mapData.push_back(0);
		}
	}else{
		startCur = true;
	}
	int level = rand() % 9 + 1;
	CCLog("%d",level);
	if(level == 1){
		int array[] = {1, 2, 6, 2, 3, 0, 4, 0	, 0, 6, 0, 0, 0, 1, 2,
			3, 0, 5, 0,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 2){
		int array[] =  { 1, 2, 6, 2, 3, 0, 5, 0, 5, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3,
			0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0,7,8,9 };
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 3){
		int array[] =  { 1, 2, 6, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 3, 0, 5, 0,
			1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0,7,8,9 };
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 4){
		int array[] =  {  1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3, 0, 0, 6, 0, 0, 0, 1, 3, 0, 0, 6, 0, 0,
			0, 1, 3, 0, 5, 0, 0, 6, 0, 0, 0, 1, 3, 0, 5, 0, 1, 2, 6, 2, 3, 0, 5, 0, 4, 0 ,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 5){
		int array[] =  { 1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3, 0, 5, 0, 5,
			0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0 ,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 6){
	int array[] =  { 1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 3, 0, 5, 0, 1, 3,
			0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0, 1, 3, 0, 5, 0 ,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 7){
		int array[] =  {1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3, 0, 5, 0, 5,
			0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0 ,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 8){
		int array[] =  {1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3, 0, 0, 6, 0,
			0, 0, 1, 3, 0, 5, 0, 0, 6, 0, 0, 0, 1, 2, 3, 1, 2, 6, 2, 3, 0, 5, 0, 4, 0 ,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 9){
		int array[] =  { 1, 2, 6, 2, 3, 0, 4, 0, 0, 6, 0, 0, 0, 1, 2, 3, 0, 0, 6, 0,
			0, 0, 1, 3, 0, 5, 0, 0, 6, 0, 0, 0, 1, 2, 3,0, 1, 2, 6, 2, 3, 0, 5, 0, 4, 0,7,8,9 };
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}else if(level == 10){
		int array[] = {1,3, 0,7,8,9};
		for(int i = 0;i < sizeof(array)/sizeof(array[0]);i++){
			mapData.push_back(array[i]);
		}
	}
}