コード例 #1
0
ファイル: EEvent.cpp プロジェクト: LeoYangLing/Client
void ExecuteEventManager::nextEvent()
{
	WorkerThreads::getInstance()->runOnThread(WorkerThreads::Main, [this](float dt) {
		assert(!m_eventList.empty());
		if (m_eventList.empty())   //Just a hack, protect
		{
			//event over
			eventFinished();
			return;
		}

		EEventPtr event = *m_eventList.begin();
		m_eventList.pop_front();

		if (m_eventList.empty())
		{
			//event over
			eventFinished();
			return;
		}

		event = *m_eventList.begin();
		event->excute([this]() { this->nextEvent();  });
	});
}
コード例 #2
0
ファイル: timeadvancer.cpp プロジェクト: A1-Triard/openmw
    void TimeAdvancer::onFrame(float dt)
    {
        if (!mRunning)
            return;

        if (mCurHour == mInterruptAt)
        {
            stop();
            eventInterrupted();
            return;
        }

        mRemainingTime -= dt;

        while (mRemainingTime <= 0)
        {
            mRemainingTime += mDelay;
            ++mCurHour;

            if (mCurHour <= mHours)
                eventProgressChanged(mCurHour, mHours);
            else
            {
                stop();
                eventFinished();
                return;
            }

        }
    }