Restore 5 highscores

This commit is contained in:
Alayan 2018-09-22 01:55:28 +02:00
parent 13b3b3c2bd
commit 82408aab2f
5 changed files with 38 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/icons/back.png"/>
<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">
<header id="name" height="7%" width="80%" align="center" text_align="center"/>
@ -19,7 +19,7 @@
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore1" icon="gui/icons/random_kart.png" width="font" height="font"/>
<icon id="iconscore1" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore1" proportion="1" text="(Empty)"/>
</div>
@ -27,7 +27,7 @@
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore2" icon="gui/icons/random_kart.png" width="font" height="font"/>
<icon id="iconscore2" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore2" proportion="1" text="(Empty)"/>
</div>
@ -35,13 +35,29 @@
<spacer width="1" height="2%"/>
<div width="95%" height="fit" layout="horizontal-row">
<icon id="iconscore3" icon="gui/icons/random_kart.png" width="font" height="font"/>
<icon id="iconscore3" icon="gui/random_kart.png" width="font" height="font"/>
<spacer width="2%" height="1"/>
<label id="highscore3" proportion="1" text="(Empty)"/>
</div>
<spacer width="1" height="2%"/>
<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="2%"/>
<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"/>
<spacer width="1" height="10%"/>
@ -91,7 +107,7 @@
</box>
<spacer width="1" height="1%"/>
<buttonbar id="buttons" height="17%" width="100%" align="center">
<icon-button id="start" width="64" height="64" icon="gui/icons/green_check.png"
<icon-button id="start" width="64" height="64" icon="gui/green_check.png"
I18N="In the track info screen" text="Start Race"/>
</buttonbar>

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

@ -37,7 +37,7 @@
#include "race/highscore_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/online/tracks_screen.hpp"
#include "states_screens/tracks_screen.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/string_utils.hpp"
@ -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);
@ -124,7 +122,7 @@ void TrackInfoScreen::init()
// images are saved squared, but must be stretched to 4:
// temporary icon, will replace it just after (but it will be shown if the given icon is not found)
screenshot->m_properties[PROP_ICON] = "gui/icons/main_help.png";
screenshot->m_properties[PROP_ICON] = "gui/main_help.png";
ITexture* image = STKTexManager::getInstance()
->getTexture(m_track->getScreenshotFile(),
@ -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);
@ -333,7 +329,7 @@ void TrackInfoScreen::updateHighScores()
ITexture* no_kart_texture =
STKTexManager::getInstance()->getTexture
(file_manager->getAsset(FileManager::GUI_ICON, "random_kart.png"));
(file_manager->getAsset(FileManager::GUI, "random_kart.png"));
m_kart_icons[n]->setImage(no_kart_texture);
}
@ -457,3 +453,4 @@ void TrackInfoScreen::eventCallback(Widget* widget, const std::string& name,
} // eventCallback
// ----------------------------------------------------------------------------

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;