void AppWarmux::ReceiveMsgCallback(const std::string& msg, const Color& color, bool in_game) { if (Replay::GetConstInstance()->IsPlaying() && in_game) { Game::GetInstance()->chatsession.NewMessage(msg, color); } else if (GameIsRunning()) { if (Game::GetCurrentMenu() && !in_game) { // Drop message, we should be paused anyway } else { // Add message to chat session in Game Game::GetInstance()->chatsession.NewMessage(msg, color); } } else if (GetCurrentMenu()) { GetCurrentMenu()->ReceiveMsgCallback(msg, color); } }
void AppWarmux::RefreshDisplay() { if (GameIsRunning()) { if (Game::GetCurrentMenu()) { Game::GetCurrentMenu()->RedrawMenu(); return; } else { GetWorld().DrawSky(true); GetWorld().Draw(true); } } else if (GetCurrentMenu()) { GetCurrentMenu()->RedrawMenu(); } }
void COptionsManager::SystemConfigChanged(bool silent) { //gEnv->pConsole->ExecuteString("sys_SaveCVars 1"); //gEnv->pSystem->SaveConfiguration(); //gEnv->pConsole->ExecuteString("sys_SaveCVars 0"); if(m_pPlayerProfileManager) { UpdateToProfile(); SaveProfile(); } if(!silent) { if(CFlashMenuScreen *pCurrentMenu = GetCurrentMenu()) { pCurrentMenu->Invoke("showErrorMessage", "Box1"); CryFixedStringT<128> text = "@system_spec_"; text.append(gEnv->pConsole->GetCVar("sys_spec")->GetString()); pCurrentMenu->Invoke("setErrorText", text.c_str()); text = "sys_spec_Full \0"; text.append(gEnv->pConsole->GetCVar("sys_spec")->GetString()); gEnv->pConsole->ExecuteString(text.c_str()); } } UpdateFlashOptions(); }
//---------------------------------------------- // highlight a menu item //---------------------------------------------- Bool TLMenu::TMenuController::HighlightMenuItem(TRef MenuItemRef) { // set menu item as highlighted on menu TPtr<TMenu> pCurrentMenu = GetCurrentMenu(); if ( !pCurrentMenu ) return FALSE; // is this a valid menu item? if ( MenuItemRef.IsValid() ) { if ( !pCurrentMenu->GetMenuItemExists(MenuItemRef) ) { TLDebug_Break("Attempting to highlight non-existant menu item"); MenuItemRef.SetInvalid(); } } // update highlight on menu pCurrentMenu->SetHighlightedMenuItem( MenuItemRef ); // notify change OnMenuItemHighlighted(); return TRUE; }
bool MenuRoot::MouseEvent(unsigned long event,const Point& delta) { if(!GetCurrentMenu()->GetOpen()) return false; // Send the event to the current menu return mMenus[mCurrent]->MouseEvent(event,delta); }
bool MenuRoot::KeyEvent(unsigned long key) { if(!GetCurrentMenu()->GetOpen()) return false; // Send the event to the current menu return mMenus[mCurrent]->KeyEvent(key); }
//---------------------------------------------- // get menu item out of current menu //---------------------------------------------- TPtr<TLMenu::TMenuItem> TLMenu::TMenuController::GetMenuItem(TRefRef MenuItemRef) { TPtr<TMenu> pCurrentMenu = GetCurrentMenu(); if ( !pCurrentMenu ) { TLDebug_Break("Current menu expected"); return NULL; } return pCurrentMenu->GetMenuItem( MenuItemRef ); }
//---------------------------------------------- // close this menu and go back to previous //---------------------------------------------- void TLMenu::TMenuController::CloseMenu() { if ( m_MenuStack.GetSize() == 0 ) { TLDebug_Break("No menus in stack to close"); return; } // remove last menu from stack m_MenuStack.RemoveLast(); // send out message // if all gone, send all-closed message if ( m_MenuStack.GetSize() == 0 ) OnMenuCloseAll(); else OnMenuClose(); // we have a new menu item at top, so "reopen" that if ( GetCurrentMenu() ) OnMenuOpen(); }