当前位置: 首页>>代码示例>>C++>>正文


C++ CEvents::Call方法代码示例

本文整理汇总了C++中CEvents::Call方法的典型用法代码示例。如果您正苦于以下问题:C++ CEvents::Call方法的具体用法?C++ CEvents::Call怎么用?C++ CEvents::Call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEvents的用法示例。


在下文中一共展示了CEvents::Call方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Unload

bool CScriptingManager::Unload(CScript * pScript)
{
	if(pScript)
	{
		CEvents * pEvents = CEvents::GetInstance();
		pEvents->Call("scriptExit", pScript);

		CScriptArguments pArguments;
		pArguments.push(pScript->GetMetaFile().ToMetaAndFileString());
		pEvents->Call("scriptUnload", &pArguments);
		pEvents->RemoveScript(pScript->GetVM());

#ifdef _SERVER
		if(g_pModuleManager)
			g_pModuleManager->ScriptUnload(pScript->GetVM());
#endif

		pScript->Unload();
		m_scripts.remove(pScript);
		delete pScript;
		return true;
	}

	return false;
}
开发者ID:Dmitriy782,项目名称:iv-online,代码行数:25,代码来源:CScriptingManager.cpp

示例2: CScript

CScript * CScriptingManager::Load(CMetaFile & mf)
{
	CScript * pScript = new CScript();

	if(!pScript->Load(mf))
	{
		delete pScript;
		return NULL;
	}

	for(auto i = m_funcs.begin(); i != m_funcs.end(); i++)
		pScript->RegisterFunction((*i)->strName, (*i)->pfnFunction, (*i)->iParameterCount, (*i)->strTemplate);

	for(auto i = m_classes.begin(); i != m_classes.end(); i++)
		pScript->RegisterClass(*i);

	for(auto i = m_constants.begin(); i != m_constants.end(); i++)
		pScript->RegisterConstant((*i)->strName, (*i)->value);

#ifdef _SERVER
	if(g_pModuleManager)
		g_pModuleManager->ScriptLoad(pScript->GetVM());
#endif

	// not a very good way , but leave it as is for now
	for(auto i = m_scripts.begin(); i != m_scripts.end(); i++)
	{
		if((*i)->GetMetaFile().m_Meta == "common" && (*i)->GetMetaFile().m_Type == mf.m_Type)
		{
			pScript->AddExternal((*i)->GetMetaFile());
		}
	}

	if(!pScript->Execute())
	{
		delete pScript;
		CLogFile::Printf("Failed to execute script %s", mf.ToMetaAndFileString().Get());
		return NULL;
	}

	m_scripts.push_back(pScript);

	CEvents * pEvents = CEvents::GetInstance();
	pEvents->Call("scriptInit", pScript);

	CScriptArguments arguments;
	arguments.push(mf.ToMetaAndFileString());
	pEvents->Call("scriptLoad", &arguments);
	return pScript;
}
开发者ID:Dmitriy782,项目名称:iv-online,代码行数:50,代码来源:CScriptingManager.cpp

示例3: OnCheckboxCheckStateChanged

// event checkBoxCheckedChanged(checkBoxName)
bool OnCheckboxCheckStateChanged(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("checkBoxCheckedChanged");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:17,代码来源:GUINatives.cpp

示例4: OnButtonClick

// event buttonClick(buttonName, bState)
// TODO: remove it. We have better alternative guiClick (OnClick) for any gui element
bool OnButtonClick(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("buttonClick");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pArguments.push(0);	// FIXME or what?
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:19,代码来源:GUINatives.cpp

示例5: OnMouseLeaves

// event guiMouseLeave(guiName)
bool OnMouseLeaves(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("guiMouseLeave");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	const CEGUI::MouseEventArgs eArgs = static_cast<const CEGUI::MouseEventArgs&>(eventArgs);
	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
	
	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:18,代码来源:GUINatives.cpp

示例6: OnKeyPress

// event guiKeyPress(string guiName, string key, string keyState)
bool OnKeyPress(const CEGUI::KeyEventArgs &eArgs, String keyState)
{	
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("guiKeyPress");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
	CEGUI::Key::Scan keyCode = eArgs.scancode;

	CSquirrelArguments pArguments;
	pArguments.push(eArgs.window->getName().c_str());
	pArguments.push(GetKeyNameByScan(eArgs.scancode));
	pArguments.push(keyState);

	CSquirrelArgument pReturn = pEvents->Call(eventName, &pArguments, pScript);
	return pReturn.GetBool();
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:21,代码来源:GUINatives.cpp

示例7: OnWindowClose

// event windowClose(windowName)
bool OnWindowClose(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("windowClose");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());

	// Event handler must return 1 to close window, otherwise, 0.
	CSquirrelArgument pReturn = pEvents->Call(eventName, &pArguments, pScript);

	if(pReturn.GetInteger())
		pWindow->hide();

	return true;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:23,代码来源:GUINatives.cpp

示例8: OnRowClick

// event rowClick(string guiName)
bool OnRowClick(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName ("rowClick");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	const CEGUI::WindowEventArgs eArgs = static_cast<const CEGUI::WindowEventArgs&>(eventArgs);
	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CEGUI::MultiColumnList * pMultiColumnList = static_cast<CEGUI::MultiColumnList*>(eArgs.window);
	int iItemID = pMultiColumnList->getItemRowIndex(pMultiColumnList->getFirstSelectedItem());

	CSquirrelArguments pArguments;
	pArguments.push(eArgs.window->getName().c_str()); // Window Name
	pArguments.push(iItemID); // Row

	CLogFile::Printf("Value: %i",iItemID);

	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:25,代码来源:GUINatives.cpp


注:本文中的CEvents::Call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。