void AnimationCommandLayer::onFrameEvent(Frame * frame)
	{

		EventFrame* evnt = dynamic_cast<EventFrame*>(frame);
		std::string aniStr = evnt->getEvent();

		if (!evnt)
		{
			return;
		}

		Sprite* sp = (Sprite*)evnt->getNode();
		if (aniStr != "")//spine动画 compare(0, 3, "spi")
		{
			Player * player = (Player *)sp->getChildByTag(SPINE_ANIMATION_PLAYER_TAG);
			player->playRoleAction(aniStr.c_str(), true);
			CCLOG("%s Spine Animation is %s", player->getName().c_str(), aniStr.c_str());
		}
//暂时去掉下面的代码,如果以后需要执行cocos studio做不出来的动画,那么修改规则,用下面的代码 cuihanbing
// 		else if (str.compare(0, 3, "act") == 0)//需要cocos2d执行的动画
// 		{
// 			if (str == "act_chuxian")
// 			{
// 				evnt->getNode()->setOpacity(256);
// 				CCLOG("Action is %s", str.c_str());
// 			}
// 		}
	}
Exemple #2
0
Frame* EventFrame::clone()
{
    EventFrame* frame = EventFrame::create();
    frame->setEvent(_event);

    frame->cloneProperty(this);

    return frame;
}
Exemple #3
0
void MainFrame::EditEvent(Event *EditedEvent = NULL) {
	EventFrame *EditedEventFrame = new EventFrame(this);

	if (EditedEvent == NULL && EventsList->GetSelectedItemCount() == 1)
		EditedEventFrame->LoadEvent(((Event *)EventsList->GetItemData(EventsList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)))->BaseEvent);
	else
		EditedEventFrame->LoadEvent(EditedEvent);

	EditedEventFrame->Show();
}
Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json)
{
    EventFrame* frame = EventFrame::create();

    const char* evnt = DICTOOL->getStringValue_json(json, Value);

    if(evnt != nullptr)
        frame->setEvent(evnt);

    return frame;
}
// EventFrame
EventFrame* EventFrame::create()
{
    EventFrame* frame = new EventFrame();
    if (frame)
    {
        frame->autorelease();
        return frame;
    }
    CC_SAFE_DELETE(frame);
    return nullptr;
}
Exemple #6
0
// EventFrame
EventFrame* EventFrame::create()
{
    EventFrame* frame = new (std::nothrow) EventFrame();
    if (frame)
    {
        frame->init();
        frame->autorelease();
        return frame;
    }
    CC_SAFE_DELETE(frame);
    return nullptr;
}
Exemple #7
0
void ScoreLabel::setScore(int score)
{
    this->timeline->play("CountUp", false);
    this->timeline->setFrameEventCallFunc([this, score](Frame* frame) {
        EventFrame* frameEvent = dynamic_cast<EventFrame*>(frame);
        auto eventName = frameEvent->getEvent();

        if (eventName == "CountUp") {
            this->scoreLabel->setString(std::to_string(score));
        }
    });
}
Exemple #8
0
void TestTimelineFrameEvent::onFrameEvent(Frame* frame)
{
    EventFrame* evnt = dynamic_cast<EventFrame*>(frame);
    if(!evnt)
        return;

    std::string str = evnt->getEvent();

    if (str == "changeColor")
    {
        evnt->getNode()->setColor(Color3B(0,0,0));
    }
    else if(str == "endChangeColor")
    {
        evnt->getNode()->setColor(Color3B(255,255,255));
    }
}
Frame* ActionTimelineCache::loadEventFrameWithFlatBuffers(const flatbuffers::EventFrame *flatbuffers)
{
    EventFrame* frame = EventFrame::create();
    
    std::string event = flatbuffers->value()->c_str();
    
    if (event != "")
        frame->setEvent(event);
    
    CCLOG("event = %s", event.c_str());
    
    int frameIndex = flatbuffers->frameIndex();
    frame->setFrameIndex(frameIndex);
    
    bool tween = flatbuffers->tween() != 0;
    frame->setTween(tween);
    
    return frame;
}
Frame* ActionTimelineCache::loadEventFrameWithFlatBuffers(const flatbuffers::EventFrame *flatbuffers)
{
    EventFrame* frame = EventFrame::create();
    
    std::string event = flatbuffers->value()->c_str();
    
    if (event != "")
        frame->setEvent(event);    
    
    int frameIndex = flatbuffers->frameIndex();
    frame->setFrameIndex(frameIndex);
    
    bool tween = flatbuffers->tween() != 0;
    frame->setTween(tween);
    
    auto easingData = flatbuffers->easingData();
    if (easingData)
    {
        loadEasingDataWithFlatBuffers(frame, easingData);
    }
    
    return frame;
}
Exemple #11
0
void Entity::attack(const std::string attackName)
{
    if (! this->stateMachine->canAttack()) {
        return;
    }

    if (this->stateMachine->isDead()) {
        return;
    }

    EntityAttackParams attackParams = this->getAttackParamsByName(attackName);
    std::string particleFilePath = attackParams.particleFilePath;

    this->timeline->play(attackName, false);
    this->timeline->setFrameEventCallFunc([this, attackName, particleFilePath](Frame* frame) {
        EventFrame* frameEvent = dynamic_cast<EventFrame*>(frame);
        auto eventName = frameEvent->getEvent();

        // log("---- %s ----", eventName.c_str());
        if (eventName == "Ready") {
            this->currentAttackName = attackName;
            this->stateMachine->readyToAttack();
        } else if (eventName == "Attack") {
            this->stateMachine->startToAttack();

            if (particleFilePath != "") {
                ParticleSystemQuad* particle = ParticleSystemQuad::create(particleFilePath);
                this->addChild(particle);
            }
        } else if (eventName == "Cooldown") {
            this->stateMachine->coolDownAttaking();
        } else if (eventName == "Finish") {
            this->stateMachine->finishAttaking();
            this->currentAttackName = "";
        }
    });
}
Exemple #12
0
void Cluster::processFrame(const EventFrame& e, Lock& l) {
    if (e.isCluster()) {
        QPID_LOG_IF(trace, loggable(e.frame), *this << " DLVR: " << e);
        ClusterDispatcher dispatch(*this, e.connectionId.getMember(), l);
        if (!framing::invoke(dispatch, *e.frame.getBody()).wasHandled())
            throw Exception(QPID_MSG("Invalid cluster control"));
    }
    else if (state >= CATCHUP) {
        map.incrementFrameSeq();
        ConnectionPtr connection = getConnection(e, l);
        if (connection) {
            QPID_LOG_IF(trace, loggable(e.frame),
                        *this << " DLVR " << map.getFrameSeq() << ":  " << e);
            connection->deliveredFrame(e);
        }
        else
            throw Exception(QPID_MSG("Unknown connection: " << e));
    }
    else // Drop connection frames while state < CATCHUP
        QPID_LOG_IF(trace, loggable(e.frame), *this << " DROP (joining): " << e);
}
Exemple #13
0
void MainFrame::NewEvent() {
	EventFrame *NewEventFrame = new EventFrame(this);
	NewEventFrame->Show();
}