本文整理汇总了C++中Dictionary::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Dictionary::Get方法的具体用法?C++ Dictionary::Get怎么用?C++ Dictionary::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EventSpawnEntity
//---------------------------------------
void Entity::EventSpawnEntity( Dictionary& params )
{
Entity* invoker;
if ( params.Get( "Invoker", invoker ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_WARNING, "Entity '%s' (%d) : EventSetAnimationState : Bad event args for 'invoker'\n",
mName.c_str(), mEntityId );
return;
}
if ( invoker != this ) return;
std::string name;
std::string animName;
params.Get( "Name", name );
params.Get( "AnimationName", animName );
Dictionary p2;
p2.Set( "EntityName", name );
p2.Set( "Position", mPosition );
EventManager::FireEvent( "SpawnEntity", p2 );
Entity* spawned=0;
p2.Get( "Entity", spawned );
if ( spawned )
{
spawned->SetAnimationState( animName, 0 );
}
}
示例2: _FromDict
void Diagram::_FromDict(const Dictionary& WormDict, WormClass& worm)
{
name ira, masha;
WormDict.Get("Ira", ira);
worm.Ira = Ver(ira);
WormDict.Get("Masha", masha);
worm.Masha = Ver(masha);
WormDict.Get("dSpin", worm.dSpin);
WormDict.Get("K", worm.K);
}
示例3: RespawnPlayer
//--------------------------------------
void RespawnPlayer( Dictionary& params )
{
int who = -1;
Player* player;
params.Get( "PlayerIndex", who );
if ( who >= 0 )
{
player = &gPlayers[ who ];
// Make sure player is still connected
if ( player->active )
{
player->alive = 1;
player->pos = RNG::RandomInRange( Vec2f( 100, 100 ), Vec2f( 700, 500 ) );
player->rotation = 0;
player->vel = Vec2f::ZERO;
gWriter.Write( NC_RESPAWN );
gWriter.Write( who );
gWriter.Write( player->pos );
gServer.SendData( gWriter );
}
}
}
示例4: SpawnGameObjectEvent
//---------------------------------------
void Map::SpawnGameObjectEvent( Dictionary& params )
{
std::string name;
Vec2f position;
// Get name
if ( params.Get( "ObjectName", name ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn GameObject: missing ObjectName\n" );
return;
}
// Get position
if ( params.Get( "Position", position ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn GameObject: missing Position\n" );
return;
}
// Spawn entity
GameObject* gameObject = NULL;
GameObjectDefinition* def = GameObjectDefinition::GetDefinitionByName( name );
if ( def )
{
gameObject = def->Create();
gameObject->Position = position;
gameObject->GameMap = this;
gameObject->SetBoundsFromSprite();
gameObject->ObjectId = mObjects.size();
// Call OnCreate for all logic nodes on the object
gameObject->FinalizeNodes();
mObjects.push_back( gameObject );
}
else
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn GameObject: No GameObject found '%s'\n", name.c_str() );
}
params.Set( "GameObject", gameObject );
}
示例5: TriggeredEvent
//---------------------------------------
void Entity::TriggeredEvent( Dictionary& params )
{
std::string eventName;
Sprite* sprite;
params.Get( "EventName", eventName );
// Event came from sprite, make sure it is ours
if ( params.Get( "Sprite", sprite ) == Dictionary::DErr_SUCCESS )
{
if ( sprite != mSprite ) return;
}
TriggerEvent( eventName );
//EntityDefinition* myDef = EntityDefinition::GetDefinitionByName( mName );
//myDef->TriggerEvent( eventName, this );
//ConsolePrintf( "Entity '%s' (%d) TriggeredEvent: %s\n",
// mName.c_str(), mEntityId, eventName.c_str() );
}
示例6: EventSetAnimationState
//---------------------------------------
void Entity::EventSetAnimationState( Dictionary& params )
{
Entity* invoker;
if ( params.Get( "Invoker", invoker ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_WARNING, "Entity '%s' (%d) : EventSetAnimationState : Bad event args for 'invoker'\n",
mName.c_str(), mEntityId );
return;
}
if ( invoker != this ) return;
std::string animName = "Idle";
int frame = 0;
params.Get( "AnimationName", animName );
params.Get( "Frame", frame );
SetAnimationState( animName, frame );
}
示例7: SetCameraBoundsEvent
//---------------------------------------
void MageGame::SetCameraBoundsEvent( Dictionary& params )
{
RectI bounds;
if ( params.Get( "Bounds", bounds ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to set camera bounds: missing Bounds\n" );
return;
}
mCamera->SetWorldBounds( bounds );
}
示例8: SpawnSpriteEvent
//---------------------------------------
void MageGame::SpawnSpriteEvent( Dictionary& params )
{
std::string spriteName;
Vec2f position;
// Get name
if ( params.Get( "SpriteName", spriteName ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn sprite: missing SpriteName\n" );
return;
}
// Get position
if ( params.Get( "Position", position ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn sprite: missing Position\n" );
return;
}
// Spawn sprite
SpawnSprite( spriteName, position );
}
示例9: EventApplyImpulse
//---------------------------------------
void Entity::EventApplyImpulse( Dictionary& params )
{
Entity* entity;
Vec2f force;
if ( params.Get( "Invoker", entity ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_WARNING, "Entity '%s' (%d) : ApplyImpulse : Bad event args for 'invoker'\n",
mName.c_str(), mEntityId );
return;
}
if ( entity != this ) return;
if ( params.Get( "Force", force ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_WARNING, "Entity '%s' (%d) : ApplyImpulse : Bad event args for 'force'\n",
mName.c_str(), mEntityId );
}
ApplyImpulse( force );
}
示例10: SpawnGameObjectEvent
//---------------------------------------
void MageGame::SpawnGameObjectEvent( Dictionary& params )
{
std::string entityName;
Vec2f position;
// Get name
if ( params.Get( "ObjectName", entityName ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn GameObject: missing ObjectName\n" );
return;
}
// Get position
if ( params.Get( "Position", position ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn GameObject: missing Position\n" );
return;
}
// Spawn entity
GameObject* gameObject = SpawnGameObject( entityName, position );
params.Set( "GameObject", gameObject );
}
示例11: SpawnEntityEvent
//---------------------------------------
void MageGame::SpawnEntityEvent( Dictionary& params )
{
std::string entityName;
Vec2f position;
// Get name
if ( params.Get( "EntityName", entityName ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn entity: missing EntityName\n" );
return;
}
// Get position
if ( params.Get( "Position", position ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_ERROR, "Failed to spawn entity: missing Position\n" );
return;
}
// Spawn entity
Entity* entity = SpawnEntity( entityName, position );
params.Set( "Entity", entity );
}
示例12: EventKill
//---------------------------------------
void Entity::EventKill( Dictionary& params )
{
Entity* invoker;
if ( params.Get( "Invoker", invoker ) != Dictionary::DErr_SUCCESS )
{
ConsolePrintf( CONSOLE_WARNING, "Entity '%s' (%d) : EventSetAnimationState : Bad event args for 'invoker'\n",
mName.c_str(), mEntityId );
return;
}
if ( invoker != this ) return;
Kill();
}
示例13: OnEnter
void BrushToolInputState::OnEnter( const Dictionary& parameters )
{
EditorState* owner = GetOwnerDerived();
// Get the selected Tile template (if specified).
Tile tileTemplate;
Dictionary::DictionaryError error = parameters.Get( "tileTemplate", tileTemplate );
if( error == Dictionary::DErr_SUCCESS )
{
// Set the selected Tile template.
SetTileTemplate( tileTemplate );
}
// Show the tile palette.
owner->GetTilePalette()->Show();
}
示例14: GetFileModTime
Tweakable& AddTweakableValue( const char* _pFilename, size_t _Counter )
{
// First, see if this file is in the files list
U32 Key = DictionaryString<int>::Hash( _pFilename );
TweakableSourceFile* pFileEntry = g_TweakableFiles.Get( Key );
if ( pFileEntry == NULL )
{ // if it's not found, add to the list of tweakable files, assume it's unmodified since the program has been built
TweakableSourceFile& Value = g_TweakableFiles.Add( Key );
// strcpy( Value.pFilename, _pFilename );
Value.pFilename = _pFilename;
Value.LastModificationTime = GetFileModTime( _pFilename );
}
// Add to the tweakables
Key = HashKey( _pFilename, _Counter );
return g_TweakableValues.Add( Key );
}
示例15: NavigateToPage
void NavigateToPage( HWND appHwnd, Document * doc, NMTREEVIEW * info )
{
if (!info->itemNew.hItem)
return;
Dictionary * dict = (Dictionary *)info->itemNew.lParam;
if (!dict)
return;
PObject dest = dict->Get( "Dest", doc->xrefTable );
if (!dest)
return;
if (dest->Type() == ObjectType::String)
{
String * s = (String *)dest.get();
dest = Object::ResolveIndirect_<Object>( NameTreeGetValue( doc, *s ), doc->xrefTable );
}
PArray destArray;
if (dest->Type() == ObjectType::Dictionary)
{
PDictionary d = boost::shared_static_cast<Dictionary>(dest);
//TODO: Implement link action
//For now handle everything as GoTo (here be Raptors)
//d->Get<Name>("S", doc->xrefTable);
destArray = d->Get<Array>("D", doc->xrefTable);
}
else if (dest->Type() == ObjectType::Array)
destArray = boost::shared_static_cast<Array>(dest);
if (destArray)
{
if (destArray->elements.empty()) return;
PDictionary page = Object::ResolveIndirect_<Dictionary>( destArray->elements[0], doc->xrefTable );
SetCurrentPage( page );
}
}