当前位置: 首页>>代码示例>>C++>>正文


C++ Dictionary::Get方法代码示例

本文整理汇总了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 );
	}
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:30,代码来源:Entity.cpp

示例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);
}
开发者ID:kunyuan,项目名称:Feynman_Simulator,代码行数:10,代码来源:diagram_IO.cpp

示例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 );
		}
	}
}
开发者ID:hydraskillz,项目名称:NetworkShooter,代码行数:27,代码来源:Server.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:43,代码来源:Map.cpp

示例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() );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:21,代码来源:Entity.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:21,代码来源:Entity.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:13,代码来源:MageGame.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:23,代码来源:MageGame.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:23,代码来源:Entity.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:24,代码来源:MageGame.cpp

示例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 );
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:24,代码来源:MageGame.cpp

示例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();
}
开发者ID:hydraskillz,项目名称:Mage2D,代码行数:15,代码来源:Entity.cpp

示例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();
}
开发者ID:andrewtc,项目名称:AndroidWars,代码行数:17,代码来源:EditorInputStates.cpp

示例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 );
	}
开发者ID:zoombapup,项目名称:GodComplex,代码行数:17,代码来源:tweakval.cpp

示例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 );
	}
}
开发者ID:chrisforbes,项目名称:pdf,代码行数:42,代码来源:outline.cpp


注:本文中的Dictionary::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。