當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。