From 9bbedc30d451861ccbd2348c00d7d8ae5a828c60 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 3 Jan 2016 22:49:06 +0000 Subject: end of first pass. many more smaller changes and preparations for later additions git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3189 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UThemes.pas | 213 ++++++ src/screens/UScreenCredits.pas | 2 +- src/screens/UScreenEdit.pas | 2 +- src/screens/UScreenName.pas | 4 +- src/screens/UScreenOptionsGraphics.pas | 1 + src/screens/UScreenOptionsLyrics.pas | 1 + src/screens/UScreenOptionsRecord.pas | 3 +- src/screens/UScreenOptionsSound.pas | 3 + src/screens/UScreenOptionsThemes.pas | 46 +- src/screens/UScreenPartyNewRound.pas | 92 ++- src/screens/UScreenPartyRounds.pas | 2 +- src/screens/UScreenPartyScore.pas | 1 - src/screens/UScreenPopup.pas | 1161 +++++++++++++++++++++++++++++++- src/screens/UScreenScore.pas | 10 +- src/screens/UScreenSing.pas | 2 +- src/screens/UScreenSongJumpto.pas | 34 +- src/screens/UScreenStatDetail.pas | 1 + 17 files changed, 1539 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index 6584590a..b5a0638a 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -904,6 +904,8 @@ type procedure ThemeSaveText(ThemeText: TThemeText; const Name: string); procedure ThemeSaveTexts(ThemeText: AThemeText; const Name: string); procedure ThemeSaveButton(ThemeButton: TThemeButton; const Name: string); + +// procedure ThemeSongLoad; end; TColor = record @@ -1171,6 +1173,8 @@ begin ThemeLoadButton(Level.ButtonMedium, 'LevelButtonMedium'); ThemeLoadButton(Level.ButtonHard, 'LevelButtonHard'); + //Song +// ThemeSongLoad(); // Song ThemeLoadBasic(Song, 'Song'); @@ -2584,6 +2588,215 @@ begin ThemeSaveText(ThemeButton.Text[T], Name + 'Text' + IntToStr(T+1)); end; +{ +procedure TTheme.ThemeSongLoad; +var + I, C: integer; + prefix: string; +begin + case (TSongMenuMode(Ini.SongMenu)) of + smRoulette: prefix := 'Roulette'; + smChessboard: prefix := 'Chessboard'; + smCarousel: prefix := 'Carousel'; + smSlotMachine: prefix := 'SlotMachine'; + smSlide: prefix := 'Slide'; + smList: prefix := 'List'; + smMosaic: prefix := 'Mosaic'; + end; + + ThemeIni := TMemIniFile.Create(Themes[Ini.Theme].FileName.ToNative); + + // Song + ThemeLoadBasic(Song, 'Song' + prefix); + + ThemeLoadText(Song.TextArtist, 'Song' + prefix + 'TextArtist'); + ThemeLoadText(Song.TextTitle, 'Song' + prefix + 'TextTitle'); + ThemeLoadText(Song.TextNumber, 'Song' + prefix + 'TextNumber'); + ThemeLoadText(Song.TextYear, 'Song' + prefix + 'TextYear'); + + // medley playlist + Song.TextMedleyMax := ThemeIni.ReadInteger('Song' + prefix + 'TextMedleyMax', 'N', 4); + + SetLength(Song.TextArtistMedley, Song.TextMedleyMax); + SetLength(Song.TextTitleMedley, Song.TextMedleyMax); + SetLength(Song.TextNumberMedley, Song.TextMedleyMax); + SetLength(Song.StaticMedley, Song.TextMedleyMax); + + for I := 0 to Song.TextMedleyMax - 1 do + begin + ThemeLoadText(Song.TextArtistMedley[I], 'Song' + prefix + 'TextMedleyArtist' + IntToStr(I + 1)); + ThemeLoadText(Song.TextTitleMedley[I], 'Song' + prefix + 'TextMedleyTitle' + IntToStr(I + 1)); + ThemeLoadText(Song.TextNumberMedley[I], 'Song' + prefix + 'TextMedleyNumber' + IntToStr(I + 1)); + ThemeLoadStatic(Song.StaticMedley[I], 'Song' + prefix + 'StaticMedley' + IntToStr(I + 1)); + end; + + //Video Icon Mod + ThemeLoadStatic(Song.VideoIcon, 'Song' + prefix + 'VideoIcon'); + + //Medley Icons + ThemeLoadStatic(Song.MedleyIcon, 'Song' + prefix + 'MedleyIcon'); + ThemeLoadStatic(Song.CalculatedMedleyIcon, 'Song' + prefix + 'CalculatedMedleyIcon'); + + //Duet Icon + ThemeLoadStatic(Song.DuetIcon, 'Song' + prefix + 'DuetIcon'); + + //Show Cat in TopLeft Mod + ThemeLoadStatic(Song.StaticCat, 'Song' + prefix + 'StaticCat'); + ThemeLoadText(Song.TextCat, 'Song' + prefix + 'TextCat'); + + //Load Cover Pos and Size from Theme Mod + Song.Cover.X := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'X', 300); + Song.Cover.Y := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Y', 190); + Song.Cover.W := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'W', 300); + Song.Cover.H := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'H', 200); + + // 0 - roulette + // 1 - chessboard + // 2 - carousel + // 3 - slotmachine + // 4 - slide + // 5 - list + // 6 - mosaic + + if (TSongMenuMode(Ini.SongMenu) in [smChessboard, smMosaic]) then + begin + Song.Cover.Rows := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Rows', 4); + Song.Cover.Cols := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Cols', 4); + Song.Cover.Padding := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Padding', 0); + Song.Cover.SelectX := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectX', 300); + Song.Cover.SelectY := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectY', 120); + Song.Cover.SelectW := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectW', 325); + Song.Cover.SelectH := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectH', 200); + Song.Cover.SelectReflection := ThemeIni.ReadBool('Song' + prefix + 'Cover', 'SelectReflection', false); + Song.Cover.SelectReflectionSpacing := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectReflectionSpacing', 0); + Song.Cover.ZoomThumbW := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'ZoomThumbW', 120); + Song.Cover.ZoomThumbH := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'ZoomThumbH', 120); + Song.Cover.ZoomThumbStyle := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'ZoomThumbStyle', 0); + Song.Cover.Tex := ThemeIni.ReadString('Song' + prefix + 'Cover', 'Text', ''); + end; + + if (TSongMenuMode(Ini.SongMenu) in [smCarousel, smSlide]) then + begin + Song.Cover.Padding := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Padding', 60); + end; + + if (TSongMenuMode(Ini.SongMenu) = smList) then + begin + Song.Cover.SelectX := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectX', 300); + Song.Cover.SelectY := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectY', 120); + Song.Cover.SelectW := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectW', 325); + Song.Cover.SelectH := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectH', 200); + Song.Cover.SelectReflection := ThemeIni.ReadBool('Song' + prefix + 'Cover', 'SelectReflection', false); + Song.Cover.SelectReflectionSpacing := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'SelectReflectionSpacing', 0); + Song.Cover.Padding := ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Padding', 4); + + Song.ListCover.Rows := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'Rows', 5); + Song.ListCover.X := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'X', 300); + Song.ListCover.Y := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'Y', 120); + Song.ListCover.W := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'W', 325); + Song.ListCover.H := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'H', 200); + Song.ListCover.Z := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'Z', 1); + Song.ListCover.Reflection := ThemeIni.ReadBool('Song' + prefix + 'SelectSong', 'Reflection', false); + Song.ListCover.ReflectionSpacing := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'ReflectionSpacing', 0); + Song.ListCover.Padding := ThemeIni.ReadInteger('Song' + prefix + 'SelectSong', 'Padding', 4); + + Song.ListCover.Typ := ParseTextureType(ThemeIni.ReadString('Song' + prefix + 'SelectSong', 'Type', ''), TEXTURE_TYPE_PLAIN); + Song.ListCover.Tex := ThemeIni.ReadString('Song' + prefix + 'SelectSong', 'Tex', ''); + Song.ListCover.DTex := ThemeIni.ReadString('Song' + prefix + 'SelectSong', 'DTex', ''); + + Song.ListCover.Color := ThemeIni.ReadString('Song' + prefix + 'SelectSong', 'Color', ''); + + C := ColorExists(Song.ListCover.Color); + if C >= 0 then + begin + Song.ListCover.ColR := Color[C].RGB.R; + Song.ListCover.ColG := Color[C].RGB.G; + Song.ListCover.ColB := Color[C].RGB.B; + end; + + Song.ListCover.DColor := ThemeIni.ReadString('Song' + prefix + 'SelectSong', 'DColor', ''); + + C := ColorExists(Song.ListCover.DColor); + if C >= 0 then + begin + Song.ListCover.DColR := Color[C].RGB.R; + Song.ListCover.DColG := Color[C].RGB.G; + Song.ListCover.DColB := Color[C].RGB.B; + end; + + end; + + // Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); + Song.Cover.Reflections := (ThemeIni.ReadInteger('Song' + prefix + 'Cover', 'Reflections', 0) = 1); + //Load Cover Pos and Size from Theme Mod End + + ThemeLoadEqualizer(Song.Equalizer, 'Song' + prefix + 'Equalizer'); + + //Screen Song Scores + ThemeLoadText(Song.TextScore, 'Song' + prefix + 'TextScore'); + ThemeLoadText(Song.TextMaxScore, 'Song' + prefix + 'TextMaxScore'); + ThemeLoadText(Song.TextMediaScore, 'Song' + prefix + 'TextMediaScore'); + ThemeLoadText(Song.TextMaxScore2, 'Song' + prefix + 'TextMaxScore2'); + ThemeLoadText(Song.TextMediaScore2, 'Song' + prefix + 'TextMediaScore2'); + ThemeLoadText(Song.TextScoreUser, 'Song' + prefix + 'TextScoreUser'); + ThemeLoadText(Song.TextMaxScoreLocal, 'Song' + prefix + 'TextMaxScoreLocal'); + ThemeLoadText(Song.TextMediaScoreLocal, 'Song' + prefix + 'TextMediaScoreLocal'); + ThemeLoadText(Song.TextScoreUserLocal, 'Song' + prefix + 'TextScoreUserLocal'); + + //Party and Non Party specific Statics and Texts + ThemeLoadStatics (Song.StaticParty, 'Song' + prefix + 'StaticParty'); + ThemeLoadTexts (Song.TextParty, 'Song' + prefix + 'TextParty'); + + ThemeLoadStatics (Song.StaticNonParty, 'Song' + prefix + 'StaticNonParty'); + ThemeLoadTexts (Song.TextNonParty, 'Song' + prefix + 'TextNonParty'); + + // Duet Singers + ThemeLoadStatic (Song.Static2PlayersDuetSingerP1, 'Song' + prefix + 'Static2PlayersDuetSingerP1'); + ThemeLoadStatic (Song.Static2PlayersDuetSingerP2, 'Song' + prefix + 'Static2PlayersDuetSingerP2'); + ThemeLoadText (Song.Text2PlayersDuetSingerP1, 'Song' + prefix + 'Text2PlayersDuetSingerP1'); + ThemeLoadText (Song.Text2PlayersDuetSingerP2, 'Song' + prefix + 'Text2PlayersDuetSingerP2'); + + ThemeLoadStatic (Song.Static3PlayersDuetSingerP1, 'Song' + prefix + 'Static3PlayersDuetSingerP1'); + ThemeLoadStatic (Song.Static3PlayersDuetSingerP2, 'Song' + prefix + 'Static3PlayersDuetSingerP2'); + ThemeLoadStatic (Song.Static3PlayersDuetSingerP3, 'Song' + prefix + 'Static3PlayersDuetSingerP3'); + ThemeLoadText (Song.Text3PlayersDuetSingerP1, 'Song' + prefix + 'Text3PlayersDuetSingerP1'); + ThemeLoadText (Song.Text3PlayersDuetSingerP2, 'Song' + prefix + 'Text3PlayersDuetSingerP2'); + ThemeLoadText (Song.Text3PlayersDuetSingerP3, 'Song' + prefix + 'Text3PlayersDuetSingerP3'); + + // 4/6 players 1 screen + ThemeLoadStatic (Song.Static4PlayersDuetSingerP3, 'Song' + prefix + 'Static4PlayersDuetSingerP3'); + ThemeLoadStatic (Song.Static4PlayersDuetSingerP4, 'Song' + prefix + 'Static4PlayersDuetSingerP4'); + + ThemeLoadStatic (Song.Static6PlayersDuetSingerP4, 'Song' + prefix + 'Static6PlayersDuetSingerP4'); + ThemeLoadStatic (Song.Static6PlayersDuetSingerP5, 'Song' + prefix + 'Static6PlayersDuetSingerP5'); + ThemeLoadStatic (Song.Static6PlayersDuetSingerP6, 'Song' + prefix + 'Static6PlayersDuetSingerP6'); + + //Party Mode + ThemeLoadStatic(Song.StaticTeam1Joker1, 'Song' + prefix + 'StaticTeam1Joker1'); + ThemeLoadStatic(Song.StaticTeam1Joker2, 'Song' + prefix + 'StaticTeam1Joker2'); + ThemeLoadStatic(Song.StaticTeam1Joker3, 'Song' + prefix + 'StaticTeam1Joker3'); + ThemeLoadStatic(Song.StaticTeam1Joker4, 'Song' + prefix + 'StaticTeam1Joker4'); + ThemeLoadStatic(Song.StaticTeam1Joker5, 'Song' + prefix + 'StaticTeam1Joker5'); + + ThemeLoadStatic(Song.StaticTeam2Joker1, 'Song' + prefix + 'StaticTeam2Joker1'); + ThemeLoadStatic(Song.StaticTeam2Joker2, 'Song' + prefix + 'StaticTeam2Joker2'); + ThemeLoadStatic(Song.StaticTeam2Joker3, 'Song' + prefix + 'StaticTeam2Joker3'); + ThemeLoadStatic(Song.StaticTeam2Joker4, 'Song' + prefix + 'StaticTeam2Joker4'); + ThemeLoadStatic(Song.StaticTeam2Joker5, 'Song' + prefix + 'StaticTeam2Joker5'); + + ThemeLoadStatic(Song.StaticTeam3Joker1, 'Song' + prefix + 'StaticTeam3Joker1'); + ThemeLoadStatic(Song.StaticTeam3Joker2, 'Song' + prefix + 'StaticTeam3Joker2'); + ThemeLoadStatic(Song.StaticTeam3Joker3, 'Song' + prefix + 'StaticTeam3Joker3'); + ThemeLoadStatic(Song.StaticTeam3Joker4, 'Song' + prefix + 'StaticTeam3Joker4'); + ThemeLoadStatic(Song.StaticTeam3Joker5, 'Song' + prefix + 'StaticTeam3Joker5'); + + ThemeLoadText (Song.TextPartyTime, 'Song' + prefix + 'TextPartyTime'); + + ThemeLoadText (Song.InfoMessageText, 'Song' + prefix + 'InfoMessageText'); + ThemeLoadStatic (Song.InfoMessageBG, 'Song' + prefix + 'InfoMessageBG'); +end; +} + procedure TTheme.CreateThemeObjects(); begin freeandnil(Loading); diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 90c0fa19..ebb7005b 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -145,7 +145,7 @@ type const Funky_Text: string = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you are hearing, '+ + 'Grandma Deluxe v2 has arrived! Thanks to Corvus5, brian-ch, brunzelchen, canni0, k-m_schindler, whiteshark0, BasisBit and the USDX WP team for the massive work on UltraStar and USDX, Wome for the nice tune you are hearing, '+ 'all the people who put massive effort and work in new songs (do not forget UltraStar w/o songs would be nothing), ppl from '+ 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index 12e2948c..0e4be73c 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -95,7 +95,7 @@ begin if Interaction = 0 then begin AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEditConvert); + //FadeTo(@ScreenEditConvert); end; if Interaction = 1 then diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index 42af50d7..02bcc44c 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -34,7 +34,7 @@ interface {$I switches.inc} uses - SysUtils, + SysUtils, SDL, UDisplay, UFiles, @@ -56,7 +56,7 @@ implementation uses UCommon, - UGraphic, + UGraphic, UIni, UNote, UTexture, diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index e2aacccd..aa4769f8 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -151,6 +151,7 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(20, 5, Theme.Options.Description[7]); +// AddButtonText(20, 5, Theme.Options.Description[10]); end; diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 468082de..b076c510 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -134,6 +134,7 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(20, 5, Theme.Options.Description[7]); +// AddButtonText(20, 5, Theme.Options.Description[10]); end; diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 38b75f5d..9d7ac93d 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -339,7 +339,7 @@ begin end; end; - Theme.OptionsRecord.SelectThreshold.showArrows := true; + Theme.OptionsRecord.SelectThreshold.showArrows := true; //basisbit TODO Theme.OptionsRecord.SelectThreshold.oneItemOnly := true; AddSelectSlide(Theme.OptionsRecord.SelectThreshold, Ini.ThresholdIndex, IThreshold); @@ -353,6 +353,7 @@ begin AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text) = 0) then AddButtonText(20, 5, Theme.Options.Description[7]); +// AddButtonText(20, 5, Theme.Options.Description[10]); // store InteractionID if (Length(AudioInputProcessor.DeviceList) > 0) then ExitButtonIID := MaxChannelCount + 4 diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index b1179282..4e5c9d74 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -98,6 +98,7 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction < 6) then +// if (SelInteraction >= 0) and (SelInteraction < 8) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; @@ -106,6 +107,7 @@ begin SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction < 6) then +// if (SelInteraction >= 0) and (SelInteraction < 8) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; @@ -164,6 +166,7 @@ begin AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then AddButtonText(20, 5, Theme.Options.Description[7]); +// AddButtonText(20, 5, Theme.Options.Description[10]); Interaction := 0; end; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 2c7a78b1..8796a5ba 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -47,8 +47,17 @@ type TScreenOptionsThemes = class(TMenu) private procedure ReloadTheme; + procedure ReloadScreens; + public +{ for later addition + ActualTheme: integer; + ActualSkin: integer; + ActualColor: integer; +} + SkinSelect: integer; + constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure OnShow; override; @@ -79,7 +88,7 @@ begin Exit; end; end; - + // check special keys case PressedKey of SDLK_ESCAPE, @@ -87,6 +96,7 @@ begin begin Ini.Save; +// ReloadScreens; // Reload all screens, after Theme changed // Todo : JB - Check if theme was actually changed UGraphic.UnLoadScreens(); @@ -105,6 +115,8 @@ begin begin Ini.Save; +// ReloadScreens; + // Reload all screens, after Theme changed // Todo : JB - Check if theme was actually changed UGraphic.UnLoadScreens(); @@ -124,7 +136,7 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; @@ -132,7 +144,7 @@ begin end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; @@ -209,12 +221,19 @@ begin AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(20, 5, Theme.Options.Description[7]); +// AddButtonText(20, 5, Theme.Options.Description[10]); end; procedure TScreenOptionsThemes.OnShow; begin inherited; +{ + ActualTheme := Ini.Theme; + ActualSkin := Ini.SkinNo; + ActualColor := Ini.Color; +} + Interaction := 0; end; @@ -232,7 +251,28 @@ begin Display.Draw; SwapBuffers; +{ + ScreenOptionsThemes.ActualTheme := self.ActualTheme; + ScreenOptionsThemes.ActualSkin := self.ActualSkin; + ScreenOptionsThemes.ActualColor := self.ActualColor; +} + Self.Destroy; end; +procedure TScreenOptionsThemes.ReloadScreens; +begin + // Reload all screens, after Theme changed +{ + if(ActualTheme <> Ini.Theme) or + (ActualSkin <> Ini.SkinNo) or + (ActualColor <> Ini.Color) then +} + begin + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(USDXVersionStr); + Ini.Load; + end; +end; + end. diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 8024108c..d5bc6ac5 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -44,6 +44,9 @@ uses type TScreenPartyNewRound = class(TMenu) + private + VisibleRound: integer; + public //Texts: TextRound: array [0..6] of cardinal; @@ -84,6 +87,7 @@ type function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; + procedure Refresh; end; implementation @@ -127,6 +131,70 @@ begin AudioPlayback.PlaySound(SoundLib.Start); Party.CallBeforeSongSelect; end; + + SDLK_UP: + begin + if VisibleRound > 0 then + begin + Dec(VisibleRound); + Refresh; + end; + end; + + SDLK_DOWN: + begin + if VisibleRound < (Length(Party.Rounds) - 7) then + begin + Inc(VisibleRound); + Refresh; + end; + end; + end; + end; +end; + +procedure TScreenPartyNewRound.Refresh; +var + N, R, I: Integer; + NumRounds: Integer; +begin + R := Party.CurrentRound; + + //Set Visibility of Round Infos + NumRounds := Length(Party.Rounds); + + N := VisibleRound; + + if ((NumRounds-7) < N) then + begin + N := NumRounds - 7; + VisibleRound := N; + end; + + if (N < 0) then + begin + N := 0; + VisibleRound := 0; + end; + + //Set Visibility of Round Infos + for I := 0 to 6 do + begin + if (I <= High(Party.Rounds)) then + begin + Statics[StaticRound[I]].Visible := True; + Text[TextRound[I]].Visible := True; + Text[TextWinner[I]].Visible := True; + + // update texts: + Text[TextRound[I]].Text := IntToStr(I + 1 + N)+') ' + Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[I + N].Mode].Name) + '_NAME'); + Text[TextWinner[I]].Text := Party.GetWinnerString(I + N); + end + else + begin + Statics[StaticRound[I]].Visible := False; + Text[TextRound[I]].Visible := False; + Text[TextWinner[I]].Visible := False; end; end; end; @@ -210,27 +278,15 @@ var begin inherited; - //Set Visibility of Round Infos - for I := 0 to 6 do + if (Party.CurrentRound > 0) then begin - if (I <= High(Party.Rounds)) then - begin - Statics[StaticRound[I]].Visible := True; - Text[TextRound[I]].Visible := True; - Text[TextWinner[I]].Visible := True; - - // update texts: - Text[TextRound[I]].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[I].Mode].Name) + '_NAME'); - Text[TextWinner[I]].Text := Party.GetWinnerString(I); - end + if (Party.CurrentRound > 1) then + VisibleRound := Party.CurrentRound - 2 else - begin - Statics[StaticRound[I]].Visible := False; - Text[TextRound[I]].Visible := False; - Text[TextWinner[I]].Visible := False; - end; + VisibleRound := Party.CurrentRound - 1; end; + Refresh; //Display Scores if (Length(Party.Teams) >= 1) then @@ -294,7 +350,7 @@ begin Text[TextTeam3Players].Visible := false; Statics[StaticTeam3].Visible := false; Statics[StaticNextPlayer3].Visible := false; - end; + end; //nextRound Texts Text[TextNextRound].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[Party.CurrentRound].Mode].Name) + '_DESC'); diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas index 6c1d7698..34175dc2 100644 --- a/src/screens/UScreenPartyRounds.pas +++ b/src/screens/UScreenPartyRounds.pas @@ -202,7 +202,7 @@ begin if Party.ModesAvailable then begin UpdateInterface; - + ModeList := Party.GetAvailableModes; SetLength(IModeNames, Length(ModeList)); SetLength(IModeIds, Length(ModeList)); diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 62c97161..7aa2cd3a 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -207,7 +207,6 @@ begin // get rankings for current round Ranking := Party.Rounds[Party.CurrentRound].Ranking; - {//Set Statics Length Statics[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Statics[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index fdf4a69c..e950581b 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -60,6 +60,66 @@ type function Draw: boolean; override; end; +{ for later addition +type + TPopupInsertUserHandler = procedure(Value: boolean; Data: pointer); + + TScreenPopupInsertUser = class(TMenu) + private + fHandler: TPopupInsertUserHandler; + fHandlerData: Pointer; + + public + Visible: boolean; // whether the menu should be drawn + Username: UTF8String; + Password: UTF8String; + InteractionTmp: integer; + + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure ShowPopup(const Title: UTF8String; Msg: UTF8String; Handler: TPopupInsertUserHandler; + HandlerData: Pointer); + function Draw: boolean; override; + end; + +type + TPopupSendScoreHandler = procedure(Value: integer; Data: pointer); + + TScreenPopupSendScore = class(TMenu) + private + fHandler: TPopupSendScoreHandler; + fHandlerData: pointer; + + TColorR: real; + TColorG: real; + TColorB: real; + + TDColorR: real; + TDColorG: real; + TDColorB: real; + + public + Visible: boolean; // whether the menu should be drawn + IWebsite: array of UTF8String; + IUsername: array of UTF8String; + IPlayersPlay: array of UTF8String; + Password: UTF8String; + Username: UTF8String; + + SelectValueP: integer; + SelectValueW: integer; + SelectValueU: integer; + + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure ShowPopup(const Title: UTF8String; Handler: TPopupSendScoreHandler; + HandlerData: Pointer); + function Draw: boolean; override; + end; +} + type TScreenPopup = class(TMenu) { @@ -87,6 +147,49 @@ type constructor Create; end; +{ for later addition +type + TScreenPopupScoreDownload = class(TMenu) + public + Visible: boolean; // whether the menu should be drawn + Actual_Song: integer; + Actual_Web: integer; + Index_Song: integer; + Num_Songs: integer; + Num_Webs: integer; + CountSongsUpdate: integer; + + OpScoreFile: boolean; + ScoreFile: TextFile; + + Download_Phase: integer; + + Text_SongSituation: UTF8String; + Text_WebSituation: UTF8String; + + Texture_ProgressBar: TTexture; + + List_MD5Song: widestring; + Receive_List: array[0..2] of widestring; + Actual_Level: integer; + Position_Receive_List: array[0..2] of integer; + + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure ShowPopup(optmode: integer; optsong: integer; optweb: integer); + procedure DownloadTimeBarSong(); + procedure DownloadTimeBarWeb(); + function Draw: boolean; override; + procedure ReadMD5FileSong(); + procedure ReceiveListScore(); + procedure SaveScoreSong(); + procedure FileSaveScoreSong(); + procedure LogSongUpdate(Artist, Title, WebName: UTF8String); + procedure OpenFile(); + end; +} + var //ISelections: array of string; SelectValue: integer; @@ -132,7 +235,7 @@ begin SDLK_DOWN: InteractNext; SDLK_UP: InteractPrev; - + SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; @@ -199,6 +302,1062 @@ begin Background.OnShow end; +{ TScreenPopupInsertUser } + +{for later addition +function TScreenPopupInsertUser.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +var + Value: boolean; + I: integer; + Password_TMP: UTF8String; +begin + Result := true; + if (PressedDown) then + begin // Key Down + // check normal keys + if (IsPrintableChar(CharCode)) then + begin + if (Interaction = 0) or (Interaction = 1) then + begin + if (Interaction = 0) then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + UCS4ToUTF8String(CharCode); + Username := Username + UCS4ToUTF8String(CharCode); + end + else + begin + Password := Password + UCS4ToUTF8String(CharCode); + Button[1].Text[0].Text := Button[1].Text[0].Text + '*'; + end; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE: + begin + Value := false; + Visible := false; + Result := false; + end; + + SDLK_BACKSPACE : + begin + if (Interaction = 0) or (Interaction = 1) then + begin + Button[Interaction].Text[0].DeleteLastLetter(); + + if (Interaction = 0) then + Username := Button[Interaction].Text[0].Text; + + if (Interaction = 1) then + begin + Password_TMP := ''; + for I := 1 to Length(Password)-1 do + Password_TMP := Password_TMP + Password[I]; + Password := Password_TMP; + end; + end; + end; + + SDLK_RETURN: + begin + InteractionTmp := Interaction; + + if (Interaction <> 3) then + Interaction := 2; + + Value := (Interaction = 2); + if (Interaction = 3) then + Visible := false; + Result := false; + end; + + SDLK_TAB: InteractNext; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; + + if (not Result) then + begin + if (@fHandler <> nil) then + fHandler(Value, fHandlerData); + end; +end; + +constructor TScreenPopupInsertUser.Create; +begin + inherited Create; + + fHandler := nil; + fHandlerData := nil; + + AddText(Theme.InsertUserPopup.TextInsertUser); + + LoadFromTheme(Theme.InsertUserPopup); + + AddButton(Theme.InsertUserPopup.ButtonUsername); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, ''); + + AddButton(Theme.InsertUserPopup.ButtonPassword); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, ''); + + AddButton(Theme.InsertUserPopup.Button1); + if (Length(Button[2].Text) = 0) then + AddButtonText(14, 20, 'Add'); + + AddButton(Theme.InsertUserPopup.Button2); + if (Length(Button[3].Text) = 0) then + AddButtonText(14, 20, 'Cancel'); + + Button[0].Text[0].Writable := true; + Button[1].Text[0].Writable := true; + + Interaction := 0; +end; + +function TScreenPopupInsertUser.Draw: boolean; +begin + Result := inherited Draw; +end; + +procedure TScreenPopupInsertUser.OnShow; +begin + inherited; +end; + +procedure TScreenPopupInsertUser.ShowPopup(const Title: UTF8String; Msg: UTF8String; Handler: TPopupInsertUserHandler; + HandlerData: Pointer); +begin + + Visible := true; //Set Visible + fHandler := Handler; + fHandlerData := HandlerData; + + Text[0].Text := Language.Translate(Msg); + Text[1].Text := Title; + + Button[0].Visible := true; + Button[1].Visible := true; + Button[2].Visible := true; + Button[3].Visible := true; + + Password := ''; + Username := ''; + + Button[0].Text[0].Text := ''; + Button[1].Text[0].Text := ''; + Button[2].Text[0].Text := Language.Translate('MSG_INSERT_USER_ADD'); + Button[3].Text[0].Text := Language.Translate('MSG_INSERT_USER_CANCEL'); + + Interaction := 0; + + Background.OnShow +end; +} +{ TScreenPopupSendScore } +{ +function TScreenPopupSendScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +var + New_User: boolean; + I, Value: integer; + Password_TMP: UTF8String; +begin + Result := true; + if (PressedDown) then + begin // Key Down + // check normal keys + if (IsPrintableChar(CharCode)) then + begin + if (Interaction = 3) or (Interaction = 4) then + begin + if (Interaction = 3) then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + UCS4ToUTF8String(CharCode); + Username := Username + UCS4ToUTF8String(CharCode); + end; + + if (Interaction = 4) then + begin + Button[1].Text[0].Text := Button[1].Text[0].Text + '*'; + Password := Password + UCS4ToUTF8String(CharCode); + end; + end + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE: + begin + Value := 0; + Visible := false; + Result := false; + end; + + SDLK_BACKSPACE: + begin + if (Interaction = 3) or (Interaction = 4) then + begin + Button[Interaction - 3].Text[0].DeleteLastLetter; + + if (Interaction = 3) then + Username := Button[Interaction - 3].Text[0].Text; + + if (Interaction = 4) then + begin + Password_TMP := ''; + for I := 1 to Length(Password)-1 do + Password_TMP := Password_TMP + Password[I]; + Password := Password_TMP; + end; + + end + else + begin + Value := 0; + Visible := false; + Result := false; + end; + end; + + SDLK_RETURN: + begin + + if (Interaction = 5) then + begin + Value := 1; + Visible := false; + end; + + if (Interaction = 6) then + begin + Value := 2; + Visible := false; + end; + + Result := false; + end; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_TAB: InteractNext; + + SDLK_RIGHT: + begin + if (Interaction < 3) then + InteractInc; + + if (Interaction = 1) and (SelectValueW <= High(IWebsite)) then + begin + New_User := false; + + if (SelectValueU <> High(IUsername)) then + SelectValueU := 0 + else + New_User := true; + + SetLength(IUsername, Length(DataBase.NetworkUser[SelectValueW].UserList)); + for I := 0 to High(DataBase.NetworkUser[SelectValueW].UserList) do + IUsername[I] := DataBase.NetworkUser[SelectValueW].UserList[I].Username; + SetLength(IUsername, Length(IUsername) + 1); + IUsername[High(IUsername)] := Language.Translate('SCORE_SEND_OTHER_USER'); + + + if (New_User = true) then + SelectValueU := High(IUsername); + + UpdateSelectSlideOptions(Theme.SendScorePopup.SelectSlide3, 2, IUsername, SelectValueU); + end; + + if (SelectValueU = High(IUsername)) then + begin + Button[0].Text[1].ColR := TColorR; + Button[0].Text[1].ColG := TColorG; + Button[0].Text[1].ColB := TColorB; + + Button[1].Text[1].ColR := TColorR; + Button[1].Text[1].ColG := TColorG; + Button[1].Text[1].ColB := TColorB; + + Button[0].Selectable := true; + Button[1].Selectable := true; + end + else + begin + Button[0].Text[1].ColR := TDColorR; + Button[0].Text[1].ColG := TDColorG; + Button[0].Text[1].ColB := TDColorB; + + Button[1].Text[1].ColR := TDColorR; + Button[1].Text[1].ColG := TDColorG; + Button[1].Text[1].ColB := TDColorB; + + Button[0].Selectable := false; + Button[1].Selectable := false; + end; + + end; + SDLK_LEFT: + begin + if (Interaction < 3) then + InteractDec; + + if (Interaction = 1) then + begin + New_User := false; + + SetLength(IUsername, Length(DataBase.NetworkUser[SelectValueW].UserList)); + + for I := 0 to High(DataBase.NetworkUser[SelectValueW].UserList) do + IUsername[I] := DataBase.NetworkUser[SelectValueW].UserList[I].Username; + + SetLength(IUsername, Length(IUsername) + 1); + IUsername[High(IUsername)] := Language.Translate('SCORE_SEND_OTHER_USER'); + + if ((SelectValueU <> High(IUsername)) and (High(IUsername) <> 0)) then + SelectValueU := 0 + else + New_User := true; + + if (New_User = true) then + SelectValueU := High(IUsername); + + UpdateSelectSlideOptions(Theme.SendScorePopup.SelectSlide3, 2, IUsername, SelectValueU); + end; + + if (SelectValueU = High(IUsername)) then + begin + Button[0].Text[1].ColR := TColorR; + Button[0].Text[1].ColG := TColorG; + Button[0].Text[1].ColB := TColorB; + + Button[1].Text[1].ColR := TColorR; + Button[1].Text[1].ColG := TColorG; + Button[1].Text[1].ColB := TColorB; + + Button[0].Selectable := true; + Button[1].Selectable := true; + end + else + begin + Button[0].Text[1].ColR := TDColorR; + Button[0].Text[1].ColG := TDColorG; + Button[0].Text[1].ColB := TDColorB; + + Button[1].Text[1].ColR := TDColorR; + Button[1].Text[1].ColG := TDColorG; + Button[1].Text[1].ColB := TDColorB; + + Button[0].Selectable := false; + Button[1].Selectable := false; + end; + + end; + + end; + end; + + if (not Result) then + begin + if (@fHandler <> nil) then + fHandler(Value, fHandlerData); + end; + +end; + +constructor TScreenPopupSendScore.Create; +var + I: integer; +begin + inherited Create; + + fHandler := nil; + fHandlerData := nil; + SelectValueP := 0; + SelectValueW := 0; + SelectValueU := 0; + + LoadFromTheme(Theme.SendScorePopup); + + SetLength(IWebsite, 0); + for I := 0 to High(DataBase.NetworkUser) do + begin + SetLength(IWebsite, Length(IWebsite) + 1); + IWebsite[High(IWebsite)] := DataBase.NetworkUser[I].Website; + end; + + AddSelectSlide(Theme.SendScorePopup.SelectSlide1, SelectValueP, IPlayersPlay); + AddSelectSlide(Theme.SendScorePopup.SelectSlide2, SelectValueW, IWebsite); + AddSelectSlide(Theme.SendScorePopup.SelectSlide3, SelectValueU, IUsername); + + TColorR := Theme.SendScorePopup.ButtonUsername.ColR; + TColorG := Theme.SendScorePopup.ButtonUsername.ColG; + TColorB := Theme.SendScorePopup.ButtonUsername.ColB; + + TDColorR := Theme.SendScorePopup.ButtonUsername.DColR; + TDColorG := Theme.SendScorePopup.ButtonUsername.DColG; + TDColorB := Theme.SendScorePopup.ButtonUsername.DColB; + + AddButton(Theme.SendScorePopup.ButtonUsername); + AddButton(Theme.SendScorePopup.ButtonPassword); + + AddButton(Theme.SendScorePopup.Button1); + AddButton(Theme.SendScorePopup.Button2); + + Interaction := 0; +end; + +function TScreenPopupSendScore.Draw: boolean; +begin + Result := inherited Draw; +end; + +procedure TScreenPopupSendScore.OnShow; +begin + inherited; +end; + +procedure TScreenPopupSendScore.ShowPopup(const Title: UTF8String; Handler: TPopupSendScoreHandler; + HandlerData: Pointer); +var + I: integer; +begin + + Visible := true; //Set Visible + fHandler := Handler; + fHandlerData := HandlerData; + Password := ''; + Username := ''; + + SelectValueP := 0; + SelectValueW := 0; + SelectValueU := 0; + + Interaction := 0; + + Text[0].Text := Language.Translate(Title); + + for I := 0 to 3 do + Button[I].Visible := true; + + Button[0].Text[0].Text := ''; + Button[1].Text[0].Text := ''; + + Button[2].Text[0].Text := Language.Translate('SCORE_SEND'); + Button[3].Text[0].Text := Language.Translate('SCORE_SAVE'); + + SetLength(IPlayersPlay, PlayersPlay); + + for I := 0 to PlayersPlay - 1 do + IPlayersPlay[I] := Ini.Name[I]; + + UpdateSelectSlideOptions(Theme.SendScorePopup.SelectSlide1, 0, IPlayersPlay, SelectValueP); + + //UpdateSelectSlideOptions(Theme.SendScorePopup.SelectSlide2, 1, IWebsite, SelectValueW); + + SetLength(IUsername, Length(DataBase.NetworkUser[SelectValueW].UserList)); + + for I := 0 to High(DataBase.NetworkUser[SelectValueW].UserList) do + IUsername[I] := DataBase.NetworkUser[SelectValueW].UserList[I].Username; + + SetLength(IUsername, Length(IUsername) + 1); + IUsername[High(IUsername)] := Language.Translate('SCORE_SEND_OTHER_USER'); + + UpdateSelectSlideOptions(Theme.SendScorePopup.SelectSlide3, 2, IUsername, SelectValueU); + + if (SelectValueU = High(IUsername)) then + begin + Button[0].Text[1].ColR := TColorR; + Button[0].Text[1].ColG := TColorG; + Button[0].Text[1].ColB := TColorB; + + Button[1].Text[1].ColR := TColorR; + Button[1].Text[1].ColG := TColorG; + Button[1].Text[1].ColB := TColorB; + + Button[0].Selectable := true; + Button[1].Selectable := true; + end + else + begin + Button[0].Selectable := false; + Button[1].Selectable := false; + + Button[0].Text[1].ColR := TDColorR; + Button[0].Text[1].ColG := TDColorG; + Button[0].Text[1].ColB := TDColorB; + + Button[1].Text[1].ColR := TDColorR; + Button[1].Text[1].ColG := TDColorG; + Button[1].Text[1].ColB := TDColorB; + end; + + SelectsS[0].Visible := true; + SelectsS[1].Visible := true; + SelectsS[2].Visible := true; + + Interaction := 0; + + Background.OnShow +end; +} +{ TScreenPopupScoreDownload } +{ +function TScreenPopupScoreDownload.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +var + Value: boolean; +begin + Result := true; + if (PressedDown) then + begin // Key Down + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Value := false; + Visible := false; + Result := false; + Text[0].Text := Language.Translate('SCORE_DOWNLOAD_RECEIVE_LIST'); + Text[1].Text := ''; + end; + + SDLK_RETURN: + begin + Value := (Interaction = 0); + if (Interaction = 0) then + begin + Visible := false; + Result := false; + Text[0].Text := Language.Translate('SCORE_DOWNLOAD_RECEIVE_LIST'); + Text[1].Text := ''; + end; + end; + + SDLK_DOWN: Interaction := -1; + SDLK_UP: Interaction := -1; + + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; + +end; + +constructor TScreenPopupScoreDownload.Create; +begin + inherited Create; + + Texture_ProgressBar := Texture.LoadTexture(Skin.GetTextureFileName('ProgressBar')); + + Theme.ScoreDownloadPopup.TextSongScoreDownload.Text := Language.Translate('SCORE_DOWNLOAD_RECEIVE_LIST'); + Theme.ScoreDownloadPopup.TextWebScoreDownload.Text := ''; + + AddText(Theme.ScoreDownloadPopup.TextSongScoreDownload); + AddText(Theme.ScoreDownloadPopup.TextWebScoreDownload); + + LoadFromTheme(Theme.ScoreDownloadPopup); + + AddButton(Theme.ScoreDownloadPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + Interaction := 0; +end; + +procedure TScreenPopupScoreDownload.LogSongUpdate(Artist, Title, WebName: UTF8String); +var + UpdateFile: TextFile; +begin + AssignFile(UpdateFile, WebScoresPath.Append(WebName + ' [Song Update].txt').ToNative); + + if FileExists(WebScoresPath.Append(WebName + ' [Song Update].txt').ToNative) then + Append(UpdateFile) + else + Rewrite(UpdateFile); + + WriteLn(UpdateFile, Artist + ' - ' + Title); + + Flush(UpdateFile); + Close(UpdateFile); +end; + +procedure TScreenPopupScoreDownload.SaveScoreSong(); +var + String_Text, User_Score, Max_Score, Media_Score: string; + I, J, Update: integer; + DeleteSongLevel: array [0..2] of boolean; +begin + + if not(CatSongs.Song[Index_Song].Main) then + begin + Actual_Song := Actual_Song + 1; + Text_SongSituation := Language.Translate('SCORE_DOWNLOAD_SONG') + ' ' + IntToStr(Actual_Song) + '/' + IntToStr(Num_Songs); + Text_WebSituation := IntToStr(Actual_Web) + '/' + IntToStr(Num_Webs); + + for J := 0 to 2 do + begin + + if (Position_Receive_List[J] <= Length(Receive_List[J])) then + begin + + String_Text := ''; + + while (Receive_List[J][Position_Receive_List[J]] <> #10) and (Position_Receive_List[J] <= Length(Receive_List[J])) do + begin + String_Text := String_Text + Receive_List[J][Position_Receive_List[J]]; + Position_Receive_List[J] := Position_Receive_List[J] + 1; + end; + + // E -> Error song no exist in web + if (String_Text <> 'ERROR') then + begin + DeleteSongLevel[J] := false; + + DataBase.AddSong(CatSongs.Song[Index_Song]); + + Max_Score := Copy(String_Text, 0, 5); + Media_Score := Copy(String_Text, 6, 5); + User_Score := Copy(String_Text, 11, Length(String_Text) - 10); + + DataBase.AddMax_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, StrToInt(Max_Score), J); + DataBase.AddMedia_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, StrToInt(Media_Score), J); + DataBase.AddUser_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, User_Score, J); + end + else + DeleteSongLevel[J] := true; + + Position_Receive_List[J] := Position_Receive_List[J] + 1; + end; + end; + + if (DeleteSongLevel[0]) and (DeleteSongLevel[1]) and (DeleteSongLevel[2]) then + begin + Update := DataBase.Delete_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID); + + if (Update <> 0) then + begin + LogSongUpdate(CatSongs.Song[Index_Song].Artist, CatSongs.Song[Index_Song].Title, DllMan.Websites[Actual_Web - 1].Name); + CountSongsUpdate := CountSongsUpdate + 1; + end; + end; + + end; + + Index_Song := Index_Song + 1; + +end; + +procedure TScreenPopupScoreDownload.FileSaveScoreSong(); +var + String_Text, User_Score, Max_Score, Media_Score, MD5_Song: string; + Level: byte; + Update: integer; + SongExist: boolean; +begin + + if not(CatSongs.Song[Index_Song].Main) then + begin + Actual_Song := Actual_Song + 1; + Text_SongSituation := Language.Translate('SCORE_DOWNLOAD_SONG') + ' ' + IntToStr(Actual_Song) + '/' + IntToStr(Num_Songs); + Text_WebSituation := IntToStr(Actual_Web) + '/' + IntToStr(Num_Webs); + + SongExist := false; + + while not (EOF(ScoreFile)) do + begin + ReadLn(ScoreFile, String_Text); + + MD5_Song := Copy(String_Text, 0, 32); + + if (CatSongs.Song[Index_Song].MD5 = MD5_Song) then + begin + SongExist := true; + DataBase.AddSong(CatSongs.Song[Index_Song]); + + Level := StrToInt(Copy(String_Text, 33, 1)) - 1; + Max_Score := Copy(String_Text, 34, 5); + Media_Score := Copy(String_Text, 39, 5); + User_Score := Copy(String_Text, 44, Length(String_Text) - 43); + + DataBase.AddMax_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, StrToInt(Max_Score), Level); + DataBase.AddMedia_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, StrToInt(Media_Score), Level); + DataBase.AddUser_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID, User_Score, Level); + end; + end; + + if not(SongExist) then + begin + Update := DataBase.Delete_Score(CatSongs.Song[Index_Song], DllMan.Websites[Actual_Web - 1].ID); + + if (Update <> 0) then + begin + LogSongUpdate(CatSongs.Song[Index_Song].Artist, CatSongs.Song[Index_Song].Title, DllMan.Websites[Actual_Web - 1].Name); + CountSongsUpdate := CountSongsUpdate + 1; + end; + end; + + Reset(ScoreFile); + end; + + Index_Song := Index_Song + 1; + +end; + +procedure TScreenPopupScoreDownload.ReadMD5FileSong(); +var + I: integer; +begin + + if (Num_Songs = 1) then + begin + Index_Song := ScreenSong.Interaction; + List_MD5Song := CatSongs.Song[ScreenSong.Interaction].MD5; + end + else + begin + for I := 0 to High(CatSongs.Song) do + begin + if not (CatSongs.Song[I].Main) then + List_MD5Song := List_MD5Song + CatSongs.Song[I].MD5; + end; + end; + + ScreenPopupScoreDownload.Download_Phase := 1; +end; + +procedure TScreenPopupScoreDownload.ReceiveListScore(); +begin + + Text_WebSituation := IntToStr(Actual_Web) + '/' + IntToStr(Num_Webs); + Text_SongSituation := Language.Translate('SCORE_DOWNLOAD_RECEIVE_LIST'); + + Receive_List[Actual_Level] := ''; + Receive_List[Actual_Level] := DllMan.WebsiteDownloadScore(List_MD5Song, Actual_Level + 1); + + if (Receive_List[Actual_Level] = '0') then + begin + ScreenPopupError.ShowPopup(Format(Language.Translate('SONG_MENU_REFRESH_SCORES_ERROR_CONNECTION'), [UTF8Encode(DllMan.Websites[Actual_Web -1].Name)])); + Text_SongSituation := Language.Translate('WEBSITE_NO_CONNECTION'); + Actual_Song := Num_Songs; + Actual_Level := 2; + + if (Num_Webs = 1) then + Visible := false + end; + + Actual_Level := Actual_Level + 1; + +end; + +procedure TScreenPopupScoreDownload.OpenFile; +var + Filename: string; +begin + + Filename := WebScoresPath.Append(DataBase.NetworkUser[Actual_Web - 1].Website + ' [Download Scores].txt').ToNative; + + if (FileExists(Filename)) then + begin + AssignFile(ScoreFile, Filename); + Reset(ScoreFile); + end + else + begin + ScreenPopupError.ShowPopup(Format(Language.Translate('SONG_MENU_REFRESH_SCORES_ERROR_FILE'), [UTF8Encode(DllMan.Websites[Actual_Web -1].Name)])); + + Actual_Song := Num_Songs; + Actual_Level := 2; + + if (Num_Webs = 1) then + Visible := false + end; + +end; + +function TScreenPopupScoreDownload.Draw: boolean; +var + I: integer; +begin + inherited Draw; + + Text[0].Text := Text_SongSituation; + Text[1].Text := Text_WebSituation; + + DownloadTimeBarSong(); + + if (Num_Webs > 1) then + DownloadTimeBarWeb(); + + if (Download_Phase = 0) then + begin + + if (OpScoreFile) then + begin + OpenFile; + Download_Phase := 1; + end + else + ReadMD5FileSong(); + + end + else + begin + // ONLINE DOWNLOAD SCORE + if not (OpScoreFile) then + begin + if (Download_Phase = 1) then + begin + if (Actual_Level <= 2) then + begin + DLLMan.LoadWebsite(Actual_Web - 1); + ReceiveListScore(); + end + else + Download_Phase := 2; + end + else + begin + if (Actual_Song < Num_Songs) then + begin + SaveScoreSong(); + end + else + begin + if ((Actual_Web < Num_Webs) and (Num_Webs > 1)) then + begin + for I:= 0 to 2 do + begin + Receive_List[I] := ''; + Position_Receive_List[I] := 1; + end; + + Download_Phase := 1; + Actual_Song := 0; + Index_Song := 0; + Actual_Level := 0; + Actual_Web := Actual_Web + 1; + end + else + begin + Button[0].Text[0].Text := Language.Translate('SCORE_DOWNLOAD_OK'); + if (CountSongsUpdate > 0) then + begin + Visible := false; + ScreenPopupInfo.ShowPopup(Format(Language.Translate('SCORE_DOWNLOAD_SONG_UPDATE'), [CountSongsUpdate])); + end + else + Interaction := 0; + end; + end; + end; + end + else + begin + // FILE DOWNLOAD + if (Actual_Song < Num_Songs) then + begin + FileSaveScoreSong(); + end + else + begin + if ((Actual_Web < Num_Webs) and (Num_Webs > 1)) then + begin + //Download_Phase := 1; + Actual_Song := 0; + Index_Song := 0; + Actual_Level := 0; + Actual_Web := Actual_Web + 1; + OpenFile; + end + else + begin + Button[0].Text[0].Text := Language.Translate('SCORE_DOWNLOAD_OK'); + + if (CountSongsUpdate > 0) then + begin + Visible := false; + ScreenPopupInfo.ShowPopup(Format(Language.Translate('SCORE_DOWNLOAD_SONG_UPDATE'), [CountSongsUpdate])); + end + else + Interaction := 0; + end; + + end; + end; + end; + + Result := true; + +end; + +procedure TScreenPopupScoreDownload.OnShow; +begin + inherited; +end; + +procedure TScreenPopupScoreDownload.DownloadTimeBarSong(); +var + x, y: real; + width, height: real; + Progress: real; + CurProgress: real; +begin + x := Theme.ScoreDownloadPopup.DownloadProgressSong.X; + y := Theme.ScoreDownloadPopup.DownloadProgressSong.Y; + + width := Theme.ScoreDownloadPopup.DownloadProgressSong.W; + height := Theme.ScoreDownloadPopup.DownloadProgressSong.H; + + glColor4f(Theme.ScoreDownloadPopup.DownloadProgressSong.ColR, Theme.ScoreDownloadPopup.DownloadProgressSong.ColG, Theme.ScoreDownloadPopup.DownloadProgressSong.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Texture_ProgressBar.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(x, y); + + CurProgress := Actual_Song; + if (CurProgress > 0) then + begin + Progress := CurProgress / Num_Songs; + glTexCoord2f((width * Progress) / 8, 0); + glVertex2f(x + width * Progress, y); + + glTexCoord2f((width * Progress) / 8, 1); + glVertex2f(x + width * Progress, y + height); + end; + + glTexCoord2f(0, 1); + glVertex2f(x, y + height); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glcolor4f(1, 0, 0, 1); + +end; + +procedure TScreenPopupScoreDownload.DownloadTimeBarWeb(); +var + x, y: real; + width, height: real; + Progress: real; + CurProgress: real; +begin + x := Theme.ScoreDownloadPopup.DownloadProgressWeb.X; + y := Theme.ScoreDownloadPopup.DownloadProgressWeb.Y; + + width := Theme.ScoreDownloadPopup.DownloadProgressWeb.W; + height := Theme.ScoreDownloadPopup.DownloadProgressWeb.H; + + glColor4f(Theme.ScoreDownloadPopup.DownloadProgressWeb.ColR, Theme.ScoreDownloadPopup.DownloadProgressWeb.ColG, Theme.ScoreDownloadPopup.DownloadProgressWeb.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Texture_ProgressBar.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(x, y); + + CurProgress := Actual_Song + ((Actual_Web - 1) * Num_Songs); + if (CurProgress > 0) then + begin + Progress := CurProgress / (Num_Songs * Num_Webs); + glTexCoord2f((width * Progress) / 8, 0); + glVertex2f(x + width * Progress, y); + + glTexCoord2f((width * Progress) / 8, 1); + glVertex2f(x + width * Progress, y + height); + end; + + glTexCoord2f(0, 1); + glVertex2f(x, y + height); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glcolor4f(1, 0, 0, 1); + +end; + +procedure TScreenPopupScoreDownload.ShowPopup(optmode: integer; optsong: integer; optweb: integer); +var + I: integer; +begin + Background.OnShow; + + //reset vars + Actual_Song := 0; + Actual_Web := 1; + Actual_Level := 0; + Index_Song := 0; + Download_Phase := 0; + List_MD5Song := ''; + OpScoreFile := false; + CountSongsUpdate := 0; + + if (optmode = 1) then + OpScoreFile := true; + + for I := 0 to 2 do + begin + Receive_List[I] := ''; + Position_Receive_List[I] := 1; + end; + + Text_SongSituation := Language.Translate('SCORE_DOWNLOAD_CREATE_LIST'); + Text_WebSituation := ''; + + if (optsong = 0) then + Num_Songs := 1 + else + Num_Songs := Songs.SongList.Count; + + if (optweb = 0) then + begin + Num_Webs := High(DataBase.NetworkUser) + 1; + if (Num_Webs > 1) then + begin + Statics[2].Visible := true; + Text[1].Visible := true; + end + else + begin + Text[1].Visible := false; + Statics[2].Visible := false; + end; + end + else + begin + Num_Webs := 1; + Actual_Web := optweb; + Text[1].Visible := false; + Statics[2].Visible := false; + end; + + Visible := true; //Set Visible + Button[0].Visible := true; + Button[0].Text[0].Text := Language.Translate('SCORE_DOWNLOAD_CANCEL'); + + Interaction := -1; + +end; +} + { TScreenPopup } function TScreenPopup.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 4fdaf0f1..6ecc7181 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -92,7 +92,7 @@ type { textures for playerstatics of seconds screen players } TPlayerStaticTexture = record - Tex: TTexture; + Tex: TTexture; end; TScreenScore = class(TMenu) @@ -291,7 +291,7 @@ end; procedure TScreenScore.RefreshTexts; var P: integer; - + begin if ActualRound < Length(PlaylistMedley.Stats) - 1 then begin @@ -537,8 +537,6 @@ begin for Counter := 0 to High(Theme.Score.PlayerStatic[Player]) do PlayerStatic[Player, Counter] := AddStatic(Theme.Score.PlayerStatic[Player, Counter]); - - for Counter := 0 to High(Theme.Score.PlayerTexts[Player]) do PlayerTexts[Player, Counter] := AddText(Theme.Score.PlayerTexts[Player, Counter]); @@ -658,7 +656,7 @@ procedure TScreenScore.DrawPlayerBars; var I: integer; begin - for I := 0 to PlayersPlay-1 do + for I := 0 to PlayersPlay - 1 do begin if (PlayerPositionMap[I].Position > 0) and ((ScreenAct = PlayerPositionMap[I].Screen) or (PlayerPositionMap[I].BothScreens)) then begin @@ -699,7 +697,7 @@ begin inherited; ActualRound := 0; - if ScreenSong.Mode = smMedley then + if (ScreenSong.Mode = smMedley) then begin for P := 0 to PlayersPlay - 1 do Player[P] := PlaylistMedley.Stats[ActualRound].Player[P]; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 4ce2f1b5..989ace43 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -585,7 +585,7 @@ end; procedure TScreenSing.onShowFinish; begin - // hide cursor on singscreen show + // hide cursor on singscreen show Display.SetCursor; // prepare music diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index b3d48679..2efff347 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -91,6 +91,10 @@ begin begin if (Interaction = 0) then begin + Button[0].Text[0].ColR := Theme.SongJumpto.ButtonSearchText.ColR; + Button[0].Text[0].ColG := Theme.SongJumpto.ButtonSearchText.ColG; + Button[0].Text[0].ColB := Theme.SongJumpto.ButtonSearchText.ColB; + Button[0].Text[0].Text := Button[0].Text[0].Text + UCS4ToUTF8String(CharCode); SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); end; @@ -114,7 +118,7 @@ begin AudioPlayback.PlaySound(SoundLib.Back); if (fVisSongs = 0) and (Length(Button[0].Text[0].Text) > 0) then begin - ScreenSong.UnLoadDetailedCover; + //ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; CatSongs.SetFilter('', fltAll); SetTextFound(0); @@ -154,6 +158,8 @@ begin end; constructor TScreenSongJumpto.Create; +var + ButtonID: integer; begin inherited Create; @@ -161,10 +167,13 @@ begin LoadFromTheme(Theme.SongJumpto); - AddButton(Theme.SongJumpto.ButtonSearchText); + ButtonID := AddButton(Theme.SongJumpto.ButtonSearchText); + if (Length(Button[0].Text) = 0) then AddButtonText(14, 20, ''); + Button[ButtonID].Text[0].Writable := true; + fSelectType := fltAll; AddSelectSlide(Theme.SongJumpto.SelectSlideType, PInteger(@fSelectType)^, Theme.SongJumpto.IType); @@ -228,10 +237,29 @@ begin fVisSongs := Count; //Fix SongSelection - ScreenSong.Interaction := high(CatSongs.Song); +{ for later addition + if (TSongMenuMode(Ini.SongMenu) in [smRoulette, smCarousel, smSlide, smSlotMachine]) then + begin +} + ScreenSong.Interaction := high(CatSongs.Song); +{ for later addition + end; + + if (TSongMenuMode(Ini.SongMenu) in [smChessboard, smList, smMosaic]) then + begin + ScreenSong.Interaction := 0; + ScreenSong.ChessboardMinLine := 0; + ScreenSong.ListMinLine := 0; + end; +} + ScreenSong.SelectNext; ScreenSong.FixSelected; +{ for later addition + ScreenSong.SetScrollRefresh; +} + //Play Correct Music if (ScreenSong.Interaction <> fLastPlayed) or (CatSongs.VisibleSongs = 0) then begin diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 1638cd85..0d0ed17b 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -174,6 +174,7 @@ begin AddButton(Theme.StatDetail.ButtonExit); if (Length(Button[3].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); +// AddButtonText(14, 20, Theme.Options.Description[9]); Interaction := 0; Typ := TStatType(0); -- cgit v1.2.3