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"));
if (mRoot->getSystem()->isGameSystem())
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() &&
(Settings::getInstance()->getBool("FavoritesAddButton") ||
CollectionSystemsManager::get()->isEditing())) {

View file

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

View file

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

View file

@ -57,6 +57,8 @@ protected:
std::vector<GuiComponent*> mThemeExtras;
std::stack<FileData*> mCursorStack;
std::vector<FileData*> mCursorStackHistory;
// This game is randomly selected in the grouped custom collections view.
FileData* mRandomGame;
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.
if (file->getSystem()->isCustomCollection() &&
file->getPath() == file->getSystem()->getName()) {
FileData* randomGame = CollectionSystemsManager::get()->
mRandomGame = CollectionSystemsManager::get()->
updateCollectionFolderMetadata(file->getSystem());
if (randomGame) {
mThumbnail.setImage(randomGame->getThumbnailPath());
mMarquee.setImage(randomGame->getMarqueePath());
mVideo->setImage(randomGame->getImagePath());
if (mRandomGame) {
mThumbnail.setImage(mRandomGame->getThumbnailPath());
mMarquee.setImage(mRandomGame->getMarqueePath());
mVideo->setImage(mRandomGame->getImagePath());
// 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
// the previously set video.
@ -368,7 +368,7 @@ void VideoGameListView::updateInfoPanel()
// file inside, or as in this case, when entering a custom collection.
mVideo->onHide();
if (!mVideo->setVideo(randomGame->getVideoPath()))
if (!mVideo->setVideo(mRandomGame->getVideoPath()))
mVideo->setDefaultVideo();
}
else {