void LevelMenuSelectUserInterface::processSelection(U32 index)     
{
   Parent::onActivate();
   GameConnection *gc = getGame()->getConnectionToServer();

   if((index & UPLOAD_LEVELS_BIT) && (index & (~UPLOAD_LEVELS_BIT)) < U32(mMenuDisplayItems.size()))
   {
      FolderManager *folderManager = mGameSettings->getFolderManager();
      string filename = strictjoindir(folderManager->getLevelDir(), mMenuDisplayItems[index & (~UPLOAD_LEVELS_BIT)]);

      if(!gc->TransferLevelFile(filename.c_str()))
         getGame()->displayErrorMessage("!!! Can't upload level: unable to read file");
   }
   else
      gc->c2sRequestLevelChange(index, false);     // The selection index is the level to load

   getUIManager()->reactivateGameUI();             // Back to the game
}
Exemple #2
0
void LevelMenuUserInterface::processSelection(U32 index)
{
   Parent::onActivate();
   GameConnection *gc = gClientGame->getConnectionToServer();
   if(mTypeSelectDone)
   {
      // The selection index is the level to load.
      logprintf("load level %s", gc->mLevelNames[index].getString());
      gc->c2sRequestLevelChange(index);
      gGameUserInterface.activate();
   }
   else
   {
      mTypeSelectDone = true;
      StringTableEntry s = gc->mLevelTypes[index];
      menuItems.clear();
      for(S32 i = 0; i < gc->mLevelTypes.size();i++)
      {
         if(gc->mLevelTypes[i] == s)
            menuItems.push_back(MenuItem(gc->mLevelNames[i].getString(), i));
      }
   }
}