Merge branch 'ryzom/ui/improvements' into yubo

merge-requests/7/merge
Nuno 4 years ago
commit c2feca91e1

@ -5503,7 +5503,7 @@ namespace NLGUI
string suri = elm.getAttribute("href");
if(suri.find("ah:") == 0)
{
if (_TrustedDomain)
if (_TrustedDomain || suri.find("ah:script:") == 0)
_Link.back() = suri;
}
else
@ -6360,11 +6360,13 @@ namespace NLGUI
void CGroupHTML::htmlOBJECTend(const CHtmlElement &elm)
{
if (!_TrustedDomain)
return;
if (_ObjectType=="application/ryzom-data")
{
if (!_TrustedDomain)
return;
if (!_ObjectData.empty())
{
if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum))
@ -6374,6 +6376,24 @@ namespace NLGUI
_ObjectScript.clear();
}
}
else if (_ObjectType=="application/ryzom-tutorial")
{
strFindReplace(_ObjectScript, "[[", "\\[\\[");
strFindReplace(_ObjectScript, "]]", "\\]\\]");
strFindReplace(_ObjectScript, "\\[\\[", "]]..'[['..[[");
strFindReplace(_ObjectScript, "\\]\\]", "]]..']]'..[[");
CLuaManager::getInstance().executeLuaScript("\ngame:executeTutorial([["+_ObjectScript+"]])\n", true);
_ObjectScript.clear();
}
else if (_ObjectType=="application/ryzom-script")
{
strFindReplace(_ObjectScript, "[[", "\\[\\[");
strFindReplace(_ObjectScript, "]]", "\\]\\]");
strFindReplace(_ObjectScript, "\\[\\[", "]]..'[['..[[");
strFindReplace(_ObjectScript, "\\]\\]", "]]..']]'..[[");
CLuaManager::getInstance().executeLuaScript("\ngame:executeRyzomScript([["+_ObjectScript+"]])\n", true);
_ObjectScript.clear();
}
_Object = false;
}

@ -74,6 +74,8 @@ bool CGroupQuickHelp::submitEvent (const char *event)
// Update the text
updateParagraph ();
CLuaManager::getInstance().executeLuaScript(toString("\ngame:processTutorialEvent(\"%s\")\n", event), true);
}
}
return false;

@ -184,6 +184,23 @@ private:
REGISTER_ACTION_HANDLER(CHandlerLUA, "lua");
std::deque<CRefPtr<CCtrlBase> > CHandlerLUA::_UICallerStack;
// ***************************************************************************
class CHandlerSCRIPT : public IActionHandler
{
public:
void execute(CCtrlBase *pCaller, const std::string &sParams)
{
string script = sParams;
strFindReplace(script, "[[", "\\[\\[");
strFindReplace(script, "]]", "\\]\\]");
strFindReplace(script, "\\[\\[", "]]..'[['..[[");
strFindReplace(script, "\\]\\]", "]]..']]'..[[");
strFindReplace(script, "|", "\n");
CLuaManager::getInstance().executeLuaScript("\ngame:executeRyzomScript([["+script+"]])\n", true);
}
};
REGISTER_ACTION_HANDLER(CHandlerSCRIPT, "script");
// ***************************************************************************
// Allow also to call script from expression
static DECLARE_INTERFACE_USER_FCT(lua)

Loading…
Cancel
Save