本文整理汇总了C++中SUIArguments::AddArgument方法的典型用法代码示例。如果您正苦于以下问题:C++ SUIArguments::AddArgument方法的具体用法?C++ SUIArguments::AddArgument怎么用?C++ SUIArguments::AddArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUIArguments
的用法示例。
在下文中一共展示了SUIArguments::AddArgument方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessEvent
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()));
}
}
}
示例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: 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);
}
示例4: 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;
}
}
示例5: ReadGameServers
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: 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;
}
示例7: 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;
}
示例8: FlushNextEvent
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();
}
}
示例9: ProcessEvent
//.........这里部分代码省略.........
// calculate ray dir
CCamera cam = gEnv->pRenderer->GetCamera();
if (pEntity->GetSlotFlags(m_dynTexGeomSlot) & ENTITY_SLOT_RENDER_NEAREST)
{
ICVar *r_drawnearfov = gEnv->pConsole->GetCVar("r_DrawNearFoV");
assert(r_drawnearfov);
cam.SetFrustum(cam.GetViewSurfaceX(),cam.GetViewSurfaceZ(),DEG2RAD(r_drawnearfov->GetFVal()),cam.GetNearPlane(),cam.GetFarPlane(), cam.GetPixelAspectRatio());
}
Vec3 vPos0 = rayPos;
Vec3 vPos1 = rayPos + rayDir;
// translate into object space
const Matrix34 m = pEntity->GetWorldTM().GetInverted();
vPos0 = m * vPos0;
vPos1 = m * vPos1;
// walk through all sub objects
const int objCount = pObj->GetSubObjectCount();
for (int obj = 0; obj <= objCount && !hasHit; ++obj)
{
Vec3 vP0, vP1;
IStatObj* pSubObj = NULL;
if (obj == objCount)
{
vP0 = vPos0;
vP1 = vPos1;
pSubObj = pObj;
}
else
{
IStatObj::SSubObject* pSub = pObj->GetSubObject(obj);
const Matrix34 mm = pSub->tm.GetInverted();
vP0 = mm * vPos0;
vP1 = mm * vPos1;
pSubObj = pSub->pStatObj;
}
IRenderMesh* pMesh = pSubObj ? pSubObj->GetRenderMesh() : NULL;
if (pMesh)
{
const Ray ray(vP0, (vP1-vP0).GetNormalized() * maxRayDist);
hasHit = RayIntersectMesh(pMesh, pMaterial, pElement, ray, hitpos, p0, p1, p2, uv0, uv1, uv2);
}
}
// skip if not hit
if (!hasHit)
{
ActivateOutput(pActInfo, EOP_Failed, 1);
return;
}
// calculate vectors from hitpos to vertices p0, p1 and p2:
const Vec3 v0 = p0-hitpos;
const Vec3 v1 = p1-hitpos;
const Vec3 v2 = p2-hitpos;
// calculate factors
const float h = (p0-p1).Cross(p0-p2).GetLength();
const float f0 = v1.Cross(v2).GetLength() / h;
const float f1 = v2.Cross(v0).GetLength() / h;
const float f2 = v0.Cross(v1).GetLength() / h;
// find the uv corresponding to hitpos
Vec3 uv = uv0 * f0 + uv1 * f1 + uv2 * f2;
// translate to flash space
int x, y, width, height;
float aspect;
pElement->GetFlashPlayer()->GetViewport(x, y, width, height, aspect);
int iX = int_round(uv.x * (float)width);
int iY = int_round(uv.y * (float)height);
// call the function provided if it is present in the UIElement description
string funcName = GetPortString(pActInfo, EIP_CallFunction);
const SUIEventDesc* eventDesc = pElement->GetFunctionDesc(funcName);
if(eventDesc)
{
SUIArguments arg;
arg.AddArgument(iX);
arg.AddArgument(iY);
pElement->CallFunction(eventDesc->sName, arg);
}
ActivateOutput(pActInfo, EOP_Success, 1);
}
}
}
}
ActivateOutput(pActInfo, EOP_Failed, 1);
}
break;
}
}
示例10: Thread
void CPacketQueue::Thread()
{
gEnv->pLog->Log(TITLE "Send/Read packets thread started!");
while(!gEnv->pSystem->IsQuitting())
{
send_mutex.lock();
if(packetsInSendQueue>0)
{
//gEnv->pLog->Log("[CryMasterServer] Sending packet...");
SPacket packet;
std::vector <SPacket>::iterator it;
it = SendPackets.begin();
packet.addr = (*it).addr;
packet.data = (*it).data;
packet.size = (*it).size;
send(packet.addr,packet.data,packet.size,0);
SendPackets.erase(it);
packetsInSendQueue--;
}
send_mutex.unlock();
read_mutex.lock();
if(packetsInReadQueue>0)
{
//gEnv->pLog->Log("[CryMasterServer] Reding packet...");
SPacket Packet;
SPlayer Player;
std::vector <SPacket>::iterator it;
it = ReadPackets.begin();
Packet.addr = (*it).addr;
Packet.data = (*it).data;
Packet.size = (*it).size;
EPacketType packetType = gClientEnv->pRsp->GetPacketType(Packet);
switch (packetType)
{
case PACKET_IDENTIFICATION:
gEnv->pLog->Log(TITLE "Identification packet recived");
break;
case PACKET_ACCOUNT:
{
gEnv->pLog->Log(TITLE "Account info packet recived");
gClientEnv->masterPlayer = gClientEnv->pRsp->ReadAccountInfo(Packet);
SPlayer Player;
SUIArguments args;
Player = gClientEnv->masterPlayer;
if(Player.playerId != 0)
{
args.AddArgument(Player.nickname.c_str());
args.AddArgument(Player.level);
args.AddArgument(Player.money);
args.AddArgument(Player.xp);
CMsEvents::GetInstance()->SendEvent(CMsEvents::eUIGE_AccountInfoResived, args);
}
break;
}
case PACKET_MESSAGE:
{
SMessage Message = gClientEnv->pRsp->ReadMsg(Packet);
if(strcmp(Message.message,""))
{
switch (Message.area)
{
case CHAT_MESSAGE_GLOBAL:
{
gEnv->pLog->Log(TITLE "Global chat message recived");
SUIArguments args;
args.AddArgument(Message.message);
CMsEvents::GetInstance()->SendEvent(CMsEvents::eUIGE_MsgResived, args);
break;
}
case CHAT_MESSAGE_PRIVATE:
break;
case CHAT_MESSAGE_SYSTEM:
{
gClientEnv->serverResult = Message.message;
gEnv->pLog->Log(TITLE "System message recived [%s]", gClientEnv->serverResult.c_str());
break;
}
//.........这里部分代码省略.........