From ac12e8ff541b2d30f0b5dd070f83fc43d9b2116d Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 4 Jul 2010 17:06:14 +0000 Subject: - possible/remainings score bar in singscreen: red at start, decreasing with lost score, filling green from left with score - added session log. log all played songs with player names and score - fixed calculation of possible scores - change tabs on/off: now with CTRL+T (songscreen) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2573 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'Game/Code/Classes/ULog.pas') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 39c334ce..62414999 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -14,7 +14,11 @@ type FileError: TextFile; FileErrorO: boolean; // opened + FileSession: TextFile; + FileSessionO: boolean; // opened + NumErrors: integer; + NumSungSongs: integer; Title: String; //Application Title @@ -38,6 +42,8 @@ type // voice function LogVoice(SoundNr: Integer; Player, Artist, Title, Points: string): string; + procedure LogSession(names: array of string; points: array of string; Artist, Title, singmode: string); + // compability procedure LogStatus(Log1, Log2: string); procedure LogError(Log1, Log2: string); overload; @@ -54,6 +60,8 @@ begin if FileBenchmarkO then CloseFile(FileBenchmark); // if FileAnalyzeO then CloseFile(FileAnalyze); if FileErrorO then CloseFile(FileError); + if FileSessionO then CloseFile(FileSession); + end; procedure TLog.BenchmarkStart(Number: integer); @@ -281,6 +289,65 @@ begin LogVoice := FileName; end; +procedure TLog.LogSession(names: array of string; points: array of string; Artist, Title, singmode: string); +var + Num: integer; + FileName: string; + I: integer; + +begin + if not FileSessionO then + begin + FileSessionO := false; + NumSungSongs := 0; + + for Num := 1 to 99999 do + begin + FileName := IntToStr(Num); + while Length(FileName) < 5 do FileName := '0' + FileName; + FileName := SessionLogPath + 'Session_' + FileName + '.log'; + if not FileExists(FileName) then break + end; + + AssignFile(FileSession, FileName); + {$I-} + Rewrite(FileSession); + if IOResult = 0 then FileSessionO := true; + {$I+} + + //If File is opened write Date to File + If (FileSessionO) then + begin + WriteLn(FileSession, 'Session Log'); + WriteLn(FileSession, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + + Flush(FileSession); + end; + end; + + if FileSessionO then + begin + try + Inc(NumSungSongs); + WriteLn(FileSession, ''); + WriteLn(FileSession, ''); + WriteLn(FileSession, '#----------------------------------------------------------------'); + WriteLn(FileSession, '# ' + IntToStr(NumSungSongs) + ') ' + 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileSession, '# Sing mode: ' + singmode); + WriteLn(FileSession, '#----------------------------------------------------------------'); + WriteLn(FileSession, '# Song: ' + Artist + ' - ' + Title + ':'); + for I := 0 to Length(names) - 1 do + begin + WriteLn(FileSession, '# ' + names[I] + ' - ' + points[I]); + end; + WriteLn(FileSession, '#-----------------------------------------------------------------'); + Flush(FileSession); + except + FileSessionO := false; + end; + end; +end; + procedure TLog.LogStatus(Log1, Log2: string); begin //Just for Debugging -- cgit v1.2.3