本文整理汇总了C++中SUIArguments类的典型用法代码示例。如果您正苦于以下问题:C++ SUIArguments类的具体用法?C++ SUIArguments怎么用?C++ SUIArguments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SUIArguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetElement
//------------------------------------------------------------------------
int CScriptBind_UIAction::GetArray( IFunctionHandler *pH, const char * elementName, int instanceID, const char* arrayName )
{
IUIElement* pElement = GetElement( elementName, instanceID );
if ( pElement )
{
const SUIParameterDesc* pArrayDesc = pElement->GetArrayDesc( arrayName );
SUIArguments vals;
if ( pArrayDesc && pElement->GetArray( pArrayDesc, vals ) )
{
SmartScriptTable res(m_pSS);
string val;
for (int i = 0; i < vals.GetArgCount(); ++i)
{
vals.GetArg(i).GetValueWithConversion(val);
res->SetAt( i+1, val.c_str() );
}
return pH->EndFunction( res );
}
UIACTION_WARNING( "LUA: Element %s has no array %s", elementName, arrayName );
}
else
{
UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName );
}
return pH->EndFunction( false );
}
示例2: OnUIEventEx
//------------------------------------------------------------------------
void SUIElementLuaCallback::OnUIEventEx( IUIElement* pSender, const char* fscommand, const SUIArguments& args, void* pUserData )
{
SUIArguments luaArgs;
luaArgs.AddArgument(fscommand);
luaArgs.AddArguments(args);
NotifyEvent(SUILuaCallbackInfo<IUIElement>::CreateInfo(pSender, "OnUIEventEx"), luaArgs);
}
示例3: args
void CFlashUIFromArrayNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
if (event == eFE_Activate && IsPortActive( pActInfo, eI_Array ))
{
SUIArguments args( GetPortString( pActInfo, eI_Array ).c_str());
ActivateOutput( pActInfo, eO_Count, args.GetArgCount());
SUIArguments leftOver;
int port = eO_Val1;
for (int i = 0; i < args.GetArgCount(); ++i)
{
string arg;
args.GetArg( i, arg );
if (port + i < eO_LeftOver)
{
ActivateOutput( pActInfo, port + i, arg );
}
else
{
leftOver.AddArgument( arg );
}
}
if (leftOver.GetArgCount() > 0)
{
ActivateOutput( pActInfo, eO_LeftOver, string( leftOver.GetAsString()));
}
}
}
示例4: GetPortInt
void CFlashUIEventNode::FlushNextEvent( SActivationInfo* pActInfo )
{
if (m_events.size() > 0)
{
const std::pair<SUIArguments, int> &data = m_events.get();
const SUIArguments & args = data.first;
bool bTriggerEvent = true;
const int checkValue = GetPortInt(pActInfo, eI_CheckPort);
if (checkValue >= 0)
{
bTriggerEvent = false;
CRY_ASSERT_MESSAGE(checkValue < args.GetArgCount(), "Port does not exist!" );
if (checkValue < args.GetArgCount())
{
string val = GetPortString(pActInfo, eI_CheckValue);
string compstr;
args.GetArg(checkValue).GetValueWithConversion(compstr);
bTriggerEvent = val == compstr;
}
}
if (bTriggerEvent)
{
int end = m_eventDesc.InputParams.Params.size();
string val;
int i = 0;
for (; i < end; ++i)
{
CRY_ASSERT_MESSAGE( i < args.GetArgCount(), "UIEvent received wrong number of arguments!" );
ActivateDynOutput( i < args.GetArgCount() ? args.GetArg(i) : TUIData(string("")), m_eventDesc.InputParams.Params[i], pActInfo, i + 2 );
}
if (m_eventDesc.InputParams.IsDynamic)
{
SUIArguments dynarg;
for (; i < args.GetArgCount(); ++i)
{
if (args.GetArg( i, val ))
dynarg.AddArgument( val );
}
ActivateOutput( pActInfo, end + eO_DynamicPorts, string( dynarg.GetAsString()));
}
ActivateOutput( pActInfo, eO_OnEvent, true );
ActivateOutput( pActInfo, eO_OnInstanceId, data.second );
}
m_events.pop();
}
}
示例5: Packet
void CReadSendPacket::ReadGameServers(SPacket packet)
{
gEnv->pLog->Log(TITLE "Read game server info packet...");
Packet* p = new Packet((const unsigned char*)packet.data, packet.size);
p->decodeBlowfish(gClientEnv->bBlowFish);
/****************************Обязательный блок************************************/
EPacketType type = (EPacketType)p->readInt(); // Packet type
const char* version = p->readString(); // Packet version
/*********************************************************************************/
int serversCount = p->readInt();
for (int i = 0 ; i != serversCount; i++)
{
SGameServer Server; SUIArguments args;
Server.id = p->readInt(); // id сервера
Server.ip = p->readString(); // ip сервера
Server.port = p->readInt(); // Порт сервера
Server.serverName = p->readString(); // Название сервера
Server.currentPlayers = p->readInt(); // Онлайн на сервере
Server.maxPlayers = p->readInt(); // Максимальное кол-во игроков
Server.mapName = p->readString(); // Название карты
Server.gameRules = p->readString(); // Режим игры
if(Server.port)
{
char tmp[64];
sprintf(tmp, "%d/%d", Server.currentPlayers, Server.maxPlayers);
args.AddArgument(Server.id);
args.AddArgument(Server.ip);
args.AddArgument(Server.port);
args.AddArgument(Server.serverName);
args.AddArgument(tmp);
args.AddArgument((const char*)Server.mapName);
args.AddArgument((const char*)Server.gameRules);
args.AddArgument(gClientEnv->pPing->Ping(Server.ip));
CMsEvents::GetInstance()->SendEvent(CMsEvents::eUIGE_GameServerInfo, args);
gClientEnv->pMasterServer->vServers.push_back(Server);
}
}
const char* endBlock = p->readString(); // Завершающий блок
if(strcmp(endBlock,EndBlock))
{
gEnv->pLog->LogWarning(TITLE "Game servers packet damaged!");
}
delete p;
}
示例6: SendResolutions
////////////////////////////////////////////////////////////////////////////
// ui functions
////////////////////////////////////////////////////////////////////////////
void CUISettings::SendResolutions()
{
SUIArguments resolutions;
for(int i = 0; i < m_Resolutions.size(); ++i)
{
string res;
res.Format("%i x %i", m_Resolutions[i].first, m_Resolutions[i].second);
m_eventSender.SendEvent<eUIE_OnGetResolutionItems>(res, (int)i);
resolutions.AddArgument(m_Resolutions[i].first);
resolutions.AddArgument(m_Resolutions[i].second);
}
m_eventSender.SendEvent<eUIE_OnGetResolutions>(resolutions);
}
示例7: GetDynInput
// ---------------------------------------------------------------
void CFlashUIBaseNodeDynPorts::GetDynInput( SUIArguments &args, const SUIParameterDesc &desc, SActivationInfo* pActInfo, int port)
{
switch (desc.eType)
{
case SUIParameterDesc::eUIPT_Bool:
args.AddArgument( GetPortBool(pActInfo, port));
break;
case SUIParameterDesc::eUIPT_Int:
args.AddArgument( GetPortInt(pActInfo, port));
break;
case SUIParameterDesc::eUIPT_Float:
args.AddArgument( GetPortFloat(pActInfo, port));
break;
case SUIParameterDesc::eUIPT_String:
args.AddArgument( GetPortString(pActInfo, port));
break;
case SUIParameterDesc::eUIPT_WString:
args.AddArgument( GetPortString(pActInfo, port), eUIDT_WString );
break;
case SUIParameterDesc::eUIPT_Vec3:
args.AddArgument( GetPortVec3(pActInfo, port));
break;
default:
{
string val;
const TFlowInputData data = GetPortAny(pActInfo, port);
data.GetValueWithConversion(val);
args.AddArgument(val, eUIDT_Any);
}
break;
}
}
示例8: UpdateObjectDesc
void CFlashUIArrayBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
if (event == eFE_Initialize)
{
UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate );
}
else if (event == eFE_Activate)
{
if (IsPortActive( pActInfo, GetInputPort(eI_UIArray)))
{
UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate );
}
if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo ))
return;
if (GetElement())
{
const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID));
if (IsPortActive ( pActInfo, GetInputPort(eI_Set)))
{
SUIArguments values( GetPortString( pActInfo, GetInputPort(eI_Value)).c_str());
SPerInstanceCall1< const SUIArguments & > caller;
caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::SetArray), values );
ActivateOutput( pActInfo, eO_OnSet, true );
}
else if (IsPortActive( pActInfo, GetInputPort(eI_Get)))
{
SUIArguments out;
SPerInstanceCall1< SUIArguments & > caller;
if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::GetArray), out, false ))
{
UIACTION_WARNING( "FG: UIElement \"%s\" called get Array for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ));
}
ActivateOutput( pActInfo, eO_Value, string( out.GetAsString()));
}
}
}
}
示例9: TryArgToLuaTable
bool TryArgToLuaTable(const SUIArguments &args, SmartScriptTable table, int idx)
{
T val;
if (args.GetArg(idx, val))
{
SetTableVal<T>(val, table, idx);
return true;
}
return false;
}
示例10: GetPortInt
void CFlashUIToArrayNode::ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
{
if (event == eFE_Activate && IsPortActive( pActInfo, eI_Set ))
{
int count = GetPortInt( pActInfo, eI_Count );
int port = eI_Val1;
SUIArguments args;
for (int i = 0; i < count; ++i)
{
TFlowInputData data = GetPortAny( pActInfo, port + i );
string val;
data.GetValueWithConversion( val );
args.AddArgument( val );
}
ActivateOutput( pActInfo, eO_OnSet, true );
ActivateOutput( pActInfo, eO_ArgList, string( args.GetAsString()));
}
}
示例11: UIArgsToLuaTable
//------------------------------------------------------------------------
bool SUIToLuaConversationHelper::UIArgsToLuaTable(const SUIArguments &args, SmartScriptTable table)
{
bool res = true;
for (int i = 0; i < args.GetArgCount(); ++i)
{
switch (args.GetArgType(i))
{
case eUIDT_Bool:
SUIConvHelperTmpl::ArgToLuaTable<bool>(args, table, i);
break;
case eUIDT_Int:
SUIConvHelperTmpl::ArgToLuaTable<int>(args, table, i);
break;
case eUIDT_Float:
SUIConvHelperTmpl::ArgToLuaTable<float>(args, table, i);
break;
case eUIDT_EntityId:
SUIConvHelperTmpl::ArgToLuaTable<EntityId>(args, table, i);
break;
case eUIDT_Vec3:
SUIConvHelperTmpl::ArgToLuaTable<Vec3>(args, table, i);
break;
case eUIDT_String:
case eUIDT_WString:
SUIConvHelperTmpl::ArgToLuaTable<string>(args, table, i);
break;
case eUIDT_Any:
{
bool ok = SUIConvHelperTmpl::TryArgToLuaTable<int>(args, table, i)
|| SUIConvHelperTmpl::TryArgToLuaTable<float>(args, table, i)
|| SUIConvHelperTmpl::TryArgToLuaTable<string>(args, table, i);
res &= ok;
}
default:
res = false;
}
}
return res;
}
示例12: LuaArgsToUIArgs
//------------------------------------------------------------------------
bool SUIToLuaConversationHelper::LuaArgsToUIArgs(IFunctionHandler* pH, int startIdx, SUIArguments &args)
{
for (int i = startIdx; i <= pH->GetParamCount(); ++i)
{
TUIData val;
if (!LuaArgToUIArg(pH, i, val))
{
return false;
}
args.AddArgument(val);
}
return true;
}
示例13: LuaTableToUIArgs
//------------------------------------------------------------------------
bool SUIToLuaConversationHelper::LuaTableToUIArgs(SmartScriptTable table, SUIArguments &args)
{
for (int i = 0; i <= table->Count(); ++i)
{
if (i == 0 && table->GetAtType(0) == svtNull)
continue; // if passing {arg1, arg2, arg3} to scriptbind first entry will be nil
TUIData val;
if (!SUIConvHelperTmpl::LuaArgToUIArgImpl(table, i, val))
return false;
args.AddArgument( val );
}
return true;
}
示例14: OnGameplayCommand
void CDevMode::OnGameplayCommand(const char* cmd)
{
SUIArguments args;
args.SetDelimiter(":");
args.SetArguments(cmd);
string action;
args.GetArg(0, action);
if (action == "GotoTagPoint")
{
int tagpoint;
args.GetArg(1, tagpoint);
if (tagpoint >= 0 && tagpoint <= 11)
GotoTagPoint(tagpoint);
}
else if (action == "SetViewMode" && gEnv->pGame && gEnv->pGame->GetIGameFramework())
{
int mode;
args.GetArg(1, mode);
IActor* pPlayer = gEnv->pGame->GetIGameFramework()->GetClientActor();
static ICVar* pCamVar = gEnv->pConsole->GetCVar("cl_cam_orbit");
if (pPlayer && pCamVar)
{
switch (mode)
{
case 0:
pCamVar->Set(0);
if (pPlayer->IsThirdPerson())
pPlayer->ToggleThirdPerson();
break;
case 1:
pCamVar->Set(0);
if (!pPlayer->IsThirdPerson())
pPlayer->ToggleThirdPerson();
break;
case 2:
pCamVar->Set(1);
break;
}
}
}
else if (action == "SetFlyMode" && gEnv->pGame && gEnv->pGame->GetIGameFramework())
{
int mode;
args.GetArg(1, mode);
IActor* pPlayer = gEnv->pGame->GetIGameFramework()->GetClientActor();
if (pPlayer && mode >= 0 && mode < 3)
pPlayer->SetFlyMode(mode);
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:50,代码来源:DevMode.cpp
示例15: EndActionInt
//------------------------------------------------------------------------------------
void CUIActionManager::EndActionInt( IUIAction* pAction, const SUIArguments& args )
{
FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION);
if ( pAction && m_actionStateMap[ pAction ] ) // only allow to end actions that are started
{
m_actionStateMap[pAction] = false;
UIACTION_LOG( "UIAction %s end (Args: %s)", pAction->GetName(), args.GetAsString() );
if (pAction->GetType() == IUIAction::eUIAT_LuaScript)
((CFlashUIAction*)pAction)->EndScript();
for (TActionListener::Notifier notifier(m_listener); notifier.IsValid(); notifier.Next())
notifier->OnEnd( pAction, args );
}
}