本文整理汇总了C++中WBEvent::GetHash方法的典型用法代码示例。如果您正苦于以下问题:C++ WBEvent::GetHash方法的具体用法?C++ WBEvent::GetHash怎么用?C++ WBEvent::GetHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WBEvent
的用法示例。
在下文中一共展示了WBEvent::GetHash方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: STATICHASH
/*virtual*/ void EldritchFramework::HandleEvent(const WBEvent& Event) {
XTRACE_FUNCTION;
Framework3D::HandleEvent(Event);
STATIC_HASHED_STRING(ToggleInvertY);
STATIC_HASHED_STRING(ToggleFullscreen);
STATIC_HASHED_STRING(OnSliderChanged);
STATIC_HASHED_STRING(WritePrefsConfig);
STATIC_HASHED_STRING(CheckForUpdates);
const HashedString EventName = Event.GetEventName();
if (EventName == sToggleInvertY) {
XTRACE_NAMED(ToggleInvertY);
// TODO: Also invert controller? Or on a separate button?
STATIC_HASHED_STRING(TurnY);
const bool InvertY = !m_InputSystem->GetMouseInvert(sTurnY);
m_InputSystem->SetMouseInvert(sTurnY, InvertY);
m_InputSystem->SetControllerInvert(sTurnY, InvertY);
// Publish config var so UI can reflect the change.
// I could make input system publish config vars for each adjustment, but
// that seems wasteful since most inputs currently have no adjustment.
STATICHASH(InvertY);
ConfigManager::SetBool(sInvertY, InvertY);
} else if (EventName == sToggleFullscreen) {
XTRACE_NAMED(ToggleFullscreen);
ToggleFullscreen();
} else if (EventName == sOnSliderChanged) {
XTRACE_NAMED(OnSliderChanged);
STATIC_HASHED_STRING(SliderName);
const HashedString SliderName = Event.GetHash(sSliderName);
STATIC_HASHED_STRING(SliderValue);
const float SliderValue = Event.GetFloat(sSliderValue);
HandleUISliderEvent(SliderName, SliderValue);
} else if (EventName == sWritePrefsConfig) {
XTRACE_NAMED(WritePrefsConfig);
WritePrefsConfig();
} else if (EventName == sCheckForUpdates) {
#if BUILD_WINDOWS && !BUILD_STEAM
XTRACE_NAMED(CheckForUpdates);
// So I can compile updating out of certain builds.
STATICHASH(Framework);
STATICHASH(CheckForUpdates);
const bool CheckForUpdates =
ConfigManager::GetBool(sCheckForUpdates, true, sFramework);
if (CheckForUpdates) {
m_CheckForUpdates->Check(false, true);
}
#endif
}
}
示例2: SetState
/*virtual*/ void WBCompState::HandleEvent(const WBEvent& Event) {
XTRACE_FUNCTION;
Super::HandleEvent(Event);
STATIC_HASHED_STRING(SetState);
const HashedString EventName = Event.GetEventName();
if (EventName == sSetState) {
STATIC_HASHED_STRING(NewState);
const HashedString State = Event.GetHash(sNewState);
SetState(State);
}
}
示例3:
/*virtual*/ void EldritchPersistence::HandleEvent( const WBEvent& Event )
{
STATIC_HASHED_STRING( SetPersistentVar );
const HashedString EventName = Event.GetEventName();
if( EventName == sSetPersistentVar )
{
STATIC_HASHED_STRING( Name );
const HashedString Name = Event.GetHash( sName );
STATIC_HASHED_STRING( Value );
const WBEvent::SParameter* const pParameter = Event.GetParameter( sValue );
m_VariableMap.Set( Name, pParameter );
}
}
示例4:
/*virtual*/ void WBCompEldFaction::HandleEvent(const WBEvent& Event) {
XTRACE_FUNCTION;
Super::HandleEvent(Event);
STATIC_HASHED_STRING(SetFaction);
const HashedString EventName = Event.GetEventName();
if (EventName == sSetFaction) {
if (m_Immutable) {
// Faction can't be changed, do nothing
} else {
STATIC_HASHED_STRING(Faction);
m_Faction = Event.GetHash(sFaction);
}
}
}
示例5: SetSendUpdatedEvent
/*virtual*/ void WBCompEldMesh::HandleEvent(const WBEvent& Event) {
XTRACE_FUNCTION;
Super::HandleEvent(Event);
STATIC_HASHED_STRING(OnInitialized);
STATIC_HASHED_STRING(OnSpawnedQueued);
STATIC_HASHED_STRING(OnLoaded);
STATIC_HASHED_STRING(OnBecameFrobTarget);
STATIC_HASHED_STRING(Hide);
STATIC_HASHED_STRING(Show);
STATIC_HASHED_STRING(HideMesh);
STATIC_HASHED_STRING(ShowMesh);
STATIC_HASHED_STRING(PlayAnim);
STATIC_HASHED_STRING(SetAnim);
STATIC_HASHED_STRING(CopyAnimations);
STATIC_HASHED_STRING(SetMesh);
STATIC_HASHED_STRING(SetTexture);
const HashedString EventName = Event.GetEventName();
if (EventName == sOnInitialized) {
SetSendUpdatedEvent();
} else if (EventName == sOnSpawnedQueued ||
EventName == sOnLoaded) // Need to have a valid transform
{
ImmediateUpdateBlendedIrradiance();
} else if (EventName == sOnBecameFrobTarget) {
STATIC_HASHED_STRING(IsFrobTarget);
const bool IsFrobTarget = Event.GetBool(sIsFrobTarget);
if (IsFrobTarget) {
STATIC_HASHED_STRING(Highlight);
m_CurrentHighlight = Event.GetVector(sHighlight);
} else {
m_CurrentHighlight.Zero();
}
} else if (EventName == sHide || EventName == sHideMesh) {
m_Hidden = true;
} else if (EventName == sShow || EventName == sShowMesh) {
m_Hidden = false;
} else if (EventName == sPlayAnim) {
STATIC_HASHED_STRING(AnimationName);
const HashedString AnimationName = Event.GetHash(sAnimationName);
STATIC_HASHED_STRING(Loop);
const bool Loop = Event.GetBool(sLoop);
STATIC_HASHED_STRING(IgnoreIfAlreadyPlaying);
const bool IgnoreIfAlreadyPlaying = Event.GetBool(sIgnoreIfAlreadyPlaying);
STATIC_HASHED_STRING(PlayRate);
const float PlayRate = Event.GetFloat(sPlayRate);
PlayAnimation(AnimationName, Loop, IgnoreIfAlreadyPlaying, PlayRate);
} else if (EventName == sSetAnim) {
STATIC_HASHED_STRING(AnimationIndex);
const int AnimationIndex = Event.GetInt(sAnimationIndex);
STATIC_HASHED_STRING(AnimationTime);
const float AnimationTime = Event.GetFloat(sAnimationTime);
STATIC_HASHED_STRING(AnimationEndBehavior);
const int AnimationEndBehavior = Event.GetInt(sAnimationEndBehavior);
STATIC_HASHED_STRING(AnimationPlayRate);
const float AnimationPlayRate = Event.GetFloat(sAnimationPlayRate);
AnimationState::SPlayAnimationParams PlayParams;
PlayParams.m_EndBehavior =
static_cast<AnimationState::EAnimationEndBehavior>(
AnimationEndBehavior);
m_Mesh->SetAnimation(AnimationIndex, PlayParams);
m_Mesh->SetAnimationTime(AnimationTime);
m_Mesh->SetAnimationPlayRate(AnimationPlayRate > 0.0f ? AnimationPlayRate
: 1.0f);
} else if (EventName == sCopyAnimations) {
STATIC_HASHED_STRING(SourceEntity);
WBEntity* const pSourceEntity = Event.GetEntity(sSourceEntity);
STATIC_HASHED_STRING(SuppressAnimEvents);
const bool SuppressAnimEvents = Event.GetBool(sSuppressAnimEvents);
CopyAnimationsFrom(pSourceEntity, SuppressAnimEvents);
} else if (EventName == sSetMesh) {
STATIC_HASHED_STRING(Mesh);
const SimpleString Mesh = Event.GetString(sMesh);
STATIC_HASHED_STRING(Texture);
const SimpleString Texture = Event.GetString(sTexture);
SetMesh(Mesh);
SetTexture(Texture);
UpdateMesh(0.0f);
} else if (EventName == sSetTexture) {
STATIC_HASHED_STRING(Texture);
const SimpleString Texture = Event.GetString(sTexture);
SetTexture(Texture);
}
//.........这里部分代码省略.........
示例6: if
/*virtual*/ void EldritchGame::HandleEvent( const WBEvent& Event )
{
XTRACE_FUNCTION;
STATIC_HASHED_STRING( ReturnToHub );
STATIC_HASHED_STRING( GoToNextLevel );
STATIC_HASHED_STRING( GoToPrevLevel );
STATIC_HASHED_STRING( GoToLevel );
STATIC_HASHED_STRING( Checkpoint );
STATIC_HASHED_STRING( TweetRIP );
STATIC_HASHED_STRING( PlayMusic );
STATIC_HASHED_STRING( StopMusic );
STATIC_HASHED_STRING( LaunchWebSite );
STATIC_HASHED_STRING( GoToLevelImmediate );
const HashedString EventName = Event.GetEventName();
if( EventName == sReturnToHub )
{
STATIC_HASHED_STRING( Restart );
const bool Restart = Event.GetBool( sRestart );
STATIC_HASHED_STRING( FlushHub );
const bool FlushHub = Event.GetBool( sFlushHub );
RequestReturnToHub( Restart, FlushHub );
}
else if( EventName == sGoToNextLevel )
{
RequestGoToNextLevel();
}
else if( EventName == sGoToPrevLevel )
{
RequestGoToPrevLevel();
}
else if( EventName == sGoToLevel )
{
STATIC_HASHED_STRING( Level );
const SimpleString Level = Event.GetString( sLevel );
STATIC_HASHED_STRING( WorldDef );
const HashedString WorldDef = Event.GetHash( sWorldDef );
RequestGoToLevel( Level, WorldDef, true );
}
else if( EventName == sCheckpoint )
{
Checkpoint();
}
else if( EventName == sTweetRIP )
{
LaunchRIPTweet();
}
else if( EventName == sLaunchWebSite )
{
LaunchWebSite();
}
else if( EventName == sPlayMusic )
{
STATIC_HASHED_STRING( Music );
const SimpleString Music = Event.GetString( sMusic );
m_Music->PlayMusic( ( Music == "" ) ? m_CurrentMusic : Music );
}
else if( EventName == sStopMusic )
{
m_Music->StopMusic();
}
else if( EventName == sGoToLevelImmediate )
{
// This should only be called after we've queued a go-to.
ASSERT( m_GoToLevelOnNextTick );
if( m_GoToLevelOnNextTick )
{
GoToLevel();
}
// HACK: Tick world once to pump the event queue. Fixes title screen bugs. (Hack because this assumes we only ever use this when returning to title screen.)
EldritchFramework* const pFramework = EldritchFramework::GetInstance();
EldritchWorld* const pWorld = pFramework->GetWorld();
pWorld->Tick( 0.0f );
}
}
示例7: if
//.........这里部分代码省略.........
// or whatever and hook this up in data, but eh. That somehow feels worse.
STATIC_HASHED_STRING( Idle );
PlayAnimation( GetFists(), sIdle, EH_Right );
HideWeaponHUD();
}
}
else if( EventName == sOnItemsSwapped )
{
// HACK, since the only things we swap (currently) are Weapon/WeaponAlt
// Hide the alt weapon, show the right hand item
WB_MAKE_EVENT( Hide, GetEntity() );
WB_DISPATCH_EVENT( GetEventManager(), Hide, GetWeaponAlt() );
WB_MAKE_EVENT( Show, GetEntity() );
WB_DISPATCH_EVENT( GetEventManager(), Show, GetItemInRightHand() );
AddAnimationsToHand( GetItemInRightHand() );
STATIC_HASHED_STRING( Idle );
PlayAnimation( GetItemInRightHand(), sIdle, EH_Right );
UpdateWeaponHUD();
WB_MAKE_EVENT( OnWeaponEquipped, GetEntity() );
WB_SET_AUTO( OnWeaponEquipped, Entity, Weapon, GetItemInRightHand() );
WB_DISPATCH_EVENT( GetEventManager(), OnWeaponEquipped, GetEntity() );
}
else if( EventName == sUseRightHand )
{
WBEntity* const pWeapon = GetItemInRightHand();
if( pWeapon )
{
STATIC_HASHED_STRING( InputEdge );
const int InputEdge = Event.GetInt( sInputEdge );
{
WB_MAKE_EVENT( Use, GetEntity() );
WB_SET_AUTO( Use, Int, InputEdge, InputEdge );
WB_DISPATCH_EVENT( GetEventManager(), Use, pWeapon );
}
}
}
else if( EventName == sUseLeftHand )
{
WBEntity* const pPower = GetItemInLeftHand();
if( pPower )
{
STATIC_HASHED_STRING( InputEdge );
const int InputEdge = Event.GetInt( sInputEdge );
{
WB_MAKE_EVENT( Use, GetEntity() );
WB_SET_AUTO( Use, Int, InputEdge, InputEdge );
WB_DISPATCH_EVENT( GetEventManager(), Use, pPower );
}
}
}
else if( EventName == sShowHands )
{
DecrementHideHandsRefs();
}
else if( EventName == sHideHands )
{
IncrementHideHandsRefs();
}
else if( EventName == sPlayHandAnim )
{
STATIC_HASHED_STRING( AnimatingEntity );
WBEntity* const pAnimatingEntity = Event.GetEntity( sAnimatingEntity );
STATIC_HASHED_STRING( AnimationName );
const HashedString AnimationName = Event.GetHash( sAnimationName );
// Don't play hand anim if we're restoring the alternate weapon
if( pAnimatingEntity == GetItemInRightHand() || pAnimatingEntity == GetItemInLeftHand() )
{
const EHand Hand = GetHandEnum( pAnimatingEntity );
PlayAnimation( pAnimatingEntity, AnimationName, Hand );
}
}
else if( EventName == sSetHandMeshes )
{
STATIC_HASHED_STRING( LeftHandMesh );
const SimpleString LeftHandMesh = Event.GetString( sLeftHandMesh );
STATIC_HASHED_STRING( LeftHandTexture );
const SimpleString LeftHandTexture = Event.GetString( sLeftHandTexture );
STATIC_HASHED_STRING( RightHandMesh );
const SimpleString RightHandMesh = Event.GetString( sRightHandMesh );
STATIC_HASHED_STRING( RightHandTexture );
const SimpleString RightHandTexture = Event.GetString( sRightHandTexture );
SetHandMeshes( LeftHandMesh, LeftHandTexture, RightHandMesh, RightHandTexture );
RestoreHandAnimations();
}
}