Example #1
0
void StarMatrix::deleteSelectedList()
{
	if(selectedList.size() <= 1)
	{
		m_layer->hideLinkNum();
		selectedList.at(0)->setSelected(false);
		return;
	}

	for(auto it = selectedList.begin();it != selectedList.end();it++)
	{
		Star* star = *it;

		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);

		Audio::getInstance()->playPop();
	}

	showComboEffect(selectedList.size(),this);
	Audio::getInstance()->playCombo(selectedList.size());

	refreshScore();
	m_layer->showLinkNum(selectedList.size());
	adjustMatrix();

	if(isEnded())
	{
		m_layer->floatLeftStarMsg(getLeftStarNum());
		CCLOG("ENDED");
	}

}
void SourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionCode& ec)
{
    // SourceBuffer.append() steps from October 1st version of the Media Source Extensions spec.
    // https://dvcs.w3.org/hg/html-media/raw-file/7bab66368f2c/media-source/media-source.html#dom-append

    // 2. If data is null then throw an INVALID_ACCESS_ERR exception and abort these steps.
    if (!data) {
        ec = INVALID_ACCESS_ERR;
        return;
    }

    // 3. If this object has been removed from the sourceBuffers attribute of media source then throw
    //    an INVALID_STATE_ERR exception and abort these steps.
    if (isRemoved()) {
        ec = INVALID_STATE_ERR;
        return;
    }

    // 5. If the readyState attribute of media source is in the "ended" state then run the following steps:
    if (isEnded()) {
        // 5.1. Set the readyState attribute of media source to "open"
        // 5.2. Queue a task to fire a simple event named sourceopen at media source.
        m_source->setReadyState(MediaSource::openKeyword());
    }

    // Steps 6 & beyond are handled by the private implementation.
    m_private->append(data->data(), data->length());
}
void SourceBuffer::setTimestampOffset(double offset, ExceptionCode& ec)
{
    // Section 3.1 timestampOffset attribute setter steps.
    // 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an
    //    INVALID_STATE_ERR exception and abort these steps.
    if (isRemoved()) {
        ec = INVALID_STATE_ERR;
        return;
    }

    // 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps:
    if (isEnded()) {
        // 4.1 Set the readyState attribute of the parent media source to "open"
        // 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
        m_source->setReadyState(MediaSource::openKeyword());
    }

    // 5. If this object is waiting for the end of a media segment to be appended, then throw an INVALID_STATE_ERR
    // and abort these steps.
    if (!m_private->setTimestampOffset(offset)) {
        ec = INVALID_STATE_ERR;
        return;
    }

    // 6. Update the attribute to the new value.
    m_timestampOffset = offset;
}
Example #4
0
void StarMatrix::deleteSelectedList(){
	//播放消除音效
	Audio::getInstance()->playPop();

	for(auto it = selectedList.begin();it != selectedList.end();it++){
		Star* star = *it;
		m_layer->showEveryScore(selectedListSize,5+(selectedListSize-selectedList.size())*5,selectedListSize-selectedList.size(),star->getPosition(),touchLeft);
		selectedList.pop_front();
		//粒子效果
		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);
		return;
	}
	clearOneByOne =false;
	//COMBO效果
	showComboEffect(selectedListSize,this);
	m_layer->showLinkNum(selectedListSize);
	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());//通知layer弹出剩余星星的信息
		CCLOG("ENDED");
	}
}
Example #5
0
void *writer(void* inV){
	struct argsRec* inS = (struct argsRec*)inV;
	buffer* in = inS->in;
	int allWrite = inS->allWrite;
	char* outName = inS->outName;
	fractal *current = NULL, *higher = (fractal*)malloc(sizeof(fractal));
	
	while(isEnded(in) == 0){
		current = load(in);
		if(current != NULL){
			if(higher == NULL)*higher = *current;
			
			if(allWrite && current->avg != 0.0){
				write_bitmap_sdl(current, current->nom);
			}
			if ( current->avg > higher->avg){
				*higher = *current;
			}
			else {
				free(current);
				current = NULL;
			}
		}
	}
	if(higher != NULL){
		if(DEBUG){
			printf("Ecrit: %s\n", higher->nom);
			fflush(stdout);
		}
		write_bitmap_sdl(higher, outName);
	}
	free(higher);
	int returnValue = 0;
	pthread_exit((void*)&returnValue);
}
Example #6
0
void *worker(void * inV){
	struct argsCalc* inS = (struct argsCalc*)inV;
	buffer* in = inS->in;
	buffer* out = inS->out;
	
	fractal* current = NULL;
	int flag = 1;
	
	while(flag){
		current = load(in);
		if(current != NULL){
			compute(current);
			if(DEBUG){
				printf("Calculé: %s\n", current->nom);;
				fflush(stdout);
			}
			unload(out, current);
		}
		if(isEnded(in))
			flag = 0;
	}
	
	//saying that this thread has finished
	pthread_mutex_lock(&(out->mutexEnd));
	out->endProduct = out->endProduct+1;
	pthread_mutex_unlock(&(out->mutexEnd));
	
	int returnValue = 1;
	pthread_exit((void*)&returnValue);
}
void MediaConvert::abort(){
	std::unique_lock<std::mutex> uniqueLock(mutex);
	if(!isEnded()){
		isAbort = true;
		convertState = ABORT;
		if(process != 0){
			process->terminateProcess();
		}
	}
	condition.notify_one();
}
Example #8
0
void StarMatrix::deleteBombList(){
	//播放消除音效
	Audio::getInstance()->playPropBomb();
	for(auto it = selectedList.begin();it != selectedList.end();it++){
		Star* star = *it;
		//粒子效果
		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);
	}
	selectedList.clear();
	//COMBO效果
	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());
	}
}
Example #9
0
void StarMatrix::doHammer(Star* s){
	selectedList.clear();
	selectedList.push_back(s);
	//播放消除音效
	Audio::getInstance()->playPropBomb();
	selectedList.pop_front();
	m_layer->showEveryScore(selectedListSize,5+(selectedListSize-selectedList.size())*5,selectedListSize-selectedList.size(),s->getPosition(),touchLeft);
	//粒子效果
	showStarParticleEffect(s->getColor(),s->getPosition(),this);
	stars[s->getIndexI()][s->getIndexJ()] = nullptr;
	s->removeFromParentAndCleanup(true);
	m_layer->showLinkNum(selectedListSize);

	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());//通知layer弹出剩余星星的信息
		CCLOG("ENDED");
	}
}
LogicalTxn::~LogicalTxn()
{
    assert(isEnded());
    assert(participants.empty());
}