Change highscore limit from 3 to 5 (#3417)

* Update to support 5 highscores

* Support 5 highscores in the UI

* Save up to 5 highscores instead of 3
This commit is contained in:
Alayan-stk-2 2018-08-30 02:32:24 +02:00 committed by auriamg
parent fb43b173d6
commit 84359ad7da
5 changed files with 35 additions and 23 deletions

View File

@ -2,12 +2,12 @@
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row">
<div x="2%" y="2%" width="96%" height="98%" layout="vertical-row">
<header id="name" height="7%" width="80%" align="center" text_align="center"/>
<spacer width="1" height="1%"/>
<box width="100%" height="40%" padding="10" layout="horizontal-row">
<box width="100%" height="42%" padding="10" layout="horizontal-row">
<!-- Left pane -->
<div proportion="1" height="100%" layout="vertical-row">
<icon-button proportion="1" width="100%" height="100%" id="screenshot" custom_ratio="1.33333"/>
@ -24,7 +24,7 @@
<label id="highscore1" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<spacer width="1" height="1%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore2" icon="gui/random_kart.png" width="font" height="font"/>
@ -32,7 +32,7 @@
<label id="highscore2" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<spacer width="1" height="1%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore3" icon="gui/random_kart.png" width="font" height="font"/>
@ -40,6 +40,22 @@
<label id="highscore3" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="1%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore4" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore4" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="1%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore5" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore5" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<label id="author" width="100%" text_align="center" word_wrap="true"/>
@ -50,7 +66,7 @@
</box>
<spacer width="1" height="1%"/>
<box width="100%" height="33%" padding="15" layout="vertical-row">
<box width="100%" height="32%" padding="15" layout="vertical-row">
<div width="100%" height="fit" layout="horizontal-row" >
<label id="lap-text" proportion="1" I18N="In the track info screen" text="Number of laps" text_align="right"/>
<spacer width="40"/>
@ -90,7 +106,7 @@
<spacer width="1" height="1%"/>
</box>
<spacer width="1" height="1%"/>
<buttonbar id="buttons" height="15%" width="100%" align="center">
<buttonbar id="buttons" height="14%" width="100%" align="center">
<icon-button id="start" width="64" height="64" icon="gui/green_check.png"
I18N="In the track info screen" text="Start Race"/>

View File

@ -40,7 +40,7 @@ public:
typedef std::string HighscoreType;
private:
enum {HIGHSCORE_LEN = 3}; // It's a top 3 list
enum {HIGHSCORE_LEN = 5}; // It's a top 5 list
std::string m_track;
HighscoreType m_highscore_type;
int m_number_of_karts;

View File

@ -1582,7 +1582,7 @@ void RaceResultGUI::displayCTFResults()
}
int current_x = x;
current_y = y + (int)((i + 1) * m_distance_between_rows * 1.5f);
current_y = y + (int)((i + 1) * m_distance_between_rows);
const KartProperties* prop = kart_properties_manager->getKart(kart_name);
if (prop != NULL)

View File

@ -72,13 +72,11 @@ void TrackInfoScreen::loadedFromFile()
m_highscore_label = getWidget<LabelWidget>("highscores");
m_kart_icons[0] = getWidget<IconButtonWidget>("iconscore1");
m_kart_icons[1] = getWidget<IconButtonWidget>("iconscore2");
m_kart_icons[2] = getWidget<IconButtonWidget>("iconscore3");
m_highscore_entries[0] = getWidget<LabelWidget>("highscore1");
m_highscore_entries[1] = getWidget<LabelWidget>("highscore2");
m_highscore_entries[2] = getWidget<LabelWidget>("highscore3");
for (unsigned int i=0;i<HIGHSCORE_COUNT;i++)
{
m_kart_icons[i] = getWidget<IconButtonWidget>(("iconscore"+std::to_string(i+1)).c_str());
m_highscore_entries[i] = getWidget<LabelWidget>(("highscore"+std::to_string(i+1)).c_str());
}
GUIEngine::IconButtonWidget* screenshot = getWidget<IconButtonWidget>("screenshot");
screenshot->setFocusable(false);
@ -259,13 +257,11 @@ void TrackInfoScreen::init()
// ---- High Scores
m_highscore_label->setVisible(has_highscores);
m_kart_icons[0]->setVisible(has_highscores);
m_kart_icons[1]->setVisible(has_highscores);
m_kart_icons[2]->setVisible(has_highscores);
m_highscore_entries[0]->setVisible(has_highscores);
m_highscore_entries[1]->setVisible(has_highscores);
m_highscore_entries[2]->setVisible(has_highscores);
for (unsigned int i=0;i<HIGHSCORE_COUNT;i++)
{
m_kart_icons[i]->setVisible(has_highscores);
m_highscore_entries[i]->setVisible(has_highscores);
}
RibbonWidget* bt_start = getWidget<GUIEngine::RibbonWidget>("buttons");
bt_start->setFocusForPlayer(PLAYER_ID_GAME_MASTER);

View File

@ -39,7 +39,7 @@ class Track;
class TrackInfoScreen : public GUIEngine::Screen,
public GUIEngine::ScreenSingleton<TrackInfoScreen>
{
static const int HIGHSCORE_COUNT = 3;
static const int HIGHSCORE_COUNT = 5;
/** A pointer to the track of which the info is shown. */
Track *m_track;