aboutsummaryrefslogtreecommitdiffstats
path: root/src/screens/UScreenTop5.pas
diff options
context:
space:
mode:
authors_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-06 12:13:34 +0000
committers_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-06 12:13:34 +0000
commit13220c16acafe9e9c1cab5a59a6be4ce38b43754 (patch)
treec88519a61bc1013387cc2f478d04570d5fe94a6f /src/screens/UScreenTop5.pas
parent136969dfd5510c1841013ccc8dc240449ff7b94a (diff)
downloadusdx-13220c16acafe9e9c1cab5a59a6be4ce38b43754.tar.gz
usdx-13220c16acafe9e9c1cab5a59a6be4ce38b43754.tar.xz
usdx-13220c16acafe9e9c1cab5a59a6be4ce38b43754.zip
Add Date to Score, Filter Players, Switch Difficulty - ID: 2901824
applied patch form sf.net bug tracker (id: 2901824) thanks to brunzelchen - Add a date-column to the score entries (UNIX-Timestamp); the date will be shown on Top5- und Stats Screen! - The Players on Top-5-Screen are now filtered: Every player with his best score! - You can switch through the difficulties on Top-5-Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1972 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/screens/UScreenTop5.pas78
1 files changed, 76 insertions, 2 deletions
diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas
index f9c86643..b0795f54 100644
--- a/src/screens/UScreenTop5.pas
+++ b/src/screens/UScreenTop5.pas
@@ -47,11 +47,13 @@ type
public
TextLevel: integer;
TextArtistTitle: integer;
+ DifficultyShow: integer;
StaticNumber: array[1..5] of integer;
TextNumber: array[1..5] of integer;
TextName: array[1..5] of integer;
TextScore: array[1..5] of integer;
+ TextDate: array[1..5] of integer;
Fadeout: boolean;
@@ -59,6 +61,7 @@ type
function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override;
function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override;
procedure OnShow; override;
+ procedure DrawScores(difficulty: integer);
function Draw: boolean; override;
end;
@@ -98,6 +101,34 @@ begin
Fadeout := true;
end;
end;
+ SDLK_RIGHT:
+ begin
+ inc(DifficultyShow);
+ if (DifficultyShow>2) then
+ DifficultyShow:=0;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_LEFT:
+ begin
+ dec(DifficultyShow);
+ if (DifficultyShow<0) then
+ DifficultyShow:=2;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_UP:
+ begin
+ inc(DifficultyShow);
+ if (DifficultyShow>2) then
+ DifficultyShow:=0;
+ DrawScores(DifficultyShow);
+ end;
+ SDLK_DOWN:
+ begin
+ dec(DifficultyShow);
+ if (DifficultyShow<0) then
+ DifficultyShow:=2;
+ DrawScores(DifficultyShow);
+ end;
SDLK_SYSREQ:
begin
Display.SaveScreenShot;
@@ -133,6 +164,7 @@ begin
TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]);
TextName[I+1] := AddText (Theme.Top5.TextName[I]);
TextScore[I+1] := AddText (Theme.Top5.TextScore[I]);
+ TextDate[I+1] := AddText (Theme.Top5.TextDate[I]);
end;
end;
@@ -141,10 +173,13 @@ procedure TScreenTop5.OnShow;
var
I: integer;
PMax: integer;
+ sung: boolean; //score added? otherwise in wasn't sung!
begin
inherited;
+ sung := false;
Fadeout := false;
+ DifficultyShow := Ini.Difficulty;
//ReadScore(CurrentSong);
@@ -152,9 +187,16 @@ begin
if PMax = 4 then
PMax := 5;
for I := 0 to PMax do
- DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt));
+ begin
+ if (Round(Player[I].ScoreTotalInt) > 0) then
+ begin
+ DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt));
+ sung:=true;
+ end;
+ end;
- DataBase.WriteScore(CurrentSong);
+ if sung then
+ DataBase.WriteScore(CurrentSong);
DataBase.ReadScore(CurrentSong);
Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title;
@@ -165,9 +207,11 @@ begin
Text[TextNumber[I]].Visible := true;
Text[TextName[I]].Visible := true;
Text[TextScore[I]].Visible := true;
+ Text[TextDate[I]].Visible := true;
Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name;
Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score);
+ Text[TextDate[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Date;
end;
for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do
@@ -176,11 +220,41 @@ begin
Text[TextNumber[I]].Visible := false;
Text[TextName[I]].Visible := false;
Text[TextScore[I]].Visible := false;
+ Text[TextDate[I]].Visible := false;
end;
Text[TextLevel].Text := IDifficulty[Ini.Difficulty];
end;
+procedure TScreenTop5.DrawScores(difficulty: integer);
+var
+ I: integer;
+begin
+ for I := 1 to Length(CurrentSong.Score[difficulty]) do
+ begin
+ Static[StaticNumber[I]].Visible := true;
+ Text[TextNumber[I]].Visible := true;
+ Text[TextName[I]].Visible := true;
+ Text[TextScore[I]].Visible := true;
+ Text[TextDate[I]].Visible := true;
+
+ Text[TextName[I]].Text := CurrentSong.Score[difficulty, I-1].Name;
+ Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[difficulty, I-1].Score);
+ Text[TextDate[I]].Text := CurrentSong.Score[difficulty, I-1].Date;
+ end;
+
+ for I := Length(CurrentSong.Score[difficulty]) + 1 to 5 do
+ begin
+ Static[StaticNumber[I]].Visible := false;
+ Text[TextNumber[I]].Visible := false;
+ Text[TextName[I]].Visible := false;
+ Text[TextScore[I]].Visible := false;
+ Text[TextDate[I]].Visible := false;
+ end;
+
+ Text[TextLevel].Text := IDifficulty[difficulty];
+end;
+
function TScreenTop5.Draw: boolean;
//var
{