* Fix #4117
This commit is contained in:
Du maosen 2019-10-29 23:14:12 +08:00 committed by Alayan-stk-2
parent 9d80d7e71a
commit 6dd5800701
3 changed files with 18 additions and 16 deletions

View File

@ -17,7 +17,7 @@
</div> </div>
</box> </box>
<spacer width="1" height="1%"/> <spacer width="1" height="1%"/>
<box width="100%" height="33%" layout="vertical-row"> <box width="100%" height="31%" layout="vertical-row">
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label id="ai-text" proportion="1" I18N="In the grand prix info screen" text="AI karts" text_align="right"/> <label id="ai-text" proportion="1" I18N="In the grand prix info screen" text="AI karts" text_align="right"/>
<spacer width="40"/> <spacer width="40"/>

View File

@ -7,10 +7,15 @@
align="center" text_align="center" /> align="center" text_align="center" />
<spacer width="100%" height="1%" /> <spacer width="100%" height="1%" />
<box width="100%" proportion="1" layout="vertical-row" padding="0"> <div width="100%" proportion="1" layout="horizontal-row" >
<box width="80%" height="100%" layout="vertical-row" padding="0">
<scrollable_toolbar id="gps" x="1%" y="1%" width="98%" height="98%" align="center" label_location="each" <scrollable_toolbar id="gps" x="1%" y="1%" width="98%" height="98%" align="center" label_location="each"
square_items="true" child_width="175" child_height="120" /> square_items="true" child_width="175" child_height="120" />
</box> </box>
<spacer width="2%" height="20" />
<icon-button id="rand-gp" width="18%" height="80%" icon="gui/icons/gp_new.png" align="center"
I18N="In the track and grand prix selection screen" text="Random Grand Prix"/>
</div>
<header width="8%" I18N="In the track and grand prix selection screen" text="All Tracks" <header width="8%" I18N="In the track and grand prix selection screen" text="All Tracks"
align="center" text_align="center" /> align="center" text_align="center" />

View File

@ -107,6 +107,12 @@ void TracksAndGPScreen::eventCallback(Widget* widget, const std::string& name,
gpis->push(); gpis->push();
} }
} }
else if (name == "rand-gp")
{
// Random GP
GPInfoScreen::getInstance()->setGP(GrandPrixData::getRandomGPID());
GPInfoScreen::getInstance()->push();
}
else if (name == "trackgroups") else if (name == "trackgroups")
{ {
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
@ -204,17 +210,8 @@ void TracksAndGPScreen::init()
} }
} }
// Random GP
std::vector<std::string> screenshots;
screenshots.push_back(file_manager->getAsset(FileManager::GUI_ICON, "main_help.png"));
gps_widget->addAnimatedItem(GrandPrixData::getRandomGPName(),
GrandPrixData::getRandomGPID(),
screenshots, 1.5f, 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
gps_widget->updateItemDisplay(); gps_widget->updateItemDisplay();
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups"); RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
tabs->select(UserConfigParams::m_last_used_track_group, PLAYER_ID_GAME_MASTER); tabs->select(UserConfigParams::m_last_used_track_group, PLAYER_ID_GAME_MASTER);
@ -288,7 +285,7 @@ void TracksAndGPScreen::buildTrackList()
} }
tracks_widget->addItem(_("Random Track"), "random_track", tracks_widget->addItem(_("Random Track"), "random_track",
"/gui/icons/track_random.png", 0 /* no badge */, "", 0 /* no badge */,
IconButtonWidget::ICON_PATH_TYPE_RELATIVE); IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
tracks_widget->updateItemDisplay(); tracks_widget->updateItemDisplay();