Make CSingNotes also implement Draw()

Also a bit refactoring
This commit is contained in:
Flamefire committed 2014-10-22 22:00:25 +02:00
1 parent 6bf8a5d64c
commit 2f99cd2560
17 files changed
+489 -697

No files matched your search

+5 -5
View File
@@ -134,7 +134,7 @@ namespace Vocaluxe.Base
public static EOffOn IgnoreArticles = EOffOn.TR_CONFIG_ON;
public static float ScoreAnimationTime = 10;
public static ETimerMode TimerMode = ETimerMode.TR_CONFIG_TIMERMODE_REMAINING;
public static int NumPlayer = 2;
public static int NumPlayers = 2;
public static EOffOn Tabs = EOffOn.TR_CONFIG_OFF;
public static string Language = CSettings.FallbackLanguage;
public static ELyricsPosition LyricsPosition = ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM;
@@ -289,7 +289,7 @@ namespace Vocaluxe.Base
xmlReader.TryGetEnumValue("//root/Game/IgnoreArticles", ref IgnoreArticles);
xmlReader.TryGetFloatValue("//root/Game/ScoreAnimationTime", ref ScoreAnimationTime);
xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode);
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer);
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayers);
xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs);
xmlReader.GetValue("//root/Game/Language", out Language, Language);
xmlReader.TryGetEnumValue("//root/Game/LyricsPosition", ref LyricsPosition);
@@ -301,8 +301,8 @@ namespace Vocaluxe.Base
if (MinLineBreakTime < 0)
MinLineBreakTime = 0.1f;
if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer)
NumPlayer = 2;
if (NumPlayers < 1 || NumPlayers > CSettings.MaxNumPlayer)
NumPlayers = 2;
bool langExists = CLanguage.SetLanguage(Language);
@@ -534,7 +534,7 @@ namespace Vocaluxe.Base
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer);
writer.WriteElementString("NumPlayer", NumPlayer.ToString());
writer.WriteElementString("NumPlayer", NumPlayers.ToString());
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
+7 -7
View File
@@ -30,7 +30,7 @@ namespace Vocaluxe.Base
static class CGame
{
private static ISongQueue _SongQueue;
private static int _NumPlayer = CConfig.NumPlayer;
private static int _NumPlayers = CConfig.NumPlayers;
/// <summary>
/// Last beat that has been evaluated
@@ -177,13 +177,13 @@ namespace Vocaluxe.Base
get { return _SongQueue.GetNumSongs(); }
}
public static int NumPlayer
public static int NumPlayers
{
get { return _NumPlayer; }
get { return _NumPlayers; }
set
{
if (value > 0 && value <= CSettings.MaxNumPlayer)
_NumPlayer = value;
_NumPlayers = value;
}
}
@@ -224,13 +224,13 @@ namespace Vocaluxe.Base
MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f);
for (int p = 0; p < _NumPlayer; p++)
for (int p = 0; p < _NumPlayers; p++)
CRecord.AnalyzeBuffer(p);
if (_LastEvalBeat >= RecordedBeat)
return;
for (int p = 0; p < _NumPlayer; p++)
for (int p = 0; p < _NumPlayers; p++)
{
for (int beat = _LastEvalBeat + 1; beat <= RecordedBeat; beat++)
{
@@ -377,7 +377,7 @@ namespace Vocaluxe.Base
CurrentBeatF = GetBeatFromTime(time, GetSong().BPM, GetSong().Gap);
for (int p = 0; p < _NumPlayer; p++)
for (int p = 0; p < _NumPlayers; p++)
{
Players[p].Points = 0;
Players[p].PointsGoldenNotes = 0;
+4 -4
View File
@@ -531,12 +531,12 @@ namespace Vocaluxe.Base
{
public int GetNumPlayer()
{
return CGame.NumPlayer;
return CGame.NumPlayers;
}
public void SetNumPlayer(int numPlayer)
{
CGame.NumPlayer = numPlayer;
CGame.NumPlayers = numPlayer;
}
public SPlayer[] GetPlayers()
@@ -655,9 +655,9 @@ namespace Vocaluxe.Base
class CBrecord : IRecording
{
public int GetToneAbs(int playerNr)
public int GetToneAbs(int player)
{
return CRecord.GetToneAbs(playerNr);
return CRecord.GetToneAbs(player);
}
}
+1 -1
View File
@@ -215,7 +215,7 @@ namespace Vocaluxe.Screens
for (int round = 0; round < points.NumRounds; round++)
{
SPlayer[] players = points.GetPlayer(round, CGame.NumPlayer);
SPlayer[] players = points.GetPlayer(round, CGame.NumPlayers);
for (int p = 0; p < players.Length; p++)
{
+23 -23
View File
@@ -125,9 +125,9 @@ namespace Vocaluxe.Screens
switch (keyEvent.Key)
{
case Keys.Add:
if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer)
if (CConfig.NumPlayers + 1 <= CSettings.MaxNumPlayer)
{
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer;
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers;
_UpdatePlayerNumber();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
@@ -135,9 +135,9 @@ namespace Vocaluxe.Screens
break;
case Keys.Subtract:
if (CConfig.NumPlayer - 1 > 0)
if (CConfig.NumPlayers - 1 > 0)
{
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2;
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers - 2;
_UpdatePlayerNumber();
//Update Tiles-List
_NameSelections[_NameSelection].UpdateList();
@@ -153,7 +153,7 @@ namespace Vocaluxe.Screens
}
else
{
if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayer)
if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayers)
_SelectingFastPlayerNr++;
else
_SelectingFastPlayerNr = 1;
@@ -186,7 +186,7 @@ namespace Vocaluxe.Screens
//Started selecting with 'P'
if (_SelectingFast)
{
if (_SelectingFastPlayerNr == CGame.NumPlayer)
if (_SelectingFastPlayerNr == CGame.NumPlayers)
resetSelection = true;
else
{
@@ -261,7 +261,7 @@ namespace Vocaluxe.Screens
_SelectingKeyboardActive = false;
_NameSelections[_NameSelection].FastSelection(false, -1);
}
else if (numberPressed <= CConfig.NumPlayer)
else if (numberPressed <= CConfig.NumPlayers)
{
_SelectingFastPlayerNr = numberPressed;
_NameSelections[_NameSelection].FastSelection(true, numberPressed);
@@ -324,7 +324,7 @@ namespace Vocaluxe.Screens
}
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.NumPlayer)
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.NumPlayers)
{
_SelectingKeyboardActive = true;
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
@@ -367,7 +367,7 @@ namespace Vocaluxe.Screens
}
else
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
{
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{
@@ -442,7 +442,7 @@ namespace Vocaluxe.Screens
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
_SelectingFastPlayerNr++;
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
if (_SelectingFastPlayerNr <= CGame.NumPlayers)
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
else
stopSelectingFast = true;
@@ -468,7 +468,7 @@ namespace Vocaluxe.Screens
_SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
if (_SelectedProfileID > -1)
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
{
if (CGame.Players[i].ProfileID == -1)
{
@@ -488,7 +488,7 @@ namespace Vocaluxe.Screens
{
bool exit = true;
//Remove profile-selection
for (int i = 0; i < CConfig.NumPlayer; i++)
for (int i = 0; i < CConfig.NumPlayers; i++)
{
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{
@@ -503,7 +503,7 @@ namespace Vocaluxe.Screens
if (mouseEvent.MB && _SelectingFast)
{
_SelectingFastPlayerNr++;
if (_SelectingFastPlayerNr <= CGame.NumPlayer)
if (_SelectingFastPlayerNr <= CGame.NumPlayers)
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
else
stopSelectingFast = true;
@@ -542,7 +542,7 @@ namespace Vocaluxe.Screens
if (_ProfilesChanged || _AvatarsChanged)
_LoadProfiles();
for (int i = 1; i <= CGame.NumPlayer; i++)
for (int i = 1; i <= CGame.NumPlayers; i++)
{
CRecord.AnalyzeBuffer(i - 1);
_Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1));
@@ -598,7 +598,7 @@ namespace Vocaluxe.Screens
if (CGame.GetNumSongs() == 1 && firstSong.IsDuet)
{
_SelectSlides[_SelectSlideDuetPlayer[i]].Clear();
_SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayer;
_SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayers;
for (int j = 0; j < firstSong.Notes.VoiceCount; j++)
_SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(firstSong.Notes.VoiceNames[j]);
@@ -616,7 +616,7 @@ namespace Vocaluxe.Screens
{
if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet)
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
CGame.Players[i].VoiceNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection;
}
CGraphics.FadeTo(EScreens.ScreenSing);
@@ -627,16 +627,16 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlidePlayerNumber].Clear();
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
_SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER"));
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1;
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers - 1;
}
private void _UpdatePlayerNumber()
{
CConfig.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
CGame.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
CConfig.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{
if (i <= CGame.NumPlayer)
if (i <= CGame.NumPlayers)
{
_Statics["StaticPlayer" + i].Visible = true;
_Statics["StaticPlayerAvatar" + i].Visible = true;
@@ -681,7 +681,7 @@ namespace Vocaluxe.Screens
private void _ResetPlayerSelections()
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
{
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID);
CGame.Players[i].ProfileID = -1;
@@ -714,7 +714,7 @@ namespace Vocaluxe.Screens
private void _CheckMics()
{
var playerWithoutMicro = new List<int>();
for (int player = 0; player < CConfig.NumPlayer; player++)
for (int player = 0; player < CConfig.NumPlayers; player++)
{
if (!CConfig.IsMicConfig(player + 1))
playerWithoutMicro.Add(player + 1);
@@ -752,7 +752,7 @@ namespace Vocaluxe.Screens
private void _CheckPlayers()
{
var playerWithoutProfile = new List<int>();
for (int player = 0; player < CConfig.NumPlayer; player++)
for (int player = 0; player < CConfig.NumPlayers; player++)
{
if (CGame.Players[player].ProfileID < 0)
playerWithoutProfile.Add(player + 1);
+47 -47
View File
@@ -139,14 +139,14 @@ namespace Vocaluxe.Screens
public override bool UpdateGame()
{
var players = new SPlayer[CGame.NumPlayer];
var players = new SPlayer[CGame.NumPlayers];
if (_Round >= 0)
players = _Points.GetPlayer(_Round, CGame.NumPlayer);
players = _Points.GetPlayer(_Round, CGame.NumPlayers);
else
{
for (int i = 0; i < CGame.NumRounds; i++)
{
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers);
for (int p = 0; p < players.Length; p++)
players[p].Points += points[p].Points;
}
@@ -167,16 +167,16 @@ namespace Vocaluxe.Screens
var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical")
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore);
}
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H;
}
}
}
@@ -266,7 +266,7 @@ namespace Vocaluxe.Screens
private void _UpdateRatings()
{
CSong song = null;
var players = new SPlayer[CGame.NumPlayer];
var players = new SPlayer[CGame.NumPlayers];
if (_Round >= 0)
{
song = CGame.GetSong(_Round);
@@ -276,14 +276,14 @@ namespace Vocaluxe.Screens
_Texts[_TextSong].Text = song.Artist + " - " + song.Title;
if (_Points.NumRounds > 1)
_Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")";
players = _Points.GetPlayer(_Round, CGame.NumPlayer);
players = _Points.GetPlayer(_Round, CGame.NumPlayers);
}
else
{
_Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE";
for (int i = 0; i < CGame.NumRounds; i++)
{
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer);
SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers);
for (int p = 0; p < players.Length; p++)
{
if (i < 1)
@@ -304,57 +304,57 @@ namespace Vocaluxe.Screens
if (song.Notes.VoiceNames.IsSet(players[p].VoiceNr))
name += " (" + song.Notes.VoiceNames[players[p].VoiceNr] + ")";
}
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name;
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Text = name;
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
_Texts[_TextScores[p, CGame.NumPlayers - 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(players[p].Points)).ToString("0000");
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000");
if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
{
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
_Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
}
else
_Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
_Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
{
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
_Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
}
else
_Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
_Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
_StaticPointsBarDrawnPoints[p] = 0.0;
if (pointAnimDirection.ToLower() == "vertical")
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = 0;
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = 0;
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H;
}
if (CProfiles.IsProfileIDValid(players[p].ProfileID))
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
_Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
}
if (CConfig.ScoreAnimationTime < 1)
{
for (int p = 0; p < CGame.NumPlayer; p++)
for (int p = 0; p < CGame.NumPlayers; p++)
{
if (pointAnimDirection.ToLower() == "vertical")
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].W = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].W / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore);
}
else
{
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].H;
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)players[p].Points) *
(_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore);
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H +
_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H;
}
_StaticPointsBarDrawnPoints[p] = players[p].Points;
}
@@ -372,13 +372,13 @@ namespace Vocaluxe.Screens
{
if (player <= numplayer)
{
_Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer;
_Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers;
_Statics[_StaticAvatar[player, numplayer]].Texture = null;
}
@@ -398,7 +398,7 @@ namespace Vocaluxe.Screens
{
for (int round = 0; round < _Points.NumRounds; round++)
{
SPlayer[] players = _Points.GetPlayer(round, CGame.NumPlayer);
SPlayer[] players = _Points.GetPlayer(round, CGame.NumPlayers);
for (int p = 0; p < players.Length; p++)
{
+30 -46
View File
@@ -24,10 +24,10 @@ using System.Linq;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Fonts;
using Vocaluxe.Base.ThemeSystem;
using VocaluxeLib;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Songs;
namespace Vocaluxe.Screens
@@ -111,8 +111,6 @@ namespace Vocaluxe.Screens
private float _TimeToFirstNoteDuet;
private float _RemainingTimeToFirstNoteDuet;
private readonly int[] _NoteLines = new int[CSettings.MaxNumPlayer];
private Stopwatch _TimerSongText;
private Stopwatch _TimerDuetText1;
private Stopwatch _TimerDuetText2;
@@ -343,20 +341,20 @@ namespace Vocaluxe.Screens
_Statics[_StaticLyricHelper].Alpha = alpha[0];
_Statics[_StaticLyricHelperTop].Alpha = alpha[0];
for (int p = 0; p < CGame.NumPlayer; p++)
for (int p = 0; p < CGame.NumPlayers; p++)
{
_SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Players[p].VoiceNr * 2]);
_SingNotes[_SingBars].PlayerNotes[p].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
}
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{
_Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
}
}
@@ -377,10 +375,10 @@ namespace Vocaluxe.Screens
}
for (int p = 0; p < CGame.NumPlayer; p++)
for (int p = 0; p < CGame.NumPlayers; p++)
{
string fmtString = (CGame.Players[p].Points < 10000) ? "0000" : "00000";
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString(fmtString);
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = CGame.Players[p].Points.ToString(fmtString);
}
if (_CurrentVideo != null && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON)
@@ -410,15 +408,13 @@ namespace Vocaluxe.Screens
_TimeRects.Clear();
_SingNotes[_SingBars].Reset();
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
_NoteLines[i] = -1;
_SingNotes[_SingBars].Init(0);
foreach (CLyric lyric in _Lyrics)
lyric.LyricStyle = CConfig.LyricStyle;
for (int p = 0; p < CGame.NumPlayer; p++)
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop;
for (int p = 0; p < CGame.NumPlayers; p++)
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop;
_SetVisibility();
_UpdateAvatars();
@@ -478,9 +474,6 @@ namespace Vocaluxe.Screens
break;
}
for (int i = 0; i < CGame.NumPlayer; i++)
_SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i);
_DrawLyricHelper();
}
@@ -554,7 +547,7 @@ namespace Vocaluxe.Screens
_TimeToFirstNote = 0f;
_TimeToFirstNoteDuet = 0f;
_Length = -1f;
var voiceAssignments = new int[CGame.NumPlayer];
var voiceAssignments = new int[CGame.NumPlayers];
if (song.IsDuet)
{
//Save duet-assignment before resetting
@@ -583,7 +576,7 @@ namespace Vocaluxe.Screens
_Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileNames[0]));
}
_SingNotes[_SingBars].Reset();
_SingNotes[_SingBars].Init(CGame.NumPlayers);
if (song.IsDuet)
@@ -595,12 +588,12 @@ namespace Vocaluxe.Screens
//Otherwise, this is done by CScreenNames
if (CGame.GetNumSongs() > 1)
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
CGame.Players[i].VoiceNr = (i + 1) % 2;
}
else
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
CGame.Players[i].VoiceNr = voiceAssignments[i];
}
}
@@ -608,10 +601,9 @@ namespace Vocaluxe.Screens
_DynamicLyricsTop = false;
_DynamicLyricsBottom = false;
for (int p = 0; p < CGame.NumPlayer; p++)
foreach (CNoteBars notes in _SingNotes[_SingBars].PlayerNotes)
{
_NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CThemes.GetPlayerColor(p + 1), p);
if (_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1].Y + _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1].H >= CSettings.RenderH / 2)
if (notes.Rect.Bottom >= CSettings.RenderH / 2)
_DynamicLyricsBottom = true;
else
_DynamicLyricsTop = true;
@@ -619,14 +611,7 @@ namespace Vocaluxe.Screens
_SetDuetLyricsVisibility(song.IsDuet);
_SetNormalLyricsVisibility();
/*
case 4:
NoteLines[0] = SingNotes[SingBars].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]);
NoteLines[1] = SingNotes[SingBars].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]);
NoteLines[2] = SingNotes[SingBars].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]);
NoteLines[3] = SingNotes[SingBars].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]);
break;
*/
_TimerSongText.Reset();
_TimerDuetText1.Reset();
_TimerDuetText2.Reset();
@@ -731,7 +716,6 @@ namespace Vocaluxe.Screens
if (song == null)
return;
_CurrentBeat = CGame.CurrentBeat;
_Lyrics[_LyricSub].Update(-100);
_Lyrics[_LyricMain].Update(CGame.CurrentBeatF);
@@ -755,10 +739,10 @@ namespace Vocaluxe.Screens
if (nr != -1)
{
for (int j = 0; j < CGame.NumPlayer; j++)
for (int j = 0; j < CGame.NumPlayers; j++)
{
if (CGame.Players[j].VoiceNr == i)
_SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr);
_SingNotes[_SingBars].PlayerNotes[j].SetLine(nr);
}
if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet)
@@ -893,7 +877,7 @@ namespace Vocaluxe.Screens
{
for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++)
{
bool isIvisible = numplayer + 1 == CGame.NumPlayer && player <= CGame.NumPlayer;
bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers;
_Texts[_TextScores[player, numplayer]].Visible = isIvisible;
_Texts[_TextNames[player, numplayer]].Visible = isIvisible &&
(CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
@@ -1351,23 +1335,23 @@ namespace Vocaluxe.Screens
private void _UpdateAvatars()
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
{
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
_Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
else
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
_Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Visible = false;
}
}
private void _UpdateNames()
{
for (int i = 0; i < CGame.NumPlayer; i++)
for (int i = 0; i < CGame.NumPlayers; i++)
{
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
_Texts[_TextNames[i, CGame.NumPlayers - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
else
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false;
_Texts[_TextNames[i, CGame.NumPlayers - 1]].Visible = false;
}
}
}
+1 -1
View File
@@ -208,7 +208,7 @@ namespace VocaluxeLib
public interface IRecording
{
int GetToneAbs(int playerNr);
int GetToneAbs(int player);
}
public interface IProfiles
+3 -3
View File
@@ -202,7 +202,7 @@ namespace VocaluxeLib.Menu
_AddSelectSlide(new CSelectSlide(sl, PartyModeID), sl.Name);
foreach (SThemeSingBar sb in Theme.SingNotes)
_AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name);
_AddSingNote(new CSingNotes(sb, PartyModeID), sb.Name);
foreach (SThemeSongMenu sm in Theme.SongMenus)
_AddSongMenu(CSongMenuFactory.GetSongMenu(sm, PartyModeID), sm.Name);
@@ -269,7 +269,7 @@ namespace VocaluxeLib.Menu
}
_LoadThemeElement<CSongMenuFramework>(_ThemeSongMenus, _AddSongMenu, xmlReader);
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader);
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader);
_LoadThemeElement<CSingNotes>(_ThemeSingNotes, _AddSingNote, xmlReader);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader);
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader);
_LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader);
@@ -499,7 +499,7 @@ namespace VocaluxeLib.Menu
public CSingNotes GetNewSingNotes()
{
return new CSingNotesClassic(PartyModeID);
return new CSingNotes(PartyModeID);
}
public CNameSelection GetNewNameSelection()
+2 -2
View File
@@ -66,7 +66,7 @@ namespace VocaluxeLib.Menu
public virtual void Init()
{
_Selection = 0;
_Selection = -1;
_PrevMouse = new Point(0, 0);
_Active = false;
}
@@ -294,7 +294,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Elements.Count; i++)
{
if (_IsVisible(i) && _Elements[i].Type != EType.SingNote)
if (_IsVisible(i))
{
var zs = new SZSort {ID = i, Z = _GetZValue(i)};
items.Add(zs);
+323
View File
@@ -0,0 +1,323 @@
#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.Diagnostics;
using System.Drawing;
using System.Linq;
using VocaluxeLib.Draw;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu.SingNotes
{
public class CNoteBars
{
private readonly SThemeSingBar _Theme;
private readonly int _PartyModeID;
private readonly int _Player;
public readonly SRectF Rect;
private readonly SColorF _Color;
public float Alpha = 1;
private readonly CSongLine[] _Lines;
/// <summary>
/// Height of one line (tone)
/// </summary>
private readonly float _NoteLineHeight;
/// <summary>
/// Additional height of a note according to selected difficulty
/// </summary>
private readonly float _AddNoteHeight;
private int _CurrentLine = -1;
private readonly Stopwatch _Timer = new Stopwatch();
private readonly List<CParticleEffect> _GoldenStars = new List<CParticleEffect>();
private readonly List<CParticleEffect> _Flares = new List<CParticleEffect>();
private readonly List<CParticleEffect> _PerfectNoteEffect = new List<CParticleEffect>();
private readonly List<CParticleEffect> _PerfectLineTwinkle = new List<CParticleEffect>();
public CNoteBars(int partyModeID, int player, SRectF rect, SThemeSingBar theme)
{
_Player = player;
_Theme = theme;
_PartyModeID = partyModeID;
Rect = rect;
_Color = CBase.Themes.GetPlayerColor(player + 1);
SPlayer playerData = CBase.Game.GetPlayers()[player];
_Lines = CBase.Game.GetSong().Notes.GetVoice(playerData.VoiceNr).Lines;
_NoteLineHeight = Rect.H / CBase.Settings.GetNumNoteLines();
_AddNoteHeight = _NoteLineHeight / 2f * (2f - (int)CBase.Profiles.GetDifficulty(playerData.ProfileID));
}
public void SetLine(int line)
{
if (_CurrentLine == line)
return;
_CurrentLine = line;
_GoldenStars.Clear();
_Flares.Clear();
_PerfectNoteEffect.Clear();
foreach (CSongNote note in _Lines[_CurrentLine].Notes.Where(note => note.Type == ENoteType.Golden))
_AddGoldenNote(_GetNoteRect(note));
}
public void Draw()
{
if (_CurrentLine == -1 || _CurrentLine >= _Lines.Length)
return;
CSongLine line = _Lines[_CurrentLine];
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
_DrawNoteLines(new SColorF(Color.Gray, 0.5f * Alpha));
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
var color = new SColorF(_Color, _Color.A * Alpha);
float baseLine = line.BaseLine;
foreach (CSongNote note in line.Notes)
{
if (note.Type != ENoteType.Freestyle)
{
SRectF rect = _GetNoteRect(note);
_DrawNoteBG(rect, color);
_DrawNote(rect, new SColorF(Color.White, 0.7f * Alpha), 0.7f);
}
}
if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
_DrawToneHelper((int)baseLine, (CBase.Game.GetMidRecordedBeat() - line.FirstNoteBeat) / beats * Rect.W);
List<CSungLine> sungLines = CBase.Game.GetPlayers()[_Player].SungLines;
if (_CurrentLine >= 0 && _CurrentLine < sungLines.Count)
{
foreach (CSungNote note in sungLines[_CurrentLine].Notes)
{
SRectF rect = _GetNoteRect(note);
if (note.EndBeat == CBase.Game.GetRecordedBeat())
rect.W -= (1 - (CBase.Game.GetMidRecordedBeat() - CBase.Game.GetRecordedBeat())) * Rect.W / beats;
float factor = (note.Hit) ? 0.7f : 0.4f;
_DrawNote(rect, color, factor);
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.HitNote.Type == ENoteType.Golden)
{
SRectF re = rect;
re.W = (CBase.Game.GetMidRecordedBeat() - note.StartBeat) / beats * Rect.W;
_AddFlare(re);
}
if (note.Perfect && !note.PerfectDrawn && note.EndBeat < CBase.Game.GetRecordedBeat())
{
_AddPerfectNote(rect);
note.PerfectDrawn = true;
}
}
}
if (_CurrentLine > 0 && sungLines.Count >= _CurrentLine && sungLines[_CurrentLine - 1].PerfectLine)
{
_AddPerfectLine();
sungLines[_CurrentLine - 1].PerfectLine = false;
}
_Flares.RemoveAll(el => !el.IsAlive);
_PerfectNoteEffect.RemoveAll(el => !el.IsAlive);
_PerfectLineTwinkle.RemoveAll(el => !el.IsAlive);
foreach (CParticleEffect perfline in _PerfectLineTwinkle)
perfline.Draw();
foreach (CParticleEffect stars in _GoldenStars)
{
stars.Alpha = Alpha;
stars.Draw();
}
foreach (CParticleEffect flare in _Flares)
flare.Draw();
foreach (CParticleEffect perfnote in _PerfectNoteEffect)
perfnote.Draw();
}
private SRectF _GetNoteRect(CBaseNote note)
{
CSongLine line = _Lines[_CurrentLine];
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
float width = note.Duration * Rect.W / beats;
var noteRect = new SRectF(
Rect.X + (note.StartBeat - line.FirstNoteBeat) * Rect.W / beats,
Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - line.BaseLine) / 2f) * _NoteLineHeight - _AddNoteHeight / 2,
width,
_NoteLineHeight + _AddNoteHeight,
Rect.Z
);
return noteRect;
}
private void _DrawNoteLines(SColorF color)
{
SRectF lineRect = Rect;
lineRect.H = 1.5f;
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
{
lineRect.Y = Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
CBase.Drawing.DrawRect(color, lineRect);
}
}
private void _DrawToneHelper(int baseLine, float offsetX)
{
int tonePlayer = CBase.Record.GetToneAbs(_Player);
while (tonePlayer - baseLine < 0)
tonePlayer += 12;
while (tonePlayer - baseLine > 12)
tonePlayer -= 12;
if (offsetX < 0f)
offsetX = 0f;
if (offsetX > Rect.W)
offsetX = Rect.W;
var drawRect = new SRectF(
Rect.X - _NoteLineHeight + offsetX,
Rect.Y + _NoteLineHeight * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
_NoteLineHeight,
_NoteLineHeight,
Rect.Z
);
var color = new SColorF(_Color, _Color.A * Alpha);
CTextureRef toneHelper = CBase.Themes.GetSkinTexture(_Theme.SkinToneHelper, _PartyModeID);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
}
private void _DrawNote(SRectF rect, SColorF color, float factor)
{
if (factor <= 0)
return;
float dh = (1f - factor) * rect.H / 2;
float dw = Math.Min(dh, rect.W / 2);
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinLeft, _PartyModeID);
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinMiddle, _PartyModeID);
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinRight, _PartyModeID);
//Width of each of the ends (round parts)
//Need 2 of them so use minimum
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
if (noteRect.W >= 4 * endsW)
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
else
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect);
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
}
private void _DrawNoteBG(SRectF noteRect, SColorF color)
{
const float period = 1500; //[ms]
if (!_Timer.IsRunning)
_Timer.Start();
if (_Timer.ElapsedMilliseconds > period)
_Timer.Restart();
float alpha = (float)(Math.Cos(_Timer.ElapsedMilliseconds / period * Math.PI * 2) + 1) / 4 + 0.5f;
CTextureRef noteBackgroundBegin = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundLeft, _PartyModeID);
CTextureRef noteBackgroundMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundMiddle, _PartyModeID);
CTextureRef noteBackgroundEnd = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundRight, _PartyModeID);
float dx = noteRect.H * noteBackgroundBegin.OrigAspect;
if (2 * dx > noteRect.W)
dx = noteRect.W / 2;
var col = new SColorF(color, color.A * alpha);
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(noteRect.X, noteRect.Y, dx, noteRect.H, noteRect.Z), col);
if (noteRect.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z), col);
else
{
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, 2 * dx, noteRect.H, noteRect.Z), col,
new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z));
}
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(noteRect.X + noteRect.W - dx, noteRect.Y, dx, noteRect.H, noteRect.Z), col);
}
private void _AddGoldenNote(SRectF noteRect)
{
var numstars = (int)(noteRect.W * 0.25f);
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(Color.Yellow), noteRect, _Theme.SkinGoldenStar, 20, EParticleType.Star);
_GoldenStars.Add(stars);
}
private void _AddFlare(SRectF noteRect)
{
var rect = new SRectF(noteRect.Right, noteRect.Y, 0f, noteRect.H, noteRect.Z);
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(Color.White), rect, _Theme.SkinGoldenStar, 20, EParticleType.Flare);
_Flares.Add(flares);
}
private void _AddPerfectNote(SRectF noteRect)
{
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinRight, _PartyModeID);
float dx = noteRect.H * noteBegin.OrigAspect;
if (2 * dx > noteRect.W)
dx = noteRect.W / 2;
SRectF r = new SRectF(noteRect.Right - dx, noteRect.Y, dx * 0.5f, dx * 0.2f, noteRect.Z);
var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(Color.White), r, _Theme.SkinPerfectNoteStart, 35,
EParticleType.PerfNoteStar);
_PerfectNoteEffect.Add(stars);
}
private void _AddPerfectLine()
{
var twinkle = new CParticleEffect(_PartyModeID, 200, _Color, Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle);
_PerfectLineTwinkle.Add(twinkle);
}
}
}
+21 -524
View File
@@ -17,30 +17,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Songs;
using VocaluxeLib.Xml;
namespace VocaluxeLib.Menu.SingNotes
{
struct SPlayerNotes
{
public int ID;
public int PlayerNr;
public SRectF Rect;
public SColorF Color;
public float Alpha;
public CSongLine[] Lines;
public int LineNr;
public Stopwatch Timer;
public List<CParticleEffect> GoldenStars;
public List<CParticleEffect> Flares;
public List<CParticleEffect> PerfectNoteEffect;
public List<CParticleEffect> PerfectLineTwinkle;
}
[XmlType("Position")]
public struct SBarPosition
{
@@ -68,14 +49,13 @@ namespace VocaluxeLib.Menu.SingNotes
[XmlArray("BarPositions")] public SBarPosition[] BarPos;
}
public abstract class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeSingBar _Theme;
private bool _ThemeLoaded;
private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID;
public readonly List<CNoteBars> PlayerNotes = new List<CNoteBars>();
public bool Selectable
{
@@ -88,27 +68,21 @@ namespace VocaluxeLib.Menu.SingNotes
/// <remarks>
/// first index = player number; second index = num players seen on screen
/// </remarks>
public SRectF[,] BarPos { get; set; }
private SRectF[,] _BarPos { get; set; }
protected CSingNotes(int partyModeID)
public CSingNotes(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeSingBar {BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer())]};
_ThemeLoaded = false;
_PlayerNotes = new List<SPlayerNotes>();
_ActID = 0;
}
protected CSingNotes(SThemeSingBar theme, int partyModeID)
public CSingNotes(SThemeSingBar theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_PlayerNotes = new List<SPlayerNotes>();
_ActID = 0;
BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
LoadSkin();
}
@@ -141,20 +115,20 @@ namespace VocaluxeLib.Menu.SingNotes
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStart, String.Empty);
int i = 0;
BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{
for (int player = 0; player <= numplayer; player++)
{
BarPos[player, numplayer] = new SRectF();
_BarPos[player, numplayer] = new SRectF();
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref BarPos[player, numplayer].X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref BarPos[player, numplayer].Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref BarPos[player, numplayer].Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref BarPos[player, numplayer].W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref BarPos[player, numplayer].H);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H);
_Theme.BarPos[i].Name = "P" + (player + 1) + "N" + (numplayer + 1);
_Theme.BarPos[i].Rect = BarPos[player, numplayer];
_Theme.BarPos[i].Rect = _BarPos[player, numplayer];
i++;
}
}
@@ -168,251 +142,17 @@ namespace VocaluxeLib.Menu.SingNotes
return _ThemeLoaded;
}
public void Reset()
public void Init(int numPlayers)
{
_PlayerNotes.Clear();
_ActID = 0;
}
public int AddPlayer(SRectF rect, SColorF color, int playerNr)
{
var notes = new SPlayerNotes
{
Rect = rect,
Color = color,
Alpha = 1f,
ID = ++_ActID,
Lines = null,
LineNr = -1,
PlayerNr = playerNr,
Timer = new Stopwatch(),
GoldenStars = new List<CParticleEffect>(),
Flares = new List<CParticleEffect>(),
PerfectNoteEffect = new List<CParticleEffect>(),
PerfectLineTwinkle = new List<CParticleEffect>()
};
_PlayerNotes.Add(notes);
return notes.ID;
}
public void SetLines(int id, CSongLine[] lines, int lineNr)
{
if (lines == null)
return;
int n = _FindPlayerNotes(id);
if (n == -1)
return;
if (lineNr == _PlayerNotes[n].LineNr)
return;
if (lines.Length <= lineNr)
return;
SPlayerNotes notes = _PlayerNotes[n];
notes.Lines = lines;
notes.LineNr = lineNr;
notes.GoldenStars.Clear();
notes.Flares.Clear();
notes.PerfectNoteEffect.Clear();
_PlayerNotes.RemoveAt(n);
_PlayerNotes.Add(notes);
}
public void SetAlpha(int id, float alpha)
{
int n = _FindPlayerNotes(id);
if (n == -1)
return;
SPlayerNotes pn = _PlayerNotes[n];
pn.Alpha = alpha;
_PlayerNotes[n] = pn;
}
public float GetAlpha(int id)
{
int n = _FindPlayerNotes(id);
if (n == -1)
return 0f;
return _PlayerNotes[n].Alpha;
PlayerNotes.Clear();
for (int p = 0; p < numPlayers; p++)
PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme));
}
public void Draw()
{
throw new NotImplementedException();
}
public void Draw(int id, List<CSungLine> sungLines, int player)
{
int n = _FindPlayerNotes(id);
if (n == -1)
return;
if (_PlayerNotes[n].LineNr == -1)
return;
if (_PlayerNotes[n].Lines == null)
return;
if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
return;
CSongLine line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
_DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
if (line.NoteCount == 0)
return;
float w = _PlayerNotes[n].Rect.W;
float h = _PlayerNotes[n].Rect.H;
int profileID = CBase.Game.GetPlayers()[_PlayerNotes[n].PlayerNr].ProfileID;
float dh = h / CBase.Settings.GetNumNoteLines() * (2f - (int)CBase.Profiles.GetDifficulty(profileID)) / 4f;
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
if (beats < 1)
return;
var color = new SColorF(
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
float baseLine = line.BaseLine;
int nr = 1;
foreach (CSongNote note in line.Notes)
{
if (note.Type != ENoteType.Freestyle)
{
float width = note.Duration / beats * w;
var rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z
);
_DrawNoteBG(rect, color, 1f, _PlayerNotes[n].Timer);
_DrawNote(rect, new SColorF(1f, 1f, 1f, 0.7f * _PlayerNotes[n].Alpha), 0.7f);
if (note.Type == ENoteType.Golden)
{
_AddGoldenNote(rect, n, nr);
nr++;
}
}
}
if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
_DrawToneHelper(n, (int)baseLine, (CBase.Game.GetMidRecordedBeat() - line.FirstNoteBeat) / beats * w);
int i = 0;
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
{
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
else
i++;
}
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
perfline.Draw();
if (sungLines == null || sungLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || sungLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
{
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{
stars.Alpha = _PlayerNotes[n].Alpha;
stars.Draw();
}
return;
}
foreach (CSungNote note in sungLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
{
float width = note.Duration / beats * w;
if (note.EndBeat == CBase.Game.GetRecordedBeat())
width -= (1 - (CBase.Game.GetMidRecordedBeat() - CBase.Game.GetRecordedBeat())) / beats * w;
var rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z
);
float f = (note.Hit) ? 0.7f : 0.4f;
_DrawNote(rect, color, f);
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.HitNote.Type == ENoteType.Golden)
{
SRectF re = rect;
re.W = (CBase.Game.GetMidRecordedBeat() - note.StartBeat) / beats * w;
_AddFlare(re, n);
}
if (note.Perfect && !note.PerfectDrawn && note.EndBeat < CBase.Game.GetRecordedBeat())
{
_AddPerfectNote(rect, n);
note.PerfectDrawn = true;
}
}
int currentLine = CBase.Game.GetPlayers()[player].SungLines.Count - 1;
if (currentLine > 0)
{
if (CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine)
{
_AddPerfectLine(n);
CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine = false;
}
}
i = 0;
while (i < _PlayerNotes[n].Flares.Count)
{
if (!_PlayerNotes[n].Flares[i].IsAlive)
_PlayerNotes[n].Flares.RemoveAt(i);
else
i++;
}
i = 0;
while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
{
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
else
i++;
}
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{
stars.Alpha = _PlayerNotes[n].Alpha;
stars.Draw();
}
foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
flare.Draw();
foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
perfnote.Draw();
foreach (CNoteBars noteBars in PlayerNotes)
noteBars.Draw();
}
public void UnloadSkin() {}
@@ -424,7 +164,7 @@ namespace VocaluxeLib.Menu.SingNotes
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
int p = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
BarPos[p, n] = bp.Rect;
_BarPos[p, n] = bp.Rect;
}
}
@@ -439,249 +179,6 @@ namespace VocaluxeLib.Menu.SingNotes
return _Theme;
}
private int _FindPlayerNotes(int id)
{
for (int i = 0; i < _PlayerNotes.Count; i++)
{
if (_PlayerNotes[i].ID == id)
return i;
}
return -1;
}
private void _DrawNote(SRectF rect, SColorF color, float factor = 1f)
{
if (factor <= 0)
return;
float dh = (1f - factor) * rect.H / 2;
float dw = Math.Min(dh, rect.W / 2);
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinLeft, _PartyModeID);
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinMiddle, _PartyModeID);
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinRight, _PartyModeID);
//Width of each of the ends (round parts)
//Need 2 of them so use minimum
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
if (noteRect.W >= 4 * endsW)
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
else
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect);
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
}
private void _DrawNoteBG(SRectF rect, SColorF color, float factor, Stopwatch timer)
{
const int spacing = 0;
const float period = 1.5f; //[s]
if (!timer.IsRunning)
timer.Start();
if (timer.ElapsedMilliseconds / 1000f > period)
{
timer.Reset();
timer.Start();
}
float alpha = (float)((Math.Cos((timer.ElapsedMilliseconds / 1000f) / period * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
float d = (1f - factor) / 2 * rect.H;
float dw = d;
if (2 * dw > rect.W)
dw = rect.W / 2;
var r = new SRectF(
rect.X + dw + spacing,
rect.Y + d + spacing,
rect.W - 2 * dw - 2 * spacing,
rect.H - 2 * d - 2 * spacing,
rect.Z
);
CTextureRef noteBackgroundBegin = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundLeft, _PartyModeID);
CTextureRef noteBackgroundMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundMiddle, _PartyModeID);
CTextureRef noteBackgroundEnd = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundRight, _PartyModeID);
float dx = r.H * noteBackgroundBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
var col = new SColorF(color.R, color.G, color.B, color.A * alpha);
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
if (r.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
else
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), col, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z));
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
}
private static void _DrawNoteLines(SRectF rect, SColorF color)
{
SRectF lineRect = rect;
lineRect.H = 1.5f;
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
{
lineRect.Y = rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
CBase.Drawing.DrawRect(color, lineRect);
}
}
private void _AddGoldenNote(SRectF rect, int n, int nr, float factor = 1f)
{
const int spacing = 0;
if (nr > _PlayerNotes[n].GoldenStars.Count)
{
float d = (1f - factor) / 2 * rect.H;
float dw = d;
if (2 * dw > rect.W)
dw = rect.W / 2;
var r = new SRectF(
rect.X + dw + spacing,
rect.Y + d + spacing,
rect.W - 2 * dw - 2 * spacing,
rect.H - 2 * d - 2 * spacing,
rect.Z
);
var numstars = (int)(r.W * 0.25f);
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStar, 20, EParticleType.Star);
_PlayerNotes[n].GoldenStars.Add(stars);
}
}
private void _AddFlare(SRectF rect, int n, float factor = 1f)
{
const int spacing = 0;
float d = (1f - factor) / 2 * rect.H;
float dw = d;
if (2 * dw > rect.W)
dw = rect.W / 2;
var r = new SRectF(
rect.X + dw + spacing + rect.W - 2 * dw - 2 * spacing,
rect.Y + d + spacing,
0f,
rect.H - 2 * d - 2 * spacing,
rect.Z
);
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStar, 20, EParticleType.Flare);
_PlayerNotes[n].Flares.Add(flares);
}
private void _AddPerfectNote(SRectF rect, int n, float factor = 1f)
{
const int spacing = 0;
float d = (1f - factor) / 2 * rect.H;
float dw = d;
if (2 * dw > rect.W)
dw = rect.W / 2;
var r = new SRectF(
rect.X + dw + spacing,
rect.Y + d + spacing,
rect.W - 2 * dw - 2 * spacing,
rect.H - 2 * d - 2 * spacing,
rect.Z
);
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinLeft, _PartyModeID);
float dx = r.H * noteBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
r = new SRectF(
r.X + r.W - dx,
r.Y,
dx * 0.5f,
dx * 0.2f,
rect.Z
);
var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStart, 35,
EParticleType.PerfNoteStar);
_PlayerNotes[n].PerfectNoteEffect.Add(stars);
}
private void _AddPerfectLine(int n)
{
var twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle);
_PlayerNotes[n].PerfectLineTwinkle.Add(twinkle);
}
private void _DrawToneHelper(int n, int baseLine, float offsetX)
{
int tonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr);
SRectF noteBounds = _PlayerNotes[n].Rect;
while (tonePlayer - baseLine < 0)
tonePlayer += 12;
while (tonePlayer - baseLine > 12)
tonePlayer -= 12;
if (offsetX < 0f)
offsetX = 0f;
if (offsetX > noteBounds.W)
offsetX = noteBounds.W;
float dy = noteBounds.H / CBase.Settings.GetNumNoteLines();
var drawRect = new SRectF(
noteBounds.X - dy + offsetX,
noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
dy,
dy,
noteBounds.Z
);
var color = new SColorF(
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
CTextureRef toneHelper = CBase.Themes.GetSkinTexture(_Theme.SkinToneHelper, _PartyModeID);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
while (tonePlayer - baseLine < 12)
tonePlayer += 12;
while (tonePlayer - baseLine > 24)
tonePlayer -= 12;
drawRect = new SRectF(
noteBounds.X - dy + offsetX,
noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
dy,
dy,
noteBounds.Z
);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY) {}
@@ -1,28 +0,0 @@
#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
namespace VocaluxeLib.Menu.SingNotes
{
class CSingNotesClassic : CSingNotes
{
public CSingNotesClassic(int partyModeID)
: base(partyModeID) {}
public CSingNotesClassic(SThemeSingBar theme, int partyModeID)
: base(theme, partyModeID) {}
}
}
+8 -3
View File
@@ -80,10 +80,15 @@ namespace VocaluxeLib.Songs
get { return _Voices.Count; }
}
public CVoice GetVoice(int index)
public CVoice GetVoice(int index, bool add = false)
{
while (index >= _Voices.Count)
_Voices.Add(new CVoice());
if (add)
{
while (index >= _Voices.Count)
_Voices.Add(new CVoice());
}
else if (index >= _Voices.Count)
return null;
return _Voices[index];
}
+2 -2
View File
@@ -768,13 +768,13 @@ namespace VocaluxeLib.Songs
private bool _AddNote(int player, CSongNote note)
{
CVoice voice = _Song.Notes.GetVoice(player);
CVoice voice = _Song.Notes.GetVoice(player, true);
return voice.AddNote(note, false);
}
private bool _NewSentence(int player, int start)
{
CVoice voice = _Song.Notes.GetVoice(player);
CVoice voice = _Song.Notes.GetVoice(player, true);
return voice.AddLine(start);
}
}
+11
View File
@@ -91,6 +91,17 @@ namespace VocaluxeLib
A = a;
}
public SColorF(SColorF color, float a) : this(color.R, color.G, color.B, a) {}
public SColorF(Color color, float a) : this(color.R / 255f, color.G / 255f, color.B / 255f, a) {}
public SColorF(Color color)
{
R = color.R / 255f;
G = color.G / 255f;
B = color.B / 255f;
A = color.A / 255f;
}
[Pure]
public Color AsColor()
{
+1 -1
View File
@@ -107,6 +107,7 @@
<Compile Include="Menu\CText.cs" />
<Compile Include="Draw\CTextureRef.cs" />
<Compile Include="Menu\IThemeable.cs" />
<Compile Include="Menu\SingNotes\CNoteBars.cs" />
<Compile Include="Xml\CXmlDeserializer.cs" />
<Compile Include="Xml\CXMLReader.cs" />
<Compile Include="Enums.cs" />
@@ -120,7 +121,6 @@
<Compile Include="Songs\CSongNote.cs" />
<Compile Include="Songs\CNotes.cs" />
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
<Compile Include="Songs\CCategory.cs" />
<Compile Include="Songs\CSong.cs" />
<Compile Include="Menu\SongMenu\CSongMenuFactory.cs" />