Added the ability to jump to the randomly selected game in the grouped custom collection system.

This commit is contained in:
Leon Styhre 2021-01-02 15:21:48 +01:00
parent 830c53e3cc
commit d34558525d
5 changed files with 40 additions and 14 deletions

View file

@ -266,7 +266,14 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
prompts.push_back(HelpPrompt("select", "options")); prompts.push_back(HelpPrompt("select", "options"));
if (mRoot->getSystem()->isGameSystem()) if (mRoot->getSystem()->isGameSystem())
prompts.push_back(HelpPrompt("x", "random")); prompts.push_back(HelpPrompt("x", "random"));
if (mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid() &&
if (mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
!CollectionSystemsManager::get()->isEditing() && mCursorStack.empty() &&
ViewController::get()->getState().viewing == ViewController::GAME_LIST) {
prompts.push_back(HelpPrompt("y", "JUMP TO GAME"));
}
else if (mRoot->getSystem()->isGameSystem() &&
!UIModeController::getInstance()->isUIModeKid() &&
!UIModeController::getInstance()->isUIModeKiosk() && !UIModeController::getInstance()->isUIModeKiosk() &&
(Settings::getInstance()->getBool("FavoritesAddButton") || (Settings::getInstance()->getBool("FavoritesAddButton") ||
CollectionSystemsManager::get()->isEditing())) { CollectionSystemsManager::get()->isEditing())) {

View file

@ -329,12 +329,12 @@ void DetailedGameListView::updateInfoPanel()
// the first of these so that we can display its game media. // the first of these so that we can display its game media.
if (file->getSystem()->isCustomCollection() && if (file->getSystem()->isCustomCollection() &&
file->getPath() == file->getSystem()->getName()) { file->getPath() == file->getSystem()->getName()) {
FileData* randomGame = CollectionSystemsManager::get()-> mRandomGame = CollectionSystemsManager::get()->
updateCollectionFolderMetadata(file->getSystem()); updateCollectionFolderMetadata(file->getSystem());
if (randomGame) { if (mRandomGame) {
mThumbnail.setImage(randomGame->getThumbnailPath()); mThumbnail.setImage(mRandomGame->getThumbnailPath());
mMarquee.setImage(randomGame->getMarqueePath()); mMarquee.setImage(mRandomGame->getMarqueePath());
mImage.setImage(randomGame->getImagePath()); mImage.setImage(mRandomGame->getImagePath());
} }
else { else {
mThumbnail.setImage(""); mThumbnail.setImage("");

View file

@ -26,7 +26,8 @@ ISimpleGameListView::ISimpleGameListView(
: IGameListView(window, root), : IGameListView(window, root),
mHeaderText(window), mHeaderText(window),
mHeaderImage(window), mHeaderImage(window),
mBackground(window) mBackground(window),
mRandomGame(nullptr)
{ {
mHeaderText.setText("Logo Text"); mHeaderText.setText("Logo Text");
mHeaderText.setSize(mSize.x(), 0); mHeaderText.setSize(mSize.x(), 0);
@ -137,6 +138,8 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
if (!newCursor) if (!newCursor)
newCursor = getCursor(); newCursor = getCursor();
setCursor(newCursor); setCursor(newCursor);
if (mRoot->getSystem()->getThemeFolder() == "custom-collections")
updateHelpPrompts();
} }
} }
@ -153,6 +156,8 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
setCursor(mCursorStack.top()); setCursor(mCursorStack.top());
if (mCursorStack.size() > 0) if (mCursorStack.size() > 0)
mCursorStack.pop(); mCursorStack.pop();
if (mRoot->getSystem()->getThemeFolder() == "custom-collections")
updateHelpPrompts();
} }
else { else {
NavigationSounds::getInstance()->playThemeNavigationSound(BACKSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(BACKSOUND);
@ -199,6 +204,17 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
return true; return true;
} }
} }
else if (config->isMappedTo("y", input) &&
mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
!CollectionSystemsManager::get()->isEditing() &&
mCursorStack.empty() && ViewController::get()->getState().viewing ==
ViewController::GAME_LIST) {
// Jump to the randomly selected game.
if (mRandomGame) {
setCursor(mRandomGame);
updateHelpPrompts();
}
}
else if (config->isMappedTo("y", input) && else if (config->isMappedTo("y", input) &&
!Settings::getInstance()->getBool("FavoritesAddButton") && !Settings::getInstance()->getBool("FavoritesAddButton") &&
!CollectionSystemsManager::get()->isEditing()) { !CollectionSystemsManager::get()->isEditing()) {
@ -226,7 +242,8 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
if (getCursor()->getType() == FOLDER && foldersOnTop == true) if (getCursor()->getType() == FOLDER && foldersOnTop == true)
foldersOnTop = !getCursor()->getParent()->getOnlyFoldersFlag(); foldersOnTop = !getCursor()->getParent()->getOnlyFoldersFlag();
if (mRoot->getSystem()->isCustomCollection()) if (mRoot->getSystem()->isCustomCollection() ||
mRoot->getSystem()->getThemeFolder() == "custom-collections")
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom"); favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
else else
favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst"); favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");

View file

@ -57,6 +57,8 @@ protected:
std::vector<GuiComponent*> mThemeExtras; std::vector<GuiComponent*> mThemeExtras;
std::stack<FileData*> mCursorStack; std::stack<FileData*> mCursorStack;
std::vector<FileData*> mCursorStackHistory; std::vector<FileData*> mCursorStackHistory;
// This game is randomly selected in the grouped custom collections view.
FileData* mRandomGame;
std::vector<std::string> mFirstLetterIndex; std::vector<std::string> mFirstLetterIndex;

View file

@ -355,12 +355,12 @@ void VideoGameListView::updateInfoPanel()
// the first of these so that we can display its game media. // the first of these so that we can display its game media.
if (file->getSystem()->isCustomCollection() && if (file->getSystem()->isCustomCollection() &&
file->getPath() == file->getSystem()->getName()) { file->getPath() == file->getSystem()->getName()) {
FileData* randomGame = CollectionSystemsManager::get()-> mRandomGame = CollectionSystemsManager::get()->
updateCollectionFolderMetadata(file->getSystem()); updateCollectionFolderMetadata(file->getSystem());
if (randomGame) { if (mRandomGame) {
mThumbnail.setImage(randomGame->getThumbnailPath()); mThumbnail.setImage(mRandomGame->getThumbnailPath());
mMarquee.setImage(randomGame->getMarqueePath()); mMarquee.setImage(mRandomGame->getMarqueePath());
mVideo->setImage(randomGame->getImagePath()); mVideo->setImage(mRandomGame->getImagePath());
// Always stop the video before setting a new video as it will otherwise continue // Always stop the video before setting a new video as it will otherwise continue
// to play if it has the same path (i.e. it is the same physical video file) as // to play if it has the same path (i.e. it is the same physical video file) as
// the previously set video. // the previously set video.
@ -368,7 +368,7 @@ void VideoGameListView::updateInfoPanel()
// file inside, or as in this case, when entering a custom collection. // file inside, or as in this case, when entering a custom collection.
mVideo->onHide(); mVideo->onHide();
if (!mVideo->setVideo(randomGame->getVideoPath())) if (!mVideo->setVideo(mRandomGame->getVideoPath()))
mVideo->setDefaultVideo(); mVideo->setDefaultVideo();
} }
else { else {