Merge branch 'develop' of github.com:Flamefire/Vocaluxe into develop

This commit is contained in:
Florian Küpper committed 2013-04-28 17:47:59 +02:00
commit ee91798639
45 files changed
+1053 -1194

No files matched your search

@@ -308,7 +308,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
if (screen != null)
{
CBase.Songs.ResetPartySongSung();
CBase.Songs.ResetSongSung();
_ToScreenMain.ResultTable = new List<CResultTableRow>();
_GameData.ResultTable = new List<CResultTableRow>();
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
@@ -459,11 +459,11 @@ namespace VocaluxeLib.PartyModes.Challenge
CBase.Game.AddSong(songID, gm);
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
SPlayer[] players = CBase.Game.GetPlayers();
if (players == null)
return;
if (player.Length < _GameData.NumPlayerAtOnce)
if (players.Length < _GameData.NumPlayerAtOnce)
return;
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
@@ -472,9 +472,9 @@ namespace VocaluxeLib.PartyModes.Challenge
{
//try to fill with the right data
if (c != null)
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
else
player[i].ProfileID = -1;
players[i].ProfileID = -1;
}
CBase.Songs.AddPartySongSung(songID);
@@ -187,14 +187,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{
_Stage = EStage.NotStarted;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
_ScreenSongOptions.Sorting.SongSorting = ESongSorting.TR_CONFIG_NONE;
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
_ScreenSongOptions.Selection.SongIndex = -1;
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
_ToScreenMain.ResultTable = new List<CResultTableRow>();
_GameData.ResultTable = new List<CResultTableRow>();
@@ -313,7 +310,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
if (screen != null)
{
CBase.Songs.ResetPartySongSung();
CBase.Songs.ResetSongSung();
_ToScreenMain.ResultTable = new List<CResultTableRow>();
_GameData.ResultTable = new List<CResultTableRow>();
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
@@ -482,11 +479,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
#region PlayerNames
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
SPlayer[] players = CBase.Game.GetPlayers();
if (players == null)
return false;
if (player.Length < _GameData.NumPlayerAtOnce)
if (players.Length < _GameData.NumPlayerAtOnce)
return false;
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
@@ -495,33 +492,32 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{
//try to fill with the right data
if (c != null)
player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
else
player[i].ProfileID = -1;
players[i].ProfileID = -1;
}
#endregion PlayerNames
#region SongQueque
if (CBase.Songs.GetNumVisibleSongs() < _NumSongs)
CBase.Songs.ResetPartySongSung();
#region SongQueue
if (CBase.Songs.GetNumSongsVisible() < _NumSongs)
CBase.Songs.ResetSongSung();
const EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
List<int> ids = new List<int>();
CSong[] visSongs = CBase.Songs.GetSongsNotSung();
if (visSongs == null)
var visibleSongs = CBase.Songs.GetVisibleSongs();
if (visibleSongs.Count == 0)
{
CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no songs!");
CBase.Graphics.FadeTo(EScreens.ScreenParty);
return false;
}
for (int i = 0; i < visSongs.Length; i++)
foreach (CSong song in visibleSongs)
{
foreach (EGameMode mode in visSongs[i].AvailableGameModes)
foreach (EGameMode mode in song.AvailableGameModes)
{
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
ids.Add(visSongs[i].ID);
ids.Add(song.ID);
}
}
@@ -536,13 +532,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
while (s < _NumSongs && ids.Count > 0)
{
int songID = ids[CBase.Game.GetRandom(ids.Count)];
CBase.Game.AddSong(songID, gm);
CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY);
CBase.Songs.AddPartySongSung(songID);
ids.Remove(songID);
s++;
}
return true;
#endregion SongQueque
#endregion SongQueue
}
private void _SetNumJokers()
@@ -374,7 +374,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (screen != null)
{
_GameData.Team = _GameData.Team == 1 ? 0 : 1;
CBase.Songs.ResetPartySongSung();
CBase.Songs.ResetSongSung();
_GameData.CurrentRoundNr = 1;
_ToScreenMain.CurrentRoundNr = 1;
_ToScreenMain.NumFields = _GameData.NumFields;
@@ -718,11 +718,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
CBase.Game.SetNumPlayer(2);
SPlayer[] player = CBase.Game.GetPlayers();
if (player == null)
SPlayer[] players = CBase.Game.GetPlayers();
if (players == null)
return;
if (player.Length < 2)
if (players.Length < 2)
return;
SProfile[] profiles = CBase.Profiles.GetProfiles();
@@ -732,7 +732,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < 2; i++)
{
//default values
player[i].ProfileID = -1;
players[i].ProfileID = -1;
}
//try to fill with the right data
@@ -740,15 +740,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
{
player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
if (isDuet)
player[0].LineNr = 0;
players[0].LineNr = 0;
}
if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
{
player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
if (isDuet)
player[1].LineNr = 1;
players[1].LineNr = 1;
}
SongSelected(r.SongID);
}
+1 -1
View File
@@ -10,7 +10,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Cleanup"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_EXPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_EXPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;StyleCop.Documentation&gt;&lt;SA1600ElementsMustBeDocumented&gt;False&lt;/SA1600ElementsMustBeDocumented&gt;&lt;SA1604ElementDocumentationMustHaveSummary&gt;False&lt;/SA1604ElementDocumentationMustHaveSummary&gt;&lt;SA1609PropertyDocumentationMustHaveValueDocumented&gt;False&lt;/SA1609PropertyDocumentationMustHaveValueDocumented&gt;&lt;SA1611ElementParametersMustBeDocumented&gt;False&lt;/SA1611ElementParametersMustBeDocumented&gt;&lt;SA1615ElementReturnValueMustBeDocumented&gt;False&lt;/SA1615ElementReturnValueMustBeDocumented&gt;&lt;SA1617VoidReturnValueMustNotBeDocumented&gt;False&lt;/SA1617VoidReturnValueMustNotBeDocumented&gt;&lt;SA1618GenericTypeParametersMustBeDocumented&gt;False&lt;/SA1618GenericTypeParametersMustBeDocumented&gt;&lt;SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;False&lt;/SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;&lt;SA1628DocumentationTextMustBeginWithACapitalLetter&gt;False&lt;/SA1628DocumentationTextMustBeginWithACapitalLetter&gt;&lt;SA1629DocumentationTextMustEndWithAPeriod&gt;False&lt;/SA1629DocumentationTextMustEndWithAPeriod&gt;&lt;SA1633SA1641UpdateFileHeader&gt;Ignore&lt;/SA1633SA1641UpdateFileHeader&gt;&lt;SA1639FileHeaderMustHaveSummary&gt;False&lt;/SA1639FileHeaderMustHaveSummary&gt;&lt;SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1644DocumentationHeadersMustNotContainBlankLines&gt;False&lt;/SA1644DocumentationHeadersMustNotContainBlankLines&gt;&lt;/StyleCop.Documentation&gt;&lt;StyleCop.Layout&gt;&lt;SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;False&lt;/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;&lt;SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;True&lt;/SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;&lt;SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;True&lt;/SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;&lt;SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;True&lt;/SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;&lt;SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;True&lt;/SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;&lt;SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;False&lt;/SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;&lt;SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;False&lt;/SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;&lt;SA1515SingleLineCommentMustBeProceededByBlankLine&gt;False&lt;/SA1515SingleLineCommentMustBeProceededByBlankLine&gt;&lt;/StyleCop.Layout&gt;&lt;StyleCop.Readability&gt;&lt;SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;True&lt;/SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;&lt;SA1106CodeMustNotContainEmptyStatements&gt;True&lt;/SA1106CodeMustNotContainEmptyStatements&gt;&lt;SA1108BlockStatementsMustNotContainEmbeddedComments&gt;True&lt;/SA1108BlockStatementsMustNotContainEmbeddedComments&gt;&lt;SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;True&lt;/SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;&lt;SA1120CommentsMustContainText&gt;False&lt;/SA1120CommentsMustContainText&gt;&lt;SA1121UseBuiltInTypeAlias&gt;False&lt;/SA1121UseBuiltInTypeAlias&gt;&lt;SA1122UseStringEmptyForEmptyStrings&gt;False&lt;/SA1122UseStringEmptyForEmptyStrings&gt;&lt;SA1123DoNotPlaceRegionsWithinElements&gt;False&lt;/SA1123DoNotPlaceRegionsWithinElements&gt;&lt;SA1124CodeMustNotContainEmptyRegions&gt;True&lt;/SA1124CodeMustNotContainEmptyRegions&gt;&lt;/StyleCop.Readability&gt;&lt;StyleCop.Spacing&gt;&lt;SA1001CommasMustBeSpacedCorrectly&gt;False&lt;/SA1001CommasMustBeSpacedCorrectly&gt;&lt;SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;False&lt;/SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;&lt;SA1006PreprocessorKeywordsMustNotBePrecededBySpaLine truncated
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Simple Reformat"&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;StyleCop.Documentation&gt;&lt;SA1600ElementsMustBeDocumented&gt;False&lt;/SA1600ElementsMustBeDocumented&gt;&lt;SA1604ElementDocumentationMustHaveSummary&gt;False&lt;/SA1604ElementDocumentationMustHaveSummary&gt;&lt;SA1609PropertyDocumentationMustHaveValueDocumented&gt;False&lt;/SA1609PropertyDocumentationMustHaveValueDocumented&gt;&lt;SA1611ElementParametersMustBeDocumented&gt;False&lt;/SA1611ElementParametersMustBeDocumented&gt;&lt;SA1615ElementReturnValueMustBeDocumented&gt;False&lt;/SA1615ElementReturnValueMustBeDocumented&gt;&lt;SA1617VoidReturnValueMustNotBeDocumented&gt;False&lt;/SA1617VoidReturnValueMustNotBeDocumented&gt;&lt;SA1618GenericTypeParametersMustBeDocumented&gt;False&lt;/SA1618GenericTypeParametersMustBeDocumented&gt;&lt;SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;False&lt;/SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;&lt;SA1628DocumentationTextMustBeginWithACapitalLetter&gt;False&lt;/SA1628DocumentationTextMustBeginWithACapitalLetter&gt;&lt;SA1629DocumentationTextMustEndWithAPeriod&gt;False&lt;/SA1629DocumentationTextMustEndWithAPeriod&gt;&lt;SA1633SA1641UpdateFileHeader&gt;Ignore&lt;/SA1633SA1641UpdateFileHeader&gt;&lt;SA1639FileHeaderMustHaveSummary&gt;False&lt;/SA1639FileHeaderMustHaveSummary&gt;&lt;SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1644DocumentationHeadersMustNotContainBlankLines&gt;False&lt;/SA1644DocumentationHeadersMustNotContainBlankLines&gt;&lt;/StyleCop.Documentation&gt;&lt;StyleCop.Spacing&gt;&lt;SA1001CommasMustBeSpacedCorrectly&gt;False&lt;/SA1001CommasMustBeSpacedCorrectly&gt;&lt;SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;False&lt;/SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;&lt;SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;True&lt;/SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;&lt;SA1021NegativeSignsMustBeSpacedCorrectly&gt;True&lt;/SA1021NegativeSignsMustBeSpacedCorrectly&gt;&lt;SA1022PositiveSignsMustBeSpacedCorrectly&gt;True&lt;/SA1022PositiveSignsMustBeSpacedCorrectly&gt;&lt;SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;True&lt;/SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;&lt;/StyleCop.Spacing&gt;&lt;StyleCop.Readability&gt;&lt;SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;True&lt;/SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;&lt;SA1106CodeMustNotContainEmptyStatements&gt;True&lt;/SA1106CodeMustNotContainEmptyStatements&gt;&lt;SA1108BlockStatementsMustNotContainEmbeddedComments&gt;True&lt;/SA1108BlockStatementsMustNotContainEmbeddedComments&gt;&lt;SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;True&lt;/SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;&lt;SA1120CommentsMustContainText&gt;False&lt;/SA1120CommentsMustContainText&gt;&lt;SA1121UseBuiltInTypeAlias&gt;False&lt;/SA1121UseBuiltInTypeAlias&gt;&lt;SA1122UseStringEmptyForEmptyStrings&gt;False&lt;/SA1122UseStringEmptyForEmptyStrings&gt;&lt;SA1123DoNotPlaceRegionsWithinElements&gt;False&lt;/SA1123DoNotPlaceRegionsWithinElements&gt;&lt;SA1124CodeMustNotContainEmptyRegions&gt;True&lt;/SA1124CodeMustNotContainEmptyRegions&gt;&lt;/StyleCop.Readability&gt;&lt;StyleCop.Layout&gt;&lt;SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;False&lt;/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;&lt;SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;True&lt;/SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;&lt;SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;True&lt;/SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;&lt;SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;True&lt;/SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;&lt;SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;True&lt;/SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;&lt;SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;False&lt;/SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;&lt;SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;False&lt;/SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;&lt;SA1515SingleLineCommentMustBeProceededByBlankLine&gt;False&lt;/SA1515SingleLineCommentMustBeProceededByBlankLine&gt;&lt;/StyleCop.Layout&gt;&lt;StyleCop.Ordering&gt;&lt;AlphabeticalUsingDirectives&gt;Ignore&lt;/AlphabeticalUsingDirectives&gt;&lt;ExpandUsingDirectiLine truncated
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Simple Reformat"&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;StyleCop.Documentation&gt;&lt;SA1600ElementsMustBeDocumented&gt;False&lt;/SA1600ElementsMustBeDocumented&gt;&lt;SA1604ElementDocumentationMustHaveSummary&gt;False&lt;/SA1604ElementDocumentationMustHaveSummary&gt;&lt;SA1609PropertyDocumentationMustHaveValueDocumented&gt;False&lt;/SA1609PropertyDocumentationMustHaveValueDocumented&gt;&lt;SA1611ElementParametersMustBeDocumented&gt;False&lt;/SA1611ElementParametersMustBeDocumented&gt;&lt;SA1615ElementReturnValueMustBeDocumented&gt;False&lt;/SA1615ElementReturnValueMustBeDocumented&gt;&lt;SA1617VoidReturnValueMustNotBeDocumented&gt;False&lt;/SA1617VoidReturnValueMustNotBeDocumented&gt;&lt;SA1618GenericTypeParametersMustBeDocumented&gt;False&lt;/SA1618GenericTypeParametersMustBeDocumented&gt;&lt;SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;False&lt;/SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;&lt;SA1628DocumentationTextMustBeginWithACapitalLetter&gt;False&lt;/SA1628DocumentationTextMustBeginWithACapitalLetter&gt;&lt;SA1629DocumentationTextMustEndWithAPeriod&gt;False&lt;/SA1629DocumentationTextMustEndWithAPeriod&gt;&lt;SA1633SA1641UpdateFileHeader&gt;Ignore&lt;/SA1633SA1641UpdateFileHeader&gt;&lt;SA1639FileHeaderMustHaveSummary&gt;False&lt;/SA1639FileHeaderMustHaveSummary&gt;&lt;SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1644DocumentationHeadersMustNotContainBlankLines&gt;False&lt;/SA1644DocumentationHeadersMustNotContainBlankLines&gt;&lt;/StyleCop.Documentation&gt;&lt;StyleCop.Spacing&gt;&lt;SA1001CommasMustBeSpacedCorrectly&gt;False&lt;/SA1001CommasMustBeSpacedCorrectly&gt;&lt;SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;False&lt;/SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;&lt;SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;True&lt;/SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;&lt;SA1021NegativeSignsMustBeSpacedCorrectly&gt;True&lt;/SA1021NegativeSignsMustBeSpacedCorrectly&gt;&lt;SA1022PositiveSignsMustBeSpacedCorrectly&gt;True&lt;/SA1022PositiveSignsMustBeSpacedCorrectly&gt;&lt;SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;True&lt;/SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;&lt;/StyleCop.Spacing&gt;&lt;StyleCop.Readability&gt;&lt;SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;True&lt;/SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;&lt;SA1106CodeMustNotContainEmptyStatements&gt;True&lt;/SA1106CodeMustNotContainEmptyStatements&gt;&lt;SA1108BlockStatementsMustNotContainEmbeddedComments&gt;True&lt;/SA1108BlockStatementsMustNotContainEmbeddedComments&gt;&lt;SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;True&lt;/SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;&lt;SA1120CommentsMustContainText&gt;False&lt;/SA1120CommentsMustContainText&gt;&lt;SA1121UseBuiltInTypeAlias&gt;False&lt;/SA1121UseBuiltInTypeAlias&gt;&lt;SA1122UseStringEmptyForEmptyStrings&gt;False&lt;/SA1122UseStringEmptyForEmptyStrings&gt;&lt;SA1123DoNotPlaceRegionsWithinElements&gt;False&lt;/SA1123DoNotPlaceRegionsWithinElements&gt;&lt;SA1124CodeMustNotContainEmptyRegions&gt;True&lt;/SA1124CodeMustNotContainEmptyRegions&gt;&lt;/StyleCop.Readability&gt;&lt;StyleCop.Layout&gt;&lt;SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;False&lt;/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;&lt;SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;True&lt;/SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;&lt;SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;True&lt;/SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;&lt;SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;True&lt;/SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;&lt;SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;True&lt;/SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;&lt;SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;False&lt;/SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;&lt;SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;False&lt;/SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;&lt;SA1515SingleLineCommentMustBeProceededByBlankLine&gt;False&lt;/SA1515SingleLineCommentMustBeProceededByBlankLine&gt;&lt;/StyleCop.Layout&gt;&lt;StyleCop.Ordering&gt;&lt;AlphabeticalUsingDirectives&gt;Ignore&lt;/AlphabeticalUsingDirectives&gt;&lt;ExpandUsingDirectiLine truncated
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
+2 -2
View File
@@ -956,7 +956,7 @@ namespace Vocaluxe.Base
reader.Read();
byte[] data = _GetBytes(reader);
reader.Dispose();
tex = CDraw.QuequeTexture(w, h, ref data);
tex = CDraw.EnqueueTexture(w, h, ref data);
return true;
}
}
@@ -1006,7 +1006,7 @@ namespace Vocaluxe.Base
origin.Dispose();
}
tex = CDraw.QuequeTexture(w, h, ref data);
tex = CDraw.EnqueueTexture(w, h, ref data);
command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)";
command.Parameters.Add("@w", DbType.Int32).Value = w;
+2 -2
View File
@@ -211,9 +211,9 @@ namespace Vocaluxe.Base
return _Draw.AddTexture(w, h, ref data);
}
public static STexture QuequeTexture(int w, int h, ref byte[] data)
public static STexture EnqueueTexture(int w, int h, ref byte[] data)
{
return _Draw.QuequeTexture(w, h, ref data);
return _Draw.EnqueueTexture(w, h, ref data);
}
public static bool UpdateTexture(ref STexture texture, ref byte[] data)
+27 -39
View File
@@ -19,7 +19,7 @@
using System;
using System.Collections.Generic;
using Vocaluxe.GameModes;
using Vocaluxe.SongQueue;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
@@ -28,7 +28,7 @@ namespace Vocaluxe.Base
{
static class CGame
{
private static IGameMode _GameMode;
private static ISongQueue _SongQueue;
private static int _NumPlayer = CConfig.NumPlayer;
private static int _OldBeatD;
@@ -64,103 +64,97 @@ namespace Vocaluxe.Base
public static void Init()
{
_GameMode = new CGameModeNormal();
_GameMode.Init();
_SongQueue = new CSongQueue();
_SongQueue.Init();
Players = new SPlayer[CSettings.MaxNumPlayer];
ResetPlayer();
CConfig.UsePlayers();
}
public static void EnterNormalGame()
{
_GameMode = new CGameModeNormal();
_GameMode.Init();
}
public static EGameMode GameMode
{
get { return _GameMode.GetCurrentGameMode(); }
get { return _SongQueue.GetCurrentGameMode(); }
}
public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
{
return _GameMode.AddVisibleSong(visibleIndex, gameMode);
return _SongQueue.AddVisibleSong(visibleIndex, gameMode);
}
public static bool AddSong(int absoluteIndex, EGameMode gameMode)
{
return _GameMode.AddSong(absoluteIndex, gameMode);
return _SongQueue.AddSong(absoluteIndex, gameMode);
}
public static bool RemoveVisibleSong(int visibleIndex)
{
return _GameMode.RemoveVisibleSong(visibleIndex);
return _SongQueue.RemoveVisibleSong(visibleIndex);
}
public static bool RemoveSong(int absoluteIndex)
{
return _GameMode.RemoveSong(absoluteIndex);
return _SongQueue.RemoveSong(absoluteIndex);
}
public static void ClearSongs()
{
_GameMode.ClearSongs();
_SongQueue.ClearSongs();
}
public static void Reset()
{
_GameMode.Reset();
_SongQueue.Reset();
}
public static void Start()
{
_GameMode.Start(Players);
_SongQueue.Start(Players);
}
public static void NextRound()
{
_GameMode.NextRound(Players);
_SongQueue.NextRound(Players);
}
public static bool IsFinished()
{
return _GameMode.IsFinished();
return _SongQueue.IsFinished();
}
public static int RoundNr
{
get { return _GameMode.GetCurrentRoundNr(); }
get { return _SongQueue.GetCurrentRoundNr(); }
}
public static CSong GetSong()
{
return _GameMode.GetSong();
return _SongQueue.GetSong();
}
public static CSong GetSong(int num)
{
return _GameMode.GetSong(num);
return _SongQueue.GetSong(num);
}
public static EGameMode GetGameMode(int num)
{
return _GameMode.GetGameMode(num);
return _SongQueue.GetGameMode(num);
}
public static int GetNumSongs()
{
return _GameMode.GetNumSongs();
return _SongQueue.GetNumSongs();
}
public static CPoints GetPoints()
{
return _GameMode.GetPoints();
return _SongQueue.GetPoints();
}
public static int NumRounds
{
get { return _GameMode.GetNumSongs(); }
get { return _SongQueue.GetNumSongs(); }
}
public static int NumPlayer
@@ -200,7 +194,7 @@ namespace Vocaluxe.Base
public static void UpdatePoints(float time)
{
CSong song = _GameMode.GetSong();
CSong song = _SongQueue.GetSong();
if (song == null)
return;
@@ -225,8 +219,8 @@ namespace Vocaluxe.Base
{
for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++)
{
if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
if ((_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
(_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
Players[p].SongFinished = true;
CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines;
@@ -252,15 +246,9 @@ namespace Vocaluxe.Base
Players[p].SingLine.Add(new CLine());
CNote[] notes = lines[line].Notes;
int note = -1;
for (int j = 0; j < notes.Length; j++)
{
if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat)
{
note = j;
break;
}
}
int note = lines[line].FindPreviousNote(beat);
if (note >= 0 && notes[note].EndBeat < beat)
note = -1;
if (note >= 0)
{
+2 -1
View File
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Vocaluxe.Base.Font;
using Vocaluxe.Screens;
using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
@@ -504,7 +505,7 @@ namespace Vocaluxe.Base
bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
//Hide volume control for bg-music if bg-music is disabled
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1)
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF)
popupVolumeControlAllowed = false;
+9 -7
View File
@@ -19,7 +19,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
@@ -567,9 +569,9 @@ namespace Vocaluxe.Base
return CSongs.NumAllSongs;
}
public int GetNumVisibleSongs()
public int GetNumSongsVisible()
{
return CSongs.NumVisibleSongs;
return CSongs.NumSongsVisible;
}
public int GetNumCategories()
@@ -617,14 +619,14 @@ namespace Vocaluxe.Base
return CSongs.GetSong(songID);
}
public CSong[] GetSongs()
public ReadOnlyCollection<CSong> GetSongs()
{
return CSongs.AllSongs;
}
public CSong[] GetSongsNotSung()
public ReadOnlyCollection<CSong> GetVisibleSongs()
{
return CSongs.SongsNotSung;
return CSongs.VisibleSongs;
}
public CCategory GetCategory(int index)
@@ -640,12 +642,12 @@ namespace Vocaluxe.Base
CSongs.AddPartySongSung(songID);
}
public void ResetPartySongSung()
public void ResetSongSung()
{
CSongs.ResetPartySongSung();
}
public void ResetPartySongSung(int catIndex)
public void ResetSongSung(int catIndex)
{
CSongs.ResetPartySongSung(catIndex);
}
+1 -1
View File
@@ -223,7 +223,7 @@ namespace Vocaluxe.Base
private static CPlaylistFile _ConvertUSDXPlaylist(string file)
{
CPlaylistFile pl = new CPlaylistFile();
CSong[] allSongs = CSongs.AllSongs;
var allSongs = CSongs.AllSongs;
if (!File.Exists(file))
return null;
+34 -39
View File
@@ -32,7 +32,7 @@ namespace Vocaluxe.Base
public CSongCategorizer()
{
CSongs.Filter.ObjectChanged += _HandleSortedSongsChanged;
CSongs.Sorter.ObjectChanged += _HandleSortedSongsChanged;
}
public List<CCategory> Categories
@@ -49,11 +49,10 @@ namespace Vocaluxe.Base
get { return _Tabs; }
set
{
if (value != _Tabs)
{
_Tabs = value;
_SetChanged();
}
if (value == _Tabs)
return;
_Tabs = value;
_SetChanged();
}
}
@@ -64,58 +63,55 @@ namespace Vocaluxe.Base
private void _CreateCategoriesLetter()
{
string category = "";
int notLetterCat = -1;
CCategory lastCategory = null;
CCategory notLetterCat = null;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
Char firstLetter = Char.ToUpper(CSongs.Sorter.SortedSongs[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
firstLetter = '#';
if (firstLetter.ToString() != category)
if (Char.IsLetter(firstLetter))
{
if (firstLetter != '#' || notLetterCat == -1)
if (lastCategory == null || CSongs.Sorter.SortedSongs[i].SortString != lastCategory.Name)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category));
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
notLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex;
lastCategory = new CCategory(CSongs.Sorter.SortedSongs[i].SortString);
_Categories.Add(lastCategory);
}
else
CSongs.Sorter.SortedSongs[i].CatIndex = notLetterCat;
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]);
}
else
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
{
if (notLetterCat == null)
{
notLetterCat = new CCategory("#");
_Categories.Add(notLetterCat);
}
notLetterCat.Songs.Add(CSongs.Sorter.SortedSongs[i]);
}
}
}
private void _CreateCategoriesNormal(string noCategoryName)
{
string category = "";
int noCategoryIndex = -1;
CCategory lastCategory = null;
CCategory noCategory = null;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
if (CSongs.Sorter.SortedSongs[i].SortString != "")
{
if (CSongs.Sorter.SortedSongs[i].SortString != category)
if (lastCategory == null || CSongs.Sorter.SortedSongs[i].SortString != lastCategory.Name)
{
category = CSongs.Sorter.SortedSongs[i].SortString;
_Categories.Add(new CCategory(category));
lastCategory = new CCategory(CSongs.Sorter.SortedSongs[i].SortString);
_Categories.Add(lastCategory);
}
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]);
}
else
{
if (noCategoryIndex < 0)
if (noCategory == null)
{
category = noCategoryName;
_Categories.Add(new CCategory(category));
noCategoryIndex = _Categories.Count - 1;
noCategory = new CCategory(noCategoryName);
_Categories.Add(noCategory);
}
CSongs.Sorter.SortedSongs[i].CatIndex = noCategoryIndex;
noCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]);
}
}
}
@@ -172,15 +168,14 @@ namespace Vocaluxe.Base
_Categories.Clear();
if (_Tabs == EOffOn.TR_CONFIG_OFF)
if (_Tabs != EOffOn.TR_CONFIG_OFF)
_CreateCategories();
else
{
//No categories. So don't create them!
_Categories.Add(new CCategory(""));
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
CSongs.Sorter.SortedSongs[i].CatIndex = 0;
_Categories[0].Songs.AddRange(CSongs.Sorter.SortedSongs);
}
else
_CreateCategories();
foreach (CCategory cat in _Categories)
cat.CoverTextureSmall = CCover.Cover(cat.Name);
+11 -11
View File
@@ -27,7 +27,7 @@ namespace Vocaluxe.Base
{
class CSongSorter : CObservable
{
private SSongPointer[] _SortedSongs = new SSongPointer[0];
private CSongPointer[] _SortedSongs = new CSongPointer[0];
private EOffOn _IgnoreArticles = CConfig.IgnoreArticles;
private ESongSorting _SongSorting = CConfig.SongSorting;
@@ -36,7 +36,7 @@ namespace Vocaluxe.Base
CSongs.Filter.ObjectChanged += _HandleFilteredSongsChanged;
}
public SSongPointer[] SortedSongs
public CSongPointer[] SortedSongs
{
get
{
@@ -84,7 +84,7 @@ namespace Vocaluxe.Base
_SetChanged();
}
private int _SortByFieldArtistTitle(SSongPointer s1, SSongPointer s2)
private int _SortByFieldArtistTitle(CSongPointer s1, CSongPointer s2)
{
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
if (res == 0)
@@ -100,7 +100,7 @@ namespace Vocaluxe.Base
return res;
}
private int _SortByFieldTitle(SSongPointer s1, SSongPointer s2)
private int _SortByFieldTitle(CSongPointer s1, CSongPointer s2)
{
int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase);
if (res == 0)
@@ -112,11 +112,11 @@ namespace Vocaluxe.Base
return res;
}
private List<SSongPointer> _CreateSortList(string fieldName)
private List<CSongPointer> _CreateSortList(string fieldName)
{
List<SSongPointer> sortList = new List<SSongPointer>();
List<CSongPointer> sortList = new List<CSongPointer>();
if (fieldName == "")
CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, "")));
CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new CSongPointer(song.ID, "")));
else
{
FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
@@ -132,16 +132,16 @@ namespace Vocaluxe.Base
{
object value = field.GetValue(song);
if (isString)
sortList.Add(new SSongPointer(song.ID, (String)value));
sortList.Add(new CSongPointer(song.ID, (String)value));
else
{
List<String> values = (List<String>)value;
if (values.Count == 0)
sortList.Add(new SSongPointer(song.ID, ""));
sortList.Add(new CSongPointer(song.ID, ""));
else
{
foreach (String sortString in values)
sortList.Add(new SSongPointer(song.ID, sortString));
sortList.Add(new CSongPointer(song.ID, sortString));
}
}
}
@@ -183,7 +183,7 @@ namespace Vocaluxe.Base
fieldName = "";
break;
}
List<SSongPointer> sortList = _CreateSortList(fieldName);
List<CSongPointer> sortList = _CreateSortList(fieldName);
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
+57 -145
View File
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using VocaluxeLib.Menu;
@@ -26,33 +27,12 @@ using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
public struct SSongPointer
{
public readonly int SongID;
public string SortString;
public int CatIndex;
public bool Visible;
public bool PartyHidden;
public SSongPointer(int id, string sortString)
{
SongID = id;
SortString = sortString;
CatIndex = -1;
Visible = false;
PartyHidden = false;
}
}
static class CSongs
{
private static readonly List<CSong> _Songs = new List<CSong>();
private static readonly List<CSong> _SongsForRandom = new List<CSong>();
private static bool _SongsLoaded;
private static bool _CoverLoaded;
private static int _CoverLoadIndex;
private static int _CatIndex = -1;
private static readonly List<CCategory> _CategoriesForRandom = new List<CCategory>();
@@ -67,16 +47,13 @@ namespace Vocaluxe.Base
get { return _Songs; }
}
public static bool SongsLoaded
{
get { return _SongsLoaded; }
}
public static bool SongsLoaded { get; private set; }
public static bool CoverLoaded
{
get
{
if (_SongsLoaded && NumAllSongs == 0)
if (SongsLoaded && NumAllSongs == 0)
_CoverLoaded = true;
return _CoverLoaded;
}
@@ -87,14 +64,14 @@ namespace Vocaluxe.Base
get { return _Songs.Count; }
}
public static int NumVisibleSongs
public static int NumSongsVisible
{
get { return Sorter.SortedSongs.Count(sp => sp.Visible); }
get { return _CatIndex < 0 ? 0 : Categories[_CatIndex].Songs.Count(sp => !sp.IsSung); }
}
public static int NumCategories
{
get { return Categorizer.Categories.Count; }
get { return Categories.Count; }
}
public static int Category
@@ -102,13 +79,8 @@ namespace Vocaluxe.Base
get { return _CatIndex; }
set
{
if (value >= -1 && value < Categorizer.Categories.Count)
{
if (value == -1 || IsCatIndexValid(value))
_CatIndex = value;
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
}
}
@@ -117,6 +89,11 @@ namespace Vocaluxe.Base
get { return _CatIndex >= 0; }
}
private static bool IsCatIndexValid(int catIndex)
{
return catIndex >= 0 && catIndex < Categories.Count;
}
/// <summary>
/// Returns the number of song in the category specified with CatIndex
/// </summary>
@@ -124,21 +101,12 @@ namespace Vocaluxe.Base
/// <returns></returns>
public static int NumSongsInCategory(int catIndex)
{
if (Categorizer.Categories.Count <= catIndex || catIndex < 0)
return 0;
int num = 0;
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
if (Sorter.SortedSongs[i].CatIndex == catIndex && !Sorter.SortedSongs[i].PartyHidden)
num++;
}
return num;
return IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count(sp => !sp.IsSung) : 0;
}
public static void NextCategory()
{
if (Category == Categorizer.Categories.Count - 1)
if (Category == Categories.Count - 1)
Category = 0;
else
Category++;
@@ -147,7 +115,7 @@ namespace Vocaluxe.Base
public static void PrevCategory()
{
if (Category == 0)
Category = Categorizer.Categories.Count - 1;
Category = Categories.Count - 1;
else
Category--;
}
@@ -157,44 +125,21 @@ namespace Vocaluxe.Base
if (!SongsLoaded)
return -1;
if (_CoverLoadIndex < _Songs.Count)
if (NumSongsWithCoverLoaded < _Songs.Count)
{
song = _Songs[_CoverLoadIndex];
_CoverLoadIndex++;
return _CoverLoadIndex;
song = _Songs[NumSongsWithCoverLoaded];
NumSongsWithCoverLoaded++;
return NumSongsWithCoverLoaded;
}
return -2;
}
public static int NumSongsWithCoverLoaded
{
get { return _CoverLoadIndex; }
}
public static void SetCoverSmall(int songIndex, STexture texture)
{
if (!_SongsLoaded)
return;
if (songIndex < _Songs.Count)
_Songs[songIndex].CoverTextureSmall = texture;
}
public static void SetCoverBig(int songIndex, STexture texture)
{
if (!_SongsLoaded)
return;
if (songIndex < _Songs.Count)
_Songs[songIndex].CoverTextureBig = texture;
}
public static int NumSongsWithCoverLoaded { get; private set; }
public static string GetCurrentCategoryName()
{
if ((Categorizer.Categories.Count > 0) && (_CatIndex >= 0) && (Categorizer.Categories.Count > _CatIndex))
return Categorizer.Categories[_CatIndex].Name;
return String.Empty;
return IsCatIndexValid(_CatIndex) ? Categories[_CatIndex].Name : "";
}
public static CSong GetSong(int songID)
@@ -204,43 +149,31 @@ namespace Vocaluxe.Base
public static void AddPartySongSung(int songID)
{
int cat = -1;
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
foreach (CCategory category in Categories)
{
if (songID == Sorter.SortedSongs[i].SongID)
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
{
Sorter.SortedSongs[i].PartyHidden = true;
Sorter.SortedSongs[i].Visible = false;
cat = Sorter.SortedSongs[i].CatIndex;
break;
song.IsSung = true;
int catIndex = _GetCategoryNumber(category);
if (NumSongsInCategory(catIndex) == 0)
ResetPartySongSung(catIndex);
return;
}
}
if (cat != -1)
{
if (NumSongsInCategory(cat) == 0)
ResetPartySongSung(cat);
}
}
public static void ResetPartySongSung()
{
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
Sorter.SortedSongs[i].PartyHidden = false;
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
foreach (CSongPointer song in Sorter.SortedSongs)
song.IsSung = false;
}
public static void ResetPartySongSung(int catIndex)
{
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
if (IsCatIndexValid(catIndex))
{
if (Sorter.SortedSongs[i].CatIndex == catIndex)
{
Sorter.SortedSongs[i].PartyHidden = false;
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
foreach (CSongPointer song in Categories[catIndex].Songs)
song.IsSung = false;
}
}
@@ -296,7 +229,7 @@ namespace Vocaluxe.Base
private static int _GetCategoryNumber(CCategory category)
{
for (int i = 0; i < Categories.Length; i++)
for (int i = 0; i < Categories.Count; i++)
{
if (Categories[i] == category)
return i;
@@ -304,59 +237,39 @@ namespace Vocaluxe.Base
return -1;
}
public static CSong[] AllSongs
public static ReadOnlyCollection<CSong> AllSongs
{
get { return _Songs.ToArray(); }
get { return _Songs.AsReadOnly(); }
}
public static CSong[] SongsNotSung
public static ReadOnlyCollection<CSong> VisibleSongs
{
get
{
List<CSong> songs = new List<CSong>();
foreach (SSongPointer sp in Sorter.SortedSongs)
if (IsCatIndexValid(_CatIndex))
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
foreach (CSongPointer sp in Categories[_CatIndex].Songs)
{
if (!sp.IsSung)
songs.Add(_Songs[sp.SongID]);
}
}
return songs.ToArray();
return songs.AsReadOnly();
}
}
public static CSong[] VisibleSongs
public static ReadOnlyCollection<CCategory> Categories
{
get
{
List<CSong> songs = new List<CSong>();
foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
}
return songs.ToArray();
}
}
public static CCategory[] Categories
{
get { return Categorizer.Categories.ToArray(); }
get { return Categorizer.Categories.AsReadOnly(); }
}
public static CSong GetVisibleSongByIndex(int index)
{
if (index < 0)
return null;
foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
{
if (index == 0)
return _Songs[sp.SongID];
index--;
}
}
return null;
var visSongs = VisibleSongs;
return (index < visSongs.Count) ? visSongs[index] : null;
}
private static void _HandleCategoriesChanged(object sender, EventArgs args)
@@ -375,7 +288,7 @@ namespace Vocaluxe.Base
public static void LoadSongs()
{
CLog.StartBenchmark(1, "Load Songs");
_SongsLoaded = false;
SongsLoaded = false;
_Songs.Clear();
CLog.StartBenchmark(2, "List Songs");
@@ -392,12 +305,11 @@ namespace Vocaluxe.Base
foreach (string file in files)
{
CSong song = CSong.LoadSong(file);
if (song != null)
{
song.ID = _Songs.Count;
if (song.ReadNotes())
_Songs.Add(song);
}
if (song == null)
continue;
song.ID = _Songs.Count;
if (song.ReadNotes())
_Songs.Add(song);
}
CLog.StopBenchmark(2, "Read TXTs");
@@ -408,7 +320,7 @@ namespace Vocaluxe.Base
Categorizer.ObjectChanged += _HandleCategoriesChanged;
CLog.StopBenchmark(2, "Sort Songs");
Category = -1;
_SongsLoaded = true;
SongsLoaded = true;
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
{
@@ -423,7 +335,7 @@ namespace Vocaluxe.Base
public static void LoadCover()
{
if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE)
return; //should be removed as soon as the other renderer are ready for queque
return; //should be removed as soon as the other renderer are ready for queue
if (!SongsLoaded || CoverLoaded)
return;
@@ -460,7 +372,7 @@ namespace Vocaluxe.Base
foreach (CSong song in _Songs)
{
song.LoadSmallCover();
_CoverLoadIndex++;
NumSongsWithCoverLoaded++;
}
GC.Collect();
_CoverLoaded = true;
+1
View File
@@ -23,6 +23,7 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
+193
View File
@@ -0,0 +1,193 @@
#region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Text;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base.Font
{
class CFont : IDisposable
{
private readonly Dictionary<char, CGlyph> _Glyphs;
private PrivateFontCollection _Fonts;
private FontFamily _Family;
private readonly float _Sizeh;
public readonly string FilePath;
public CFont(string file)
{
FilePath = file;
_Glyphs = new Dictionary<char, CGlyph>();
switch (CConfig.TextureQuality)
{
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
_Sizeh = 25f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_LOW:
_Sizeh = 50f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM:
_Sizeh = 100f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGH:
_Sizeh = 200f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST:
_Sizeh = 400f;
break;
default:
_Sizeh = 100f;
break;
}
}
public System.Drawing.Font GetFont()
{
if (_Fonts == null)
{
_Fonts = new PrivateFontCollection();
try
{
_Fonts.AddFontFile(FilePath);
_Family = _Fonts.Families[0];
}
catch (Exception e)
{
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
}
}
return new System.Drawing.Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color, float begin, float end)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color, begin, end);
}
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight);
}
private void _GetGlyphTextureAndRect(char chr, float x, float y, float z, float h, out STexture texture, out SRectF rect)
{
AddGlyph(chr);
CFonts.Height = h;
CGlyph glyph = _Glyphs[chr];
texture = glyph.Texture;
float factor = h / texture.Height;
float width = texture.Width * factor;
float d = glyph.Sizeh / 5f * factor;
rect = new SRectF(x - d, y, width, h, z);
}
public float GetWidth(char chr)
{
AddGlyph(chr);
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.Height;
return glyph.Width * factor;
}
public float GetHeight(char chr)
{
return CFonts.Height;
/*WTF???
AddGlyph(chr);
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.height;
return glyph.Texture.height * factor;*/
}
public void AddGlyph(char chr)
{
if (_Glyphs.ContainsKey(chr))
return;
float h = CFonts.Height;
_Glyphs.Add(chr, new CGlyph(chr, _Sizeh));
CFonts.Height = h;
}
public void UnloadAllGlyphs()
{
foreach (CGlyph glyph in _Glyphs.Values)
glyph.UnloadTexture();
_Glyphs.Clear();
}
public void Dispose()
{
if (_Fonts != null)
{
_Fonts.Dispose();
_Fonts = null;
UnloadAllGlyphs();
}
GC.SuppressFinalize(this);
}
}
struct SFont
{
public string Name;
public bool IsThemeFont;
public int PartyModeID;
public string ThemeName;
public string Folder;
public string FileNormal;
public string FileItalic;
public string FileBold;
public string FileBoldItalic;
public float Outline; //0..1, 0=not outline 1=100% outline
public SColorF OutlineColor;
public CFont Normal;
public CFont Italic;
public CFont Bold;
public CFont BoldItalic;
}
}
@@ -1,321 +1,13 @@
#region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
namespace Vocaluxe.Base.Font
{
class CGlyph
{
private readonly float _Sizeh = 50f;
public float Sizeh
{
get { return _Sizeh; }
}
public STexture Texture;
public readonly int Width;
public CGlyph(char chr, float maxHigh)
{
_Sizeh = maxHigh;
float outline = CFonts.Outline;
const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
float factor = _GetFactor(chr, flags);
CFonts.Height = Sizeh * factor;
Font fo;
Size sizeB;
SizeF size;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
size = g.MeasureString(chr.ToString(), fo);
}
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
CFonts.Height = Sizeh;
fo = CFonts.GetFont();
PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + Sizeh / 5f,
(sizeB.Height - size.Height - (size.Height + Sizeh / 4f) * (1f - factor)) / 2f);
using (GraphicsPath path = new GraphicsPath())
{
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
Sizeh,
point,
new StringFormat());
using (Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
Sizeh * outline))
{
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
}
}
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width);
g.Dispose();
}
fo.Dispose();
}
public void UnloadTexture()
{
CDraw.RemoveTexture(ref Texture);
}
private float _GetFactor(char chr, TextFormatFlags flags)
{
if (CFonts.Style == EStyle.Normal)
return 1f;
EStyle style = CFonts.Style;
CFonts.Style = EStyle.Normal;
CFonts.Height = Sizeh;
float hStyle, hNormal;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
hNormal = sizeB.Height;
}
CFonts.Style = style;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
hStyle = sizeB.Height;
}
return hNormal / hStyle;
}
}
class CFont : IDisposable
{
private readonly Dictionary<char, CGlyph> _Glyphs;
private PrivateFontCollection _Fonts;
private FontFamily _Family;
private readonly float _Sizeh;
public readonly string FilePath;
public CFont(string file)
{
FilePath = file;
_Glyphs = new Dictionary<char, CGlyph>();
switch (CConfig.TextureQuality)
{
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
_Sizeh = 25f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_LOW:
_Sizeh = 50f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM:
_Sizeh = 100f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGH:
_Sizeh = 200f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST:
_Sizeh = 400f;
break;
default:
_Sizeh = 100f;
break;
}
}
public Font GetFont()
{
if (_Fonts == null)
{
_Fonts = new PrivateFontCollection();
try
{
_Fonts.AddFontFile(FilePath);
_Family = _Fonts.Families[0];
}
catch (Exception e)
{
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
}
}
return new Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color, float begin, float end)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color, begin, end);
}
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight);
}
private void _GetGlyphTextureAndRect(char chr, float x, float y, float z, float h, out STexture texture, out SRectF rect)
{
AddGlyph(chr);
CFonts.Height = h;
CGlyph glyph = _Glyphs[chr];
texture = glyph.Texture;
float factor = h / texture.Height;
float width = texture.Width * factor;
float d = glyph.Sizeh / 5f * factor;
rect = new SRectF(x - d, y, width, h, z);
}
public float GetWidth(char chr)
{
AddGlyph(chr);
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.Height;
return glyph.Width * factor;
}
public float GetHeight(char chr)
{
return CFonts.Height;
/*WTF???
AddGlyph(chr);
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.height;
return glyph.Texture.height * factor;*/
}
public void AddGlyph(char chr)
{
if (_Glyphs.ContainsKey(chr))
return;
float h = CFonts.Height;
_Glyphs.Add(chr, new CGlyph(chr, _Sizeh));
CFonts.Height = h;
}
public void UnloadAllGlyphs()
{
foreach (CGlyph glyph in _Glyphs.Values)
glyph.UnloadTexture();
_Glyphs.Clear();
}
public void Dispose()
{
if (_Fonts != null)
{
_Fonts.Dispose();
_Fonts = null;
UnloadAllGlyphs();
}
GC.SuppressFinalize(this);
}
}
struct SFont
{
public string Name;
public bool IsThemeFont;
public int PartyModeID;
public string ThemeName;
public string Folder;
public string FileNormal;
public string FileItalic;
public string FileBold;
public string FileBoldItalic;
public float Outline; //0..1, 0=not outline 1=100% outline
public SColorF OutlineColor;
public CFont Normal;
public CFont Italic;
public CFont Bold;
public CFont BoldItalic;
}
static class CFonts
{
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
@@ -328,15 +20,6 @@ namespace Vocaluxe.Base
public static EStyle Style = EStyle.Normal;
public static int CurrentFont
{
get { return _CurrentFont; }
set
{
if ((value >= 0) && (value < _Fonts.Count))
_CurrentFont = value;
}
}
public static float Height
{
get { return _Height; }
@@ -372,7 +55,7 @@ namespace Vocaluxe.Base
_LoadFontList();
}
public static Font GetFont()
public static System.Drawing.Font GetFont()
{
return _GetCurrentFont().GetFont();
}
@@ -504,35 +187,13 @@ namespace Vocaluxe.Base
public static void SetFont(string fontName)
{
int index;
if (PartyModeID != -1)
{
index = _GetFontIndexParty(PartyModeID, fontName);
if (index >= 0 && index < _Fonts.Count)
{
_CurrentFont = index;
return;
}
}
index = _GetFontIndex(CConfig.Theme, fontName);
if (index >= 0 && index < _Fonts.Count)
{
int index = _GetPartyFontIndex(PartyModeID, fontName);
if (index < 0)
index = _GetThemeFontIndex(CConfig.Theme, fontName);
if (index < 0)
index = _GetFontIndex(fontName);
if (index >= 0)
_CurrentFont = index;
return;
}
for (int i = 0; i < _Fonts.Count; i++)
{
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName)
{
_CurrentFont = i;
return;
}
}
}
public static RectangleF GetTextBounds(CText text)
@@ -728,7 +389,18 @@ namespace Vocaluxe.Base
}
}
private static int _GetFontIndex(string themeName, string fontName)
private static int _GetFontIndex(string fontName)
{
for (int i = 0; i < _Fonts.Count; i++)
{
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName)
return i;
}
return -1;
}
private static int _GetThemeFontIndex(string themeName, string fontName)
{
if (themeName == "" || fontName == "")
return -1;
@@ -742,14 +414,14 @@ namespace Vocaluxe.Base
return -1;
}
private static int _GetFontIndexParty(int partyModeID, string fontName)
private static int _GetPartyFontIndex(int partyModeID, string fontName)
{
if (partyModeID == -1 || fontName == "")
return -1;
for (int i = 0; i < _Fonts.Count; i++)
{
if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].PartyModeID == partyModeID)
if (!_Fonts[i].IsThemeFont && _Fonts[i].PartyModeID == partyModeID && _Fonts[i].Name == fontName)
return i;
}
@@ -762,7 +434,7 @@ namespace Vocaluxe.Base
for (int i = 0; i < _Fonts.Count; i++)
{
CurrentFont = i;
_CurrentFont = i;
foreach (char chr in text)
{
+125
View File
@@ -0,0 +1,125 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base.Font
{
class CGlyph
{
public float Sizeh { get; private set; }
public STexture Texture;
public readonly int Width;
public CGlyph(char chr, float maxHigh)
{
Sizeh = maxHigh;
float outline = CFonts.Outline;
const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
float factor = _GetFactor(chr, flags);
CFonts.Height = Sizeh * factor;
System.Drawing.Font fo;
Size sizeB;
SizeF size;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
size = g.MeasureString(chr.ToString(), fo);
}
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
CFonts.Height = Sizeh;
fo = CFonts.GetFont();
PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + Sizeh / 5f,
(sizeB.Height - size.Height - (size.Height + Sizeh / 4f) * (1f - factor)) / 2f);
using (GraphicsPath path = new GraphicsPath())
{
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
Sizeh,
point,
new StringFormat());
using (Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
Sizeh * outline))
{
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
}
}
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
Texture = CDraw.AddTexture(bmp);
//bmp.Save("font/" + chr + CFonts.Style + ".png", ImageFormat.Png);
Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width);
g.Dispose();
}
fo.Dispose();
}
public void UnloadTexture()
{
CDraw.RemoveTexture(ref Texture);
}
private float _GetFactor(char chr, TextFormatFlags flags)
{
if (CFonts.Style == EStyle.Normal)
return 1f;
EStyle style = CFonts.Style;
CFonts.Style = EStyle.Normal;
CFonts.Height = Sizeh;
float hStyle, hNormal;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
System.Drawing.Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
hNormal = sizeB.Height;
}
CFonts.Style = style;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
System.Drawing.Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
hStyle = sizeB.Height;
}
return hNormal / hStyle;
}
}
}
+9 -223
View File
@@ -1,238 +1,24 @@
#region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Collections.Generic;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
struct SSongQueque
{
public readonly int SongID;
public readonly EGameMode GameMode;
public SSongQueque(int songID, EGameMode gameMode)
{
SongID = songID;
GameMode = gameMode;
}
}
abstract class CGameMode : IGameMode
{
private List<SSongQueque> _SongQueque;
private int _CurrentSong;
private CPoints _Points;
private CSong _LastSong;
private int _LastSongID = -1;
#region Implementation
public virtual void Init()
public CSong GetSong(int songID)
{
_SongQueque = new List<SSongQueque>();
Reset();
}
public virtual EGameMode GetCurrentGameMode()
{
if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count)
return _SongQueque[_CurrentSong].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
}
public virtual bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
{
if (CSongs.VisibleSongs.Length > visibleIndex)
if (songID != _LastSongID)
{
int songID = CSongs.VisibleSongs[visibleIndex].ID;
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
return false;
_SongQueque.Add(new SSongQueque(songID, gameMode));
return true;
CSong song = CSongs.GetSong(songID);
_LastSong = _PrepareSong(song);
_LastSongID = songID;
}
return false;
return _LastSong;
}
public virtual bool AddSong(int absoluteIndex, EGameMode gameMode)
{
if (CSongs.AllSongs.Length > absoluteIndex)
{
int songID = CSongs.AllSongs[absoluteIndex].ID;
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
return false;
_SongQueque.Add(new SSongQueque(songID, gameMode));
return true;
}
return false;
}
public virtual bool RemoveVisibleSong(int visibleIndex)
{
if (CSongs.VisibleSongs.Length > visibleIndex)
{
int index = -1;
int songID = CSongs.VisibleSongs[visibleIndex].ID;
for (int i = 0; i < _SongQueque.Count; i++)
{
if (_SongQueque[i].SongID == songID)
{
index = i;
break;
}
}
if (index == -1)
return false;
_SongQueque.RemoveAt(index);
return true;
}
return false;
}
public virtual bool RemoveSong(int absoluteIndex)
{
if (CSongs.AllSongs.Length > absoluteIndex)
{
int index = -1;
int songID = CSongs.AllSongs[absoluteIndex].ID;
for (int i = 0; i < _SongQueque.Count; i++)
{
if (_SongQueque[i].SongID == songID)
{
index = i;
break;
}
}
if (index == -1)
return false;
_SongQueque.RemoveAt(index);
return true;
}
return false;
}
public virtual void ClearSongs()
{
_SongQueque.Clear();
}
public virtual void Reset()
{
_CurrentSong = -1;
}
public virtual void Start(SPlayer[] player)
{
_Points = new CPoints(_SongQueque.Count, player);
}
public virtual void NextRound(SPlayer[] player)
{
if (_CurrentSong < _SongQueque.Count && _SongQueque.Count > 0)
{
if (_CurrentSong > -1)
{
_Points.SetPoints(
_CurrentSong,
_SongQueque[_CurrentSong].SongID,
player,
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY,
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET,
_SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG);
}
_CurrentSong++;
}
}
public virtual bool IsFinished()
{
return _CurrentSong == _SongQueque.Count || _SongQueque.Count == 0;
}
public virtual int GetCurrentRoundNr()
{
return _CurrentSong + 1;
}
public virtual CSong GetSong()
{
if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count)
{
CSong song = CSongs.GetSong(_SongQueque[_CurrentSong].SongID);
song = new CSong(song);
switch (GetCurrentGameMode())
{
case EGameMode.TR_GAMEMODE_MEDLEY:
// set medley mode timings
song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap;
if (song.Start < 0f)
song.Start = 0f;
song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap;
// set lines to medley mode
song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat);
break;
case EGameMode.TR_GAMEMODE_SHORTSONG:
song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap;
// set lines to medley mode
song.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd);
break;
}
return song;
}
return null;
}
public virtual int GetNumSongs()
{
return _SongQueque.Count;
}
public virtual CSong GetSong(int num)
{
if (num - 1 < _SongQueque.Count && num - 1 > -1)
return CSongs.GetSong(_SongQueque[num - 1].SongID);
return null;
}
public virtual EGameMode GetGameMode(int num)
{
if (num - 1 < _SongQueque.Count && num > -1)
return _SongQueque[num].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
}
public virtual CPoints GetPoints()
{
return _Points;
}
#endregion Implementation
protected abstract CSong _PrepareSong(CSong song);
}
}
+81
View File
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
static class CGameModes
{
private static Dictionary<EGameMode, IGameMode> _GameModes;
public static void Init()
{
_GameModes = new Dictionary<EGameMode, IGameMode>
{
{EGameMode.TR_GAMEMODE_NORMAL, new CGameModeNormal()},
{EGameMode.TR_GAMEMODE_DUET, new CGameModeDuet()},
{EGameMode.TR_GAMEMODE_SHORTSONG, new CGameModeShort()},
{EGameMode.TR_GAMEMODE_MEDLEY, new CGameModeMedley()}
};
}
public static IGameMode Get(EGameMode gameMode)
{
if (_GameModes == null)
return null;
IGameMode result;
if (!_GameModes.TryGetValue(gameMode, out result))
result = _GameModes[EGameMode.TR_GAMEMODE_NORMAL];
return result;
}
}
class CGameModeNormal : CGameMode
{
protected override CSong _PrepareSong(CSong song)
{
return song;
}
}
class CGameModeDuet : CGameMode
{
protected override CSong _PrepareSong(CSong song)
{
return (song.IsDuet) ? song : null;
}
}
class CGameModeShort : CGameMode
{
protected override CSong _PrepareSong(CSong song)
{
CSong newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap};
// set lines to short mode
newSong.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd);
return newSong;
}
}
class CGameModeMedley : CGameMode
{
protected override CSong _PrepareSong(CSong song)
{
CSong newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap};
if (newSong.Start < 0f)
newSong.Start = 0f;
newSong.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap;
// set lines to medley mode
newSong.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat);
return newSong;
}
}
}
+2 -43
View File
@@ -1,50 +1,9 @@
#region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
interface IGameMode
{
void Init();
EGameMode GetCurrentGameMode();
bool AddVisibleSong(int visibleIndex, EGameMode gameMode);
bool AddSong(int absoluteIndex, EGameMode gameMode);
bool RemoveVisibleSong(int visibleIndex);
bool RemoveSong(int absoluteIndex);
void ClearSongs();
void Reset();
void Start(SPlayer[] player);
void NextRound(SPlayer[] player);
bool IsFinished();
int GetCurrentRoundNr();
CPoints GetPoints();
int GetNumSongs();
CSong GetSong();
CSong GetSong(int num);
EGameMode GetGameMode(int num);
CSong GetSong(int songID);
}
}
+24 -15
View File
@@ -29,12 +29,14 @@ using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using SlimDX.Windows;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
{
class CDirect3D : Form, IDraw
class CDirect3D : RenderForm, IDraw
{
#region private vars
private readonly CKeys _Keys;
@@ -51,7 +53,7 @@ namespace Vocaluxe.Lib.Draw
private readonly Dictionary<int, STexture> _Textures;
private readonly Dictionary<int, Texture> _D3DTextures;
private readonly List<STextureQueque> _Queque;
private readonly List<STextureQueue> _Queue;
private readonly Queue<int> _IDs;
private readonly Object _MutexTexture = new Object();
@@ -81,7 +83,7 @@ namespace Vocaluxe.Lib.Draw
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
_Textures = new Dictionary<int, STexture>();
_D3DTextures = new Dictionary<int, Texture>();
_Queque = new List<STextureQueque>();
_Queue = new List<STextureQueue>();
_IDs = new Queue<int>();
//Fill Queue with 100000 IDs
@@ -97,7 +99,7 @@ namespace Vocaluxe.Lib.Draw
{
_D3D = new Direct3D();
}
catch (Direct3D9NotFoundException e)
catch (Direct3DX9NotFoundException e)
{
MessageBox.Show("No DirectX runtimes were found, please download and install them " +
"from http://www.microsoft.com/download/en/details.aspx?id=8109",
@@ -515,13 +517,15 @@ namespace Vocaluxe.Lib.Draw
//We want to begin drawing
if (_Device.BeginScene().IsFailure)
CLog.LogError("Failed to begin scene");
_CheckQueque();
_Run = _Run && CGraphics.Draw();
_CheckQueue();
if (!CGraphics.Draw())
_Run = false;
_RenderVertexBuffer();
//We finished drawing the frame
if (_Device.EndScene().IsFailure)
CLog.LogError("Failed to end scene");
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
if (!CGraphics.UpdateGameLogic(_Keys, _Mouse))
_Run = false;
try
{
//Now push the frame to the Viewport
@@ -578,6 +582,11 @@ namespace Vocaluxe.Lib.Draw
/// <returns></returns>
public bool Unload()
{
try
{
Close();
}
catch {}
//Dispose all textures
foreach (KeyValuePair<int, Texture> p in _D3DTextures)
{
@@ -1010,10 +1019,10 @@ namespace Vocaluxe.Lib.Draw
return t;
}
public STexture QuequeTexture(int w, int h, ref byte[] data)
public STexture EnqueueTexture(int w, int h, ref byte[] data)
{
STexture texture = new STexture(-1);
STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w};
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
texture.Height = h;
texture.Width = w;
@@ -1022,8 +1031,8 @@ namespace Vocaluxe.Lib.Draw
{
_D3DTextures.Add(_IDs.Peek(), null);
texture.Index = _IDs.Dequeue();
queque.ID = texture.Index;
_Queque.Add(queque);
queue.ID = texture.Index;
_Queue.Add(queue);
_Textures[texture.Index] = texture;
}
return texture;
@@ -1405,14 +1414,14 @@ namespace Vocaluxe.Lib.Draw
}
#endregion drawing
private void _CheckQueque()
private void _CheckQueue()
{
lock (_MutexTexture)
{
if (_Queque.Count == 0)
if (_Queue.Count == 0)
return;
STextureQueque q = _Queque[0];
STextureQueue q = _Queue[0];
STexture texture;
if (_Textures.ContainsKey(q.ID))
texture = _Textures[q.ID];
@@ -1423,7 +1432,7 @@ namespace Vocaluxe.Lib.Draw
_D3DTextures[q.ID] = t;
_Textures[texture.Index] = texture;
_Queque.RemoveAt(0);
_Queue.RemoveAt(0);
}
}
+7 -1
View File
@@ -27,6 +27,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
@@ -266,6 +267,11 @@ namespace Vocaluxe.Lib.Draw
public bool Unload()
{
try
{
Close();
}
catch {}
Dispose();
return true;
}
@@ -418,7 +424,7 @@ namespace Vocaluxe.Lib.Draw
return new STexture(-1);
}
public STexture QuequeTexture(int w, int h, ref byte[] data)
public STexture EnqueueTexture(int w, int h, ref byte[] data)
{
return AddTexture(w, h, ref data);
}
+22 -14
View File
@@ -30,6 +30,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
@@ -41,7 +42,7 @@ namespace Vocaluxe.Lib.Draw
public int Height;
};
struct STextureQueque
struct STextureQueue
{
public int ID;
public int Width;
@@ -63,7 +64,7 @@ namespace Vocaluxe.Lib.Draw
private readonly Dictionary<int, STexture> _Textures;
private readonly Queue<int> _IDs;
private readonly List<STextureQueque> _Queque;
private readonly List<STextureQueue> _Queue;
private readonly Object _MutexTexture = new Object();
@@ -80,7 +81,7 @@ namespace Vocaluxe.Lib.Draw
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
_Textures = new Dictionary<int, STexture>();
_Queque = new List<STextureQueque>();
_Queue = new List<STextureQueue>();
_IDs = new Queue<int>(1000000);
for (int i = 1; i < 1000000; i++)
@@ -412,15 +413,17 @@ namespace Vocaluxe.Lib.Draw
if (_Run)
{
ClearScreen();
_Run = _Run && CGraphics.Draw();
if (!CGraphics.Draw())
_Run = false;
if (!CGraphics.UpdateGameLogic(_Keys, _Mouse))
_Run = false;
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
_Control.SwapBuffers();
if ((CSettings.IsFullScreen && !_Fullscreen) || (!CSettings.IsFullScreen && _Fullscreen))
_ToggleFullScreen();
_CheckQueque();
_CheckQueue();
if (CTime.IsRunning())
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
@@ -437,6 +440,11 @@ namespace Vocaluxe.Lib.Draw
public bool Unload()
{
try
{
Close();
}
catch {}
STexture[] textures = new STexture[_Textures.Count];
_Textures.Values.CopyTo(textures, 0);
for (int i = 0; i < _Textures.Count; i++)
@@ -907,10 +915,10 @@ namespace Vocaluxe.Lib.Draw
return texture;
}
public STexture QuequeTexture(int w, int h, ref byte[] data)
public STexture EnqueueTexture(int w, int h, ref byte[] data)
{
STexture texture = new STexture(-1);
STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w};
STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w};
texture.Height = h;
texture.Width = w;
@@ -918,8 +926,8 @@ namespace Vocaluxe.Lib.Draw
lock (_MutexTexture)
{
texture.Index = _IDs.Dequeue();
queque.ID = texture.Index;
_Queque.Add(queque);
queue.ID = texture.Index;
_Queue.Add(queue);
_Textures[texture.Index] = texture;
}
@@ -1333,14 +1341,14 @@ namespace Vocaluxe.Lib.Draw
return _Textures.Count;
}
private void _CheckQueque()
private void _CheckQueue()
{
lock (_MutexTexture)
{
if (_Queque.Count == 0)
if (_Queue.Count == 0)
return;
STextureQueque q = _Queque[0];
STextureQueue q = _Queue[0];
STexture texture = new STexture(-1);
if (_Textures.ContainsKey(q.ID))
texture = _Textures[q.ID];
@@ -1407,7 +1415,7 @@ namespace Vocaluxe.Lib.Draw
_Textures[texture.Index] = texture;
q.Data = null;
_Queque.RemoveAt(0);
_Queue.RemoveAt(0);
}
}
#endregion Textures
+1 -1
View File
@@ -52,7 +52,7 @@ namespace Vocaluxe.Lib.Draw
STexture AddTexture(Bitmap bitmap);
STexture AddTexture(int w, int h, IntPtr data);
STexture AddTexture(int w, int h, ref byte[] data);
STexture QuequeTexture(int w, int h, ref byte[] data);
STexture EnqueueTexture(int w, int h, ref byte[] data);
bool UpdateTexture(ref STexture texture, ref byte[] data);
bool UpdateTexture(ref STexture texture, IntPtr data);
+1 -2
View File
@@ -155,9 +155,8 @@ namespace Vocaluxe.Lib.Playlist
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
CPlaylistSong playlistSong = new CPlaylistSong {SongID = -1};
CSong[] allSongs = CSongs.AllSongs;
foreach (CSong curSong in allSongs)
foreach (CSong curSong in CSongs.AllSongs)
{
if (curSong.Artist != artist || curSong.Title != title)
continue;
+1
View File
@@ -25,6 +25,7 @@ using System.Reflection;
using System.Windows.Forms;
using Vocaluxe.Base;
using System.Runtime.ExceptionServices;
using Vocaluxe.Base.Font;
namespace Vocaluxe
{
+4 -4
View File
@@ -219,12 +219,12 @@ namespace Vocaluxe.Screens
for (int round = 0; round < points.NumRounds; round++)
{
SPlayer[] player = points.GetPlayer(round, CGame.NumPlayer);
SPlayer[] players = points.GetPlayer(round, CGame.NumPlayer);
for (int p = 0; p < player.Length; p++)
for (int p = 0; p < players.Length; p++)
{
if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !CProfiles.IsGuestProfile(player[p].ProfileID))
_NewEntryIDs.Add(CDataBase.AddScore(player[p]));
if (players[p].Points > CSettings.MinScoreForDB && players[p].SongFinished && !CProfiles.IsGuestProfile(players[p].ProfileID))
_NewEntryIDs.Add(CDataBase.AddScore(players[p]));
}
}
}
+1
View File
@@ -19,6 +19,7 @@
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Screens
+1 -5
View File
@@ -20,6 +20,7 @@
using System;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
namespace Vocaluxe.Screens
@@ -180,12 +181,7 @@ namespace Vocaluxe.Screens
CConfig.SaveConfig();
if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection)
{
CCover.ReloadCover();
CSongs.Filter.SearchString = String.Empty;
CSongs.Sorter.SetOptions(CConfig.SongSorting, CConfig.IgnoreArticles);
CSongs.Categorizer.Tabs = CConfig.Tabs;
}
if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection)
{
+31 -31
View File
@@ -127,31 +127,31 @@ namespace Vocaluxe.Screens
public override bool UpdateGame()
{
SPlayer[] player = new SPlayer[CGame.NumPlayer];
SPlayer[] players = new SPlayer[CGame.NumPlayer];
if (_Round != 0)
player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
else
{
for (int i = 0; i < CGame.NumRounds; i++)
{
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
for (int p = 0; p < player.Length; p++)
player[p].Points += points[p].Points;
for (int p = 0; p < players.Length; p++)
players[p].Points += points[p].Points;
}
for (int p = 0; p < player.Length; p++)
player[p].Points = (int)(player[p].Points / CGame.NumRounds);
for (int p = 0; p < players.Length; p++)
players[p].Points = (int)(players[p].Points / CGame.NumRounds);
}
for (int p = 0; p < player.Length; p++)
for (int p = 0; p < players.Length; p++)
{
if (_StaticPointsBarDrawnPoints[p] < player[p].Points)
if (_StaticPointsBarDrawnPoints[p] < players[p].Points)
{
if (CConfig.ScoreAnimationTime >= 1)
{
_StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000;
if (_StaticPointsBarDrawnPoints[p] > player[p].Points)
_StaticPointsBarDrawnPoints[p] = player[p].Points;
if (_StaticPointsBarDrawnPoints[p] > players[p].Points)
_StaticPointsBarDrawnPoints[p] = players[p].Points;
string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical")
{
@@ -260,7 +260,7 @@ namespace Vocaluxe.Screens
private void _UpdateRatings()
{
CSong song = null;
SPlayer[] player = new SPlayer[CGame.NumPlayer];
SPlayer[] players = new SPlayer[CGame.NumPlayer];
if (_Round != 0)
{
song = CGame.GetSong(_Round);
@@ -270,7 +270,7 @@ namespace Vocaluxe.Screens
_Texts[_TextSong].Text = song.Artist + " - " + song.Title;
if (_Points.NumRounds > 1)
_Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")";
player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
}
else
{
@@ -278,47 +278,47 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumRounds; i++)
{
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
for (int p = 0; p < player.Length; p++)
for (int p = 0; p < players.Length; p++)
{
if (i < 1)
player[p].ProfileID = points[p].ProfileID;
player[p].Points += points[p].Points;
players[p].ProfileID = points[p].ProfileID;
players[p].Points += points[p].Points;
}
}
for (int p = 0; p < player.Length; p++)
player[p].Points = (int)Math.Round(player[p].Points / CGame.NumRounds);
for (int p = 0; p < players.Length; p++)
players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds);
}
for (int p = 0; p < player.Length; p++)
for (int p = 0; p < players.Length; p++)
{
string name = CProfiles.GetPlayerName(player[p].ProfileID, p);
string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
if (song != null && song.IsDuet)
{
if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1")
if (players[p].LineNr == 0 && song.DuetPart1 != "Part 1")
name += " (" + song.DuetPart1 + ")";
else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2")
else if (players[p].LineNr == 1 && song.DuetPart2 != "Part 2")
name += " (" + song.DuetPart2 + ")";
}
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name;
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
else
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000");
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000");
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
{
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString());
CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
}
else
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString());
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
{
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
}
else
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points)));
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
_StaticPointsBarDrawnPoints[p] = 0.0;
string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
@@ -331,19 +331,19 @@ namespace Vocaluxe.Screens
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
}
if (CProfiles.IsProfileIDValid(player[p].ProfileID))
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture;
if (CProfiles.IsProfileIDValid(players[p].ProfileID))
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[players[p].ProfileID].Avatar.Texture;
}
if (CConfig.ScoreAnimationTime < 1)
{
for (int p = 0; p < CGame.NumPlayer; p++)
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)players[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
_StaticPointsBarDrawnPoints[p] = player[p].Points;
_StaticPointsBarDrawnPoints[p] = players[p].Points;
}
}
+25 -24
View File
@@ -25,6 +25,7 @@ using System.IO;
using System.Linq;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
@@ -450,8 +451,6 @@ namespace Vocaluxe.Screens
{
if (_Active)
{
_UpdateMedleyCountdown();
if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
{
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
@@ -517,12 +516,15 @@ namespace Vocaluxe.Screens
_DrawLyricHelper();
if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY)
{
_UpdateMedleyCountdown();
_Texts[_TextMedleyCountdown].Draw();
}
if (_Pause)
{
_Statics[_StaticPauseBG].ForceDraw();
_Texts[_TextPause].ForceDraw();
_Statics[_StaticPauseBG].Draw(true);
_Texts[_TextPause].Draw(true);
foreach (CButton button in _Buttons)
button.Draw();
@@ -948,28 +950,27 @@ namespace Vocaluxe.Screens
private void _UpdateMedleyCountdown()
{
if (CGame.GetSong() != null)
CSong song = CGame.GetSong();
if (song == null)
return;
float timeToFirstMedleyNote = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) + song.Gap;
if (_CurrentTime < timeToFirstMedleyNote)
{
CSong song = CGame.GetSong();
float currentTime = _CurrentTime - song.Start;
float timeToFirstMedleyNote = (CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) + song.Gap - song.Start);
if (currentTime < timeToFirstMedleyNote && CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY)
{
float timeDiff = timeToFirstMedleyNote - currentTime + 1;
double t = timeDiff - Math.Truncate(timeDiff);
_Texts[_TextMedleyCountdown].Visible = true;
_Texts[_TextMedleyCountdown].Text = Math.Round((decimal)(timeDiff - t)).ToString();
float h = (float)(t * CSettings.RenderH);
float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width;
float x = CSettings.RenderW / 2 - w / 2;
float y = CSettings.RenderH / 2 - h / 2;
_Texts[_TextMedleyCountdown].X = x;
_Texts[_TextMedleyCountdown].Y = y;
_Texts[_TextMedleyCountdown].Height = h;
}
else
_Texts[_TextMedleyCountdown].Visible = false;
float timeDiff = timeToFirstMedleyNote - _CurrentTime + 1;
float fullSeconds = (float)Math.Truncate(timeDiff);
float partSeconds = timeDiff - fullSeconds;
_Texts[_TextMedleyCountdown].Visible = true;
_Texts[_TextMedleyCountdown].Text = fullSeconds.ToString();
float h = partSeconds * CSettings.RenderH;
float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width;
float x = CSettings.RenderW / 2 - w / 2;
float y = CSettings.RenderH / 2 - h / 2;
_Texts[_TextMedleyCountdown].X = x;
_Texts[_TextMedleyCountdown].Y = y;
_Texts[_TextMedleyCountdown].Height = h;
}
else
_Texts[_TextMedleyCountdown].Visible = false;
}
private void _DrawLyricHelper()
+53 -55
View File
@@ -213,7 +213,7 @@ namespace Vocaluxe.Screens
if (_Buttons[_ButtonStart].Selected)
_HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong());
}
if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
if (CSongs.NumSongsVisible > 0 && !_Sso.Selection.PartyMode)
{
if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
{
@@ -276,7 +276,7 @@ namespace Vocaluxe.Screens
break;
case Keys.S:
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode)
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumSongsVisible > 0 && !_Sso.Selection.PartyMode)
_StartMedleySong(_SongMenus[_SongMenu].GetSelectedSong());
break;
@@ -338,7 +338,9 @@ namespace Vocaluxe.Screens
else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected)
_HandleSelectButton();
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected)
_OpenPlaylistAction();
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selected)
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
_ToggleSongOptions(ESongOptionsView.Medley);
else if (_Buttons[_ButtonOptionsStartMedley].Selected)
@@ -440,7 +442,7 @@ namespace Vocaluxe.Screens
{
//TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button.
//E.g. clicking to fast on Select random song starts the next random song. is this OK?
if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
{
_ToggleSongOptions(ESongOptionsView.None);
_StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection());
@@ -515,7 +517,12 @@ namespace Vocaluxe.Screens
}
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected)
{
_OpenPlaylistAction();
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
return true;
}
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].ValueSelected)
{
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
return true;
}
else if (_Buttons[_ButtonOptionsRandomMedley].Selected)
@@ -551,7 +558,7 @@ namespace Vocaluxe.Screens
}
}
if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode)
if (CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode)
{
if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive)
{
@@ -565,7 +572,7 @@ namespace Vocaluxe.Screens
if (mouseEvent.LBH)
{
if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumSongsVisible > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1)
{
_DragAndDropCover = _SongMenus[_SongMenu].GetSelectedSongCover();
_DragAndDropCover.Rect.Z = CSettings.ZNear;
@@ -612,7 +619,7 @@ namespace Vocaluxe.Screens
_SearchActive = _Sso.Sorting.SearchActive;
_SearchText = _Sso.Sorting.SearchString;
CGame.EnterNormalGame();
CGame.Reset();
_SongMenus[_SongMenu].OnShow();
if (_Sso.Selection.PartyMode)
@@ -646,9 +653,9 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Disabled = false;
int song = _SongMenus[_SongMenu].GetActualSelection();
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length)
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Count)
_Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length)
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Count)
_Texts[_TextSelection].Text = CSongs.Categories[song].Name;
else
_Texts[_TextSelection].Text = String.Empty;
@@ -815,7 +822,7 @@ namespace Vocaluxe.Screens
private void _StartVisibleSong(int songNr)
{
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr)
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumSongsVisible > songNr)
{
EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
@@ -832,15 +839,12 @@ namespace Vocaluxe.Screens
{
if ((CSongs.Category >= 0) && (songNr >= 0))
{
EGameMode gm;
if (CSongs.VisibleSongs[songNr].Medley.Source != EMedleySource.None)
gm = EGameMode.TR_GAMEMODE_MEDLEY;
else
if (CSongs.VisibleSongs[songNr].Medley.Source == EMedleySource.None)
return;
CGame.Reset();
CGame.ClearSongs();
CGame.AddVisibleSong(songNr, gm);
CGame.AddVisibleSong(songNr, EGameMode.TR_GAMEMODE_MEDLEY);
CGraphics.FadeTo(EScreens.ScreenNames);
}
@@ -852,7 +856,7 @@ namespace Vocaluxe.Screens
CGame.ClearSongs();
List<int> ids = new List<int>();
for (int i = 0; i < CSongs.AllSongs.Length; i++)
for (int i = 0; i < CSongs.AllSongs.Count; i++)
ids.Add(i);
while (ids.Count > 0)
@@ -878,7 +882,7 @@ namespace Vocaluxe.Screens
CGame.ClearSongs();
List<int> ids = new List<int>();
for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
ids.Add(CSongs.VisibleSongs[i].ID);
while (ids.Count > 0)
@@ -906,12 +910,12 @@ namespace Vocaluxe.Screens
List<int> ids = new List<int>();
if (allSongs)
{
for (int i = 0; i < CSongs.AllSongs.Length; i++)
for (int i = 0; i < CSongs.AllSongs.Count; i++)
ids.Add(i);
}
else
{
for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
ids.Add(CSongs.VisibleSongs[i].ID);
}
int s = 0;
@@ -981,6 +985,21 @@ namespace Vocaluxe.Screens
return false;
}
private int _FindIndex<T>(IList<T> list, int start, Predicate<T> match)
{
for (int i = start; i < list.Count; i++)
{
if (match(list[i]))
return i;
}
for (int i = 0; i < start; i++)
{
if (match(list[i]))
return i;
}
return -1;
}
private void _JumpTo(char letter)
{
int start = 0;
@@ -988,29 +1007,21 @@ namespace Vocaluxe.Screens
if (CSongs.IsInCategory)
{
//TODO: Check and use sorting method
CSong[] songs = CSongs.VisibleSongs;
int ct = songs.Length;
if (curSelected >= 0 && curSelected < ct - 1)
{
CSong currentSong = CSongs.GetVisibleSongByIndex(curSelected);
if (currentSong != null && currentSong.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
start = curSelected + 1;
}
int visibleID = Array.FindIndex(songs, start, ct - start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID < 0 && start > 1)
visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
var songs = CSongs.VisibleSongs;
int ct = songs.Count;
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
start = curSelected + 1;
int visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
_SongMenus[_SongMenu].SetSelectedSong(visibleID);
}
else
{
CCategory[] categories = CSongs.Categories;
int ct = categories.Length;
var categories = CSongs.Categories;
int ct = categories.Count;
if (curSelected >= 0 && curSelected < ct - 1 && categories[curSelected].Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
start = curSelected + 1;
int visibleID = Array.FindIndex(categories, start, ct - start, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID < 0 && start > 1)
visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
int visibleID = _FindIndex(categories, start, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
if (visibleID > -1)
_SongMenus[_SongMenu].SetSelectedCategory(visibleID);
}
@@ -1026,7 +1037,7 @@ namespace Vocaluxe.Screens
int songIndex = _SongMenus[_SongMenu].GetSelectedSong();
int songID = -1;
if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex)
if (songIndex != -1 && CSongs.NumSongsVisible > 0 && CSongs.NumSongsVisible > songIndex)
songID = CSongs.VisibleSongs[songIndex].ID;
if (newFilterString == "" && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
@@ -1043,7 +1054,7 @@ namespace Vocaluxe.Screens
CSongs.Sort(_Sso.Sorting.SongSorting, _Sso.Sorting.Tabs, _Sso.Sorting.IgnoreArticles, newFilterString, _Sso.Sorting.DuetOptions);
if (songID == -1 || CSongs.NumVisibleSongs == 0 || CSongs.NumVisibleSongs <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID)
if (songID == -1 || CSongs.NumSongsVisible == 0 || CSongs.NumSongsVisible <= songIndex || CSongs.GetVisibleSongByIndex(songIndex).ID != songID)
refresh = true;
if (refresh)
@@ -1097,7 +1108,6 @@ namespace Vocaluxe.Screens
EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL;
if (_AvailableGameModes.Count > 0)
lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
_SetInteractionToButton(_Buttons[_ButtonOptionsSing]);
_AvailableGameModes.Clear();
_SelectSlides[_SelectSlideOptionsMode].Clear();
if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet)
@@ -1159,12 +1169,12 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear();
if (CSongs.IsInCategory)
{
for (int i = 1; i <= CSongs.VisibleSongs.Length; i++)
for (int i = 1; i <= CSongs.VisibleSongs.Count; i++)
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
}
else
{
for (int i = 1; i <= CSongs.AllSongs.Length; i++)
for (int i = 1; i <= CSongs.AllSongs.Count; i++)
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
}
if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5)
@@ -1183,11 +1193,12 @@ namespace Vocaluxe.Screens
private void _OpenPlaylist(int playlistID)
{
if (CPlaylists.Playlists.Length > playlistID && playlistID > -1)
if (CPlaylists.Playlists.Length > playlistID && playlistID >= 0)
{
_Playlists[_Playlist].LoadPlaylist(playlistID);
_SongMenus[_SongMenu].SetSmallView(true);
_Playlists[_Playlist].Visible = true;
_SetSelectSlidePlaylistToCurrentPlaylist();
}
}
@@ -1212,19 +1223,6 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames);
}
private void _OpenPlaylistAction()
{
//Open a playlist
if (_Playlists[_Playlist].ActivePlaylistID != _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection)
{
_Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection;
_SetSelectSlidePlaylistToCurrentPlaylist();
//Open playlist
_OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID);
}
}
private void _OpenAndAddPlaylistAction()
{
//Open an existing playlist and add song
+179
View File
@@ -0,0 +1,179 @@
#region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Collections.Generic;
using Vocaluxe.Base;
using Vocaluxe.GameModes;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.SongQueue
{
struct SSongQueueEntry
{
public readonly int SongID;
public readonly EGameMode GameMode;
public SSongQueueEntry(int songID, EGameMode gameMode)
{
SongID = songID;
GameMode = gameMode;
}
}
class CSongQueue : ISongQueue
{
private List<SSongQueueEntry> _SongQueue;
private int _CurrentSong;
private CPoints _Points;
#region Implementation
public void Init()
{
_SongQueue = new List<SSongQueueEntry>();
Reset();
CGameModes.Init();
}
public EGameMode GetCurrentGameMode()
{
if (_CurrentSong >= 0 && _CurrentSong < _SongQueue.Count)
return _SongQueue[_CurrentSong].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
}
public bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
{
return CSongs.VisibleSongs.Count > visibleIndex && _AddSong(CSongs.VisibleSongs[visibleIndex].ID, gameMode);
}
public bool AddSong(int absoluteIndex, EGameMode gameMode)
{
return CSongs.AllSongs.Count > absoluteIndex && _AddSong(CSongs.AllSongs[absoluteIndex].ID, gameMode);
}
private bool _AddSong(int songID, EGameMode gameMode)
{
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
return false;
_SongQueue.Add(new SSongQueueEntry(songID, gameMode));
return true;
}
public bool RemoveVisibleSong(int visibleIndex)
{
return CSongs.VisibleSongs.Count > visibleIndex && _RemoveSong(CSongs.VisibleSongs[visibleIndex].ID);
}
public bool RemoveSong(int absoluteIndex)
{
return CSongs.AllSongs.Count > absoluteIndex && _RemoveSong(CSongs.AllSongs[absoluteIndex].ID);
}
private bool _RemoveSong(int songID)
{
for (int i = 0; i < _SongQueue.Count; i++)
{
if (_SongQueue[i].SongID != songID)
continue;
_SongQueue.RemoveAt(i);
return true;
}
return false;
}
public void ClearSongs()
{
_SongQueue.Clear();
}
public void Reset()
{
_CurrentSong = -1;
}
public void Start(SPlayer[] players)
{
_Points = new CPoints(_SongQueue.Count, players);
}
public void NextRound(SPlayer[] players)
{
if (_CurrentSong < _SongQueue.Count && _SongQueue.Count > 0)
{
if (_CurrentSong > -1)
{
_Points.SetPoints(
_CurrentSong,
_SongQueue[_CurrentSong].SongID,
players,
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY,
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET,
_SongQueue[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG);
}
_CurrentSong++;
}
}
public bool IsFinished()
{
return _CurrentSong == _SongQueue.Count || _SongQueue.Count == 0;
}
public int GetCurrentRoundNr()
{
return _CurrentSong + 1;
}
public CSong GetSong()
{
if (_CurrentSong >= 0 && _CurrentSong < _SongQueue.Count)
return CGameModes.Get(_SongQueue[_CurrentSong].GameMode).GetSong(_SongQueue[_CurrentSong].SongID);
return null;
}
public int GetNumSongs()
{
return _SongQueue.Count;
}
public CSong GetSong(int num)
{
if (num - 1 < _SongQueue.Count && num > 0)
return CSongs.GetSong(_SongQueue[num - 1].SongID);
return null;
}
public EGameMode GetGameMode(int num)
{
if (num - 1 < _SongQueue.Count && num > 0)
return _SongQueue[num - 1].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
}
public CPoints GetPoints()
{
return _Points;
}
#endregion Implementation
}
}
@@ -17,8 +17,34 @@
// */
#endregion
namespace Vocaluxe.GameModes
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.SongQueue
{
// Nomal singing
class CGameModeNormal : CGameMode {}
interface ISongQueue
{
void Init();
EGameMode GetCurrentGameMode();
bool AddVisibleSong(int visibleIndex, EGameMode gameMode);
bool AddSong(int absoluteIndex, EGameMode gameMode);
bool RemoveVisibleSong(int visibleIndex);
bool RemoveSong(int absoluteIndex);
void ClearSongs();
void Reset();
void Start(SPlayer[] players);
void NextRound(SPlayer[] players);
bool IsFinished();
int GetCurrentRoundNr();
CPoints GetPoints();
int GetNumSongs();
CSong GetSong();
CSong GetSong(int num);
EGameMode GetGameMode(int num);
}
}
+6 -2
View File
@@ -176,7 +176,7 @@
<Compile Include="Base\CCover.cs" />
<Compile Include="Base\CDataBase.cs" />
<Compile Include="Base\CDraw.cs" />
<Compile Include="Base\CFont.cs" />
<Compile Include="Base\Font\CFont.cs" />
<Compile Include="Base\CGame.cs" />
<Compile Include="Base\CInput.cs" />
<Compile Include="Base\CLanguage.cs" />
@@ -195,12 +195,16 @@
<Compile Include="Base\CTheme.cs" />
<Compile Include="Base\CVideo.cs" />
<Compile Include="Base\CWebcam.cs" />
<Compile Include="Base\Font\CFonts.cs" />
<Compile Include="Base\Font\CGlyph.cs" />
<Compile Include="CSplashScreen.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GameModes\CGameMode.cs" />
<Compile Include="GameModes\CGameModeNormal.cs" />
<Compile Include="GameModes\CGameModes.cs" />
<Compile Include="SongQueue\CSongQueue.cs" />
<Compile Include="GameModes\IGameMode.cs" />
<Compile Include="SongQueue\ISongQueue.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Lib\Draw\CDirect3D.cs">
<SubType>Form</SubType>
+14 -14
View File
@@ -80,23 +80,23 @@ namespace VocaluxeLib.Menu
if (round >= NumRounds)
return new SPlayer[1];
SPlayer[] player = new SPlayer[numPlayer];
SPlayer[] players = new SPlayer[numPlayer];
for (int p = 0; p < player.Length; p++)
for (int p = 0; p < players.Length; p++)
{
player[p].Points = _Rounds[round, p].Points;
player[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
player[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
player[p].SongID = _Rounds[round, p].SongID;
player[p].LineNr = _Rounds[round, p].LineNr;
player[p].Medley = _Rounds[round, p].Medley;
player[p].Duet = _Rounds[round, p].Duet;
player[p].ShortSong = _Rounds[round, p].ShortSong;
player[p].DateTicks = _Rounds[round, p].DateTicks;
player[p].SongFinished = _Rounds[round, p].SongFinished;
player[p].ProfileID = _Rounds[round, p].ProfileID;
players[p].Points = _Rounds[round, p].Points;
players[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
players[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
players[p].SongID = _Rounds[round, p].SongID;
players[p].LineNr = _Rounds[round, p].LineNr;
players[p].Medley = _Rounds[round, p].Medley;
players[p].Duet = _Rounds[round, p].Duet;
players[p].ShortSong = _Rounds[round, p].ShortSong;
players[p].DateTicks = _Rounds[round, p].DateTicks;
players[p].SongFinished = _Rounds[round, p].SongFinished;
players[p].ProfileID = _Rounds[round, p].ProfileID;
}
return player;
return players;
}
}
}
+5 -10
View File
@@ -221,27 +221,22 @@ namespace VocaluxeLib.Menu
return false;
}
public void Draw()
public void Draw(bool forceDraw = false)
{
Draw(1f, Rect.Z, Aspect, false);
Draw(1f, Rect.Z, Aspect, forceDraw);
}
public void Draw(EAspect aspect)
{
Draw(1f, Rect.Z, aspect, false);
Draw(1f, Rect.Z, aspect);
}
public void Draw(float scale, EAspect aspect)
{
Draw(scale, Rect.Z, aspect, false);
Draw(scale, Rect.Z, aspect);
}
public void ForceDraw()
{
Draw(1f, Rect.Z, Aspect, true);
}
public void Draw(float scale, float z, EAspect aspect, bool forceDraw)
public void Draw(float scale, float z, EAspect aspect, bool forceDraw = false)
{
STexture texture = _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
-5
View File
@@ -601,11 +601,6 @@ namespace VocaluxeLib.Menu
return false;
}
public void ForceDraw()
{
Draw(true);
}
public void Draw(bool forceDraw = false)
{
if (!forceDraw && !Visible && CBase.Settings.GetGameState() != EGameState.EditTheme)
+4 -5
View File
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.PartyModes;
@@ -240,7 +241,7 @@ namespace VocaluxeLib.Menu
public interface ISongs
{
int GetNumSongs();
int GetNumVisibleSongs();
int GetNumSongsVisible();
int GetNumCategories();
int NumSongsInCategory(int categoryIndex);
@@ -253,13 +254,11 @@ namespace VocaluxeLib.Menu
CSong GetVisibleSong(int visibleIndex);
CSong GetSongByID(int songID);
CSong[] GetSongs();
CSong[] GetSongsNotSung();
ReadOnlyCollection<CSong> GetVisibleSongs();
CCategory GetCategory(int index);
void AddPartySongSung(int songID);
void ResetPartySongSung();
void ResetPartySongSung(int catIndex);
void ResetSongSung(int catIndex = -1);
void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions);
+1
View File
@@ -423,6 +423,7 @@ namespace VocaluxeLib.Menu.SingNotes
return _PerfectLine;
}
//Find last note with StartBeat<=Beat
public int FindPreviousNote(int beat)
{
//If no notes -> No previous note
+20 -82
View File
@@ -26,6 +26,19 @@ using VocaluxeLib.Menu.SingNotes;
namespace VocaluxeLib.Menu.SongMenu
{
public class CSongPointer
{
public readonly int SongID;
public string SortString;
public bool IsSung;
public CSongPointer(int id, string sortString)
{
SongID = id;
SortString = sortString;
}
}
[Flags]
enum EHeaderFlags
{
@@ -40,58 +53,11 @@ namespace VocaluxeLib.Menu.SongMenu
public enum EMedleySource
{
None,
None = 0,
Calculated,
Tag
}
public class CCategory
{
public readonly string Name;
private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1);
private bool _CoverBigLoaded;
public CCategory(string name)
{
Name = name;
}
public STexture CoverTextureSmall
{
get { return _CoverTextureSmall; }
set { _CoverTextureSmall = value; }
}
public STexture CoverTextureBig
{
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
set
{
if (value.Index != -1)
{
_CoverTextureBig = value;
_CoverBigLoaded = true;
}
}
}
public CCategory(string name, STexture coverSmall, STexture coverBig)
{
Name = name;
CoverTextureSmall = coverSmall;
CoverTextureBig = coverBig;
}
public CCategory(CCategory cat)
{
Name = cat.Name;
CoverTextureSmall = cat.CoverTextureSmall;
CoverTextureBig = cat.CoverTextureBig;
}
}
public struct SMedley
{
public EMedleySource Source;
@@ -99,28 +65,16 @@ namespace VocaluxeLib.Menu.SongMenu
public int EndBeat;
public float FadeInTime;
public float FadeOutTime;
// ReSharper disable UnusedParameter.Local
public SMedley(int dummy)
// ReSharper restore UnusedParameter.Local
{
Source = EMedleySource.None;
StartBeat = 0;
EndBeat = 0;
FadeInTime = 0f;
FadeOutTime = 0f;
}
}
public class CSong
{
private bool _CoverSmallLoaded;
private bool _CoverBigLoaded;
private bool _NotesLoaded;
private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1);
public SMedley Medley = new SMedley(0);
public SMedley Medley;
public bool CalculateMedley = true;
public float PreviewStart;
@@ -140,18 +94,7 @@ namespace VocaluxeLib.Menu.SongMenu
public EAspect VideoAspect = EAspect.Crop;
public bool CoverSmallLoaded
{
get { return _CoverSmallLoaded; }
}
public bool CoverBigLoaded
{
get { return _CoverBigLoaded; }
}
public bool NotesLoaded
{
get { return _NotesLoaded; }
}
public bool NotesLoaded { get; private set; }
public STexture CoverTextureSmall
{
@@ -171,12 +114,7 @@ namespace VocaluxeLib.Menu.SongMenu
public STexture CoverTextureBig
{
get
{
if (_CoverBigLoaded)
return _CoverTextureBig;
return _CoverTextureSmall;
}
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
set
{
_CoverTextureBig = value;
@@ -278,7 +216,7 @@ namespace VocaluxeLib.Menu.SongMenu
VideoAspect = song.VideoAspect;
_CoverSmallLoaded = song._CoverSmallLoaded;
_CoverBigLoaded = song._CoverBigLoaded;
_NotesLoaded = song._NotesLoaded;
NotesLoaded = song.NotesLoaded;
Artist = song.Artist;
Title = song.Title;
@@ -619,7 +557,7 @@ namespace VocaluxeLib.Menu.SongMenu
private bool _ReadNotes(string filePath, bool forceReload = false)
{
//Skip loading if already done and no reload is forced
if (_NotesLoaded && !forceReload)
if (NotesLoaded && !forceReload)
return true;
if (!File.Exists(filePath))
@@ -784,7 +722,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
_FindRefrain();
_FindShortEnd();
_NotesLoaded = true;
NotesLoaded = true;
if (IsDuet)
_CheckDuet();
}
-6
View File
@@ -35,12 +35,6 @@ namespace VocaluxeLib.Menu.SongMenu
_CreateSongMenu();
}
public void UpdateSongMenuType()
{
if (_Type != CBase.Config.GetSongMenuType())
_CreateSongMenu();
}
public bool Selected
{
get { return _SongMenu.IsSelected(); }
@@ -252,8 +252,6 @@ namespace VocaluxeLib.Menu.SongMenu
StaticMedleyTagIcon = new CStatic(_PartyModeID)
}
};
_ThemeLoaded = false;
}
public string GetThemeName()
@@ -598,7 +596,7 @@ namespace VocaluxeLib.Menu.SongMenu
protected void _SelectSong(int nr)
{
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
{
_Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f));
_Streams.Clear();
@@ -609,7 +607,7 @@ namespace VocaluxeLib.Menu.SongMenu
CBase.Drawing.RemoveTexture(ref _Vidtex);
_Actsong = nr;
if (_Actsong >= CBase.Songs.GetNumVisibleSongs())
if (_Actsong >= CBase.Songs.GetNumSongsVisible())
_Actsong = 0;
@@ -138,7 +138,6 @@ namespace VocaluxeLib.Menu.SongMenu
//AfterCategoryChange();
SetSelectedSong(_ActSong);
_AfterCategoryChange();
CBase.Songs.UpdateRandomSongList();
int actcat = _PreviewSelected;
if ((CBase.Songs.GetNumCategories() > 0) && (actcat < 0))
@@ -155,7 +154,7 @@ namespace VocaluxeLib.Menu.SongMenu
_MedleyTagIcon.Visible = false;
}
if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != "")
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
{
_CoverBig.Texture = _CoverBigTexture;
_Artist.Text = String.Empty;
@@ -253,7 +252,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
else
{
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !songOptions.Selection.RandomOnly)
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumSongsVisible() - 1 && !songOptions.Selection.RandomOnly)
{
_Locked++;
_UpdateList();
@@ -291,7 +290,7 @@ namespace VocaluxeLib.Menu.SongMenu
_UpdateList();
}
}
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !songOptions.Selection.RandomOnly)
else if (_Locked < CBase.Songs.GetNumSongsVisible() - _NumW && !songOptions.Selection.RandomOnly)
{
_Locked += _NumW;
_UpdateList();
@@ -403,7 +402,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (CBase.Songs.GetCurrentCategoryIndex() >= 0)
{
int actsong = _PreviewSelected;
if ((CBase.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
if ((CBase.Songs.GetNumSongsVisible() > actsong) && (actsong >= 0))
{
CSong song = CBase.Songs.GetVisibleSong(actsong);
@@ -529,7 +528,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
base.SetSelectedSong(visibleSongNr);
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumVisibleSongs())
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible())
_SetSelectedTile(visibleSongNr);
}
@@ -592,11 +591,11 @@ namespace VocaluxeLib.Menu.SongMenu
if (_ActualSelection >= 0 && _ActualSelection < _Tiles.Count)
_Tiles[_ActualSelection].Selected = true;
if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
if ((_LastKnownNumSongs == CBase.Songs.GetNumSongsVisible()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
return;
_LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex();
_LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs();
_LastKnownNumSongs = CBase.Songs.GetNumSongsVisible();
_UpdateList(0, true);
CBase.Songs.UpdateRandomSongList();
}
@@ -609,7 +608,7 @@ namespace VocaluxeLib.Menu.SongMenu
private void _UpdateList(int offset, bool force = false)
{
bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0;
int itemCount = isInCategory ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories();
int itemCount = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
if (offset >= (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1)))
offset = (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1));
+1
View File
@@ -137,6 +137,7 @@
<Compile Include="Menu\SingNotes\CNotes.cs" />
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
<Compile Include="Menu\SongMenu\CCategory.cs" />
<Compile Include="Menu\SongMenu\CSong.cs" />
<Compile Include="Menu\SongMenu\CSongMenu.cs" />
<Compile Include="Menu\SongMenu\CSongMenuBook.cs" />