aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Screens')
-rw-r--r--Game/Code/Screens/UScreenStatDetail.pas72
-rw-r--r--Game/Code/Screens/UScreenStatMain.pas12
2 files changed, 43 insertions, 41 deletions
diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas
index 98faed03..b9a3b2df 100644
--- a/Game/Code/Screens/UScreenStatDetail.pas
+++ b/Game/Code/Screens/UScreenStatDetail.pas
@@ -5,12 +5,19 @@ interface
{$I switches.inc}
uses
- UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes;
+ UMenu,
+ SDL,
+ SysUtils,
+ UDisplay,
+ UMusic,
+ UIni,
+ UDataBase,
+ UThemes;
type
TScreenStatDetail = class(TMenu)
public
- Typ: Byte;
+ Typ: TStatType;
Page: CardinaL;
Count: Byte;
Reversed: Boolean;
@@ -30,14 +37,11 @@ type
implementation
-{Stat Screens:
- 0 - Best Scores
- 1 - Best Singers
- 2 - Most sung Songs
- 3 - Most popular Band
-}
-
-uses UGraphic, UDataBase, ULanguage, math, ULog;
+uses
+ UGraphic,
+ ULanguage,
+ math,
+ ULog;
function TScreenStatDetail.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean;
begin
@@ -138,7 +142,7 @@ begin
AddButtonText(14, 20, Theme.Options.Description[7]);
Interaction := 0;
- Typ := 0;
+ Typ := TStatType(0);
end;
procedure TScreenStatDetail.onShow;
@@ -148,8 +152,10 @@ begin
//Set Tot Entrys and PAges
TotEntrys := DataBase.GetTotalEntrys(Typ);
TotPages := Ceil(TotEntrys / Count);
+
//Show correct Title
SetTitle;
+
//Show First Page
Reversed := False;
SetPage(0);
@@ -157,14 +163,13 @@ end;
procedure TScreenStatDetail.SetTitle;
begin
- //Set Title
- Case Reversed of
- True: Text[Count].Text := Theme.StatDetail.DescriptionR[Typ];
- False: Text[Count].Text := Theme.StatDetail.Description[Typ];
- end;
+ if Reversed then
+ Text[Count].Text := Theme.StatDetail.DescriptionR[Ord(Typ)]
+ else
+ Text[Count].Text := Theme.StatDetail.Description[Ord(Typ)];
end;
-Procedure TScreenStatDetail.SetPage(NewPage: Cardinal);
+procedure TScreenStatDetail.SetPage(NewPage: Cardinal);
var
Result: AStatResult;
I: Integer;
@@ -176,16 +181,16 @@ begin
begin
Page := NewPage;
- FormatStr := Theme.StatDetail.FormatStr[Typ];
+ FormatStr := Theme.StatDetail.FormatStr[Ord(Typ)];
//refresh Texts
- For I := 0 to Count-1 do
+ for I := 0 to Count-1 do
begin
try
case Typ of
- 0:begin //Best Scores
+ stBestScores: begin //Best Scores
//Set Texts
- if (Result[I].Score>0) then
+ if (Result[I].Score > 0) then
Text[I].Text := Format(FormatStr, [Result[I].Singer,
Result[I].Score,
Theme.ILevel[Result[I].Difficulty],
@@ -195,18 +200,18 @@ begin
Text[I].Text := '';
end;
- 1:begin //Best Singers
+ stBestSingers: begin //Best Singers
//Set Texts
- if (Result[I].AverageScore>0) then
+ if (Result[I].AverageScore > 0) then
Text[I].Text := Format(FormatStr, [Result[I].Player,
Result[I].AverageScore])
else
Text[I].Text := '';
end;
- 2:begin //Popular Songs
+ stMostSungSong: begin //Popular Songs
//Set Texts
- if (Result[I].Artist<>'') then
+ if (Result[I].Artist <> '') then
Text[I].Text := Format(FormatStr, [Result[I].Artist,
Result[I].Title,
Result[I].TimesSung])
@@ -214,9 +219,9 @@ begin
Text[I].Text := '';
end;
- 3:begin //Popular Bands
+ stMostPopBand: begin //Popular Bands
//Set Texts
- if (Result[I].ArtistName<>'') then
+ if (Result[I].ArtistName <> '') then
Text[I].Text := Format(FormatStr, [Result[I].ArtistName,
Result[I].TimesSungtot])
else
@@ -229,19 +234,16 @@ begin
end;
end;
- if (Page + 1 = TotPages) AND (TotEntrys Mod Count <> 0) then
- PerPage := (TotEntrys Mod Count)
+ if (Page + 1 = TotPages) and (TotEntrys mod Count <> 0) then
+ PerPage := (TotEntrys mod Count)
else
PerPage := Count;
- Text[Count+1].Text := Format(Theme.StatDetail.PageStr, [Page + 1,
- TotPages,
- PerPage,
- TotEntrys]);
+ Text[Count+1].Text := Format(Theme.StatDetail.PageStr,
+ [Page + 1, TotPages, PerPage, TotEntrys]);
//Show correct Title
SetTitle;
-
end;
end;
@@ -250,7 +252,7 @@ end;
procedure TScreenStatDetail.SetAnimationProgress(Progress: real);
var I: Integer;
begin
- For I := 0 to high(Button) do
+ for I := 0 to High(Button) do
Button[I].Texture.ScaleW := Progress;
end;
diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas
index 9d0349ed..9e581a82 100644
--- a/Game/Code/Screens/UScreenStatMain.pas
+++ b/Game/Code/Screens/UScreenStatMain.pas
@@ -81,7 +81,7 @@ begin
else //One of the Stats Buttons Pressed
begin
AudioPlayback.PlaySound(SoundLib.Back);
- ScreenStatDetail.Typ := Interaction;
+ ScreenStatDetail.Typ := TStatType(Interaction);
FadeTo(@ScreenStatDetail);
end;
end;
@@ -213,12 +213,12 @@ begin
%3:d Count of Songs with Video (A3)
%4:s Name of the most popular Song}
A1 := Songs.SongList.Count;
- A2 := Database.GetTotalEntrys(2);
+ A2 := Database.GetTotalEntrys(stMostSungSong);
A3 := SongswithVid;
SetLength(Result1, 1);
- Database.GetStats(Result1, 2, 1, 0, False);
+ Database.GetStats(Result1, stMostSungSong, 1, 0, False);
A4 := Result1[0].Artist;
A5 := Result1[0].Title;
@@ -237,13 +237,13 @@ begin
%2:d Best Players Score
%3:s Best Score Player (Result2)
%4:d Best Score}
- A1 := Database.GetTotalEntrys(1);
+ A1 := Database.GetTotalEntrys(stBestSingers);
SetLength(Result1, 1);
- Database.GetStats(Result1, 1, 1, 0, False);
+ Database.GetStats(Result1, stBestSingers, 1, 0, False);
SetLength(Result2, 1);
- Database.GetStats(Result2, 0, 1, 0, False);
+ Database.GetStats(Result2, stBestScores, 1, 0, False);
try
Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]);