Merge pull request #210 from Jiiniasu/DB
Highscore Listing Styles + Adjustments
This commit is contained in:
commit
633848f31a
13 files changed
+128
-14
No files matched your search
@@ -73,6 +73,8 @@
|
||||
<string name="TR_CONFIG_TIMERMODE_TOTAL">Total</string>
|
||||
<string name="TR_CONFIG_TIMERLOOK_NORMAL">Normal</string>
|
||||
<string name="TR_CONFIG_TIMERLOOK_EXPANDED">Expanded</string>
|
||||
<string name="TR_CONFIG_HIGHSCORE_LIST_ALL">List all</string>
|
||||
<string name="TR_CONFIG_HIGHSCORE_LIST_BEST">List best</string>
|
||||
<string name="TR_CONFIG_OWN_MUSIC">Own music and background-music</string>
|
||||
<string name="TR_CONFIG_NO_OWN_MUSIC">No own music</string>
|
||||
<string name="TR_CONFIG_ONLY_OWN_MUSIC">Only own music</string>
|
||||
@@ -183,6 +185,7 @@
|
||||
<string name="TR_SCREENOGAME_TABS">Tabs</string>
|
||||
<string name="TR_SCREENOGAME_DIFFICULTY">Game difficulty</string>
|
||||
<string name="TR_SCREENOGAME_TIMERMODE">Timer mode</string>
|
||||
<string name="TR_SCREENOGAME_HIGHSCORESTYLE">Highscore style</string>
|
||||
<string name="TR_SCREENORECORD_OPTIONS">Record Options</string>
|
||||
<string name="TR_SCREENORECORD_DEVICE">Device</string>
|
||||
<string name="TR_SCREENORECORD_INPUT">Input</string>
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
<string name="TR_CONFIG_TIMERMODE_TOTAL">Total</string>
|
||||
<string name="TR_CONFIG_TIMERLOOK_NORMAL">Normal</string>
|
||||
<string name="TR_CONFIG_TIMERLOOK_EXPANDED">Utvidgad</string>
|
||||
<string name="TR_CONFIG_HIGHSCORE_LIST_ALL">Lista alla</string>
|
||||
<string name="TR_CONFIG_HIGHSCORE_LIST_BEST">Lista bästa</string>
|
||||
<string name="TR_CONFIG_OWN_MUSIC">Egen musik och bakgrundsmusik</string>
|
||||
<string name="TR_CONFIG_NO_OWN_MUSIC">Ingen egen musik</string>
|
||||
<string name="TR_CONFIG_ONLY_OWN_MUSIC">Endast egen musik</string>
|
||||
@@ -183,6 +185,7 @@
|
||||
<string name="TR_SCREENOGAME_TABS">Flikar</string>
|
||||
<string name="TR_SCREENOGAME_DIFFICULTY">Spelets svårighetsgrad</string>
|
||||
<string name="TR_SCREENOGAME_TIMERMODE">Timerläge</string>
|
||||
<string name="TR_SCREENOGAME_HIGHSCORESTYLE">Topplistestil</string>
|
||||
<string name="TR_SCREENORECORD_OPTIONS">Inspelningsalternativ</string>
|
||||
<string name="TR_SCREENORECORD_DEVICE">Enhet</string>
|
||||
<string name="TR_SCREENORECORD_INPUT">Ingång</string>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<X>120</X>
|
||||
<Y>160</Y>
|
||||
<Z>0</Z>
|
||||
<H>42</H>
|
||||
<H>35</H>
|
||||
<MaxW>0</MaxW>
|
||||
<Color Name="StaticColor" />
|
||||
<SelColor Name="TextSelColor" />
|
||||
@@ -792,4 +792,4 @@
|
||||
</ParticleEffect>
|
||||
</ParticleEffects>
|
||||
<ScreenSettings />
|
||||
</Screen>
|
||||
</Screen>
|
||||
@@ -2,7 +2,7 @@
|
||||
<Screen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Informations>
|
||||
<ScreenName>ScreenOptionsGame</ScreenName>
|
||||
<ScreenVersion>2</ScreenVersion>
|
||||
<ScreenVersion>3</ScreenVersion>
|
||||
</Informations>
|
||||
<Backgrounds>
|
||||
<Background Name="Background1">
|
||||
@@ -191,6 +191,20 @@
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_TIMERMODE</Text>
|
||||
</Text>
|
||||
<Text Name="Text8">
|
||||
<X>75</X>
|
||||
<Y>467</Y>
|
||||
<Z>0</Z>
|
||||
<H>27</H>
|
||||
<MaxW>0</MaxW>
|
||||
<Color Name="StaticColor" />
|
||||
<SelColor Name="TextSelColor" />
|
||||
<Align>Left</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENOGAME_HIGHSCORESTYLE</Text>
|
||||
</Text>
|
||||
</Texts>
|
||||
<Buttons>
|
||||
<Button Name="ButtonExit">
|
||||
@@ -519,6 +533,48 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>3</NumVisible>
|
||||
</SelectSlide>
|
||||
<SelectSlide Name="SelectSlideHighscoreStyle">
|
||||
<Skin/>
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
<SkinSelected>SelectSlide</SkinSelected>
|
||||
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
|
||||
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
|
||||
<Rect>
|
||||
<X>500</X>
|
||||
<Y>460</Y>
|
||||
<W>700</W>
|
||||
<H>50</H>
|
||||
<Z>0</Z>
|
||||
</Rect>
|
||||
<RectArrowLeft>
|
||||
<X>505</X>
|
||||
<Y>465</Y>
|
||||
<W>40</W>
|
||||
<H>40</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowLeft>
|
||||
<RectArrowRight>
|
||||
<X>1170</X>
|
||||
<Y>465</Y>
|
||||
<W>40</W>
|
||||
<H>40</H>
|
||||
<Z>0</Z>
|
||||
</RectArrowRight>
|
||||
<Color Name="SelectSlideColor" />
|
||||
<SelColor Name="SelectSlideSelColor" />
|
||||
<ArrowColor Name="ArrowColor" />
|
||||
<ArrowSelColor Name="ArrowSelColor" />
|
||||
<TextColor Name="TextColor" />
|
||||
<TextSelColor Name="TextSelColor" />
|
||||
<TextH>27</TextH>
|
||||
<TextRelativeX>50</TextRelativeX>
|
||||
<TextRelativeY>0</TextRelativeY>
|
||||
<TextMaxW>205.33</TextMaxW>
|
||||
<TextFont>Outline</TextFont>
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>2</NumVisible>
|
||||
</SelectSlide>
|
||||
</SelectSlides>
|
||||
<SingNotes />
|
||||
<NameSelections />
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
ScreenOptionsGame
|
||||
|
||||
++++++++++
|
||||
Version 3:
|
||||
|
||||
Add:
|
||||
<Text8>
|
||||
<SelectSlideHighscoreStyle>
|
||||
++++++++++
|
||||
Version 2:
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@ namespace Vocaluxe.Base
|
||||
[DefaultValue(ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM)] public ELyricsPosition LyricsPosition;
|
||||
[DefaultValue(0.1f)] public float MinLineBreakTime; //Minimum time to show the text before it is (to be) sung (if possible)
|
||||
[XmlArrayItem("Player"), XmlArray] public string[] Players;
|
||||
[DefaultValue(EHighscoreStyle.TR_CONFIG_HIGHSCORE_LIST_BEST)] public EHighscoreStyle HighscoreStyle;
|
||||
}
|
||||
|
||||
public struct SConfigVideo
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace Vocaluxe.Base
|
||||
return _HighscoreDB.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID);
|
||||
}
|
||||
|
||||
public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode)
|
||||
public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode, EHighscoreStyle style)
|
||||
{
|
||||
return _HighscoreDB == null ? null : _HighscoreDB.LoadScore(songID, gameMode);
|
||||
return _HighscoreDB == null ? null : _HighscoreDB.LoadScore(songID, gameMode, style);
|
||||
}
|
||||
|
||||
public static int AddScore(SPlayer player)
|
||||
|
||||
@@ -91,6 +91,11 @@ namespace Vocaluxe.Base
|
||||
return CConfig.SongMenu;
|
||||
}
|
||||
|
||||
public EHighscoreStyle GetHighscoreStyle()
|
||||
{
|
||||
return CConfig.Config.Game.HighscoreStyle;
|
||||
}
|
||||
|
||||
public EOffOn GetVideosToBackground()
|
||||
{
|
||||
return CConfig.Config.Video.VideosToBackground;
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace Vocaluxe.Lib.Database
|
||||
return lastInsertID;
|
||||
}
|
||||
|
||||
public List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode)
|
||||
public List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode, EHighscoreStyle style)
|
||||
{
|
||||
var scores = new List<SDBScoreEntry>();
|
||||
using (var connection = new SQLiteConnection())
|
||||
@@ -304,9 +304,37 @@ namespace Vocaluxe.Lib.Database
|
||||
if (dataBaseSongID < 0)
|
||||
return scores;
|
||||
|
||||
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
"ORDER BY [Score] DESC";
|
||||
switch (style)
|
||||
{
|
||||
case EHighscoreStyle.TR_CONFIG_HIGHSCORE_LIST_BEST:
|
||||
command.CommandText = "SELECT os.PlayerName, os.Score, os.Date, os.Difficulty, os.LineNr, os.id " +
|
||||
"FROM Scores os " +
|
||||
"INNER JOIN ( " +
|
||||
"SELECT sc.PlayerName, sc.Score, sc.Difficulty, sc.LineNr, MIN(sc.Date) AS Date " +
|
||||
"FROM Scores sc " +
|
||||
"INNER JOIN ( " +
|
||||
"SELECT Playername, MAX(Score) AS Score, Difficulty, LineNr " +
|
||||
"FROM Scores " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
"GROUP BY PlayerName, Difficulty, LineNr " +
|
||||
") AS mc " +
|
||||
"ON sc.PlayerName = mc.PlayerName AND sc.Difficulty = mc.Difficulty AND sc.LineNr = mc.LineNr AND sc.Score = mc.Score " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
"GROUP BY sc.PlayerName, sc.Difficulty, sc.LineNr, sc.Score " +
|
||||
") AS iq " +
|
||||
"ON os.PlayerName = iq.PlayerName AND os.Difficulty = iq.Difficulty AND os.LineNr = iq.LineNr AND os.Score = iq.Score AND os.Date = iq.Date " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
"GROUP BY os.PlayerName, os.Difficulty, os.LineNr, os.Score " +
|
||||
"ORDER BY os.Score DESC, os.Date ASC";
|
||||
break;
|
||||
case EHighscoreStyle.TR_CONFIG_HIGHSCORE_LIST_ALL:
|
||||
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id " +
|
||||
"FROM Scores " +
|
||||
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
|
||||
"ORDER BY [Score] DESC, [Date] ASC";
|
||||
break;
|
||||
}
|
||||
|
||||
command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID;
|
||||
command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley;
|
||||
command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet;
|
||||
@@ -475,7 +503,7 @@ namespace Vocaluxe.Lib.Database
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "CREATE TABLE IF NOT EXISTS Songs ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
|
||||
"Artist TEXT NOT NULL, Title TEXT NOT NULL, NumPlayed INTEGER, DateAdded BIGING);";
|
||||
"Artist TEXT NOT NULL, Title TEXT NOT NULL, NumPlayed INTEGER, DateAdded BIGINT);";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "CREATE TABLE IF NOT EXISTS Scores ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Vocaluxe.Screens
|
||||
name += " (P" + (_Scores[_Round][_Pos + p].VoiceNr + 1) + ")";
|
||||
_Texts[_TextName[p]].Text = name;
|
||||
|
||||
_Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000");
|
||||
_Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("D");
|
||||
_Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date;
|
||||
|
||||
_ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID);
|
||||
@@ -239,7 +239,8 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
int songID = CGame.GetSong(round).ID;
|
||||
EGameMode gameMode = CGame.GetGameMode(round);
|
||||
_Scores[round] = CDataBase.LoadScore(songID, gameMode);
|
||||
EHighscoreStyle style = CBase.Config.GetHighscoreStyle();
|
||||
_Scores[round] = CDataBase.LoadScore(songID, gameMode, style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Vocaluxe.Screens
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 2; }
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
private const string _SelectSlideLanguage = "SelectSlideLanguage";
|
||||
@@ -36,6 +36,7 @@ namespace Vocaluxe.Screens
|
||||
private const string _SelectSlideSongSorting = "SelectSlideSongSorting";
|
||||
private const string _SelectSlideTabs = "SelectSlideTabs";
|
||||
private const string _SelectSlideTimerMode = "SelectSlideTimerMode";
|
||||
private const string _SelectSlideHighscoreStyle = "SelectSlideHighscoreStyle";
|
||||
|
||||
private const string _ButtonExit = "ButtonExit";
|
||||
private const string _ButtonServer = "ButtonServer";
|
||||
@@ -45,7 +46,7 @@ namespace Vocaluxe.Screens
|
||||
base.Init();
|
||||
|
||||
_ThemeButtons = new string[] {_ButtonExit, _ButtonServer};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideLanguage, _SelectSlideDebugLevel, _SelectSlideSongMenu, _SelectSlideSongSorting, _SelectSlideTabs, _SelectSlideTimerMode};
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideLanguage, _SelectSlideDebugLevel, _SelectSlideSongMenu, _SelectSlideSongSorting, _SelectSlideTabs, _SelectSlideTimerMode, _SelectSlideHighscoreStyle};
|
||||
}
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
@@ -60,6 +61,7 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.Config.Game.SongSorting);
|
||||
_SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Config.Game.Tabs);
|
||||
_SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.Config.Game.TimerMode);
|
||||
_SelectSlides[_SelectSlideHighscoreStyle].SetValues<EHighscoreStyle>((int)CConfig.Config.Game.HighscoreStyle);
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
@@ -140,6 +142,7 @@ namespace Vocaluxe.Screens
|
||||
CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
|
||||
CConfig.Config.Game.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection;
|
||||
CConfig.Config.Game.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection;
|
||||
CConfig.Config.Game.HighscoreStyle = (EHighscoreStyle)_SelectSlides[_SelectSlideHighscoreStyle].Selection;
|
||||
|
||||
CConfig.SaveConfig();
|
||||
|
||||
|
||||
@@ -369,6 +369,12 @@ namespace VocaluxeLib
|
||||
Game
|
||||
}
|
||||
|
||||
public enum EHighscoreStyle
|
||||
{
|
||||
TR_CONFIG_HIGHSCORE_LIST_ALL,
|
||||
TR_CONFIG_HIGHSCORE_LIST_BEST
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base screens
|
||||
/// </summary>
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace VocaluxeLib
|
||||
|
||||
ESongMenu GetSongMenuType();
|
||||
|
||||
EHighscoreStyle GetHighscoreStyle();
|
||||
|
||||
EOffOn GetDrawNoteLines();
|
||||
EOffOn GetDrawToneHelper();
|
||||
|
||||
|
||||
Reference in new issue
Block a user