コード例 #1
0
ファイル: lwf_event.cpp プロジェクト: 435886030/lwf
int LWF::AddMovieEventHandler(
	string instanceName, const MovieEventHandlerDictionary &h)
{
	if (h.empty())
		return -1;

	int instId = SearchInstanceId(GetStringId(instanceName));
	if (instId >= 0)
		return AddMovieEventHandler(instId, h);

	if (instanceName.find('.') == string::npos)
		return -1;

	MovieEventHandlersDictionary::iterator it =
		m_movieEventHandlersByFullName.find(instanceName);
	if (it == m_movieEventHandlersByFullName.end()) {
		m_movieEventHandlersByFullName[instanceName] = MovieEventHandlers();
		it = m_movieEventHandlersByFullName.find(instanceName);
	}
	int id = GetEventOffset();
	it->second.Add(id, h);

	Movie *m = SearchMovieInstance(instId);
	if (m)
		m->AddHandlers(&it->second);

	return id;
}
コード例 #2
0
ファイル: lwf_event.cpp プロジェクト: 435886030/lwf
int LWF::AddMovieEventHandler(
	int instId, const MovieEventHandlerDictionary &h)
{
	if (instId < 0 || instId >= (int)data->instanceNames.size())
		return -1;

	int id = GetEventOffset();
	m_movieEventHandlers[instId].Add(id, h);

	Movie *m = SearchMovieInstanceByInstanceId(instId);
	if (m)
		m->AddHandlers(&m_movieEventHandlers[instId]);

	return id;
}