void AttentionBar::OnAction(wxCommandEvent& event) { ActionsMap::const_iterator i = m_actions.find(event.GetEventObject()); if ( i == m_actions.end() ) { event.Skip(); return; } HideMessage(); i->second(); }
/** \brief Create and display icons for each of the RemoteNodes. in pacNodes. * This sets the remote view contents and updates the layout when necessary. * It also gets the initial path the first time it is called. * * \todo Perform periodic layouts while downloading large dirlisting. * \todo Display file sizes in a human readable format? * \todo Move the entry path stuff somewhere else? * * \param pacNodes List of RemoteNodes that should be updated for the remote view contents. * \param bInitial Set this to true if this is the first of several messages and we should clear the iconview first. * \param bFinal Set this to true if this is the last of the directory listing. and should Layout() when done. */ void RemoteIconView::SetContents( std::vector< RemoteNode >* pacNodes, bool bInitial, bool bFinal ) { /* If we haven't yet got the entry path, get it now. */ if( m_zPath == "" ) { /* \todo Is it possible that GetEntryPath() could be "" ? */ if( m_pcServer->GetEntryPath() != "" ) { m_zPath = m_pcServer->GetEntryPath(); if( m_pcDirChangedMsg ) { Message cTmp = *m_pcDirChangedMsg; cTmp.AddString( "file/path", m_zPath ); Invoke( &cTmp ); } } else { DEBUG( "RemoteView: GetEntryPath() is empty.\n" ); } } if( bInitial ) Clear(); /* Remove all icons */ HideMessage(); int nCount = pacNodes->size(); // DEBUG( "RemoteIconView: Dirlisting fragment contains %i nodes; %s initial, %sfinal\n", nCount, bInitial?"":"not ", bFinal?"":"not " ); for( int i = 0; i < nCount; i++ ) { RemoteNode cNode = (*pacNodes)[i]; // DEBUG( " '%s', %s, size %i, permissions %i\n", cNode.GetName().c_str(), (cNode.IsDir() ? "dir" : "file"), cNode.GetSize(), cNode.GetPermissions() ); Image* pcImage = GetNodeImage( &cNode, (GetView() == VIEW_LIST || GetView() == VIEW_DETAILS) ); RemoteIconData* pcData = new RemoteIconData; pcData->m_cNode = cNode; uint nIndex = AddIcon( pcImage, pcData ); AddIconString( nIndex, cNode.GetName() ); String zTmp; if( cNode.IsDir() ) { zTmp = "<Dir>"; } else { zTmp.Format( "%li", cNode.GetSize() ); } AddIconString( nIndex, zTmp ); AddIconString( nIndex, cNode.GetTimestamp().GetDate() ); } // When this is the last of the directory listing, reset the update flag. if( bFinal ) { m_bUpdatePending = false; } Layout(); }
void AttentionBar::OnAction(wxCommandEvent& event) { ActionsMap::const_iterator i = m_actions.find(event.GetEventObject()); if ( i == m_actions.end() ) { event.Skip(); return; } // first perform the action... i->second(); // ...then hide the message HideMessage(); }
void AttentionBar::OnAction(wxCommandEvent& event) { ActionsMap::const_iterator i = m_actions.find(event.GetEventObject()); if ( i == m_actions.end() ) { event.Skip(); return; } // first perform the action... AttentionMessage::ActionInfo info; info.checkbox = m_checkbox->IsShown() && m_checkbox->IsChecked(); i->second(info); // ...then hide the message HideMessage(); }
void CMPTutorial::OnMapOpen(bool open) { if(!m_enabled) return; // hide any previous messages which are waiting for this event. if(open && m_currentEvent.m_msgRemovalCondition == eMRC_OpenMap) { if(!m_currentEvent.m_pCurrentSound.get()) HideMessage(); else m_currentEvent.m_msgRemovalCondition = eMRC_SoundFinished; } if(open) { TriggerEvent(eTE_OpenMap); } else { TriggerEvent(eTE_CloseMap); } }
void CMPTutorial::Update() { FUNCTION_PROFILER(GetISystem(), PROFILE_GAME); if(!m_enabled && g_pGameCVars->g_PSTutorial_Enabled) EnableTutorialMode(true); else if(m_enabled && !g_pGameCVars->g_PSTutorial_Enabled) EnableTutorialMode(false); m_currentEvent.m_msgDisplayTime -= gEnv->pTimer->GetFrameTime(); if(!m_enabled) { if(m_currentEvent.m_msgDisplayTime < 0.0f && m_currentEvent.m_msgRemovalCondition != eMRC_None) { m_currentEvent.m_msgRemovalCondition = eMRC_None; SAFE_HUD_FUNC(ShowTutorialText(NULL,1)); } } // update the text... must be done even if not enabled, to ensure the 'you may reenable...' // message is shown correctly. if(m_currentEvent.m_numChunks > 0) { // calculate how far through the current sound we are CTimeValue now = gEnv->pTimer->GetFrameStartTime(); float soundTimer = now.GetMilliSeconds() - m_currentEvent.m_soundStartTime; assert(soundTimer >= 0); float soundPercent = 1.0f; if(m_currentEvent.m_soundLength == 0.0f && m_currentEvent.m_pCurrentSound.get()) { m_currentEvent.m_soundLength = m_currentEvent.m_pCurrentSound->GetLengthMs(); } if(m_currentEvent.m_soundLength > 0.0f) { soundPercent = soundTimer / m_currentEvent.m_soundLength; } for(int i=m_currentEvent.m_numChunks-1; i > m_currentEvent.m_currentChunk; --i) { if(m_currentEvent.m_chunks[i].m_startPercent <= soundPercent) { m_currentEvent.m_currentChunk = i; int pos = 2; // 2=bottom, 1=middle IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor(); if(pClientActor && pClientActor->GetLinkedVehicle()) { pos = 1; } SAFE_HUD_FUNC(ShowTutorialText(m_currentEvent.m_chunks[i].m_text, pos)); break; } } } if(!m_enabled) return; CPlayer* pPlayer = static_cast<CPlayer*>(g_pGame->GetIGameFramework()->GetClientActor()); if(!pPlayer) return; // don't start until game begins if(pPlayer->GetSpectatorMode() != 0 || g_pGame->GetGameRules()->GetCurrentStateId() != 3) return; if(!m_initialised) { m_initialised = true; if(g_pGame->GetHUD()) { // register as a HUD listener g_pGame->GetHUD()->RegisterListener(this); } // go through entity list and pull out the factories. IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator(); while (!pIt->IsEnd()) { if (IEntity * pEnt = pIt->Next()) { if(pEnt->GetClass() == m_pHQClass) { m_baseList.push_back(pEnt->GetId()); //CryLog("Adding HQ %d to list: %d", pEnt->GetId(), m_baseList.size()); } else if(pEnt->GetClass() == m_pAlienEnergyPointClass) { m_alienEnergyPointList.push_back(pEnt->GetId()); //CryLog("Adding AEP %d to list: %d", pEnt->GetId(), m_alienEnergyPointList.size()); } else if(pEnt->GetClass() == m_pSpawnGroupClass) { m_spawnGroupList.push_back(pEnt->GetId()); //CryLog("Adding spawngroup %d to list: %d", pEnt->GetId(), m_spawnGroupList.size()); } else if(pEnt->GetClass() == m_pFactoryClass) { m_factoryList.push_back(pEnt->GetId()); //CryLog("Adding Factory %d to list: %d", pEnt->GetId(), m_factoryList.size()); } } } } // first the briefing events. These are shown in order. bool showPrompt = CheckBriefingEvents(pPlayer); // player has been killed if(pPlayer->GetHealth() <= 0) { showPrompt = TriggerEvent(eTE_Killed); } else if(!showPrompt) { // check each event type here. Which might take a while. // entering a neutral factory // enter prototype factory // enter hostile factory // find alien crash m_entityCheckTimer -= gEnv->pTimer->GetFrameTime(); if(m_entityCheckTimer < 0.0f) { CheckNearbyEntities(pPlayer); m_entityCheckTimer = ENTITY_CHECK_TIME; } // board vehicle and vehicle tutorials CheckVehicles(pPlayer); // player has been wounded if(pPlayer->GetHealth() < pPlayer->GetMaxHealth()) TriggerEvent(eTE_Wounded); // bases m_baseCheckTimer -= gEnv->pTimer->GetFrameTime(); if(m_baseCheckTimer < 0.0f) { CheckBases(pPlayer); m_baseCheckTimer = ENTITY_CHECK_TIME; } } bool promptShown = false; for(int i=0; i<eTE_NumEvents; ++i) { if(m_events[i].m_status == eMS_Waiting) { if(m_currentEvent.m_msgDisplayTime < -MESSAGE_GAP_TIME) { ShowMessage(m_events[i]); } promptShown = true; break; } } if(!promptShown && (m_currentEvent.m_msgRemovalCondition == eMRC_Time) && (m_currentEvent.m_msgDisplayTime < 0.0f)) { HideMessage(); } }
void CMPTutorial::OnBuyMenuOpen(bool open, FlashRadarType buyZoneType) { if(!m_enabled) return; // hide any previous messages which are waiting for this event. if(open && m_currentEvent.m_msgRemovalCondition == eMRC_OpenBuyMenu) { if(!m_currentEvent.m_pCurrentSound.get()) HideMessage(); else m_currentEvent.m_msgRemovalCondition = eMRC_SoundFinished; } else if(!open && m_currentEvent.m_msgRemovalCondition == eMRC_CloseBuyMenu) { if(!m_currentEvent.m_pCurrentSound.get()) HideMessage(); else m_currentEvent.m_msgRemovalCondition = eMRC_SoundFinished; } if(open) { // depends on type of factory bool showPrompt = false; switch(buyZoneType) { case ELTV: // this seems to be the default value, and occurs when players are at spawn points. case EHeadquarter: case EHeadquarter2: case EBarracks: TriggerEvent(eTE_BarracksTwo); break; case EFactoryVehicle: showPrompt = TriggerEvent(eTE_VehicleBuyMenu); break; case EFactoryAir: showPrompt = TriggerEvent(eTE_AirBuyMenu); break; case EFactoryPrototype: showPrompt = TriggerEvent(eTE_PrototypeBuyMenu); break; case EFactorySea: showPrompt = TriggerEvent(eTE_NavalBuyMenu); break; case EFactoryTank: showPrompt = TriggerEvent(eTE_WarBuyMenu); break; default: // other types don't show help break; } /*if(!showPrompt) { if(ammoPage) TriggerEvent(eTE_BuyAmmo); } */ } else { if(buyZoneType == EBarracks || buyZoneType == EHeadquarter || buyZoneType == EHeadquarter2 || buyZoneType == ELTV) TriggerEvent(eTE_CloseBarracksBuyMenu); else TriggerEvent(eTE_CloseBuyMenu); } }
void AttentionBar::OnClose(wxCommandEvent& WXUNUSED(event)) { HideMessage(); }
BOOL SnarlInterface::HideMessage() { return HideMessage(m_nLastMessageId); }