highscore is marked as online when using online mode
parent
729518af7f
commit
1c6cb70590
|
@ -45,6 +45,7 @@ int Model::OnInit (int argc, char* argv[]) {
|
|||
// Reset the newest highscore entry index which may be used for highlighting
|
||||
// the newest entry.
|
||||
mNewestHighscoreEntryIndex = std::numeric_limits<unsigned int>::max();
|
||||
mHighscoreIsOnline = false;
|
||||
|
||||
// initialize event handlers and register them
|
||||
Engine::RegisterListener (this, EventGameOver);
|
||||
|
@ -188,12 +189,15 @@ void Model::LoadHighscoreList () {
|
|||
AddLocalHighscoreEntry ("Jabba the Hutt", 1000);
|
||||
}
|
||||
|
||||
mHighscoreIsOnline = false;
|
||||
|
||||
if (Model::UseServerHighscore.GetBoolValue()) {
|
||||
Engine::LogDebug ("Retrieving Highscore from server");
|
||||
std::stringstream global_highscore_stream;
|
||||
|
||||
if (PullGlobalHighscore(global_highscore_stream)) {
|
||||
ParseHighscoreStream(global_highscore_stream);
|
||||
mHighscoreIsOnline = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ class Model : public Engine::ModelBase {
|
|||
unsigned int AddLocalHighscoreEntry(const std::string &name, const unsigned int points);
|
||||
void LoadLocalHighscoreList ();
|
||||
void SaveLocalHighscoreList ();
|
||||
bool GetHighscoreIsOnline() { return mHighscoreIsOnline; };
|
||||
|
||||
std::list<HighscoreEntry> mHighscoreList;
|
||||
unsigned int mNewestHighscoreEntryIndex;
|
||||
|
@ -111,6 +112,8 @@ class Model : public Engine::ModelBase {
|
|||
static Engine::Variable UseServerHighscore;
|
||||
static Engine::Variable UseServerHighscoreAsked;
|
||||
|
||||
bool mHighscoreIsOnline;
|
||||
|
||||
virtual bool OnReceiveEvent (const Engine::EventBasePtr &event);
|
||||
|
||||
friend class View;
|
||||
|
|
|
@ -852,8 +852,22 @@ void View::DrawHighscoreEntry (float x, float y, float entry_width, const std::s
|
|||
|
||||
void View::DrawUiHighscore() {
|
||||
DrawPageTitle ("Highscores");
|
||||
SelectFont ("console.ttf size=23");
|
||||
|
||||
if (GetModel()->GetHighscoreIsOnline()) {
|
||||
SelectFont("console.ttf size=23 color=#006600");
|
||||
std::string title= "-online-";
|
||||
float width, height;
|
||||
DrawGLStringMeasure(title.c_str(), &width, &height);
|
||||
|
||||
float xpos = (screen_right - width) * 0.5 - 40;
|
||||
float ypos = 130;
|
||||
Engine::GUI::Label (4, title.c_str(), xpos - 2, ypos + 2);
|
||||
|
||||
SelectFont("console.ttf size=23 color=#00cf00");
|
||||
Engine::GUI::Label (4, title.c_str(), xpos, ypos);
|
||||
}
|
||||
|
||||
SelectFont ("console.ttf size=23");
|
||||
unsigned int entry_length = 32;
|
||||
float char_width, height;
|
||||
DrawGLStringMeasure ("M", &char_width, &height);
|
||||
|
|
Loading…
Reference in New Issue